Ammo Alerts

by Wyrrrd

Adds map alerts for players when a gun turret, vehicle or artillery is either out of ammo or has low ammo.

Utilities
30 days ago
0.18 - 2.0
48.0K

b [Fixed] Crash on surface rename

30 days ago
(updated 30 days ago)

Hi there

Here's the crash :

The mod Ammo Alerts (2.0.8) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event Gun_Turret_Alerts::on_surface_renamed (ID 143)
Gun_Turret_Alerts/control.lua:149: attempt to call field 'deepcopy' (a nil value)
stack traceback:
Gun_Turret_Alerts/control.lua:149: in function <Gun_Turret_Alerts/control.lua:144>
stack traceback:
[C]: in function 'newindex'
__dimension-warp
/scripts/planets/aquilo.lua:142: in function 'randomizer'
dimension-warp/scripts/surface-generation.lua:53: in function 'generate_surface'
dimension-warp/scripts/warp.lua:57: in function 'prepare_warp_to_next_surface'
dimension-warp/scripts/warp.lua:93: in function 'cb'
dimension-warp/lib/events.lua:18: in function <dimension-warp/lib/events.lua:16>

From what i understand, it looks like your code here https://github.com/Wyrrrd/Gun_Turret_Alerts/blob/c08b964a8d013ff79ef2624371ade05db77b80cb/control.lua#L149C1-L149C131 is using deepcopy while you never have 'require("util")' in your code (so table.deepcopy doesn't exist)

(i didn't know if you prefer a message here or in your github)

30 days ago
(updated 30 days ago)

As I depend on "base" which in turn should load util in, you might have a mod loaded that deliberately wipes util. Could you try to find it for me?

30 days ago
(updated 30 days ago)

As I depend on "base" which in turn should load util in, you might have a mod loaded that deliberately wipes util.

No it doesn't.
You have to explicitly load util to have deepcopy, otherwise it's not there.

Also my mod (dimension-warp) explicitly load util and use it, so clearly I don't wipe it...

If you want to test it by yourself, just create a vanilla game with your mod only and type:

/c local surface = game.create_surface('test_surface')
surface.name = "new_name"

and you'll have the same exact error (minus the stack from dimension-warp)
https://imgur.com/a/OroXsax

30 days ago
(updated 30 days ago)

Nevermind, fixed it in 2.0.10.

New response