(https://paste.whitefire.in/view/uPUIWvbpgM)
Code: Select all
{
type = "container",
name = "fre_connection-chest_input",
icon = "__base__/graphics/icons/steel-chest.png",
flags = {"not-blueprintable", "not-deconstructable"},
minable = nil,
max_health = 0,
corpse = "small-remnants",
open_sound = { filename = "__base__/sound/metallic-chest-open.ogg", volume=0.65 },
close_sound = { filename = "__base__/sound/metallic-chest-close.ogg", volume = 0.7 },
resistances =
{
{
type = "fire",
percent = 90
}
},
collision_box = {{-0.35, -0.35}, {0.35, 0.35}},
selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
fast_replaceable_group = "fre_connection-chest",
inventory_size = 48,
vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
picture =
{
filename = "__base__/graphics/entity/steel-chest/steel-chest.png",
priority = "extra-high",
width = 48,
height = 34,
shift = {0.1875, 0}
},
},
{
type = "container",
name = "fre_connection-chest_output",
icon = "__base__/graphics/icons/steel-chest.png",
flags = {"not-blueprintable", "not-deconstructable"},
minable = nil,
max_health = 0,
corpse = "small-remnants",
open_sound = { filename = "__base__/sound/metallic-chest-open.ogg", volume=0.65 },
close_sound = { filename = "__base__/sound/metallic-chest-close.ogg", volume = 0.7 },
resistances =
{
{
type = "fire",
percent = 90
}
},
collision_box = {{-0.35, -0.35}, {0.35, 0.35}},
selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
fast_replaceable_group = "fre_connection-chest",
inventory_size = 48,
vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
picture =
{
filename = "__base__/graphics/entity/steel-chest/steel-chest.png",
priority = "extra-high",
width = 48,
height = 34,
shift = {0.1875, 0}
},
},
I want to replace an existing neutral entity with the opposite type. These are both identical besides entity name.
This is for reversing inputs and outputs, like so:
Code: Select all
self.input, self.output = self.output, self.input
self.input = self.input.surface.create_entity({
name='fre_connection-chest_input',
position=self.input.position,
force='neutral',
fast_replace=true,
})
self.output = self.output.surface.create_entity({
name='fre_connection-chest_output',
position=self.output.position,
force='neutral',
fast_replace=true,
})