HeroTurrets_Redux


Turrets are built using salvaged self-learning AI tech from your ship allowing them to get deadlier with practice. Extends turrets via ranking system based on kills. Turrets are generated and are not limited to vanilla turrets, identifiable by overlaid rank insignia. Rank buffs individual turrets.

Content
7 months ago
2.0
10.5K
Combat

b Error while running event HeroTurretRedux::on_entity_died (ID 4)

a month ago

Hi, do you know how to fix this?

Error while running event HeroTurretRedux::on_entity_died (ID 4)
LuaEntity doesn't contain key fluidbox.
stack traceback:
[C]: in function 'index'
__HeroTurretRedux
/prototypes/scripts/turrets.lua:185: in function 'local_replace_turret'
HeroTurretRedux/prototypes/scripts/turrets.lua:560: in function 'v'
HeroTurretRedux/control.lua:377: in function 'local_on_standard_entity_event'
HeroTurretRedux/control.lua:409: in function <HeroTurretRedux/control.lua:408>

10 days ago
(updated 10 days ago)

This comes from Factorio 2.1 removing LuaEntity.fluidbox. In prototypes/scripts/turrets.lua, local_replace_turret collects the old turret's fluids, but the code that would put them back is commented out, so the loop can simply be deleted (around line 184):

local fluid = {}
-- delete from here ...
if entity.fluidbox ~= nil then
  for k = 1, #entity.fluidbox do local fb = entity.fluidbox[k]
    if fb ~=nil and fb.name ~= nil then
      table.insert(fluid,fb)
    end
  end
end
-- ... to here

On 2.1 the rank recipes also need one change in prototypes/scripts/types.lua (around line 689), because 2.1 ignores category on recipes:

-- before
category = turret.recipe.category,
-- after
categories = turret.recipe.categories or (turret.recipe.category and {turret.recipe.category}) or nil,

With both changes, a 2.1.21 save with ~1800 ranked turrets loads, migrates and runs a headless test without script errors. I haven't yet confirmed a rank-up in normal play.

Otherwise, HeroTurretsReduxFork (linked in the "[Use this] 2.1 update" thread) is the maintained 2.1 version, endorsed by the author there, and it already handles this.

New response