This commit is contained in:
2025-04-12 03:19:51 +09:00
parent b5b70e00e3
commit dd58524a51
2 changed files with 48 additions and 0 deletions

View File

@@ -159,4 +159,33 @@ if settings.startup['PHI-CT'].value or settings.startup['PHI-MI'].value or (sett
gui_update(player, player.opened)
end
end)
local entities = {
['rail-support'] = true,
['rail-ramp'] = true,
}
local function build(event)
if entities[event.entity.name] then
local p = event.entity.surface.create_entity{name = 'rail-electric-pole', position = {event.entity.position.x, event.entity.position.y}, force = game.forces.neutral, quality = event.entity.quality}
p.destructible = false
end
end
local function destroy(event)
if entities[event.entity.name] then
local e = event.entity.surface.find_entity({name = 'rail-electric-pole', quality = event.entity.quality.name}, {event.entity.position.x, event.entity.position.y})
if e then
e.destroy()
end
end
end
script.on_event(defines.events.on_built_entity, build)
script.on_event(defines.events.on_robot_built_entity, build)
script.on_event(defines.events.on_entity_died, destroy)
script.on_event(defines.events.on_player_mined_entity, destroy)
script.on_event(defines.events.on_robot_pre_mined, destroy)
script.on_event(defines.events.script_raised_destroy, destroy)
end

View File

@@ -167,6 +167,25 @@ if settings.startup['PHI-CT'].value or settings.startup['PHI-MI'].value or (sett
if mods['space-age'] and data.raw['inserter']['stack-inserter'] then
data.raw['inserter']['stack-inserter'].allow_custom_vectors = true
end
local entity = table.deepcopy(data.raw['electric-pole']['big-electric-pole'])
entity.name = 'rail-electric-pole'
entity.hidden = true
entity.hidden_in_factoriopedia = true
entity.minable.result = nil
entity.maximum_wire_distance = math.floor(data.raw['rail-support']['rail-support'].support_range * 1.5)
entity.supply_area_distance = 0
entity.water_reflection = nil
entity.pictures = nil
entity.active_picture = nil
entity.collision_box = {{0, 0}, {0, 0}}
entity.selection_box = nil
entity.collision_mask = {colliding_with_tiles_only = true, layers = {}, not_colliding_with_itself = true}
entity.flags = {'hide-alt-info', 'no-copy-paste', 'not-blueprintable', 'not-deconstructable', 'not-flammable', 'not-on-map', 'not-selectable-in-game', 'placeable-off-grid', 'placeable-player'}
entity.max_health = 2147483648
entity.next_upgrade = nil
entity.order = 'zz'
data:extend({entity})
end
if settings.startup['PHI-MI'].value then