Page 1 of 1

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

Posted: Fri Nov 08, 2024 11:44 pm
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>

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

Posted: Fri Nov 22, 2024 5:21 pm
by Loewchen
Ref.: 122087