I'm doing this same process for two different entity upgrade sets. The entities I'm beginning and replacing with are deep copies of logistic requester chests as follows:
Code: Select all
ent = util.table.deepcopy(data.raw["logistic-container"]["logistic-chest-requester"])
ent.name = "k2cp-resort"
...
ent = util.table.deepcopy(data.raw["logistic-container"]["k2cp-resort"])
ent.name = "k2cp-resort-mk2"
...
ent = util.table.deepcopy(data.raw["logistic-container"]["logistic-chest-requester"])
ent.name = "k2cp-city"
...
ent = util.table.deepcopy(data.raw["logistic-container"]["k2cp-city"])
ent.name = "k2cp-city-mk2"
...
Code: Select all
local new_entity = old_object.state.entity.surface.create_entity
{ name=new_object
, target=old_object.state.entity
, position=old_object.state.entity.position
, direction=old_object.state.entity.direction
, force=game.forces.player
, fast_replace=true
, player=player
, raise_built=false
, create_build_effect_smoke=false
, spawn_decorations=false
}
I tried to use this in the create_entity function to carry over the filters, which worked slick as u please, but then it seems to invalidate the entity itself which causes issues downstream?
Code: Select all
request_filters = old_object.state.entity.get_logistic_point(defines.logistic_member_index.logistic_container).filters