This mod allows players to create and remotely control Avatars. Avatars act like players, with a few minor exceptions. The mod also includes a few custom entities to control and create the Avatars.

4 days ago
0.13 - 1.1

b Crash

6 months ago


I keep getting this error (playing with Krastorio 2 and a bunch of other mods):

The mod Avatars (0.5.5) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event Avatars::on_player_driving_changed_state (ID 26)
LuaEntity API call when LuaEntity was invalid.
stack traceback:
Avatars/scripts/sort.lua:84: in function 'getFilteredTable'
Avatars/scripts/sort.lua:41: in function 'getSortedTable'
Avatars/scripts/gui.lua:108: in function 'draw'
Avatars/control.lua:45: in function <Avatars/control.lua:40>
stack traceback:
[C]: in function 'index'
/scripts/sort.lua:84: in function 'getFilteredTable'
Avatars/scripts/sort.lua:41: in function 'getSortedTable'
Avatars/scripts/gui.lua:108: in function 'draw'
Avatars/control.lua:45: in function <Avatars/control.lua:40

6 months ago

Doesn't look like it is Krastorio at a glance. Do you have any mods that transport you to a different surface (a different place, like inside warehouses or factories or something)?

I could fix it on my end easily, but a different mod of yours seems to be deleting the avatars and recreating them. In theory they should be setting a flag so that the Avatars mod would get the event of that, but it doesn't look like it is. If the other mod isn't giving me the destroy event then they probably aren't giving me the recreate event, so the fix would just leave avatars lying around that you can't control or do anything with.

6 months ago


thanks for the quick answer. The only mod I can think of that might be deleting avatars is the teleporter mod. But I have used that one before. It would be great if there was some graceful way to recover from this error. So far I have tried disabling all mods except avatar, but it still keeps crashing whenever I try to control an avatar. Any ideas?

The full list of my currently installed mods is:
(not quite sure what else I might have installed at some point in time though. sorry)
Evolution Reduction_0.18.0.zip

6 months ago

Looks like Teleporters uses "teleport" so it is safe.

So, the problem is that at some point during your game another mod deleted and recreated an avatar without informing the Avatars mod. So, this means that even if you remove the other mods, that avatar is still invalidated and Avatars has no idea that it was destroyed or created again.

I can fix the check that is failing, and alert you that an Avatar is invalid. I will also add a command that will search for any orphaned Avatars to repair the listing. That command will most likely cause a massive lag spike, because I would have to search the entire map for all avatars and see if there are any that are unknown to the Avatars mod.

6 months ago
(updated 6 months ago)

Ok, check out the 0.5.6 version and let me know if it works.

When you get into a control unit, you will likely see some warnings in the chat log, it will list the avatars that have gone missing (not needed, but if you named them specifically, that may help to find them later).

You can run the following command in the chat to repair the global listing, this may cause some lag if you have a massive map, but I didn't notice a lag on a medium sized base that I use for testing this type of thing sometimes.

/c remote.call("Avatars", "repair_avatars_listing")

If the removed/added amounts at the end of that command line up, then you're good to go. The avatars that went missing will have fresh avatar names, but they will be usable. If not, then somehow an avatar went missing or an extra was created by another mod.

I was missing a few inter-mod events, so it's possible that if a current mod of yours was causing this that fixed the issue. If you see this issue in the future though, it's likely the offending mod is still around and is doing something wrong. However, you will get the warnings again and can rerun the repair command and everything will work on my end.

6 months ago

Thanks for the update. So... partial succcess. It doesn't crash anymore on entering the control station. But the control station just shows an empty list and on clicking refresh it crashes at once, see below.

The mod Avatars (0.5.6) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event Avatars::on_gui_click (ID 1)
Avatars/scripts/gui.lua:252: attempt to index field 'upperSortFlow' (a nil value)
stack traceback:
Avatars/scripts/gui.lua:252: in function 'getSortValues'
Avatars/scripts/gui.lua:271: in function 'update'
Avatars/scripts/gui.lua:72: in function 'update'
Avatars/control.lua:93: in function <Avatars/control.lua:63>

Manually placing a new avatar fixes the crash though.
Then, after running the command command it says it fixed it but after clicking on refresh or leaving and re-entering the control station, it still complains about the same avatar that it could not find. Any idea? Should I send you the savegame somehow?

6 months ago

Hm, yes please send the save over. I can replicate the crash on Refresh, but the Avatar still missing I can't.

If you need somewhere to upload it, I made a quick folder on my drive public so you can should be able to drop it there (assuming you have a Google account): https://drive.google.com/drive/folders/1baXxh8rfoDYKg4-QYuC18El4wwl2CQOa?usp=sharing

6 months ago


6 months ago

Ok, now it should be good in 0.5.7. I fixed both the repair not working properly and the refresh crashing when the list is empty.

6 months ago

Ok, that fixed that problem. Thank you very much!

Now though every time I save and load a game it loses the avatar I was in and I have to execute your command to get the avatar back. Any idea?

6 months ago

Wow, that is a strange one. If I save the game while controlling an avatar on your save then it becomes invalid. BUT, if I do the same thing on a different save, I don't get this issue. I think I have to attribute it to something wrong with your save, but I can't say what sadly.

I'll put in a bug report with Factorio to see if it is something on their end, but for now just try to save from your main player character, not from an avatar.

6 months ago

Pretty strange bug indeed. :)

Thanks for checking everything and putting in the command to fix things. Maybe I messed around with too many mods. Or one of the mods does something strange to the avatar on loading? Who knows...

6 months ago

So, Rseding replied to my bug, I guess it's something to do with your save having been a multiplayer save at some point, so I need to handle player connection. (Which I thought I had handled in past versions, but I guess that is no longer the case). I'll work on it sometime over the next few days and let you know when I have a fix.

6 months ago

Ok, this should be totally fix now in 0.5.8.

5 months ago

not quite... :D
Directly on loading:
The mod Avatars (0.5.8) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event Avatars::on_player_joined_game (ID 43)
Avatars/scripts/storage.lua:145: attempt to index field 'playerData' (a nil value)
stack traceback:
Avatars/scripts/storage.lua:145: in function 'getByPlayer'
Avatars/scripts/storage.lua:157: in function 'repairOnJoinedGame'
Avatars/control.lua:41: in function <Avatars/control.lua:39>

5 months ago

Blurghhghghghg. I hadn't tested on a save with multiple avatars lying around. 0.5.9 should do it.

Sorry for the late fix on this one, I had a busy weekend and forgot about the email.

5 months ago

Hehe. The old programmer wisdom is really true: behind every tiny bug is a bigger one just waiting to come out :D

But thank you for the prompt bug fixing and the overall awesome mod. It really improves the game play at lot by removing a large part of the boring running around.

Can I also request a few ui improvements? :D

For example it would be nice if after clicking the disconnect button the menu for selecting an avatar would appear at once instead of having to press enter two times every time. And with the 10 quickbars it would be great if the avatars would remember which quickbar was selected and went back to the same ones.

5 months ago

Ok sure, I've made a note to look into that. I'm not too familiar about the quickbars from modding, but I wouldn't think it would be too difficult.

5 months ago

Just to let you know, the changes you asked for made it into 0.5.10.

New response