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 [Pending] crash

2 years ago

Please report this error to the mod author.

Error while running event minime::on_gui_click (ID 1)
minime/scripts/gui.lua:248: bad argument #1 of 2 to 'ipairs' (table expected, got nil)
stack traceback:
[C]: in function 'ipairs'
minime/scripts/gui.lua:248: in function 'toggle_character_page_entities'
minime/scripts/gui.lua:475: in function 'update_page_selector_buttons'
minime/scripts/gui.lua:1243: in function 'event_handler'
minime/scripts/events.lua:185: in function <minime/scripts/events.lua:182>
Please report this error to the mod author.

Error while running event minime::on_gui_click (ID 1)
minime/scripts/gui.lua:248: bad argument #1 of 2 to 'ipairs' (table expected, got nil)
stack traceback:
[C]: in function 'ipairs'
minime/scripts/gui.lua:248: in function 'toggle_character_page_entities'
minime/scripts/gui.lua:475: in function 'update_page_selector_buttons'
minime/scripts/gui.lua:1243: in function 'event_handler'
minime/scripts/events.lua:185: in function <minime/scripts/events.lua:182>"
^C

2 years ago

Avoid ipairs, use pairs instead

2 years ago
(updated 2 years ago)

I usually do, but ipairs should be safe there (table should be indexed by numbers and there should be no gaps). The problem here is that there is no table. :-)

I've already found this (or a similar) crash on starting a new game yesterday, and fixed it. But it was late and I was tired and I'd already messed about with GUI stuff which is in a half-finished state. So it will be some more time until I'll push out an update.

2 years ago

Please report this error to the mod author.

Error while running event minime::on_gui_click (ID 1)
minime/scripts/gui.lua:248: bad argument #1 of 2 to 'ipairs' (table expected, got nil)

OK, until I can update, please change line 248 of gui.lua to this:

  for c, char in ipairs(previews or {}) do

This will fix the crash. However, I can't reproduce it. Whatever I try, I get a table instead of nil. So, could you upload a saved game again, please?

2 years ago

I don't remember what I clicked

2 years ago

I'll tell you if it crashes next time

2 years ago

Should be fixed in 1.1.11!

2 years ago

Error while running event minime::on_init()
minime/scripts/gui.lua:106: attempt to index local 'p_data' (a nil value)
stack traceback:
minime/scripts/gui.lua:106: in function 'make_gui_character_pages'
minime/scripts/character.lua:793: in function 'update_character_list'
minime/control.lua:169: in function 'init'
minime/control.lua:273: in function <minime/control.lua:261>

2 years ago

1.1.11

2 years ago
(updated 2 years ago)

when i open a previous save

2 years ago

Thanks for the report!

when i open a previous save

You mean a save where this mod wasn't used before? I've just got the same error after I loaded a game I've started yesterday for testing another mod …

2 years ago

new crash , have you fix this ?

Please report this error to the mod author.

Error while running event minime::on_player_joined_game (ID 44)
minime/scripts/character.lua:807: {
self = "userdata"
} is not a valid character!
stack traceback:
[C]: in function 'error'
__minime
/scripts/character.lua:807: in function 'copy_character'
minime/scripts/player.lua:194: in function 'update_armor'
minime/scripts/player.lua:59: in function 'initialize_player_previews'
minime/scripts/player.lua:411: in function 'init_player'
minime/scripts/player.lua:495: in function 'event_handler'
minime/scripts/events.lua:185: in function <minime/scripts/events.lua:182>
816377.312 Error ServerMultiplayerManager.cpp:91: MultiplayerManager failed: "The mod miniMAXIme: Character scaler and selector (1.1.10) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event minime::on_player_joined_game (ID 44)
minime/scripts/character.lua:807: {
self = "userdata"
} is not a valid character!
stack traceback:
[C]: in function 'error'
__minime
/scripts/character.lua:807: in function 'copy_character'
minime/scripts/player.lua:194: in function 'update_armor'
minime/scripts/player.lua:59: in function 'initialize_player_previews'
minime/scripts/player.lua:411: in function 'init_player'
minime/scripts/player.lua:495: in function 'event_handler'
minime/scripts/events.lua:185: in function <minime/scripts/events.lua:182>"

2 years ago

I've sent you a preview of the new version. Could you try if the crash still happens there?

2 years ago

I've sent you a preview of the new version. Could you try if the crash still happens there? If it does, could you send me a saved game? Can't really test if a fix works when I can't reproduce it. :-)

2 years ago

Please update it directly as I am using on the server

2 years ago

OK, I'll upload in a sec! :-)

2 years ago

