mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Added remaing modules
This commit is contained in:
@@ -30,9 +30,9 @@ function left.add(obj)
|
||||
if not is_type(obj,'table') then return end
|
||||
if not is_type(obj.name,'string') then return end
|
||||
verbose('Created Left Gui: '..obj.name)
|
||||
setmetatable(obj,{__index=left._prototype,__call=function(self,player) if player then self:toggle{player=player,element={name=self.name}} else left.update(self.name) end end})
|
||||
setmetatable(obj,{__index=left._prototype,__call=function(self,player) if player then self:toggle(player) else left.update(self.name) end end})
|
||||
Gui.data('left',obj.name,obj)
|
||||
Gui.toolbar(obj.name,obj.caption,obj.tooltip,obj.toggle)
|
||||
Gui.toolbar(obj.name,obj.caption,obj.tooltip,function(event) obj:toggle(event) end)
|
||||
return obj
|
||||
end
|
||||
|
||||
@@ -47,10 +47,7 @@ function left.update(frame,players)
|
||||
local frames = Gui.data.left or {}
|
||||
if frame then frames = {[frame]=frames[frame]} or {} end
|
||||
for name,left in pairs(frames) do
|
||||
if _left then
|
||||
local fake_event = {player_index=player.index,element={name=name}}
|
||||
left.open(fake_event)
|
||||
end
|
||||
if _left then left:first_open(player) end
|
||||
end
|
||||
end
|
||||
else
|
||||
@@ -67,8 +64,7 @@ function left.update(frame,players)
|
||||
}:on_event('resolve',function(thread)
|
||||
for name,left in pairs(thread.data.frames) do
|
||||
if left then
|
||||
local fake_event = {player_index=thread.data.player.index,element={name=name}}
|
||||
left.open(fake_event)
|
||||
left:first_open(thread.data.player)
|
||||
end
|
||||
end
|
||||
end):queue()
|
||||
@@ -79,22 +75,20 @@ end
|
||||
--- Used to open the left gui of every player
|
||||
-- @usage Gui.left.open('foo')
|
||||
-- @tparam string left_name this is the gui that you want to open
|
||||
function left.open(left_name)
|
||||
-- @tparam[opt] LuaPlayer the player to open the gui for
|
||||
function left.open(left_name,player)
|
||||
local players = player and {player} or game.connected_players
|
||||
local _left = Gui.data.left[left_name]
|
||||
if not _left then return end
|
||||
if not Server or not Server._thread then
|
||||
for _,player in pairs(game.connected_players) do
|
||||
local left_flow = mod_gui.get_frame_flow(player)
|
||||
if left_flow[_left.name] then left_flow[_left.name].style.visible = true end
|
||||
end
|
||||
for _,player in pairs(players) do _left:open(player) end
|
||||
else
|
||||
Server.new_thread{
|
||||
data={players=game.connected_players}
|
||||
data={players=players}
|
||||
}:on_event('tick',function(thread)
|
||||
if #thread.data.players == 0 then thread:close() return end
|
||||
local player = table.remove(thread.data.players,1)
|
||||
local left_flow = mod_gui.get_frame_flow(player)
|
||||
if left_flow[_left.name] then left_flow[_left.name].style.visible = true end
|
||||
_left:open(player)
|
||||
end):open()
|
||||
end
|
||||
end
|
||||
@@ -102,49 +96,73 @@ end
|
||||
--- Used to close the left gui of every player
|
||||
-- @usage Gui.left.close('foo')
|
||||
-- @tparam string left_name this is the gui that you want to close
|
||||
function left.close(left_name)
|
||||
-- @tparam[opt] LuaPlayer the player to close the gui for
|
||||
function left.close(left_name,player)
|
||||
local players = player and {player} or game.connected_players
|
||||
local _left = Gui.data.left[left_name]
|
||||
if not _left then return end
|
||||
if not Server or not Server._thread then
|
||||
for _,player in pairs(game.connected_players) do
|
||||
local left_flow = mod_gui.get_frame_flow(player)
|
||||
if left_flow[_left.name] then left_flow[_left.name].style.visible = false end
|
||||
end
|
||||
if not Server or not Server._thread or player then
|
||||
for _,player in pairs(players) do _left:close(player) end
|
||||
else
|
||||
Server.new_thread{
|
||||
data={players=game.connected_players}
|
||||
data={players=players}
|
||||
}:on_event('tick',function(thread)
|
||||
if #thread.data.players == 0 then thread:close() return end
|
||||
local player = table.remove(thread.data.players,1)
|
||||
local left_flow = mod_gui.get_frame_flow(player)
|
||||
if left_flow[_left.name] then left_flow[_left.name].style.visible = false end
|
||||
_left:close(player)
|
||||
end):open()
|
||||
end
|
||||
end
|
||||
|
||||
-- this is used to draw the gui for the first time (these guis are never destoryed), used by the script
|
||||
function left._prototype.open(event)
|
||||
|
||||
--- Used to force the gui open for the player
|
||||
-- @usage left:open(player)
|
||||
-- @tparam luaPlayer player the player to open the gui for
|
||||
function left._prototype:open(player)
|
||||
local player = Game.get_player(event)
|
||||
local _left = Gui.data.left[event.element.name]
|
||||
local left_flow = mod_gui.get_frame_flow(player)
|
||||
local frame = nil
|
||||
if left_flow[_left.name] then
|
||||
frame = left_flow[_left.name]
|
||||
frame.clear()
|
||||
else
|
||||
frame = left_flow.add{type='frame',name=_left.name,style=mod_gui.frame_style,caption=_left.caption,direction='vertical'}
|
||||
frame.style.visible = false
|
||||
if is_type(_left.open_on_join,'boolean') then frame.style.visible = _left.open_on_join end
|
||||
end
|
||||
if is_type(_left.draw,'function') then _left.draw(frame) else frame.style.visible = false error('No Callback On '.._left.name) end
|
||||
if not left_flow[_left.name] then self:first_open(player) end
|
||||
left_flow[_left.name].style.visible = true
|
||||
end
|
||||
|
||||
-- this is called when the toolbar button is pressed
|
||||
function left._prototype.toggle(event)
|
||||
--- Used to force the gui closed for the player
|
||||
-- @usage left:open(player)
|
||||
-- @tparam luaPlayer player the player to close the gui for
|
||||
function left._prototype:close(player)
|
||||
local player = Game.get_player(event)
|
||||
local _left = Gui.data.left[event.element.name]
|
||||
local left_flow = mod_gui.get_frame_flow(player)
|
||||
if not left_flow[_left.name] then _left.open(event) end
|
||||
if not left_flow[_left.name] then self:first_open(player) end
|
||||
left_flow[_left.name].style.visible = false
|
||||
end
|
||||
|
||||
--- When the gui is first made or is updated this function is called, used by the script
|
||||
-- @usage left:first_open(player) -- returns the frame
|
||||
-- @tparam LuaPlayer player the player to draw the gui for
|
||||
-- @treturn LuaFrame the frame made/updated
|
||||
function left._prototype:first_open(player)
|
||||
local player = Game.get_player(player)
|
||||
local left_flow = mod_gui.get_frame_flow(player)
|
||||
local frame = nil
|
||||
if left_flow[self.name] then
|
||||
frame = left_flow[self.name]
|
||||
frame.clear()
|
||||
else
|
||||
frame = left_flow.add{type='frame',name=self.name,style=mod_gui.frame_style,caption=self.caption,direction='vertical'}
|
||||
frame.style.visible = false
|
||||
if is_type(self.open_on_join,'boolean') then frame.style.visible = self.open_on_join end
|
||||
end
|
||||
if is_type(self.draw,'function') then self.draw(frame) else frame.style.visible = false error('No Callback On '.._left.name) end
|
||||
return frame
|
||||
end
|
||||
|
||||
--- Toggles the visiblity of the gui based on some conditions
|
||||
-- @usage left:toggle(player) -- returns new state
|
||||
-- @tparam LuaPlayer player the player to toggle the gui for, remember there are condition which need to be met
|
||||
-- @treturn boolean the new state that the gui is in
|
||||
function left._prototype:toggle(player)
|
||||
local player = Game.get_player(player)
|
||||
local left_flow = mod_gui.get_frame_flow(player)
|
||||
if not left_flow[_left.name] then _left:first_open(player) end
|
||||
local left = left_flow[_left.name]
|
||||
local open = false
|
||||
if is_type(_left.can_open,'function') then
|
||||
@@ -170,6 +188,7 @@ function left._prototype.toggle(event)
|
||||
end
|
||||
if open == false then player_return({'ExpGamingCore_Gui.cant-open-no-reason'},defines.textcolor.crit,player) player.play_sound{path='utility/cannot_build'}
|
||||
elseif open ~= true then player_return({'ExpGamingCore_Gui.cant-open',open},defines.textcolor.crit,player) player.play_sound{path='utility/cannot_build'} end
|
||||
return left.style.visible
|
||||
end
|
||||
|
||||
left.on_player_joined_game = function(event)
|
||||
@@ -177,8 +196,7 @@ left.on_player_joined_game = function(event)
|
||||
local player = Game.get_player(event)
|
||||
local frames = Gui.data.left or {}
|
||||
for name,left in pairs(frames) do
|
||||
local fake_event = {player_index=player.index,element={name=name}}
|
||||
left.open(fake_event)
|
||||
left:first_open(player)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
-- @module GuiAnnouncements@4.0.0
|
||||
-- @author Cooldude2606
|
||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||
-- @alais ThisModule
|
||||
|
||||
-- maybe make this not require Role and have it optinal
|
||||
|
||||
|
||||
47
modules/HealthIndicator/control.lua
Normal file
47
modules/HealthIndicator/control.lua
Normal file
@@ -0,0 +1,47 @@
|
||||
--- In game text float to desplay health to other players.
|
||||
-- @module HealthIndicator@1.0.1
|
||||
-- @author Ps7cho (converted by Cooldude2606)
|
||||
-- @license https://opensource.org/licenses/MIT
|
||||
-- @alais ThisModule
|
||||
|
||||
-- Module Require
|
||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
||||
|
||||
-- Local Varibles
|
||||
local green = 200 -- above this makes text green
|
||||
local yellow = 100 -- above this makes text yellow
|
||||
|
||||
-- Module Define
|
||||
local module_verbose = false
|
||||
local ThisModule = {}
|
||||
|
||||
-- Global Define
|
||||
local global = global()
|
||||
|
||||
-- Event Handlers Define
|
||||
script.on_event(defines.events.on_entity_damaged, function(event)
|
||||
if event.entity.name ~= 'player' then return end
|
||||
local player = Game.get_player(event.entity.player)
|
||||
if player.character then
|
||||
if player.character.health == nil then return end
|
||||
local index = player.index
|
||||
local health = math.ceil(player.character.health)
|
||||
if global[index] == nil then global[index] = health end
|
||||
if global[index] ~= health then
|
||||
if health < global[index] then
|
||||
local text = health..' (-'..math.floor(event.final_damage_amount)..')'
|
||||
if health > green then
|
||||
player.surface.create_entity{name="flying-text", color={b = 0.2, r= 0.1, g = 1, a = 0.8}, text=text, position= {player.position.x, player.position.y-2}}
|
||||
elseif health > yellow then
|
||||
player.surface.create_entity{name="flying-text", color={r = 1, g = 1, b = 0}, text=text, position= {player.position.x, player.position.y-2}}
|
||||
else
|
||||
player.surface.create_entity{name="flying-text", color={b = 0.1, r= 1, g = 0, a = 0.8}, text=text, position= {player.position.x, player.position.y-2}}
|
||||
end
|
||||
end
|
||||
global[index] = health
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Module Return
|
||||
return ThisModule
|
||||
@@ -1,29 +0,0 @@
|
||||
|
||||
-- not made by cooldude :O - still i just copyed from a mod and made a few editing
|
||||
-- https://mods.factorio.com/mods/chocolateTthunder/Show_Health
|
||||
-- edits include: tick limit to avoid lag, only shows health when it is lost
|
||||
|
||||
Event.register(defines.events.on_entity_damaged, function(event)
|
||||
if event.entity.name ~= 'player' then return end
|
||||
local player = Game.get_player(event.entity.player)
|
||||
if player.character then
|
||||
if player.character.health == nil then return end
|
||||
local index = player.index
|
||||
local health = math.ceil(player.character.health)
|
||||
if global.player_health == nil then global.player_health = {} end
|
||||
if global.player_health[index] == nil then global.player_health[index] = health end
|
||||
if global.player_health[index] ~= health then
|
||||
if health < global.player_health[index] then
|
||||
local text = health..' (-'..math.floor(event.final_damage_amount)..')'
|
||||
if health > 200 then
|
||||
player.surface.create_entity{name="flying-text", color={b = 0.2, r= 0.1, g = 1, a = 0.8}, text=text, position= {player.position.x, player.position.y-2}}
|
||||
elseif health > 100 then
|
||||
player.surface.create_entity{name="flying-text", color={r = 1, g = 1, b = 0}, text=text, position= {player.position.x, player.position.y-2}}
|
||||
else
|
||||
player.surface.create_entity{name="flying-text", color={b = 0.1, r= 1, g = 0, a = 0.8}, text=text, position= {player.position.x, player.position.y-2}}
|
||||
end
|
||||
end
|
||||
global.player_health[index] = health
|
||||
end
|
||||
end
|
||||
end)
|
||||
17
modules/HealthIndicator/softmod.json
Normal file
17
modules/HealthIndicator/softmod.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "HealthIndicator",
|
||||
"version": "1.0.1",
|
||||
"type": "Module",
|
||||
"description": "In game text float to desplay health to other players.",
|
||||
"location": "<blank>",
|
||||
"keywords": [
|
||||
"Health",
|
||||
"Overlay",
|
||||
"Text",
|
||||
"Damage"
|
||||
],
|
||||
"author": " Ps7cho (converted by Cooldude2606)",
|
||||
"contact": "Discord: Cooldude2606#5241",
|
||||
"license": "https://opensource.org/licenses/MIT",
|
||||
"dependencies": {}
|
||||
}
|
||||
@@ -1,7 +1,18 @@
|
||||
--- Assigns random colours to players (larger range than default) and allows predefined colours for users.
|
||||
-- @module PlayerAutoColor@4.0.0
|
||||
-- @author Cooldude2606
|
||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||
-- @alais ThisModule
|
||||
|
||||
-- made by cooldude - we are lazy and we want to always have the same colour, also uses std lib to auto assign random colours
|
||||
-- Module Require
|
||||
local Color = require('FactorioStdLib@Color@^0.8.0')
|
||||
|
||||
local default_colours = {
|
||||
-- Module Define
|
||||
local module_verbose = false
|
||||
local ThisModule = {}
|
||||
|
||||
-- Global Define
|
||||
local global = global{
|
||||
BADgamerNL={r=255,g=20,b=147},
|
||||
arty714={r=150,g=68,b=161},
|
||||
Cooldude2606={r=57,g=192,b=207},
|
||||
@@ -16,6 +27,7 @@ local default_colours = {
|
||||
UUBlueFire={r=0,g=204,b=255}
|
||||
}
|
||||
|
||||
-- Event Handlers Define
|
||||
Event.register(defines.events.on_player_created, function(event)
|
||||
local player = game.players[event.player_index]
|
||||
local colours = table.keys(defines.color)
|
||||
@@ -30,3 +42,6 @@ Event.register(defines.events.on_player_created, function(event)
|
||||
end
|
||||
player.chat_color = player.color
|
||||
end)
|
||||
|
||||
-- Module Return
|
||||
return ThisModule
|
||||
17
modules/PlayerAutoColor/softmod.json
Normal file
17
modules/PlayerAutoColor/softmod.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "PlayerAutoColor",
|
||||
"version": "4.0.0",
|
||||
"type": "Module",
|
||||
"description": "Assigns random colours to players (larger range than default) and allows predefined colours for users.",
|
||||
"location": "<blank>",
|
||||
"keywords": [
|
||||
"Colour",
|
||||
"Color",
|
||||
"Player",
|
||||
"Vibrant"
|
||||
],
|
||||
"author": "Cooldude2606",
|
||||
"contact": "Discord: Cooldude2606#5241",
|
||||
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
||||
"dependencies": {}
|
||||
}
|
||||
37
modules/RankChanger/Boiler Print Module
Normal file
37
modules/RankChanger/Boiler Print Module
Normal file
@@ -0,0 +1,37 @@
|
||||
--- Desction <get from json>
|
||||
-- @module ThisModule@X.Y.Z
|
||||
-- @author <get from json>
|
||||
-- @license <get from json>
|
||||
-- @alais ThisModule
|
||||
|
||||
-- Module Require
|
||||
local Module = require('Module@>X.Y.Z')
|
||||
local SubModule = require('Collection.Submodule@^X.Y.Z')
|
||||
local OptModule -- OptModule@^X.Y.Z
|
||||
|
||||
-- Local Varibles
|
||||
|
||||
-- Module Define
|
||||
local module_verbose = false
|
||||
local ThisModule = {
|
||||
on_init=function(self)
|
||||
if loaded_modules['OptModule@^X.Y.Z'] then OptModule = require('OptModule@^X.Y.Z') end
|
||||
if loaded_modules['OptModule2@^X.Y.Z'] then require(module_path..'/src/module2',{self=self}) end
|
||||
--code
|
||||
end,
|
||||
on_post=function()
|
||||
--code
|
||||
end
|
||||
}
|
||||
|
||||
-- Global Define
|
||||
local global = global{
|
||||
key='value'
|
||||
}
|
||||
|
||||
-- Function Define
|
||||
|
||||
-- Event Handlers Define
|
||||
|
||||
-- Module Return
|
||||
return ThisModule
|
||||
126
modules/SpawnArea/control.lua
Normal file
126
modules/SpawnArea/control.lua
Normal file
@@ -0,0 +1,126 @@
|
||||
--- Creates a safe spawn area with chests and auto refilling turrets.
|
||||
-- @module SpawnArea@4.0.0
|
||||
-- @author Cooldude2606
|
||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||
-- @alais ThisModule
|
||||
|
||||
-- Module Require
|
||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
||||
|
||||
-- Local Varibles
|
||||
local turret_enabled = true
|
||||
local turret_ammo = 'uranium-rounds-magazine'
|
||||
|
||||
local tile_positions = require(module_path..'/src/spawn_tiles')
|
||||
local entity_positions = require(module_path..'/src/spawn_entities')
|
||||
|
||||
local global_offset = {x=0,y=-2}
|
||||
local decon_radius = 20
|
||||
local decon_tile = 'concrete'
|
||||
local partern_radius = 50
|
||||
local partern_tile = 'stone-path'
|
||||
|
||||
-- Module Define
|
||||
local module_verbose = false
|
||||
local ThisModule = {}
|
||||
|
||||
-- Global Define
|
||||
-- location of auto refill turrets
|
||||
local global = global{
|
||||
{1,-3,-3},
|
||||
{1,-3,3},
|
||||
{1,3,-3},
|
||||
{1,3,3}
|
||||
}
|
||||
|
||||
-- Function Define
|
||||
function ThisModule.afk_belt(surface,offset)
|
||||
local belts = {{-0.5,-0.5,2},{0.5,-0.5,4},{-0.5,0.5,0},{0.5,0.5,6}}
|
||||
for _,pos in pairs(belts) do
|
||||
local position = {pos[1]+offset[1],pos[2]+offset[2]}
|
||||
local belt = surface.create_entity{name='transport-belt',position=position,force='neutral',direction=pos[3]}
|
||||
belt.destructible = false; belt.health = 0; belt.minable = false; belt.rotatable = false
|
||||
end
|
||||
end
|
||||
|
||||
function ThisModule.auto_turret(surface,pos)
|
||||
if not turret_enabled then error('Auto Turrets are disabled.') end
|
||||
-- adds a new turrent to the global list, returns index
|
||||
local _return
|
||||
if surface then
|
||||
local surface = Game.get_surface(surface)
|
||||
if not surface then error('Surface is not valid.') end
|
||||
local posx = pos.x or pos[1] or error('Position is not valid.')
|
||||
local posy = pos.y or pos[2] or error('Position is not valid.')
|
||||
_return = table.insert(global,{surface.index,posx,posy})
|
||||
end
|
||||
-- spawns turrets and refills them
|
||||
if not game.forces['spawn'] then game.create_force('spawn').set_cease_fire('player',true) game.forces['player'].set_cease_fire('spawn',true) end
|
||||
for _,pos in pairs(global) do
|
||||
local surface = game.surfaces[pos[1]]
|
||||
local turret = surface.find_entity('gun-turret',{pos[2],pos[3]})
|
||||
if not turret then
|
||||
turret = surface.create_entity{name='gun-turret',position={pos[2],pos[3]},force='spawn'}
|
||||
turret.destructible = false; turret.health = 0; turret.minable = false; turret.rotatable = false; turret.operable = false; turret.health = 0
|
||||
end
|
||||
if turret.get_inventory(defines.inventory.turret_ammo).can_insert{name=turret_ammo,count=10} then
|
||||
turret.get_inventory(defines.inventory.turret_ammo).insert{name=turret_ammo,count=10}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Event Handlers Define
|
||||
if turret_enabled then
|
||||
script.on_event(defines.events.on_tick,function(event)
|
||||
if event.tick % 3600 then
|
||||
ThisModule.auto_turret()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
script.on_event(defines.events.on_player_created, function(event)
|
||||
if event.player_index == 1 then
|
||||
local player = Game.get_player(event)
|
||||
local surface = player.surface
|
||||
local offset = {x=0,y=0}
|
||||
local partern_base_tile = surface.get_tile(player.position).name
|
||||
if partern_base_tile == 'deepwater' or partern_base_tile == 'water' then partern_base_tile = 'grass-1' end
|
||||
local base_tiles = {}
|
||||
local tiles = {}
|
||||
-- generates a safe area of land and removes all entites
|
||||
for x = -partern_radius, partern_radius do
|
||||
for y = -partern_radius, partern_radius do
|
||||
if x^2+y^2 < decon_radius^2 then
|
||||
table.insert(base_tiles,{name=decon_tile,position={x+offset.x,y+offset.y}})
|
||||
local entities = surface.find_entities_filtered{area={{x+offset.x-1,y+offset.y-1},{x+offset.x,y+offset.y}}}
|
||||
for _,entity in pairs(entities) do if entity.name ~= 'player' then entity.destroy() end end
|
||||
elseif x^2+y^2 < partern_radius^2 then
|
||||
table.insert(base_tiles,{name=partern_base_tile,position={x+offset.x,y+offset.y}})
|
||||
end
|
||||
end
|
||||
end
|
||||
surface.set_tiles(base_tiles)
|
||||
-- creates the partern in the spawn
|
||||
for _,position in pairs(tile_positions) do
|
||||
table.insert(tiles,{name=partern_tile,position={position[1]+offset.x+global_offset.x,position[2]+offset.y+global_offset.y}})
|
||||
end
|
||||
surface.set_tiles(tiles)
|
||||
-- spawns all the entites in spawn
|
||||
for _,entity in pairs(entity_positions) do
|
||||
local entity = surface.create_entity{name=entity[1],position={entity[2]+offset.x+global_offset.x,entity[3]+offset.y+global_offset.y},force='neutral'}
|
||||
entity.destructible = false; entity.health = 0; entity.minable = false; entity.rotatable = false
|
||||
end
|
||||
-- generates spawn turrents and afk belts
|
||||
if turret_enabled then ThisModule.auto_turret() end
|
||||
ThisModule.afk_belt(surface,{offset.x-5,offset.y-5})
|
||||
ThisModule.afk_belt(surface,{offset.x+5,offset.y-5})
|
||||
ThisModule.afk_belt(surface,{offset.x-5,offset.y+5})
|
||||
ThisModule.afk_belt(surface,{offset.x+5,offset.y+5})
|
||||
-- sets the spawn and moves the first player there
|
||||
player.force.set_spawn_position(offset,surface)
|
||||
player.teleport(offset,surface)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Module Return
|
||||
return ThisModule
|
||||
17
modules/SpawnArea/softmod.json
Normal file
17
modules/SpawnArea/softmod.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "SpawnArea",
|
||||
"version": "4.0.0",
|
||||
"type": "Module",
|
||||
"description": "Creates a safe spawn area with chests and auto refilling turrets.",
|
||||
"location": "<blank>",
|
||||
"keywords": [
|
||||
"Spawn",
|
||||
"Safe",
|
||||
"Turrets",
|
||||
"Auto Refill"
|
||||
],
|
||||
"author": "Cooldude2606",
|
||||
"contact": "Discord: Cooldude2606#5241",
|
||||
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
||||
"dependencies": {}
|
||||
}
|
||||
16
modules/SpawnArea/src/spawn_entities.lua
Normal file
16
modules/SpawnArea/src/spawn_entities.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
return {
|
||||
{"stone-wall",-10,-6},{"stone-wall",-10,-5},{"stone-wall",-10,-4},{"stone-wall",-10,-3},{"stone-wall",-10,-2},{"stone-wall",-10,-1},{"stone-wall",-10,0},{"stone-wall",-10,3},{"stone-wall",-10,4},{"stone-wall",-10,5},
|
||||
{"stone-wall",-10,6},{"stone-wall",-10,7},{"stone-wall",-10,8},{"stone-wall",-10,9},{"stone-wall",-8,-8},{"small-lamp",-8,-4},{"small-lamp",-8,-1},{"iron-chest",-8,0},{"iron-chest",-8,3},{"small-lamp",-8,4},
|
||||
{"small-lamp",-8,7},{"stone-wall",-8,11},{"stone-wall",-7,-8},{"small-electric-pole",-7,-2},{"iron-chest",-7,0},{"iron-chest",-7,3},{"small-electric-pole",-7,5},{"stone-wall",-7,11},{"stone-wall",-6,-8},{"small-lamp",-6,-6},
|
||||
{"iron-chest",-6,0},{"iron-chest",-6,3},{"small-lamp",-6,9},{"stone-wall",-6,11},{"stone-wall",-5,-8},{"small-lamp",-5,-1},{"iron-chest",-5,0},{"iron-chest",-5,3},{"small-lamp",-5,4},{"stone-wall",-5,11},
|
||||
{"stone-wall",-4,-8},{"small-electric-pole",-4,-5},{"iron-chest",-4,0},{"iron-chest",-4,3},{"small-electric-pole",-4,8},{"stone-wall",-4,11},{"stone-wall",-3,-8},{"small-lamp",-3,-6},{"small-lamp",-3,-3},{"small-lamp",-3,6},
|
||||
{"small-lamp",-3,9},{"stone-wall",-3,11},{"stone-wall",-2,-8},{"iron-chest",-2,-6},{"iron-chest",-2,-5},{"iron-chest",-2,-4},{"iron-chest",-2,-3},{"iron-chest",-2,-2},{"iron-chest",-2,5},{"iron-chest",-2,6},
|
||||
{"iron-chest",-2,7},{"iron-chest",-2,8},{"iron-chest",-2,9},{"stone-wall",-2,11},{"stone-wall",1,-8},{"iron-chest",1,-6},
|
||||
{"iron-chest",1,-5},{"iron-chest",1,-4},{"iron-chest",1,-3},{"iron-chest",1,-2},{"iron-chest",1,5},{"iron-chest",1,6},{"iron-chest",1,7},{"iron-chest",1,8},{"iron-chest",1,9},{"stone-wall",1,11},
|
||||
{"stone-wall",2,-8},{"small-lamp",2,-6},{"small-lamp",2,-3},{"small-lamp",2,6},{"small-lamp",2,9},{"stone-wall",2,11},{"stone-wall",3,-8},{"small-electric-pole",3,-5},{"iron-chest",3,0},{"iron-chest",3,3},
|
||||
{"small-electric-pole",3,8},{"stone-wall",3,11},{"stone-wall",4,-8},{"small-lamp",4,-1},{"iron-chest",4,0},{"iron-chest",4,3},{"small-lamp",4,4},{"stone-wall",4,11},{"stone-wall",5,-8},{"small-lamp",5,-6},
|
||||
{"iron-chest",5,0},{"iron-chest",5,3},{"small-lamp",5,9},{"stone-wall",5,11},{"stone-wall",6,-8},{"small-electric-pole",6,-2},{"iron-chest",6,0},{"iron-chest",6,3},{"small-electric-pole",6,5},{"stone-wall",6,11},
|
||||
{"stone-wall",7,-8},{"small-lamp",7,-4},{"small-lamp",7,-1},{"iron-chest",7,0},{"iron-chest",7,3},{"small-lamp",7,4},{"small-lamp",7,7},{"stone-wall",7,11},{"stone-wall",9,-6},{"stone-wall",9,-5},
|
||||
{"stone-wall",9,-4},{"stone-wall",9,-3},{"stone-wall",9,-2},{"stone-wall",9,-1},{"stone-wall",9,0},{"stone-wall",9,3},{"stone-wall",9,4},{"stone-wall",9,5},{"stone-wall",9,6},{"stone-wall",9,7},
|
||||
{"stone-wall",9,8},{"stone-wall",9,9}
|
||||
}
|
||||
@@ -1,13 +1,4 @@
|
||||
|
||||
-- made by cooldude - this makes a spawn area and auto refill turents to protect the afk people, idk what it is at this point, but feel ffree to try and make it yours
|
||||
|
||||
--[[
|
||||
note for positions
|
||||
{-1,-1} {0,-1} {1,-1}
|
||||
{-1,0} {0,0} {1,0}
|
||||
{-1,1} {0,1} {1,1}
|
||||
--]]
|
||||
local tile_positions = {
|
||||
return {
|
||||
{-49,-3},{-49,-2},{-49,1},{-49,2},{-49,5},{-49,6},{-48,-4},{-48,-3},{-48,-2},{-48,1},{-48,2},{-48,5},{-48,6},{-48,7},{-47,-7},{-47,-6},{-47,-5},{-47,-4},{-47,-3},{-47,-2},{-47,5},{-47,6},{-47,7},{-47,8},{-47,9},{-47,10},{-46,-8},{-46,-7},{-46,-6},{-46,-5},
|
||||
{-46,-4},{-46,-3},{-46,-2},{-46,-1},{-46,4},{-46,5},{-46,6},{-46,7},{-46,8},{-46,9},{-46,10},{-46,11},{-45,-17},{-45,-16},{-45,-15},{-45,-14},{-45,-13},{-45,-12},{-45,-9},{-45,-8},{-45,-7},{-45,-2},{-45,-1},{-45,0},{-45,1},{-45,2},{-45,3},{-45,4},{-45,5},{-45,10},
|
||||
{-45,11},{-45,12},{-45,15},{-45,16},{-45,17},{-45,18},{-45,19},{-45,20},{-44,-18},{-44,-17},{-44,-16},{-44,-15},{-44,-14},{-44,-13},{-44,-12},{-44,-9},{-44,-8},{-44,-1},{-44,0},{-44,1},{-44,2},{-44,3},{-44,4},{-44,11},{-44,12},{-44,15},{-44,16},{-44,17},{-44,18},{-44,19},
|
||||
@@ -115,99 +106,4 @@ local tile_positions = {
|
||||
{43,12},{43,15},{43,16},{43,17},{43,18},{43,19},{43,20},{43,21},{44,-17},{44,-16},{44,-15},{44,-14},{44,-13},{44,-12},{44,-9},{44,-8},{44,-7},{44,-2},{44,-1},{44,0},{44,1},{44,2},{44,3},{44,4},{44,5},{44,10},{44,11},{44,12},{44,15},{44,16},
|
||||
{44,17},{44,18},{44,19},{44,20},{45,-8},{45,-7},{45,-6},{45,-5},{45,-4},{45,-3},{45,-2},{45,-1},{45,4},{45,5},{45,6},{45,7},{45,8},{45,9},{45,10},{45,11},{46,-7},{46,-6},{46,-5},{46,-4},{46,-3},{46,-2},{46,5},{46,6},{46,7},{46,8},
|
||||
{46,9},{46,10},{47,-4},{47,-3},{47,-2},{47,1},{47,2},{47,5},{47,6},{47,7},{48,-3},{48,-2},{48,1},{48,2},{48,5},{48,6}
|
||||
}
|
||||
|
||||
local entitys = {
|
||||
{"stone-wall",-10,-6},{"stone-wall",-10,-5},{"stone-wall",-10,-4},{"stone-wall",-10,-3},{"stone-wall",-10,-2},{"stone-wall",-10,-1},{"stone-wall",-10,0},{"stone-wall",-10,3},{"stone-wall",-10,4},{"stone-wall",-10,5},
|
||||
{"stone-wall",-10,6},{"stone-wall",-10,7},{"stone-wall",-10,8},{"stone-wall",-10,9},{"stone-wall",-8,-8},{"small-lamp",-8,-4},{"small-lamp",-8,-1},{"iron-chest",-8,0},{"iron-chest",-8,3},{"small-lamp",-8,4},
|
||||
{"small-lamp",-8,7},{"stone-wall",-8,11},{"stone-wall",-7,-8},{"small-electric-pole",-7,-2},{"iron-chest",-7,0},{"iron-chest",-7,3},{"small-electric-pole",-7,5},{"stone-wall",-7,11},{"stone-wall",-6,-8},{"small-lamp",-6,-6},
|
||||
{"iron-chest",-6,0},{"iron-chest",-6,3},{"small-lamp",-6,9},{"stone-wall",-6,11},{"stone-wall",-5,-8},{"small-lamp",-5,-1},{"iron-chest",-5,0},{"iron-chest",-5,3},{"small-lamp",-5,4},{"stone-wall",-5,11},
|
||||
{"stone-wall",-4,-8},{"small-electric-pole",-4,-5},{"iron-chest",-4,0},{"iron-chest",-4,3},{"small-electric-pole",-4,8},{"stone-wall",-4,11},{"stone-wall",-3,-8},{"small-lamp",-3,-6},{"small-lamp",-3,-3},{"small-lamp",-3,6},
|
||||
{"small-lamp",-3,9},{"stone-wall",-3,11},{"stone-wall",-2,-8},{"iron-chest",-2,-6},{"iron-chest",-2,-5},{"iron-chest",-2,-4},{"iron-chest",-2,-3},{"iron-chest",-2,-2},{"iron-chest",-2,5},{"iron-chest",-2,6},
|
||||
{"iron-chest",-2,7},{"iron-chest",-2,8},{"iron-chest",-2,9},{"stone-wall",-2,11},{"stone-wall",1,-8},{"iron-chest",1,-6},
|
||||
{"iron-chest",1,-5},{"iron-chest",1,-4},{"iron-chest",1,-3},{"iron-chest",1,-2},{"iron-chest",1,5},{"iron-chest",1,6},{"iron-chest",1,7},{"iron-chest",1,8},{"iron-chest",1,9},{"stone-wall",1,11},
|
||||
{"stone-wall",2,-8},{"small-lamp",2,-6},{"small-lamp",2,-3},{"small-lamp",2,6},{"small-lamp",2,9},{"stone-wall",2,11},{"stone-wall",3,-8},{"small-electric-pole",3,-5},{"iron-chest",3,0},{"iron-chest",3,3},
|
||||
{"small-electric-pole",3,8},{"stone-wall",3,11},{"stone-wall",4,-8},{"small-lamp",4,-1},{"iron-chest",4,0},{"iron-chest",4,3},{"small-lamp",4,4},{"stone-wall",4,11},{"stone-wall",5,-8},{"small-lamp",5,-6},
|
||||
{"iron-chest",5,0},{"iron-chest",5,3},{"small-lamp",5,9},{"stone-wall",5,11},{"stone-wall",6,-8},{"small-electric-pole",6,-2},{"iron-chest",6,0},{"iron-chest",6,3},{"small-electric-pole",6,5},{"stone-wall",6,11},
|
||||
{"stone-wall",7,-8},{"small-lamp",7,-4},{"small-lamp",7,-1},{"iron-chest",7,0},{"iron-chest",7,3},{"small-lamp",7,4},{"small-lamp",7,7},{"stone-wall",7,11},{"stone-wall",9,-6},{"stone-wall",9,-5},
|
||||
{"stone-wall",9,-4},{"stone-wall",9,-3},{"stone-wall",9,-2},{"stone-wall",9,-1},{"stone-wall",9,0},{"stone-wall",9,3},{"stone-wall",9,4},{"stone-wall",9,5},{"stone-wall",9,6},{"stone-wall",9,7},
|
||||
{"stone-wall",9,8},{"stone-wall",9,9}
|
||||
}
|
||||
|
||||
local turrets = {{-3,-3},{-3,3},{3,-3},{3,3}}
|
||||
local turret_ammo = 'uranium-rounds-magazine'
|
||||
|
||||
local global_offset = {x=0,y=-2}
|
||||
local decon_radius = 20
|
||||
local decon_tile = 'concrete'
|
||||
local partern_radius = 50
|
||||
local partern_tile = 'stone-path'
|
||||
|
||||
local function afk_belt(surface,offset)
|
||||
local belts = {{-0.5,-0.5,2},{0.5,-0.5,4},{-0.5,0.5,0},{0.5,0.5,6}}
|
||||
for _,pos in pairs(belts) do
|
||||
local position = {pos[1]+offset[1],pos[2]+offset[2]}
|
||||
local belt = surface.create_entity{name='transport-belt',position=position,force='neutral',direction=pos[3]}
|
||||
belt.destructible = false; belt.health = 0; belt.minable = false; belt.rotatable = false
|
||||
end
|
||||
end
|
||||
|
||||
local function spawn_turrets()
|
||||
local surface = game.surfaces[1]
|
||||
if not game.forces['spawn'] then game.create_force('spawn').set_cease_fire('player',true) game.forces['player'].set_cease_fire('spawn',true) end
|
||||
for _,pos in pairs(turrets) do
|
||||
local turret = surface.find_entity('gun-turret',pos)
|
||||
if not turret then
|
||||
turret = surface.create_entity{name='gun-turret',position=pos,force='spawn'}
|
||||
turret.destructible = false; turret.health = 0; turret.minable = false; turret.rotatable = false; turret.operable = false; turret.health = 0
|
||||
end
|
||||
if turret.get_inventory(defines.inventory.turret_ammo).can_insert{name=turret_ammo,count=10} then
|
||||
turret.get_inventory(defines.inventory.turret_ammo).insert{name=turret_ammo,count=10}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Event.register(defines.events.on_tick,function(event)
|
||||
if event.tick % 3600 then
|
||||
spawn_turrets()
|
||||
end
|
||||
end)
|
||||
|
||||
Event.register(defines.events.on_player_created, function(event)
|
||||
if event.player_index == 1 then
|
||||
local player = Game.get_player(event)
|
||||
local surface = player.surface
|
||||
local offset = {x=0,y=0}
|
||||
local partern_base_tile = surface.get_tile(player.position).name
|
||||
if partern_base_tile == 'deepwater' or partern_base_tile == 'water' then partern_base_tile = 'grass-1' end
|
||||
local base_tiles = {}
|
||||
local tiles = {}
|
||||
for x = -partern_radius-5, partern_radius+5 do
|
||||
for y = -partern_radius-5, partern_radius+5 do
|
||||
if x^2+y^2 < decon_radius^2 then
|
||||
table.insert(base_tiles,{name=decon_tile,position={x+offset.x,y+offset.y}})
|
||||
local entities = surface.find_entities_filtered{area={{x+offset.x-1,y+offset.y-1},{x+offset.x,y+offset.y}}}
|
||||
for _,entity in pairs(entities) do if entity.name ~= 'player' then entity.destroy() end end
|
||||
elseif x^2+y^2 < partern_radius^2 then
|
||||
table.insert(base_tiles,{name=partern_base_tile,position={x+offset.x,y+offset.y}})
|
||||
end
|
||||
end
|
||||
end
|
||||
surface.set_tiles(base_tiles)
|
||||
for _,position in pairs(tile_positions) do
|
||||
table.insert(tiles,{name=partern_tile,position={position[1]+offset.x+global_offset.x,position[2]+offset.y+global_offset.y}})
|
||||
end
|
||||
surface.set_tiles(tiles)
|
||||
for _,entity in pairs(entitys) do
|
||||
local entity = surface.create_entity{name=entity[1],position={entity[2]+offset.x+global_offset.x,entity[3]+offset.y+global_offset.y},force='neutral'}
|
||||
entity.destructible = false; entity.health = 0; entity.minable = false; entity.rotatable = false
|
||||
end
|
||||
spawn_turrets()
|
||||
afk_belt(surface,{offset.x-5,offset.y-5})
|
||||
afk_belt(surface,{offset.x+5,offset.y-5})
|
||||
afk_belt(surface,{offset.x-5,offset.y+5})
|
||||
afk_belt(surface,{offset.x+5,offset.y+5})
|
||||
player.force.set_spawn_position(offset,surface)
|
||||
player.teleport(offset,surface)
|
||||
end
|
||||
end)
|
||||
}
|
||||
@@ -1,25 +1,17 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
--- Creates a warp point system which makes moving around large maps easier.
|
||||
-- @module WarpPoints@4.0.0
|
||||
-- @author Cooldude2606
|
||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||
-- @alais ThisModule
|
||||
|
||||
This file can be used with permission but this and the credit below must remain in the file.
|
||||
Contact a member of management on our discord to seek permission to use our code.
|
||||
Any changes that you may make to the code are yours but that does not make the script yours.
|
||||
Discord: https://discord.gg/r6dC2uK
|
||||
]]
|
||||
--Please Only Edit Below This Line-----------------------------------------------------------
|
||||
-- Module Require
|
||||
local Gui = require('ExpGamingCore.Gui@^4.0.0')
|
||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
||||
local Role -- ExpGamingCore.Role@^4.0.0
|
||||
|
||||
-- Needs updating to new gui core
|
||||
|
||||
local warp_tiles = {
|
||||
{-3,-2},{-3,-1},{-3,0},{-3,1},{-3,2},{3,-2},{3,-1},{3,0},{3,1},{3,2},
|
||||
{-2,-3},{-1,-3},{0,-3},{1,-3},{2,-3},{-2,3},{-1,3},{0,3},{1,3},{2,3}
|
||||
}
|
||||
|
||||
local warp_entities = {
|
||||
{'small-lamp',-3,-2},{'small-lamp',-3,2},{'small-lamp',3,-2},{'small-lamp',3,2},
|
||||
{'small-lamp',-2,-3},{'small-lamp',2,-3},{'small-lamp',-2,3},{'small-lamp',2,3},
|
||||
{'small-electric-pole',-3,-3},{'small-electric-pole',3,3},{'small-electric-pole',-3,3},{'small-electric-pole',3,-3}
|
||||
}
|
||||
-- Local Varibles
|
||||
local warp_tiles = require(module_path..'/src/warp_tiles')
|
||||
local warp_entities = require(module_path..'/src/warp_entities')
|
||||
|
||||
local warp_radius = 4
|
||||
local spawn_warp_scale = 5
|
||||
@@ -28,21 +20,37 @@ local warp_limit = 60
|
||||
local warp_item = 'discharge-defense-equipment'
|
||||
local global_offset = {x=0,y=0}
|
||||
|
||||
local function _warps(reset)
|
||||
global.addons = not reset and global.addons or {}
|
||||
global.addons.warps = not reset and global.addons.warps or {warps={},cooldowns={}}
|
||||
return global.addons.warps
|
||||
end
|
||||
-- Module Define
|
||||
local global
|
||||
local module_verbose = false
|
||||
local ThisModule = {
|
||||
on_init=function(self)
|
||||
if loaded_modules['ExpGamingCore.Role@^4.0.0'] then Role = require('ExpGamingCore.Role@^4.0.0') end
|
||||
if loaded_modules['ExpGamingCore.Command@^4.0.0'] then require(module_path..'/src/commands',{self=self,warps=global}) end
|
||||
end
|
||||
}
|
||||
|
||||
local function remove_warp_point(name)
|
||||
local warp = _warps().warps[name]
|
||||
-- Global Define
|
||||
global = global{
|
||||
warps={}, -- 0,0 is always a warp
|
||||
cooldowns={}
|
||||
}
|
||||
|
||||
-- Function Define
|
||||
|
||||
--- Removes a warp point from the list, and then updates the gui
|
||||
-- @usage ThisModule.remove_warp_point(name) -- name cant be spawn
|
||||
-- @tparam string name the name of the warp point
|
||||
function ThisModule.remove_warp_point(name)
|
||||
local warp = global.warps[name]
|
||||
if not warp then return end
|
||||
local surface = warp.surface
|
||||
local offset = warp.position
|
||||
local tiles = {}
|
||||
local tiles = {}
|
||||
for x = -warp_radius-2, warp_radius+2 do
|
||||
for y = -warp_radius-2, warp_radius+2 do
|
||||
-- clears the area where the warp was
|
||||
for x = -warp_radius, warp_radius do
|
||||
for y = -warp_radius, warp_radius do
|
||||
if x^2+y^2 < (warp_radius+1)^2 then
|
||||
table.insert(tiles,{name=warp.old_tile,position={x+offset.x,y+offset.y}})
|
||||
local entities = surface.find_entities_filtered{area={{x+offset.x-1,y+offset.y-1},{x+offset.x,y+offset.y}}}
|
||||
@@ -52,20 +60,26 @@ local function remove_warp_point(name)
|
||||
end
|
||||
surface.set_tiles(tiles)
|
||||
if warp.tag.valid then warp.tag.destroy() end
|
||||
_warps().warps[name] = nil
|
||||
Gui.left.update('warp-list')
|
||||
global.warps[name] = nil
|
||||
ThisModule.Gui()
|
||||
end
|
||||
|
||||
local function make_warp_point(position,surface,force,name)
|
||||
local warp = _warps().warps[name]
|
||||
--- Adds a warp point from the list, and then updates the gui
|
||||
-- @usage ThisModule.make_warp_point({x=10,y=10},surface,force,name)
|
||||
-- @tparam table position the position of the new warp point
|
||||
-- @tparam surface surface the surface that the warp point is on
|
||||
-- @tparam force force the force that the warp point will belong to
|
||||
-- @tparam string name the name of the warp point to be made
|
||||
function ThisModule.make_warp_point(position,surface,force,name)
|
||||
local warp = global.warps[name]
|
||||
if warp then return end; warp = nil
|
||||
local offset = {x=math.floor(position.x),y=math.floor(position.y)}
|
||||
local old_tile = surface.get_tile(offset).name
|
||||
local base_tiles = {}
|
||||
local tiles = {}
|
||||
-- this makes a base plate to make the warp point
|
||||
for x = -warp_radius-2, warp_radius+2 do
|
||||
for y = -warp_radius-2, warp_radius+2 do
|
||||
for x = -warp_radius, warp_radius do
|
||||
for y = -warp_radius, warp_radius do
|
||||
if x^2+y^2 < warp_radius^2 then
|
||||
table.insert(base_tiles,{name=warp_tile,position={x+offset.x,y+offset.y}})
|
||||
end
|
||||
@@ -81,61 +95,51 @@ local function make_warp_point(position,surface,force,name)
|
||||
local entity = surface.create_entity{name=entity[1],position={entity[2]+offset.x+global_offset.x,entity[3]+offset.y+global_offset.y},force='neutral'}
|
||||
entity.destructible = false; entity.health = 0; entity.minable = false; entity.rotatable = false
|
||||
end
|
||||
-- creates a tag on the map for the wap point
|
||||
local tag = force.add_chart_tag(surface,{
|
||||
position={offset.x+0.5,offset.y+0.5},
|
||||
text='Warp: '..name,
|
||||
icon={type='item',name=warp_item}
|
||||
})
|
||||
_warps().warps[name] = {tag=tag,surface=surface,position=tag.position,old_tile=old_tile}
|
||||
local _temp = {Spawn=_warps().warps.Spawn}
|
||||
_warps().warps.Spawn = nil
|
||||
for name,data in pairs(table.keysort(_warps().warps)) do _temp[name] = data end
|
||||
_warps().warps = _temp
|
||||
Gui.left.update('warp-list')
|
||||
global.warps[name] = {tag=tag,surface=surface,position=tag.position,old_tile=old_tile}
|
||||
local _temp = {Spawn=global.warps.Spawn}
|
||||
global.warps.Spawn = nil
|
||||
for name,data in pairs(table.keysort(global.warps)) do _temp[name] = data end
|
||||
global.warps = _temp
|
||||
ThisModule.Gui()
|
||||
end
|
||||
|
||||
commands.add_command('make-warp', 'Make a warp point at your location', {'name',true}, function(event,args)
|
||||
if not game.player then return end
|
||||
local position = game.player.position
|
||||
local name = args.name
|
||||
if game.player.gui.top[name] then player_return({'warp-system.name-used'},defines.textcolor.med) return commands.error end
|
||||
if _warps().warps[name] then player_return({'warp-system.name-used'},defines.textcolor.med) return commands.error end
|
||||
if position.x^2 + position.y^2 < 100 then player_return({'warp-system.too-close'},defines.textcolor.med) return commands.error end
|
||||
-- to do add a test for all warps
|
||||
make_warp_point(position,game.player.surface,game.player.force,name)
|
||||
end)
|
||||
|
||||
local remove_warp = Gui.inputs.add{
|
||||
local remove_warp = Gui.inputs{
|
||||
type='button',
|
||||
name='remove-warp-point',
|
||||
caption='utility/remove',
|
||||
tooltip={'warp-system.remove-tooltip'}
|
||||
}:on_event('click',function(event)
|
||||
local name = event.element.parent.name
|
||||
remove_warp_point(name)
|
||||
ThisModule.remove_warp_point(name)
|
||||
end)
|
||||
|
||||
local go_to_warp = Gui.inputs.add{
|
||||
local go_to_warp = Gui.inputs{
|
||||
type='button',
|
||||
name='go-to-warp-point',
|
||||
caption='utility/export_slot',
|
||||
tooltip={'warp-system.go-to-tooltip'}
|
||||
}:on_event('click',function(event)
|
||||
local player = Game.get_player(event)
|
||||
local cooldown = _warps().cooldowns[event.player_index] or 0
|
||||
local warp = _warps().warps[event.element.parent.name]
|
||||
local cooldown = global.cooldowns[event.player_index] or 0
|
||||
local warp = global.warps[event.element.parent.name]
|
||||
if cooldown > 0 then player_return({'warp-system.cooldown',cooldown},nil,event) return end
|
||||
if player.vehicle then player.vehicle.set_driver(nil) end
|
||||
if player.vehicle then player.vehicle.set_passenger(nil) end
|
||||
if player.vehicle then return end
|
||||
player.teleport(warp.surface.find_non_colliding_position('player',warp.position,32,1),warp.surface)
|
||||
if not Role.allowed(player,'always-warp') then
|
||||
if not Role and not player.admin or Role and not Role.allowed(player,'always-warp') then
|
||||
event.element.parent.parent.parent.parent.style.visible = false
|
||||
_warps().cooldowns[event.player_index] = warp_limit
|
||||
global.cooldowns[event.player_index] = warp_limit
|
||||
end
|
||||
end)
|
||||
|
||||
Gui.left.add{
|
||||
ThisModule.Gui = Gui.left{
|
||||
name='warp-list',
|
||||
caption='item/'..warp_item,
|
||||
tooltip={'warp-system.tooltip'},
|
||||
@@ -154,7 +158,7 @@ Gui.left.add{
|
||||
type='table',
|
||||
column_count=2
|
||||
}
|
||||
for name,warp in pairs(_warps().warps) do
|
||||
for name,warp in pairs(global.warps) do
|
||||
if not warp.tag or not warp.tag.valid then
|
||||
player.force.add_chart_tag(warp.surface,{
|
||||
position=warp.position,
|
||||
@@ -171,18 +175,18 @@ Gui.left.add{
|
||||
type='flow',
|
||||
name=name
|
||||
}
|
||||
local btn = go_to_warp:draw(_flow)
|
||||
local btn = go_to_warp(_flow)
|
||||
btn.style.height = 20
|
||||
btn.style.width = 20
|
||||
if Role.allowed(player,'make-warp') and name ~= 'Spawn' then
|
||||
local btn = remove_warp:draw(_flow)
|
||||
if not Role and player.admin and name ~= 'Spawn' or Role and Role.allowed(player,'make-warp') and name ~= 'Spawn' then
|
||||
local btn = remove_warp(_flow)
|
||||
btn.style.height = 20
|
||||
btn.style.width = 20
|
||||
end
|
||||
end
|
||||
local cooldown = _warps().cooldowns[player.index] or 0
|
||||
local cooldown = global.cooldowns[player.index] or 0
|
||||
if cooldown > 0 then frame.style.visible = false return
|
||||
elseif Role.allowed(player,'always-warp') then return
|
||||
elseif not Role and player.admin or Role and Role.allowed(player,'always-warp') then return
|
||||
elseif player.surface.get_tile(player.position).name == warp_tile
|
||||
and player.surface.name == 'nauvis'
|
||||
then return
|
||||
@@ -190,8 +194,8 @@ Gui.left.add{
|
||||
else frame.style.visible = false end
|
||||
end,
|
||||
can_open=function(player)
|
||||
local cooldown = _warps().cooldowns[player.index] or 0
|
||||
if Role.allowed(player,'always-warp') then return true
|
||||
local cooldown = global.cooldowns[player.index] or 0
|
||||
if not Role and player.admin or Role and Role.allowed(player,'always-warp') then return true
|
||||
elseif player.surface.get_tile(player.position).name == warp_tile
|
||||
and player.surface.name == 'nauvis'
|
||||
then return true
|
||||
@@ -202,30 +206,31 @@ Gui.left.add{
|
||||
open_on_join=true
|
||||
}
|
||||
|
||||
Event.register(defines.events.on_tick,function(event)
|
||||
-- Event Handlers Define
|
||||
script.on_event(defines.events.on_tick,function(event)
|
||||
if not (event.tick % 60 == 0) then return end
|
||||
for index,time in pairs(_warps().cooldowns) do
|
||||
if time > 0 then
|
||||
_warps().cooldowns[index] = time-1
|
||||
if _warps().cooldowns[index] == 0 then player_return({'warp-system.cooldown-zero'},defines.textcolor.low,index) end
|
||||
global.cooldowns[index] = time-1
|
||||
if global.cooldowns[index] == 0 then player_return({'warp-system.cooldown-zero'},defines.textcolor.low,index) end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Event.register(defines.events.on_player_changed_position, function(event)
|
||||
script.on_event(defines.events.on_player_changed_position, function(event)
|
||||
local player = Game.get_player(event)
|
||||
local cooldown = _warps().cooldowns[player.index] or 0
|
||||
local cooldown = global.cooldowns[player.index] or 0
|
||||
local tile = player.surface.get_tile(player.position).name
|
||||
if not Role.allowed(player,'always-warp') and cooldown == 0 then
|
||||
if not Role and player.admin or Role and not Role.allowed(player,'always-warp') and cooldown == 0 then
|
||||
if tile == warp_tile and player.surface.name == 'nauvis' then
|
||||
mod_gui.get_frame_flow(player)['warp-list'].style.visible = true
|
||||
ThisModule.Gui:open(player)
|
||||
elseif player.position.x^2+player.position.y^2 < (warp_radius*spawn_warp_scale)^2 then
|
||||
mod_gui.get_frame_flow(player)['warp-list'].style.visible = true
|
||||
else mod_gui.get_frame_flow(player)['warp-list'].style.visible = false end
|
||||
ThisModule.Gui:open(player)
|
||||
else ThisModule.Gui:close(player) end
|
||||
end
|
||||
end)
|
||||
|
||||
Event.register(defines.events.on_player_created, function(event)
|
||||
script.on_event(defines.events.on_player_created, function(event)
|
||||
if event.player_index == 1 then
|
||||
local player = Game.get_player(event)
|
||||
player.force.chart(player.surface, {{player.position.x - 20, player.position.y - 20}, {player.position.x + 20, player.position.y + 20}})
|
||||
@@ -234,6 +239,9 @@ Event.register(defines.events.on_player_created, function(event)
|
||||
text='Warp: Spawn',
|
||||
icon={type='item',name=warp_item}
|
||||
})
|
||||
_warps().warps['Spawn'] = {tag=tag,surface=player.surface,position={0,0}}
|
||||
global.warps['Spawn'] = {tag=tag,surface=player.surface,position={0,0}}
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
-- Module Return
|
||||
return ThisModule
|
||||
17
modules/WarpPoints/softmod.json
Normal file
17
modules/WarpPoints/softmod.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "WarpPoints",
|
||||
"version": "4.0.0",
|
||||
"type": "Module",
|
||||
"description": "Creates a warp point system which makes moving around large maps easier.",
|
||||
"location": "<blank>",
|
||||
"keywords": [
|
||||
"Warps",
|
||||
"System",
|
||||
"Teleport",
|
||||
"PAX"
|
||||
],
|
||||
"author": "Cooldude2606",
|
||||
"contact": "Discord: Cooldude2606#5241",
|
||||
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
||||
"dependencies": {}
|
||||
}
|
||||
15
modules/WarpPoints/src/commands.lua
Normal file
15
modules/WarpPoints/src/commands.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
local warps = warps
|
||||
local self = self
|
||||
|
||||
commands.add_command('make-warp', 'Make a warp point at your location', {
|
||||
['name']={true,'string-inf'}
|
||||
}, function(event,args)
|
||||
if not game.player then return end
|
||||
local position = game.player.position
|
||||
local name = args.name
|
||||
if game.player.gui.top[name] then player_return({'warp-system.name-used'},defines.textcolor.med) return commands.error end
|
||||
if warps.warps[name] then player_return({'warp-system.name-used'},defines.textcolor.med) return commands.error end
|
||||
if position.x^2 + position.y^2 < 100 then player_return({'warp-system.too-close'},defines.textcolor.med) return commands.error end
|
||||
-- to do add a test for all warps
|
||||
self.make_warp_point(position,game.player.surface,game.player.force,name)
|
||||
end)
|
||||
5
modules/WarpPoints/src/warp_entities.lua
Normal file
5
modules/WarpPoints/src/warp_entities.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
return {
|
||||
{'small-lamp',-3,-2},{'small-lamp',-3,2},{'small-lamp',3,-2},{'small-lamp',3,2},
|
||||
{'small-lamp',-2,-3},{'small-lamp',2,-3},{'small-lamp',-2,3},{'small-lamp',2,3},
|
||||
{'small-electric-pole',-3,-3},{'small-electric-pole',3,3},{'small-electric-pole',-3,3},{'small-electric-pole',3,-3}
|
||||
}
|
||||
4
modules/WarpPoints/src/warp_tiles.lua
Normal file
4
modules/WarpPoints/src/warp_tiles.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
return {
|
||||
{-3,-2},{-3,-1},{-3,0},{-3,1},{-3,2},{3,-2},{3,-1},{3,0},{3,1},{3,2},
|
||||
{-2,-3},{-1,-3},{0,-3},{1,-3},{2,-3},{-2,3},{-1,3},{0,3},{1,3},{2,3}
|
||||
}
|
||||
107
modules/WornPaths/control.lua
Normal file
107
modules/WornPaths/control.lua
Normal file
@@ -0,0 +1,107 @@
|
||||
--- Makes paths which wear down and paths where entites are placed.
|
||||
-- @module WornPaths@^4.0.0
|
||||
-- @author Cooldude2606
|
||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||
-- @alais ThisModule
|
||||
|
||||
-- Module Require
|
||||
local Game = require('FactorioStdLib@^0.8.0')
|
||||
|
||||
-- Local Varibles
|
||||
local entites = require(module_path..'/src/entites')
|
||||
local paths = require(module_path..'/src/paths')
|
||||
for tile,value in pairs(paths) do value[1]=-1/value[1] end
|
||||
local placed_paths = require(module_path..'/src/placed')
|
||||
|
||||
local adjacency_boost = 2 -- makes paths more lickly to be next to each other; must be greater than 0
|
||||
adjacency_boost = 10/adjacency_boost -- dont change this line
|
||||
|
||||
-- Module Define
|
||||
local module_verbose = false
|
||||
local ThisModule = {}
|
||||
|
||||
-- Global Define
|
||||
local global = global()
|
||||
|
||||
-- Function Define
|
||||
local function global_key(surface,pos)
|
||||
return 'S'..surface.name..'X'..math.floor(pos.x)..'Y'..math.floor(pos.y)
|
||||
end
|
||||
|
||||
--- Downgrads a tile in this position
|
||||
-- @usage ThisModule.down_grade(surface,{x=10,y=10})
|
||||
-- @tparam surface surface the surface the tile is on
|
||||
-- @tparam table pos the position of the tile to change
|
||||
function ThisModule.down_grade(surface,pos)
|
||||
local tile = surface.get_tile(pos).name
|
||||
local new_tile = paths[tile][2]
|
||||
if new_tile == 'world-gen' then
|
||||
new_tile = global[global_key(surface,pos)] or 'grass-1'
|
||||
end
|
||||
surface.set_tiles{{name=new_tile,position=pos}}
|
||||
end
|
||||
|
||||
-- Event Handlers Define
|
||||
script.on_event({defines.events.on_player_built_tile,defines.events.on_robot_built_tile}, function(event)
|
||||
local surface = event.surface_index and game.surfaces[event.surface_index] or event.robot and event.robot.surface
|
||||
local old_tiles = event.tiles
|
||||
for _,old_tile in pairs(old_tiles) do
|
||||
if placed_paths[old_tile.old_tile.name] or old_tile.old_tile.name == 'water' or old_tile.old_tile.name == 'deepwater' then else
|
||||
global[global_key(surface,old_tile.position)]=old_tile.old_tile.name -- not a mistake, this makes it have dimising returns
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
script.on_event(defines.events.on_player_changed_position, function(event)
|
||||
local player = Game.get_player(event)
|
||||
if player and player.valid and game.tick > 10 then else return end
|
||||
if player.afk_time > 300 then return end
|
||||
local surface = player.surface
|
||||
local pos = player.position
|
||||
local tile_name = surface.get_tile(pos).name
|
||||
if not paths[tile_name] then return end
|
||||
local count = -9 -- this value is important
|
||||
for x = -1,1 do for y = -1,1 do
|
||||
local _pos = {pos.x+x,pos.y+y}
|
||||
if placed_paths[tile_name] and not placed_paths[surface.get_tile(_pos).name]
|
||||
or surface.get_tile(_pos).name == paths[tile_name][2]
|
||||
then count=count+1 end
|
||||
end end
|
||||
local chance = paths[tile_name][1]/(count-adjacency_boost)
|
||||
if math.random() < chance then
|
||||
down_grade(surface,pos)
|
||||
end
|
||||
end)
|
||||
|
||||
script.on_event({defines.events.on_built_entity,on_robot_built_entity}, function(event)
|
||||
local entity = event.created_entity
|
||||
local surface = entity.surface
|
||||
if entites[entity.name] then
|
||||
local box = entity.prototype.collision_box
|
||||
local size = math.abs(box.left_top.x-box.right_bottom.x)*math.abs(box.left_top.y-box.right_bottom.y)
|
||||
for x = box.left_top.x,box.right_bottom.x do for y = box.left_top.y,box.right_bottom.y do
|
||||
local pos = {x=x,y=y}
|
||||
local tile = surface.get_tile(pos).name
|
||||
if paths[tile] and math.random() < paths[tile][1]*size/(-10) then
|
||||
ThisModule.down_grade(surface,pos)
|
||||
end
|
||||
end end
|
||||
end
|
||||
end)
|
||||
-- Module Return
|
||||
-- when called it will downgrade a tile
|
||||
return setmetatable(ThisModule,{__call=function(self,...) self.down_grade(...) end})
|
||||
|
||||
--[[
|
||||
/interface
|
||||
local tile_name = surface.get_tile(position).name
|
||||
if not paths[tile_name] then return end
|
||||
local count = -9 -- this value is important
|
||||
for x = -1,1 do for y = -1,1 do
|
||||
local _pos = {position.x+x,position.y+y}
|
||||
if placed_paths[tile_name] and not placed_paths[surface.get_tile(_pos).name]
|
||||
or surface.get_tile(_pos).name == paths[tile_name][2]
|
||||
then count=count+1 end
|
||||
end end
|
||||
return paths[tile_name][1]/(count-adjacency_boost)
|
||||
]]
|
||||
@@ -1,145 +0,0 @@
|
||||
-- made by cooldude
|
||||
-- idea from Mylon - Dirt Path
|
||||
|
||||
local adjacency_boost = 2 -- makes paths more lickly to be next to each other; must be greater than 0
|
||||
local entities = {
|
||||
['stone-furnace']=2,
|
||||
['steel-furnace']=2,
|
||||
['electric-furnace']=3,
|
||||
['assembling-machine-1']=3,
|
||||
['assembling-machine-2']=3,
|
||||
['assembling-machine-3']=3,
|
||||
['beacon']=3,
|
||||
['centrifuge']=3,
|
||||
['chemical-plant']=3,
|
||||
['oil-refinery']=7,
|
||||
['storage-tank']=3,
|
||||
['nuclear-reactor']=5,
|
||||
['steam-engine']=4,
|
||||
['steam-turbine']=4,
|
||||
['boiler']=3,
|
||||
['heat-exchanger']=3,
|
||||
['stone-wall']=1,
|
||||
['gate']=1,
|
||||
['gun-turret']=2,
|
||||
['laser-turret']=2,
|
||||
['radar']=3,
|
||||
['lab']=3,
|
||||
['big-electric-pole']=2,
|
||||
['substation']=2,
|
||||
['rocket-silo']=7
|
||||
}
|
||||
local placed_paths = {
|
||||
['refined-concrete']=true,
|
||||
['refined-hazard-concrete-right']=true,
|
||||
['refined-hazard-concrete-left']=true,
|
||||
['concrete']=true,
|
||||
['hazard-concrete-right']=true,
|
||||
['hazard-concrete-left']=true,
|
||||
['stone-path']=true
|
||||
}
|
||||
local paths = {
|
||||
-- ['tile name'] = {health,convert to}
|
||||
-- health is the average number of steps in hundards before it changes
|
||||
['refined-concrete']={70,'concrete'},
|
||||
['refined-hazard-concrete-right']={70,'hazard-concrete-right'},
|
||||
['refined-hazard-concrete-left']={70,'hazard-concrete-left'},
|
||||
['concrete']={50,'stone-path'},
|
||||
['hazard-concrete-right']={50,'stone-path'},
|
||||
['hazard-concrete-left']={50,'stone-path'},
|
||||
['stone-path']={40,'world-gen'}, -- world-gen just makes it pick the last tile not placed by a player
|
||||
['sand-1']={1,'sand-2'},
|
||||
['sand-2']={3,'sand-3'},
|
||||
['sand-3']={1,'red-desert-3'},
|
||||
['red-desert-3']={1,'red-desert-2'},
|
||||
['red-desert-2']={3,'dirt-1'},
|
||||
['grass-2']={1,'grass-1'},
|
||||
['grass-1']={1,'grass-3'},
|
||||
['grass-3']={3,'red-desert-0'},
|
||||
['red-desert-0']={1,'red-desert-1'},
|
||||
['red-desert-1']={3,'dirt-1'},
|
||||
['dirt-1']={1,'dirt-2'},
|
||||
['dirt-2']={1,'dirt-3'},
|
||||
['dirt-3']={3,'dirt-4'},
|
||||
['dirt-4']={1,'dirt-5'},
|
||||
['dirt-5']={1,'dirt-6'},
|
||||
['grass-4']={3,'dirt-4'}
|
||||
}
|
||||
for tile,value in pairs(paths) do
|
||||
value[1]=1/(value[1]*125)
|
||||
end
|
||||
|
||||
local function global_key(surface,pos)
|
||||
return 'S'..surface.name..'X'..math.floor(pos.x)..'Y'..math.floor(pos.y)
|
||||
end
|
||||
|
||||
local function down_grade(surface,pos)
|
||||
local tile = surface.get_tile(pos).name
|
||||
local new_tile = paths[tile][2]
|
||||
if new_tile == 'world-gen' then
|
||||
if global.paths == nil then global.paths = {} end -- nil as you can set to false to disable
|
||||
new_tile = global.paths[global_key(surface,pos)] or 'grass-1'
|
||||
end
|
||||
surface.set_tiles{{name=new_tile,position=pos}}
|
||||
end
|
||||
|
||||
Event.register(defines.events.on_player_built_tile, function(event)
|
||||
local surface = game.surfaces[event.surface_index]
|
||||
local old_tiles = event.tiles
|
||||
for _,old_tile in pairs(old_tiles) do
|
||||
if placed_paths[old_tile.old_tile.name] or old_tile.old_tile.name == 'water' or old_tile.old_tile.name == 'deep-water' then else
|
||||
if global.paths == nil then global.paths = {} end -- nil as you can set to false to disable
|
||||
global.paths[global_key(surface,old_tile.position)]=old_tile.old_tile.name -- not a mistake, this makes it have dimising returns
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Event.register(defines.events.on_player_changed_position, function(event)
|
||||
local player = Game.get_player(event)
|
||||
if player and player.valid and game.tick > 10 then else return end
|
||||
if player.afk_time > 300 then return end
|
||||
local surface = player.surface
|
||||
local pos = player.position
|
||||
local tile_name = surface.get_tile(pos).name
|
||||
if not paths[tile_name] then return end
|
||||
local chance = paths[tile_name][1]
|
||||
local count = 1
|
||||
for x = -1,1 do for y = -1,1 do
|
||||
local _pos = {pos.x+x,pos.y+y}
|
||||
if placed_paths[tile_name] and not placed_paths[surface.get_tile(_pos).name]
|
||||
or surface.get_tile(_pos).name == paths[tile_name][2]
|
||||
then chance=chance*((adjacency_boost+8)/count) count=count+1 end
|
||||
end end
|
||||
if math.random() < chance then
|
||||
down_grade(surface,pos)
|
||||
end
|
||||
end)
|
||||
|
||||
Event.register(defines.events.on_built_entity, function(event)
|
||||
local entity = event.entity
|
||||
local surface = player.surface
|
||||
if entities[entity.name] then
|
||||
local size = entities[entity.name]
|
||||
for (x in 0,size) do for (y in 0,size) do
|
||||
local pos = [entity.position.x+x,entity.position.y+y]
|
||||
local tile = surface.get_tile(pos).name
|
||||
if math.random() < paths[tile]*size then
|
||||
down_grade(surface,pos)
|
||||
end
|
||||
end end
|
||||
end
|
||||
end)
|
||||
|
||||
--[[
|
||||
/interface
|
||||
local tile_name = tile.name
|
||||
local chance = paths[tile_name][1]
|
||||
local count = 1
|
||||
for x = -1,1 do for y = -1,1 do
|
||||
local _pos = {position.x+x,position.y+y}
|
||||
if paths[tile_name][2] == 'world-gen' and not placed_paths[surface.get_tile(_pos).name]
|
||||
or surface.get_tile(_pos).name == paths[tile_name][2]
|
||||
then game.print('boost '..tostring(count)) chance=chance=chance*(adjacency_boost/count) count=count+1 end end
|
||||
end
|
||||
return chance
|
||||
]]
|
||||
17
modules/WornPaths/softmod.json
Normal file
17
modules/WornPaths/softmod.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "WornPaths",
|
||||
"version": "4.0.0",
|
||||
"type": "Module",
|
||||
"description": "Makes paths which wear down and paths where entites are placed.",
|
||||
"location": "<blank>",
|
||||
"keywords": [
|
||||
"Paths",
|
||||
"Worn",
|
||||
"Decay",
|
||||
"Degrade"
|
||||
],
|
||||
"author": "Cooldude2606",
|
||||
"contact": "Discord: Cooldude2606#5241",
|
||||
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
|
||||
"dependencies": {}
|
||||
}
|
||||
27
modules/WornPaths/src/entites.lua
Normal file
27
modules/WornPaths/src/entites.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
return {
|
||||
['stone-furnace']=true,
|
||||
['steel-furnace']=true,
|
||||
['electric-furnace']=true,
|
||||
['assembling-machine-1']=true,
|
||||
['assembling-machine-2']=true,
|
||||
['assembling-machine-3']=true,
|
||||
['beacon']=true,
|
||||
['centrifuge']=true,
|
||||
['chemical-plant']=true,
|
||||
['oil-refinery']=true,
|
||||
['storage-tank']=true,
|
||||
['nuclear-reactor']=true,
|
||||
['steam-engine']=true,
|
||||
['steam-turbine']=true,
|
||||
['boiler']=true,
|
||||
['heat-exchanger']=true,
|
||||
['stone-wall']=true,
|
||||
['gate']=true,
|
||||
['gun-turret']=true,
|
||||
['laser-turret']=true,
|
||||
['radar']=true,
|
||||
['lab']=true,
|
||||
['big-electric-pole']=true,
|
||||
['substation']=true,
|
||||
['rocket-silo']=true
|
||||
}
|
||||
27
modules/WornPaths/src/paths.lua
Normal file
27
modules/WornPaths/src/paths.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
local paths = {
|
||||
-- ['tile name'] = {health,convert to}
|
||||
-- the greater health is the lower the chance it will be down graded, must be grater than 0
|
||||
['refined-concrete']={70,'concrete'},
|
||||
['refined-hazard-concrete-right']={70,'hazard-concrete-right'},
|
||||
['refined-hazard-concrete-left']={70,'hazard-concrete-left'},
|
||||
['concrete']={50,'stone-path'},
|
||||
['hazard-concrete-right']={50,'stone-path'},
|
||||
['hazard-concrete-left']={50,'stone-path'},
|
||||
['stone-path']={40,'world-gen'}, -- world-gen just makes it pick the last tile not placed by a player
|
||||
['sand-1']={5,'sand-2'},
|
||||
['sand-2']={10,'sand-3'},
|
||||
['sand-3']={5,'red-desert-3'},
|
||||
['red-desert-3']={5,'red-desert-2'},
|
||||
['red-desert-2']={10,'dirt-1'},
|
||||
['grass-2']={5,'grass-1'},
|
||||
['grass-1']={5,'grass-3'},
|
||||
['grass-3']={10,'red-desert-0'},
|
||||
['red-desert-0']={5,'red-desert-1'},
|
||||
['red-desert-1']={10,'dirt-1'},
|
||||
['dirt-1']={5,'dirt-2'},
|
||||
['dirt-2']={5,'dirt-3'},
|
||||
['dirt-3']={10,'dirt-4'},
|
||||
['dirt-4']={5,'dirt-5'},
|
||||
['dirt-5']={5,'dirt-6'},
|
||||
['grass-4']={10,'dirt-4'}
|
||||
}
|
||||
9
modules/WornPaths/src/placed.lua
Normal file
9
modules/WornPaths/src/placed.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
return {
|
||||
['refined-concrete']=true,
|
||||
['refined-hazard-concrete-right']=true,
|
||||
['refined-hazard-concrete-left']=true,
|
||||
['concrete']=true,
|
||||
['hazard-concrete-right']=true,
|
||||
['hazard-concrete-left']=true,
|
||||
['stone-path']=true
|
||||
}
|
||||
Reference in New Issue
Block a user