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
17 days ago
0.16 - 2.0
31.7K

b [Fixed?] Error

2 months ago

Error loading mod: Error while loading entity prototype "_f42f38fb_b84e_4b34_8fd8_70cce8873d5b" (character-corpse): Invalid pictures index: 5, expected value in the range of 1 to 4. in property tree at ROOT.character-corpse._f42f38fb_b84e_4b34_8fd8_70cce8873d5b
Modifications: Des, the Wickerbeast (Lexxy's 2.0 fork) › miniMAXIme: Character scaler and selector

2 months ago

I can't reproduce that. Are you using SA? Can't test with that as I haven't bought it.

By the way, it seems Lexxy's fork is now obsolete as the original mod has been updated for Factorio 2.0. Does the error occur with that mod as well?

2 months ago

Hi. Yes. I'm using SA.

I replaced Lexxy's fork with the original as suggested, but I got a different error now:

Error loading mod: Error while loading entity prototype "character-corpse" (character-corpse): Invalid pictures index: 5, expected value in the range of 1 to 4. in property tree at ROOT.character-corpse.character-corpse
Modifications: Mod base › Space Age › Tidy Menus › Metal and Stars › Des, the Wickerbeast

2 months ago

Could you enable the debug setting of the character mod helper and post factorio-current.log? If you're on the forum, you could PM me and attach the file.

2 months ago
(updated 2 months ago)

My version isn't necessarily "obsolete" exactly... it's just designed for my friend group :P

I believe this error is actually caused by the metal-and-stars mod ("Metal and Stars" in English). In the file prototypes/entity/prototype-mech-armor-animations.lua on line(s) 136 or 137 maybe, the mod adds a new character corpse picture to the base character corpse prototype, which breaks all CharacterModHelper skin mods that have their own corpse - including the Protogen skins(s) (and others) - because the CharacterModHelper characters are missing a picture for the new corpse state. minime ("miniMAXIme") partially obfuscates the error when installed but doesn't cause it.

For my version of the mod ("Lexxy's Fork"), this is something I probably won't fix.

Related:

2 months ago

My version isn't necessarily "obsolete" exactly... it's just designed for my friend group :P

Sorry if I was mistaken about this. I noticed that you didn't deprecate your mod, but it didn't show up when I searched the mod portal. Not sure whether I turned off mods with the tag "Internal" myself or whether that is the default setting, but I thought you'd have used that tag to hide the mod. Also, you redirect people to the original mod on your info page, so that let me assume your mod was obsolete. But as it isn't, do you want me to add a dependency on it to miniMAXIme?

I believe this error is actually caused by the metal-and-stars mod ("Metal and Stars" in English). In the file prototypes/entity/prototype-mech-armor-animations.lua on line(s) 136 or 137 maybe, the mod adds a new character corpse picture to the base character corpse prototype, which breaks all CharacterModHelper skin mods that have their own corpse - including the Protogen skins(s) (and others) - because the CharacterModHelper characters are missing a picture for the new corpse state. minime ("miniMAXIme") partially obfuscates the error when installed but doesn't cause it.

Thanks for figuring this out! One question: What happens when you remove those lines from prototypes/entity/prototype-mech-armor-animations.lua? Do you get an error regarding the character graphics as well?

For my version of the mod ("Lexxy's Fork"), this is something I probably won't fix.

I think the problem should be addressed in the character-mod helper. Your mod already calls its function check_my_prototypes, so if I'd adjust that function you wouldn't have to do anything at all on your end.

I suppose the thing to do is to check whether the new corpse has as many pictures as the default corpse (before things are copied). If the new corpse has less pictures, copy the last one as many times as necessary.

2 months ago
(updated 2 months ago)

Quick note: I don't have a lot of free time due to the ongoing war(s) so I may not be quick to respond, but I really love your mod, and all the other character mods that you've made possible/easier :3

Also I'm not super good with words so the following may not be organized super well or make a lot of sense, sorry...

Disabling either line 136 (table.insert) OR line 137 (setting .mech-armor to the length of .pictures) allows the game to load without erroring, and even allows starting a new game. I haven't tested all/any of metal-and-stars's gameplay, but dying also functions normally. I believe this is due to the fact that the value of .armor_picture_mapping.mech-armor that CMH copied to its characters' corpses no longer exceeds the length of the new character corpses' .pictures array.

So I made a small change to your CharModHelper.create_prototypes function:

    local corpse = table.deepcopy(data.raw["character-corpse"]["character-corpse"])
    CharModHelper.apply_properties(corpse, prototype_data.corpse)
+   prototype_data.corpse.armor_picture_mapping = table.deepcopy(corpse.armor_picture_mapping)
    data:extend({corpse})

This stopped the error and allowed me to use mini-me, the Protogen character, and the Wickerbeast character, but will break any characters that define their own .armor_picture_mapping arrays (currently, only the imaginary one I just made as far as I know). I'm not necessarily a huge fan of the idea of inserting extra entries into the corpes' pictures array just to match the length of the character corpse generated outside of CMH characters, because semantically that doesn't make a lot of sense. The .armor_picture_mapping for each character probably needs to be stored when they call CharModHelper.create_prototypes...

To ease my concern with the currently-hypothetical case where a character defines their own .armor_picture_mapping, I think an if might help...

    local corpse = table.deepcopy(data.raw["character-corpse"]["character-corpse"])
    CharModHelper.apply_properties(corpse, prototype_data.corpse)
    if prototype_data.corpse.armor_picture_mapping == nil then
        prototype_data.corpse.armor_picture_mapping = table.deepcopy(corpse.armor_picture_mapping)
    end
    data:extend({corpse})
    CMH.created_msg(corpse)

Seems to work for me! Dying with mech-armor equiped also functions without errors.

2 months ago

Quick note: I don't have a lot of free time due to the ongoing war(s) so I may not be quick to respond, but I really love your mod, and all the other character mods that you've made possible/easier :3

Thanks for the compliment! :-)

