mirror of
https://github.com/PHIDIAS0303/factorio-mod-PHI.git
synced 2025-12-30 20:01:40 +09:00
.
This commit is contained in:
@@ -25,6 +25,12 @@ 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'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if settings.startup['PHI-CT'].value then
|
if settings.startup['PHI-CT'].value then
|
||||||
local function trash_creation(event)
|
local function trash_creation(event)
|
||||||
local entity = event.created_entity or event.entity
|
local entity = event.created_entity or event.entity
|
||||||
@@ -160,31 +166,36 @@ if settings.startup['PHI-CT'].value or settings.startup['PHI-MI'].value or (sett
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local entities = {
|
|
||||||
['rail-support'] = true
|
|
||||||
}
|
|
||||||
|
|
||||||
local function build(event)
|
local function build_electric_pole(event)
|
||||||
if entities[event.entity.name] then
|
if event.entity.name == 'rail-support' then
|
||||||
local p = event.entity.surface.create_entity{name = 'rail-electric-pole', position = {event.entity.position.x, event.entity.position.y}, force = 'neutral', quality = event.entity.quality.name}
|
for _, v in pairs(rail_support_pole) do
|
||||||
p.destructible = false
|
if prototypes.entity[v] then
|
||||||
end
|
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}
|
||||||
end
|
p.destructible = false
|
||||||
|
end
|
||||||
local function destroy(event)
|
|
||||||
if entities[event.entity.name] then
|
|
||||||
local e = event.entity.surface.find_entity{entity = {name = 'rail-electric-pole', force = 'neutral', quality = event.entity.quality.name}, position = {event.entity.position.x, event.entity.position.y}}
|
|
||||||
|
|
||||||
if e then
|
|
||||||
e.destroy()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
script.on_event(defines.events.on_built_entity, build)
|
local function destroy_electric_pole(event)
|
||||||
script.on_event(defines.events.on_robot_built_entity, build)
|
if event.entity.name == 'rail-support' then
|
||||||
script.on_event(defines.events.on_entity_died, destroy)
|
for _, v in pairs(rail_support_pole) do
|
||||||
script.on_event(defines.events.on_player_mined_entity, destroy)
|
if prototypes.entity[v] then
|
||||||
script.on_event(defines.events.on_robot_pre_mined, destroy)
|
local e = event.entity.surface.find_entity{entity = {name = v, force = 'neutral', quality = event.entity.quality.name}, position = {event.entity.position.x, event.entity.position.y}}
|
||||||
script.on_event(defines.events.script_raised_destroy, destroy)
|
|
||||||
|
if e then
|
||||||
|
e.destroy()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
script.on_event(defines.events.on_built_entity, build_electric_pole)
|
||||||
|
script.on_event(defines.events.on_robot_built_entity, build_electric_pole)
|
||||||
|
script.on_event(defines.events.on_entity_died, destroy_electric_pole)
|
||||||
|
script.on_event(defines.events.on_player_mined_entity, destroy_electric_pole)
|
||||||
|
script.on_event(defines.events.on_robot_pre_mined, destroy_electric_pole)
|
||||||
|
script.on_event(defines.events.script_raised_destroy, destroy_electric_pole)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ if settings.startup['PHI-CT'].value or settings.startup['PHI-MI'].value or (sett
|
|||||||
end
|
end
|
||||||
|
|
||||||
local entity = table.deepcopy(data.raw['electric-pole']['big-electric-pole'])
|
local entity = table.deepcopy(data.raw['electric-pole']['big-electric-pole'])
|
||||||
entity.name = 'rail-electric-pole'
|
entity.name = 'rail-support-pole-electric'
|
||||||
entity.hidden = true
|
entity.hidden = true
|
||||||
entity.hidden_in_factoriopedia = true
|
entity.hidden_in_factoriopedia = true
|
||||||
entity.minable.result = nil
|
entity.minable.result = nil
|
||||||
@@ -182,10 +182,27 @@ if settings.startup['PHI-CT'].value or settings.startup['PHI-MI'].value or (sett
|
|||||||
entity.selection_box = nil
|
entity.selection_box = nil
|
||||||
entity.collision_mask = {colliding_with_tiles_only = true, layers = {}, not_colliding_with_itself = true}
|
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.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.next_upgrade = nil
|
||||||
entity.order = 'zz'
|
entity.order = 'zz'
|
||||||
data:extend({entity})
|
data:extend({entity})
|
||||||
|
|
||||||
|
if (not (settings.startup['PHI-VP'].value and settings.startup['PHI-VP-MAIN'].value)) and mods['space-age'] and data.raw['lightning-attractor']['lightning-rod'] then
|
||||||
|
entity = table.deepcopy(data.raw['lightning-attractor']['lightning-rod'])
|
||||||
|
entity.name = 'rail-support-pole-lightning'
|
||||||
|
entity.hidden = true
|
||||||
|
entity.hidden_in_factoriopedia = true
|
||||||
|
entity.minable.result = nil
|
||||||
|
entity.range_elongation = math.floor(data.raw['rail-support']['rail-support'].support_range * 1.75)
|
||||||
|
entity.water_reflection = nil
|
||||||
|
entity.chargable_graphics = 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.next_upgrade = nil
|
||||||
|
entity.order = 'zz'
|
||||||
|
data:extend({entity})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if settings.startup['PHI-MI'].value then
|
if settings.startup['PHI-MI'].value then
|
||||||
|
|||||||
Reference in New Issue
Block a user