Hi, I got a new one:

The mod miniMAXIme: Character scaler and selector (1.1.12) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event minime::on_init()
minime/scripts/player.lua:358: attempt to index field 'minime_armor_prototypes' (a nil value)
stack traceback:
minime/scripts/player.lua:358: in function 'update_armor'
minime/scripts/player.lua:127: in function 'initialize_player_previews'
minime/scripts/player.lua:604: in function 'init_player'
minime/scripts/gui.lua:112: in function 'make_gui_character_pages'
minime/scripts/character.lua:794: in function 'update_character_list'
minime/control.lua:183: in function 'init'
minime/control.lua:244: in function <minime/control.lua:241>

2 years ago
(updated 2 years ago)

Thanks for finding this! global.minime_armor_prototypes doesn't exist, so I guess moving things around in the init script would help. Could you try that, please?

In control.lua, move this block (lines 180-184):

------------------------------------------------------------------------------------
-- Build/rebuild list of character prototypes, and remove preview surfaces created
-- for characters from removed mods
minime_character.update_character_list()
minime.writeDebug("Updated list of character prototypes")

behind this block (now: lines 191-194):

------------------------------------------------------------------------------------
-- Rebuild list of armor prototypes (relevant for inventory_size_bonus)
minime_character.make_armor_list()
minime.writeDebug("Created list of available armor prototypes!")

Does that fix it, or will that crash in another place?

2 years ago

Yes, this works.

But now i got 3 buttons in the ui where one says:

Unknown Key: "minime-GUI.toggle-button-caption"

2 years ago

That's weird. This is an old name, I've renamed the string in 1.1.11. There also is a migration file that should have destroyed the old GUIs. Could you send me the saved game where that happened?

2 years ago

Your are right, the button is gone when i start a new game.
But I died shortly after start and got a full crash:

Error while running event minime::on_post_entity_died (ID 133)
minime/scripts/debugging.lua:366: Wrong argument! nil is not a valid corpse prototype name!
stack traceback:
[C]: in function 'error'
minime/scripts/debugging.lua:366: in function 'arg_err'
minime/scripts/corpse.lua:479: in function 'event_handler'
minime/scripts/events.lua:194: in function <minime/scripts/events.lua:191>
stack traceback:
[C]: in function 'create_entity'
space-exploration/scripts/solar-flare.lua:268: in function 'tick_flare'
space-exploration/control.lua:1291: in function 'callback'
space-exploration/scripts/event.lua:15: in function <space-exploration/scripts/event.lua:13>
189.148 Error CrashHandler.cpp:635: Received SIGSEGV
Factorio crashed. Generating symbolized stacktrace, please wait ...
/tmp/factorio-build-s2MpP5/src/Util/Logger.cpp (313): Logger::writeStacktrace(FileWriteStream, StackTraceInfo) [clone .constprop.0]
/tmp/factorio-build-s2MpP5/src/Util/CrashHandler.cpp (184): CrashHandler::writeStackTrace(CrashHandler::CrashReason)
/tmp/factorio-build-s2MpP5/src/Util/CrashHandler.cpp (636): CrashHandler::commonSignalHandler(int)
/tmp/factorio-build-s2MpP5/src/Util/CrashHandler.cpp (642): CrashHandler::SignalHandler(int)
0x7f712493ed5f
/tmp/factorio-build-s2MpP5/src/Util/AdvancedTilePosition.cpp (20): AdvancedTilePosition::AdvancedTilePosition(MapPosition const&)
/tmp/factorio-build-s2MpP5/src/Graphics/EntityRenderer.cpp (315): EntityRenderer::prepareRow(int, unsigned long)
/tmp/factorio-build-s2MpP5/src/Graphics/EntityRenderer.cpp (226): EntityRenderer::threadJob(unsigned long)
/home/build/gcc-11.2/include/c++/11.2.0/bits/std_function.h (560): std::function<void ()>::operator()() const
/tmp/factorio-build-s2MpP5/src/Util/WorkerThread.cpp (48): WorkerThread::loop()
../../../../../libstdc++-v3/src/c++11/thread.cc (82): execute_native_thread_routine
start_thread
__clone
0xffffffffffffffff
Stack trace logging done

plus i started my save game with your debug mode enabled and posted the log file: https://rentry.co/yq8fb

2 years ago

Sorry, but the log seems to be incomplete (too big?). The interesting part where the crash happens isn't available there.

2 years ago

Your are right, the button is gone when i start a new game.

But why doesn't the migration run when you load your old game? I've had the same problems (three buttons because old + new GUI existed) before, that's why I added the migration and it worked for me.