So I made a small change to your CharModHelper.create_prototypes function:

diff local corpse = table.deepcopy(data.raw["character-corpse"]["character-corpse"]) CharModHelper.apply_properties(corpse, prototype_data.corpse) + prototype_data.corpse.armor_picture_mapping = table.deepcopy(corpse.armor_picture_mapping) data:extend({corpse})

This stopped the error and allowed me to use mini-me, the Protogen character, and the Wickerbeast character, but will break any characters that define their own .armor_picture_mapping arrays (currently, only the imaginary one I just made as far as I know).

Makes sense.

I'm not necessarily a huge fan of the idea of inserting extra entries into the corpes' pictures array just to match the length of the character corpse generated outside of CMH characters, because semantically that doesn't make a lot of sense.

Also, it's not as simple as I thought because pictures can be an array of pictures, or be hidden behind sheet/sheets. In IRobot, I think I even used pictures = { layers = {…} } (one picture consisting of different layers, living directly in the root of pictures). So counting pictures is complex and error prone.

The .armor_picture_mapping for each character probably needs to be stored when they call CharModHelper.create_prototypes...

Yes, using armor_picture_mapping is much easier!

To ease my concern with the currently-hypothetical case where a character defines their own .armor_picture_mapping, I think an if might help...

lua local corpse = table.deepcopy(data.raw["character-corpse"]["character-corpse"]) CharModHelper.apply_properties(corpse, prototype_data.corpse) if prototype_data.corpse.armor_picture_mapping == nil then prototype_data.corpse.armor_picture_mapping = table.deepcopy(corpse.armor_picture_mapping) end data:extend({corpse}) CMH.created_msg(corpse)

Seems to work for me! Dying with mech-armor equiped also functions without errors.

I've done this in a slightly different way:

  • Do nothing if the new corpse doesn't have armor_picture_mapping. I assume that character mods will set this if they use pictures. If picture is used instead, armor_picture_mapping should be ignored.
  • Store the highest value found in prototype_data.corpse.armor_picture_mapping as last_pic.
  • Loop over data.raw["character-corpse"]["character-corpse"].armor_picture_mapping. If we find an armor that is not listed in prototype_data.corpse.armor_picture_mapping, add it with the value of last_pic.

Please check out version 2.0.3 of CharacterModHelper! If you find new bugs, please report them there.

2 months ago

Error is no more, thank you!

New response