Observed behavior: the trash cargo pod and the requested cargo pod both land in the cargo landing pad.
Expected behavior: for the trash cargo pod to land on the surface, and for the space platform foundation request to not get fulfilled.
The relevant code, packaged in the attached mod for confirmation convenience:
(notice that print indeed says "cat" so the platform is not creating the wrong entity)
Code: Select all
local cat = table.deepcopy(data.raw["cargo-pod"]["cargo-pod"])
cat.name = "cat"
data:extend{cat}
for _, hatch_definition in pairs(data.raw["space-platform-hub"]["space-platform-hub"].cargo_station_parameters.hatch_definitions) do
if hatch_definition.cargo_unit_entity_to_spawn == "cargo-pod" then
hatch_definition.cargo_unit_entity_to_spawn = "cat"
end
end
Code: Select all
script.on_init(function()
local pad = game.surfaces.nauvis.create_entity{
name = "cargo-landing-pad",
force = "player",
position = {0, 10},
}
local platform = game.forces.player.create_space_platform{name = "platform", planet = "nauvis", starter_pack = "space-platform-starter-pack"}
local hub = platform.apply_starter_pack()
hub.get_inventory(defines.inventory.hub_trash).insert("wood")
pad.get_logistic_sections().sections[1].set_slot(1, {value = {type = "item", name = "space-platform-foundation", quality = "normal"}, min = 10})
end)
script.on_event(defines.events.on_cargo_pod_started_ascending, function(event)
game.print(event.cargo_pod.name)
end)
