[pard] [2.0.16]Lua error on laser_defense menu sim if player dies

lyvgbfh
Fast Inserter
Fast Inserter
Posts: 170
Joined: Fri Jul 10, 2020 6:48 pm
Contact:

[pard] [2.0.16]Lua error on laser_defense menu sim if player dies

Post by lyvgbfh »

The game will throw a Lua error if the player dies on the nauvis_biter_base_laser_defense sim. This can have any number of causes, I've attached a mod which simply removes the shield value from the energy-shield-mk2-equipment and all other menu sims.

The fix is to add a character.valid check in the on_tick event.

Code: Select all

  script.on_event(defines.events.on_tick, function()
    local k, destination = next(points)
    if not k then return end
    if not character.valid then return end

Code: Select all

Error while running event level::on_tick (ID 0)
LuaEntity API call when LuaEntity was invalid.
stack traceback:
	[C]: in function '__index'
	[string "    local logo = game.surfaces.nauvis.find_en..."]:72: in function <[string "    local logo = game.surfaces.nauvis.find_en..."]:68>
Attachments
testmod_1.0.0.zip
(2.57 KiB) Downloaded 13 times
factorio-current.log
(6.52 KiB) Downloaded 13 times
Post Reply

Return to “Assigned”