Personal Transformer2


Allows you to charge your power armor from the electric network, and vice versa.

Content
25 days ago
1.1 - 2.0
3.05K
Armor Power

b Crash when leaving Compact Circuit surface

a month ago

Error while running event PersonalTransformer2::on_player_changed_surface (ID 54)
LuaEntity API call when LuaEntity was invalid.
stack traceback:
[C]: in function 'index'
__PersonalTransformer2
/control.lua:637: in function 'remove_entity'
PersonalTransformer2/control.lua:827: in function 'equipmentRemoved'
PersonalTransformer2/control.lua:873: in function 'playerOrArmorChanged'
PersonalTransformer2/control.lua:287: in function <PersonalTransformer2/control.lua:283>

Problem is caused by Compact Circuits deleting the surface upon leaving, thereby destroying all entities.
Can be fixed by adding this to both for loops in remove_entity:

if (not entity.valid) then
table.remove(storage.transformer_data[grid_id].grid_transformer_entities, index)
elseif (entity.name == entity_input_name) then

a month ago

I've taken note of this and made an issue on the git page. I'll see if I can put something together this weekend. Thanks for the detailed report and a solution!

New response