RitnCharacters

by Ritn

Change your character! All mods that add a character are automatically supported. A non-exhaustive list is available in the description. ---------------------------------------------- Changer votre personnage ! Tous mod ajoutant un personnage sont pris en charge automatiquement. Une liste non exhaustives est disponible en description.

Utilities
13 days ago
0.18 - 2.0
2.94K

b [FIX 1.2.2] Crash when mod is added to game

2 years ago

Hi! When your mod is added to an existing game, it seems you don't initialize global.players, which will result in a crash when the player chooses a character:

Error while running event RitnCharacters::on_gui_click (ID 1)
__RitnCharacters__/lualib/functions/characters.lua:14: attempt to index field '?' (a nil value)
stack traceback:
    __RitnCharacters__/lualib/functions/characters.lua:14: in function 'changeCharacter'
    __RitnCharacters__/lualib/modules/change-character.lua:73: in function 'func'
    __RitnLib__/lualib/event-listener.lua:54: in function <__RitnLib__/lualib/event-listener.lua:52>
1 year, 8 months ago

Hello,
I had set aside this mod for a while, but I just released an update for it.
I haven't addressed this issue in this latest update yet.
I'll look into it tomorrow.
Thank you for bringing this to my attention, and sorry for responding so late.

1 year, 8 months ago

Unfortunately, I can't get it to work: Starting a new game will crash back to the main menu with some scenarios, or completely crash the game (so I must restart Factorio) with other scenarios. Loading an existing game where your mod is added will result in another error when I use your shortcut.

I've sent you a PM on the forum with the detailed error messages and a log file.

1 year, 8 months ago

Yes, I know. I will work on this issue today, actually.

1 year, 8 months ago

I just read your private message on the forum.
For your information, I no longer hard-code the list of characters now, I retrieve them from game.entities_prototypes only if the type is "character".

1 year, 8 months ago

I have just published an update of my mod which should fix all the problems that you have mentioned to me.

1 year, 8 months ago

Unfortunately, there still are crashes related to the missing font. When starting a new game, this will raise an error that requires restarting Factorio. When an existing game is loaded, using the shortcut results in this error message:

Error while running event RitnCharacters::on_lua_shortcut (ID 36)
Missing specification of font with name: "ritn-default-bold-18"
stack traceback:
  [C]: in function '__newindex'
  __RitnLib__/classes/RitnClass/gui/RitnStyle.lua:340: in function 'font'
  __RitnCharacters__/classes/RitnGuiChanger.lua:78: in function 'create'
  __RitnCharacters__/classes/RitnGuiChanger.lua:127: in function 'action_open'
  __RitnCharacters__/classes/RitnGuiChanger.lua:99: in function 'on_lua_shortcut'
  __RitnCharacters__/modules/events.lua:46: in function 'func'
  __RitnLib__/core/eventListener.lua:54: in function <__RitnLib__/core/eventListener.lua:52>
1 year, 8 months ago

Indeed, during my tests I enabled RitnTeleporter which loads this font.
Sorry again and thank you for letting me know !

1 year, 8 months ago

Thanks for the fix! It's working now.

Indeed, during my tests I enabled RitnTeleporter which loads this font.

Ah, yes -- I know such problems. :-)

For your information, I no longer hard-code the list of characters now, I retrieve them from game.entities_prototypes only if the type is "character".

Good, I'll update my helper mod ASAP.

1 year, 8 months ago

Thanks for the fix! It's working now.

Indeed, during my tests I enabled RitnTeleporter which loads this font.

Ah, yes -- I know such problems. :-)

For your information, I no longer hard-code the list of characters now, I retrieve them from game.entities_prototypes only if the type is "character".

Good, I'll update my helper mod ASAP.

This thread has been locked.