1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-03 13:12:11 +02:00
2020-08-10 23:15:29 +02:00

63 lines
1.4 KiB
Lua

local Global = require 'utils.global'
local this = {}
Global.register(
this,
function(tbl)
this = tbl
end
)
local Public = {}
function Public.reset()
if this.surfaces then
for k, surface in pairs(this.surfaces) do
if surface and surface.valid then
game.delete_surface(surface)
end
end
end
for k, _ in pairs(this) do
this[k] = nil
end
this.doors = {}
this.wagons = {}
this.trains = {}
this.players = {}
this.surfaces = {}
this.multiple_chests = true
this.allow_player_to_build_trains = false
this.wagon_types = {
['cargo-wagon'] = true,
['artillery-wagon'] = true,
['fluid-wagon'] = true,
['locomotive'] = true
}
this.wagon_areas = {
['cargo-wagon'] = {left_top = {x = -20, y = 0}, right_bottom = {x = 20, y = 60}},
['artillery-wagon'] = {left_top = {x = -20, y = 0}, right_bottom = {x = 20, y = 60}},
['fluid-wagon'] = {left_top = {x = -20, y = 0}, right_bottom = {x = 20, y = 60}},
['locomotive'] = {left_top = {x = -20, y = 0}, right_bottom = {x = 20, y = 60}}
}
end
function Public.get(key)
if key then
return this[key]
else
return this
end
end
function Public.set_wagon_area(tbl)
if not tbl then
return
end
this.wagon_areas = tbl
end
return Public