This commit is contained in:
2026-05-01 21:44:37 +09:00
parent 1aaf6fd832
commit d8a6067a3f
2 changed files with 48 additions and 33 deletions
+6 -28
View File
@@ -1,3 +1,5 @@
local rail_support = require('control/rail-support')
local inserter_direction = { local inserter_direction = {
[1] = defines.direction.north, [1] = defines.direction.north,
[2] = defines.direction.northnortheast, [2] = defines.direction.northnortheast,
@@ -23,11 +25,6 @@ for k, v in pairs(inserter_direction) do
inserter_direction_reversed[v] = k inserter_direction_reversed[v] = k
end end
local rail_support_pole = {
'rail-support-pole-electric',
'rail-support-pole-lightning'
}
local function gui_create(player) local function gui_create(player)
if player.gui.relative.phi_cl_inserter_config then if player.gui.relative.phi_cl_inserter_config then
player.gui.relative.phi_cl_inserter_config.destroy() player.gui.relative.phi_cl_inserter_config.destroy()
@@ -99,16 +96,7 @@ end
-- settings.startup['PHI-GM'].value and settings.startup['PHI-GM'].value == 'SAP' -- settings.startup['PHI-GM'].value and settings.startup['PHI-GM'].value == 'SAP'
local function entity_build(event) local function entity_build(event)
if event.entity.type == 'rail-support' then rail_support.build(event)
for _, v in pairs(rail_support_pole) do
if prototypes.entity[v] then
local p = event.entity.surface.create_entity{name = v, position = {event.entity.position.x, event.entity.position.y}, force = 'neutral', quality = event.entity.quality.name}
p.destructible = false
end
end
return
end
if event.entity.type == 'lab' and prototypes.entity['proxy-container'] then if event.entity.type == 'lab' and prototypes.entity['proxy-container'] then
local p = event.entity.surface.create_entity{name = 'proxy-container', position = {event.entity.position.x, event.entity.position.y}, force = 'neutral', quality = event.entity.quality.name} local p = event.entity.surface.create_entity{name = 'proxy-container', position = {event.entity.position.x, event.entity.position.y}, force = 'neutral', quality = event.entity.quality.name}
@@ -158,19 +146,7 @@ local function entity_build(event)
end end
local function entity_destroy(event) local function entity_destroy(event)
if event.entity.type == 'rail-support' then rail_support.destroy(event)
for _, v in pairs(rail_support_pole) do
if prototypes.entity[v] then
local p = event.entity.surface.find_entity({name = v, force = 'neutral', quality = event.entity.quality.name}, {event.entity.position.x, event.entity.position.y})
if p then
p.destroy()
end
end
end
return
end
if event.entity.type == 'lab' and prototypes.entity['proxy-container'] then if event.entity.type == 'lab' and prototypes.entity['proxy-container'] then
local p = event.entity.surface.find_entity({name = 'proxy-container', force = 'neutral', quality = event.entity.quality.name}, {event.entity.position.x, event.entity.position.y}) local p = event.entity.surface.find_entity({name = 'proxy-container', force = 'neutral', quality = event.entity.quality.name}, {event.entity.position.x, event.entity.position.y})
@@ -306,6 +282,7 @@ script.on_nth_tick(1800, function(_)
n = n + 1 n = n + 1
end end
if prototypes.entity['super-combinator'] then
for _, s in pairs(game.surfaces) do for _, s in pairs(game.surfaces) do
local c = s.find_entities_filtered{type='constant-combinator', name='super-combinator'} local c = s.find_entities_filtered{type='constant-combinator', name='super-combinator'}
@@ -316,6 +293,7 @@ script.on_nth_tick(1800, function(_)
end end
end end
end end
end
end) end)
local function handle_research_queue(entity, combinator) local function handle_research_queue(entity, combinator)
+37
View File
@@ -0,0 +1,37 @@
local rail_support_pole = {
'rail-support-pole-electric',
'rail-support-pole-lightning'
}
local main = {}
function main.build(event)
if event.entity.type == 'rail-support' then
for _, v in pairs(rail_support_pole) do
if prototypes.entity[v] then
local p = event.entity.surface.create_entity{name = v, position = {event.entity.position.x, event.entity.position.y}, force = 'neutral', quality = event.entity.quality.name}
p.destructible = false
end
end
return
end
end
function main.destroy(event)
if event.entity.type == 'rail-support' then
for _, v in pairs(rail_support_pole) do
if prototypes.entity[v] then
local p = event.entity.surface.find_entity({name = v, force = 'neutral', quality = event.entity.quality.name}, {event.entity.position.x, event.entity.position.y})
if p then
p.destroy()
end
end
end
return
end
end
return main