mirror of
https://github.com/PHIDIAS0303/factorio-mod-PHI.git
synced 2026-05-13 05:08:44 +09:00
.
This commit is contained in:
+11
-33
@@ -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,12 +282,14 @@ script.on_nth_tick(1800, function(_)
|
|||||||
n = n + 1
|
n = n + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, s in pairs(game.surfaces) do
|
if prototypes.entity['super-combinator'] then
|
||||||
local c = s.find_entities_filtered{type='constant-combinator', name='super-combinator'}
|
for _, s in pairs(game.surfaces) do
|
||||||
|
local c = s.find_entities_filtered{type='constant-combinator', name='super-combinator'}
|
||||||
|
|
||||||
if #c > 0 then
|
if #c > 0 then
|
||||||
for _, entity in pairs(c) do
|
for _, entity in pairs(c) do
|
||||||
table.insert(storage.phi_cl.combinator.combinator_list, entity)
|
table.insert(storage.phi_cl.combinator.combinator_list, entity)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -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
|
||||||
Reference in New Issue
Block a user