[2.0.73] cargo landing pads happily accept pods they should not

Post your bugs and problems so we can fix them.
User avatar
Quezler
Filter Inserter
Filter Inserter
Posts: 300
Joined: Fri Mar 25, 2016 6:37 pm
Contact:

[2.0.73] cargo landing pads happily accept pods they should not

Post by Quezler »

When i create a new cargo pod and do NOT add it to the `receiving_cargo_units` of the `cargo-landing-pad` i expected the pad to not be able to receive them.

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)
Attachments
Screenshot 2026-02-06 at 15.34.48.png
Screenshot 2026-02-06 at 15.34.48.png (179.66 KiB) Viewed 117 times
if-it-fits-i-sitz_0.0.1.zip
(2.02 KiB) Downloaded 5 times
Post Reply

Return to “Bug Reports”