diff --git a/PHI-CL/control.lua b/PHI-CL/control.lua index ef2ed37..15be3a5 100644 --- a/PHI-CL/control.lua +++ b/PHI-CL/control.lua @@ -1,5 +1,4 @@ -local cargo_landing_pad = require('control/cargo-landing-pad') -local cargo_landing_chest = require('control/cargo-landing-chest') +local cargo_landing = require('control/cargo-landing') local lab = require('control/lab') local rail_support = require('control/rail-support') local trash = require('control/trash') @@ -53,8 +52,7 @@ local function gui_update(player, entity) end local function entity_build(event) - cargo_landing_pad.build(event) - cargo_landing_chest.build(event) + cargo_landing.build(event) lab.build(event) rail_support.build(event) trash.build(event) diff --git a/PHI-CL/control/cargo-landing-chest.lua b/PHI-CL/control/cargo-landing-chest.lua deleted file mode 100644 index 5e7e820..0000000 --- a/PHI-CL/control/cargo-landing-chest.lua +++ /dev/null @@ -1,29 +0,0 @@ -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 diff --git a/PHI-CL/control/cargo-landing-pad.lua b/PHI-CL/control/cargo-landing-pad.lua deleted file mode 100644 index 80ae2be..0000000 --- a/PHI-CL/control/cargo-landing-pad.lua +++ /dev/null @@ -1,26 +0,0 @@ -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 diff --git a/PHI-CL/control/cargo-landing.lua b/PHI-CL/control/cargo-landing.lua new file mode 100644 index 0000000..9a179d9 --- /dev/null +++ b/PHI-CL/control/cargo-landing.lua @@ -0,0 +1,45 @@ +local main = {} + +function main.build(event) + if event.entity.type == 'proxy-container' then + 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 + + elseif event.entity.type == 'cargo-landing-pad' then + 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 +end + +return main diff --git a/PHI-CL/data/b/mig.lua b/PHI-CL/data/b/mig.lua index 8b8d84b..ec1053e 100644 --- a/PHI-CL/data/b/mig.lua +++ b/PHI-CL/data/b/mig.lua @@ -208,7 +208,7 @@ end for _, v in pairs(data.raw['inserter']) do if v.energy_source and v.energy_source.type and (v.energy_source.type == 'electric' or v.energy_source.type == 'void' or v.energy_source.type == 'burner') then v.allow_custom_vectors = true - v.flags = {'placeable-neutral', 'placeable-player', 'player-creation', ((v.hand_size and v.hand_size < 1) and 'building-direction-8-way') or 'building-direction-16-way'} + v.flags = {'placeable-neutral', 'placeable-player', 'player-creation', ((v.hand_size and v.hand_size > 0.8) and 'building-direction-16-way') or 'building-direction-8-way'} if v.energy_source.type == 'burner' then v.allow_burner_leech = true