mirror of
https://github.com/PHIDIAS0303/factorio-mod-PHI.git
synced 2026-05-13 05:08:44 +09:00
.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
local main = {}
|
||||
|
||||
function main.build(event)
|
||||
if event.entity.type ~= 'cargo-landing-pad' then
|
||||
return
|
||||
end
|
||||
|
||||
if event.entity.name ~= 'cargo-landing-pad' then
|
||||
return
|
||||
end
|
||||
if not prototypes.entity['proxy-cargo-landing-chest'] then
|
||||
return
|
||||
end
|
||||
|
||||
local ec = game.surfaces[event.entity.surface].find_entities_filtered{type='cargo-landing-pad'}
|
||||
|
||||
if #ec > 1 then
|
||||
return
|
||||
end
|
||||
|
||||
local ep = game.surfaces[event.entity.surface].find_entities_filtered{type='proxy-container', name='proxy-cargo-landing-chest'}
|
||||
|
||||
for _, v in pairs(ep) do
|
||||
v.proxy_target_entity = ec[1]
|
||||
v.proxy_target_inventory = defines.inventory.cargo_landing_pad_main
|
||||
end
|
||||
end
|
||||
|
||||
return main
|
||||
@@ -0,0 +1,26 @@
|
||||
local main = {}
|
||||
|
||||
function main.build(event)
|
||||
if event.entity.type ~= 'proxy-container' then
|
||||
return
|
||||
end
|
||||
|
||||
if event.entity.name ~= 'proxy-cargo-landing-chest' then
|
||||
return
|
||||
end
|
||||
|
||||
if not prototypes.entity['cargo-landing-pad'] then
|
||||
return
|
||||
end
|
||||
|
||||
local ec = game.surfaces[event.entity.surface].find_entities_filtered{type='cargo-landing-pad'}
|
||||
|
||||
if not ec then
|
||||
return
|
||||
end
|
||||
|
||||
event.entity.proxy_target_entity = ec[1]
|
||||
event.entity.proxy_target_inventory = defines.inventory.cargo_landing_pad_main
|
||||
end
|
||||
|
||||
return main
|
||||
@@ -0,0 +1,36 @@
|
||||
local main = {}
|
||||
|
||||
function main.build(event)
|
||||
if event.entity.type ~= 'lab' then
|
||||
return
|
||||
end
|
||||
|
||||
if not prototypes.entity['proxy-container'] then
|
||||
return
|
||||
end
|
||||
|
||||
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}
|
||||
p.destructible = false
|
||||
p.proxy_target_entity = event.entity
|
||||
p.proxy_target_inventory = defines.inventory.lab_input
|
||||
end
|
||||
|
||||
function main.destroy(event)
|
||||
if event.entity.type ~= 'lab' then
|
||||
return
|
||||
end
|
||||
|
||||
if not prototypes.entity['proxy-container'] then
|
||||
return
|
||||
end
|
||||
|
||||
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})
|
||||
|
||||
if not p then
|
||||
return
|
||||
end
|
||||
|
||||
p.destroy()
|
||||
end
|
||||
|
||||
return main
|
||||
@@ -6,31 +6,31 @@ local rail_support_pole = {
|
||||
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
|
||||
|
||||
if event.entity.type ~= 'rail-support' then
|
||||
return
|
||||
end
|
||||
|
||||
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
|
||||
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 event.entity.type ~= 'rail-support' then
|
||||
return
|
||||
end
|
||||
|
||||
if p then
|
||||
p.destroy()
|
||||
end
|
||||
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
|
||||
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user