miniMAXIme: Character scaler and selector

by Pi-C

The player stands like a giant near the vehicles. Now you can adjust the size of your character -- and you can change your appearance at any time if you've other mods that provide extra characters!

Tweaks
11 days ago
0.16 - 2.0
26.4K

b [Fixed] dup char

2 years ago

while swich god mode

2 years ago

模组 miniMAXIme: Character scaler and selector (1.1.5) 引发了无法恢复的错误。
请向模组作者报告此错误。

Error while running event minime::on_gui_click (ID 1)
模组 miniMAXIme: Character scaler and selector (1.1.5) 引发了无法恢复的错误。
请向模组作者报告此错误。

Error while running event minime::on_player_toggled_map_editor (ID 120)
minime/control.lua:427:

[ER Global Lock] Forbidden global read:
{key = "character"}

stack traceback:
[C]: in function 'error'
minime/control.lua:427: in function 'index'
__minime
/scripts/character.lua:1414: in function 'event_handler'
minime/scripts/events.lua:155: in function <minime/scripts/events.lua:152>
[C]: in function 'toggle_map_editor'
minime/scripts/character.lua:507: in function 'toggle_map_editor'
minime/scripts/character.lua:1190: in function 'switch_characters'
minime/scripts/gui.lua:653: in function 'button_click'
minime/scripts/gui.lua:704: in function 'event_handler'
minime/scripts/events.lua:155: in function <minime/scripts/events.lua:152>
stack traceback:
[C]: in function 'toggle_map_editor'
minime/scripts/character.lua:507: in function 'toggle_map_editor'
minime/scripts/character.lua:1190: in function 'switch_characters'
minime/scripts/gui.lua:653: in function 'button_click'
minime/scripts/gui.lua:704: in function 'event_handler'
minime/scripts/events.lua:155: in function <minime/scripts/events.lua:152>

2 years ago

crash

2 years ago
(updated 2 years ago)

Thanks for the report! Please change lines 1414 and 1415 of scripts.character.lua:

--            global.detached_characters[character.unit_number] = nil
--minime.writeDebug("Removed global.detached_characters[%s]!", {global.detached_characters[character.unit_number]})

    global.detached_characters[detached.unit_number] = nil
minime.writeDebug("Removed global.detached_characters[%s]!", {detached.unit_number})

Does that fix it?

2 years ago
2 years ago
(updated 2 years ago)

now my mod supported your mod

https://mods.factorio.com/mod/miku-bikini-swimsuit

There's a crash (even without my mod):

Failed to load mod "miku-bikini-swimsuit": __miku-bikini-swimsuit__/lib/character_tool.lua:27: bad argument #1 of 2 to 'pairs' (table expected, got nil)

The error is in this line:

for mod, version in pairs(GEAR_GIRL_keep_default_character) do

GEAR_GIRL_keep_default_character has never been defined, so you're trying to go over the key/value pairs of nil.

When I wrote the compatibility code for Gear Girl, I had this in data,lua:

------------------------------------------------------------------------------------
-- Create table for other character-selector mods to register with Gear Girl.
------------------------------------------------------------------------------------
GEAR_GIRL_keep_default_character = GEAR_GIRL_keep_default_character or {}

This defines a global table, which can be read by all mods. I guess this worked for you because you also had the Gear Girl mod running, so the global table had already been defined by that mod. Without it, you'll get the crash.

In general, you should use a unique name for your global variables (for example, prefix them with "MIKU_": like "MIKU_keep_default_character"), to avoid confusion. However, in this case it actually would make sense to share a global variable between all character mods, so that character selector mods don't have to add themselves to the several global tables.

There's another problem: While the compatibility code in Gear Girl is mine, I don't have access to that mod (the author just accepted my patch), so I can't update it myself. But I do have access to "I, Robot" and "Among Us Character", so these will always be up to date. Lately, I've made significant changes to copying the characters:

Gear Girl will make a copy of the default character in data.lua and may overwrite the default character again with this copy in data-final-fixes.lua. If any other mod changes the default character in data-updates.lua, these changes will be lost. If Gear Girl doesn't overwrite the default character, changes to properties like running speed, mining reach etc. will not be applied to the new character. This problem has been solved in "I, Robot" and "Among Us Character": I keep track of the properties that must be changed for the new character (e.g. animations, name and localization, corpse) and in data-final-fixes.lua, I overwrite ONLY THESE properties when overwriting the default character, or copy ALL OTHER properties from default to new character. I guess it would be useful if you'd take a look at any of these mods. :-)

2 years ago

do you have a discord?

2 years ago

No discord, no facebook, instagram or whatever. But I'm available on the forums. :-)

2 years ago

mod fixed

2 years ago

my mod code available on github

2 years ago

if you have some suggestion for my code, you can open a pr

2 years ago

I'm not even on github. :-D

But I see you're registered on the forum as well, and you've already made a post, so you're allowed to send private messages. I could send you some diffs there.

2 years ago

Why doesn't the corpse switch when the skin is switched?

2 years ago

Get yourself an A-bomb and kill yourself. Respawn, change character, and kill yourself again. The first corpse will not change, but the second corpse will be that which belongs to your new character.

This is intended: When you know that you died in a bikini swimsuit it should be easier to recognize your old corpse. That's less of a problem in singleplayer mode, but may be an issue in multiplayer.

2 years ago

Get yourself an A-bomb and kill yourself. Respawn, change character, and kill yourself again. The first corpse will not change, but the second corpse will be that which belongs to your new character.

This is intended: When you know that you died in a bikini swimsuit it should be easier to recognize your old corpse. That's less of a problem in singleplayer mode, but may be an issue in multiplayer.

I get it, it does, look at the other two errors

2 years ago

if you have some suggestion for my code, you can open a pr

Just sent you a private message with an improved version on the forum. :-)

New response