Open ahicks92 opened 1 month ago
Ok, here's a working function to create a space platform from a silo with a starter pack in it.
function new_platform_from_silo(name,silo)
local inventory=silo.get_inventory(defines.inventory.rocket_silo_rocket)
local pack = nil
for _,i in pairs(inventory.get_contents()) do
if prototypes.item[i.name].type == 'space-platform-starter-pack' then
pack = i
break
end
end
if not pack then
error("replace with nice error message saying to insert a starter pack into the silo first")
end
local args={
name = name,
planet = silo.surface.planet.name,
starter_pack=pack
}
silo.force.create_space_platform(args)
end
It's also possible to create a request for a space platform through a GUI that's available below the surface selector in the remote view. This GUI basically just lets you select the three parameters for the create_space_platform call. You type the name (or let the auto-filled backer name stay, select a planet from a drop-down, and select a starter-pack from a filtered item picker. If you create platform request in this way, then a silo that is set to auto request on that planet will request the starter pack from your logistics and launch it up. Either way we want to support will require a UI for the name at least. It'd be nice to support both.
I added a forum request for launching players and cargo to particular platforms since this seems to be engine implemented and is not exposed. https://forums.factorio.com/viewtopic.php?f=28&t=122877
We need to collect info on space platforms. Might as well put it here. I think that if we have new cursor module it's mostly okay, but:
We have API access to some but not all of it.