2 years ago

Hi Pi-C,

here's the log you're looking for factorio-current.log

Regards,

–max2344

2 years ago

Hi Pi-C,

here's the log you're looking for factorio-current.log

Hi, max!
This log shows no crash, it seems to end naturally after the game was loaded and the players joined:

====================================================================================================
Leaving event script for on_player_joined_game
Event data: tick = 120976205, player_index = 2
(@__minime__/scripts/events.lua: 196)
====================================================================================================

 412.640 Quitting: window closed.
 435.411 Goodbye

However, I noticed that there's a bug in the call to the error function, so it doesn't give useful information.

Error while running event minime::on_post_entity_died (ID 133)
minime/scripts/debugging.lua:366: Wrong argument! nil is not a valid corpse prototype name!

Would you mind changing line 479 of scripts/corpse.lua from

          minime.arg_err(proto, "corpse prototype name")

to

          minime.arg_err(corpse.name, "corpse prototype name")

and trying again? There seems to be a corpse (indexing it doesn't crash), but the name doesn't match any name in our corpse-prototype list, although it is rebuilt in on_configuration_changed.

2 years ago

Hi Pi-C,

I am sorry for the confusion. The first log file factorio-current.log contains the debug log for loading my save game, where I got 3 buttons without a crash.

I created a second log file factorio-current.log-missing-corpse containing a new game with the crash after I modified line 479 in scripts/corpse.lua as you suggested.

Regards,

-dodo.the.last

2 years ago
(updated 2 years ago)

Hi Pi-C,

I am sorry for the confusion. The first log file factorio-current.log contains the debug log for loading my save game, where I got 3 buttons without a crash.

Thanks for the clarification!

I created a second log file factorio-current.log-missing-corpse containing a new game with the crash after I modified line 479 in scripts/corpse.lua as you suggested.

Ah, yes -- that was helpful! I build the list of corpse prototypes by going over the list of available character prototypes and fetching the name of the character-corpse they use. In 1.1.12 the order was

minime_character.update_character_list()
minime_corpse.make_corpse_list()
minime_character.make_armor_list()

This didn't work because update_character_list needs to know the list of available armors, so in the WIP version the order is

minime_corpse.make_corpse_list()
minime_character.make_armor_list()
minime_character.update_character_list()

Now, when we build the list of corpse prototypes, the list of character prototypes hasn't been built yet, so just the generic replacement corpse is in the list -- which will result in the crash you've experienced.

Could you try moving the block with minime_corpse.make_corpse_list() behind minime_character.update_character_list()? That would be in control.lua, function init(), starting at about line 180. Try to get killed and see if you are respawned without error. If that works, reload the game and try to change your armor (preferably to an armor with different inventory bonus, e.g. no armor --> heavy armor --> power armor should work in vanilla). I hope that will fix the missing-corpse crash, but I'm not really sure it won't break somewhere else. :-)

2 years ago

Hi Pi-C,

I can confirm, moving minime_corpse.make_corpse_list after minime_character.update_character_list fixed the problem. I tested it with no armor, heavy armor, power armor each in a new game.

The character respawned without problems every time, even with all my mods enabled :)

Regards,

-dodo.the.last

2 years ago

Hi, dodo.the.last!

I'm still struggling to understand the issue with the three buttons. The log file you've sent for that issue is rather clear: You've used version 1.1.12, and no migration script was run. Apparently, you also didn't change any mods, but just startup settings:

 192.598 Script @__minime__/scripts/debugging.lua:94: 
====================================================================================================
Entered event script for on_configuration_changed
Event data: mod_changes = {}, mod_startup_settings_changed = true, migration_applied = false
(@__minime__/control.lua: 254)
====================================================================================================

I've tried things locally , starting a game with 1.1.10, opening the GUI, and saving. When I loaded the game with version 1.1.11, the old GUI toggle button was gone; the old character selector GUI was still open but couldn't be used as the GUI elements had been renamed between versions and the script ignored the old names. Then I loaded the same game with version 1.1.12 and both the old toggle button and the old GUI were gone.

The migration script from version 1.1.11 removed just the toggle button, but kept the main GUI. In 1.1.12, I've moved migrations/01_01_11.lua to migrations/01_01_12.lua and added some code to remove the main GUI as well.

So, the migration wasn't run when you created the log file, meaning you must have updated the mod and saved the game with version 1.1.12 at some time before. Do you remember what version you were using before upgrading to 1.1.12 -- are there any versions you've skipped? But as far as I can see, I've never changed the names of toggle button and GUI before adding the second GUI in 1.1.11…

New response