I'm posting this as a bug, since this was suggested to be a possible game bug fromthis thread
I updated my mod to have biters attack when cliffs get bombed. In testing I found no errors and all seemed to work fine, but I've gotten a few crash reports.
They are:
and
Error
I've attached the mod. I've also attached a save from the first error report, but I can't load it, get this error:
Error_when_loading_save
It seems that for some reason, the cliffs are being triggered, but are not valid....Here is the code that is erroring out: (it's the "if settings" line
Code: Select all
script.on_event(defines.events.on_trigger_created_entity, function(event)
local entity = event.entity
if settings.startup["NE_Tree_Hugger"].value and global.cliff_explosive[entity.name] then
writeDebug("Cliff Bombed")
Look_and_Attack(entity, 2)
end
end)
Code: Select all
---------------------------------------------
local function On_Init()
global.cliff_explosive = {}
global.cliff_explosive["ground-explosion"] = "ground-explosion"
end
---------------------------------------------
local function On_Config_Change()
global.cliff_explosive = {}
global.cliff_explosive["ground-explosion"] = "ground-explosion"
end
---------------------------------------------
script.on_configuration_changed(On_Config_Change)
script.on_init(On_Init)
Code: Select all
if NE_Enemies.Settings.NE_Tree_Hugger == true then
local proj = data.raw["projectile"]["cliff-explosives"]
if proj and proj.action then
local action = proj.action[1].action_delivery.target_effects
for _, eff in pairs(action) do
if eff.type == "create-entity" and eff.entity_name == "ground-explosion" then
eff.trigger_created_entity = true
break
end
end
end
end
Thanks for taking a look.