#On today's episode of over engineered
1 messages · Page 1 of 1 (latest)
Black magic
---This function sets the "autolaunch" checkbox on the rocket silo gui.
---This parameter is not exposed directly on `LuaEntity`.
---The workaround is to place a blueprint since the property is exposed on the blueprint string.
---@param rocket_silo_data RocketSiloData
local function enable_autolaunch(rocket_silo_data)
local entity = rocket_silo_data.entity
local inventory = game.create_inventory(1)
inventory.insert {name = "blueprint"}
local stack = inventory[1]
stack.create_blueprint {
surface = entity.surface_index,
force = entity.force_index,
area = {{0, 0}, {0, 0}},
include_entities = false
}
stack.set_blueprint_entities {{
entity_number = 1,
name = entity.name,
position = {
x = 0,
y = 0
},
launch_to_orbit_automatically = true -- Magic happens on this line.
}}
stack.build_blueprint {
surface = entity.surface_index,
force = entity.force_index,
position = entity.position,
skip_fog_of_war = false
}
inventory.destroy()
end