ZElectricVehicles (quality fork)


Adds an Electrical Transformer to allow vehicles to function on battery. Original author N0TZ3R0. Modified by theSunLike to make quality transformers to create quality electric fuel.

Content
22 hours ago
2.0
154
Transportation

b possible issues game load code

3 hours ago

In on_configuration_changed, you reset storage.evc, but the onAddEquip_Event function modifies the script_data.evcouple table (which still contains a reference to the old storage.evc) and then sets storage.evc to refer to that old table.

I don't know if this will cause issues in practice (when entities/grids/equipments/... are modified by mod updates/installs, some old entries might be invalid and might cause issues if not every possible type of invalidity is checked on every access), but it would be much simpler to change the on_configuration_changed event to

storage.evc = {}
script_data.evcouple = storage.evc

and remove the storage.evc writes in the onAdd/onRemove functions (the point of having the local reference to the storage entry is to not need to access it on every event).

New response