mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Sorted items that need converting
This commit is contained in:
32
modules/AdvancedStartingItems/starting-items.lua
Normal file
32
modules/AdvancedStartingItems/starting-items.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
-- made by cooldude - this just allows condidtions on stating items and custom ammounts to be added, ie more iron made means more starting iron
|
||||
|
||||
local items = {
|
||||
['iron-plate']=function(player,made) if tick_to_min(game.tick) < 5 then return 8 else return (made*10)/math.pow(tick_to_min(game.tick),2) end end,
|
||||
['copper-plate']=function(player,made) if tick_to_min(game.tick) < 5 then return 0 else return (made*8)/math.pow(tick_to_min(game.tick),2) end end,
|
||||
['electronic-circuit']=function(player,made) if tick_to_min(game.tick) < 5 then return 0 else return (made*6)/math.pow(tick_to_min(game.tick),2) end end,
|
||||
['iron-gear-wheel']=function(player,made) if tick_to_min(game.tick) < 5 then return 0 else return (made*6)/math.pow(tick_to_min(game.tick),2) end end,
|
||||
['steel-plate']=function(player,made) if tick_to_min(game.tick) < 5 then return 0 else return(made*4)/math.pow(tick_to_min(game.tick),2) end end,
|
||||
['pistol']=function(player,made) if player.force.item_production_statistics.get_input_count('submachine-gun') > 5 then return 0 else return 1 end end,
|
||||
['submachine-gun']=function(player,made) if made > 5 then return 1 else return 0 end end,
|
||||
['firearm-magazine']=function(player,made) if player.force.item_production_statistics.get_input_count('piercing-rounds-magazine') > 100 then return 0 else return 10 end end,
|
||||
['piercing-rounds-magazine']=function(player,made) if made > 100 then return 10 else return 0 end end,
|
||||
['light-armor']=function(player,made) if made > 5 and player.force.item_production_statistics.get_input_count('heavy-armor') <= 5 then return 1 else return 0 end end,
|
||||
['heavy-armor']=function(player,made) if made > 5 then return 1 else return 0 end end,
|
||||
['burner-mining-drill']=function(player,made) if tick_to_min(game.tick) < 5 then return 4 else return 0 end end,
|
||||
['stone-furnace']=function(player,made) if tick_to_min(game.tick) < 5 then return 4 else return 0 end end,
|
||||
['iron-axe']=function(player,made) if made > 5 and player.force.item_production_statistics.get_input_count('steel-axe') <= 5 then return 1 else return 0 end end,
|
||||
['steel-axe']=function(player,made) if made > 5 then return 1 else return 0 end end
|
||||
}
|
||||
Event.register(defines.events.on_player_created, function(event)
|
||||
local player = game.players[event.player_index]
|
||||
if event.player_index == 1 then
|
||||
player.force.friendly_fire = false
|
||||
game.map_settings.enemy_expansion.enabled = false
|
||||
player.force.chart(player.surface, {{player.position.x - 400, player.position.y - 400}, {player.position.x + 400, player.position.y + 400}})
|
||||
end
|
||||
for item,count in pairs(items) do
|
||||
if type(count) == 'function' then count = math.floor(count(player,player.force.item_production_statistics.get_input_count(item))) end
|
||||
if count > 0 then player.insert{name=item, count=count} end
|
||||
end
|
||||
end)
|
||||
28
modules/DeathMarkers/body-marker.lua
Normal file
28
modules/DeathMarkers/body-marker.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
-- made by cooldude - this just adds a marker to the map which is removed when the body is removed
|
||||
|
||||
Event.register(defines.events.on_player_died, function(event)
|
||||
local player = game.players[event.player_index]
|
||||
local tag = player.force.add_chart_tag(player.surface,{
|
||||
position=player.position,
|
||||
text='Death: '..player.name..' ('..tick_to_display_format(event.tick)..')'
|
||||
})
|
||||
if not global.corpses then global.corpses = {} end
|
||||
table.insert(global.corpses,tag)
|
||||
end)
|
||||
|
||||
Event.register(defines.events.on_tick, function(event)
|
||||
if (game.tick%3600) ~= 0 then return end
|
||||
if not global.corpses then global.corpses = {} end
|
||||
local key = 1
|
||||
while key <= #global.corpses do
|
||||
local tag = global.corpses[key]
|
||||
if not tag or not tag.valid then table.remove(global.corpses,key) else
|
||||
if not tag.target then
|
||||
local entity = tag.surface.find_entity('character-corpse',tag.position)
|
||||
if entity then tag.target = entity
|
||||
else tag.destroy() table.remove(global.corpses,key) key=key-1 end
|
||||
elseif not tag.target.valid then tag.destroy() table.remove(global.corpses,key) key=key-1 end
|
||||
end
|
||||
key=key+1
|
||||
end
|
||||
end)
|
||||
54
modules/DeconControl/tree-decon.lua
Normal file
54
modules/DeconControl/tree-decon.lua
Normal file
@@ -0,0 +1,54 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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-----------------------------------------------------------
|
||||
|
||||
Event.register(-1,function(event)
|
||||
Server.new_thread{
|
||||
name='tree-decon',
|
||||
data={trees={},chache={},clear=0}
|
||||
}:on_event('tick',function(self)
|
||||
local trees = self.data.trees
|
||||
if self.data.clear ~= 0 and self.data.clear < game.tick then self.data.chache = {} self.data.clear = 0 end
|
||||
if #trees == 0 then return end
|
||||
for i = 0,math.ceil(#trees/10) do
|
||||
local tree = table.remove(trees,1)
|
||||
if tree and tree.valid then tree.destroy() end
|
||||
end
|
||||
end):on_event(defines.events.on_marked_for_deconstruction,function(self,event)
|
||||
local chache = self.data.chache[event.player_index]
|
||||
if not chache then
|
||||
local player = Game.get_player(event)
|
||||
if not player then return end
|
||||
local rank = Ranking.get_rank(player)
|
||||
if rank:allowed('tree-decon') then self.data.chache[event.player_index] = {'tree-decon',false}
|
||||
elseif not rank:allowed('decon') then self.data.chache[event.player_index] = {'no-decon',false}
|
||||
else self.data.chache[event.player_index] = {'decon',false} end
|
||||
chache = self.data.chache[event.player_index]
|
||||
end
|
||||
if not event.entity.last_user or event.entity.name == 'entity-ghost' then
|
||||
if chache[1] == 'tree-decon' then
|
||||
table.insert(self.data.trees,event.entity)
|
||||
self.data.clear = game.tick + 10
|
||||
end
|
||||
else
|
||||
if chache[1] == 'no-decon' then
|
||||
event.entity.cancel_deconstruction('player')
|
||||
if not chache[2] then
|
||||
chache[2] = true
|
||||
local player = Game.get_player(event)
|
||||
player_return({'tree-decon.player-print'},defines.textcolor.crit,player)
|
||||
local rank = Ranking.get_group('Admin').lowest
|
||||
Ranking.print(rank,{'tree-decon.rank-print',player.name},defines.textcolor.info)
|
||||
Admin.give_warning(player,'<server>','Trying To Decon The Base')
|
||||
end
|
||||
self.data.clear = game.tick + 10
|
||||
end
|
||||
end
|
||||
end):open()
|
||||
end)
|
||||
@@ -8,6 +8,7 @@
|
||||
local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0')
|
||||
local Server = require('ExpGamingCore.Server@^4.0.0')
|
||||
local Ranking = require('ExpGamingCore.Ranking@^4.0.0')
|
||||
local Gui = require('ExpGamingCore.Gui@^4.0.0')
|
||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
||||
local Color = require('FactorioStdLib.Color@^0.8.0')
|
||||
local Sync -- ExpGamingCore.Sync@^4.0.0
|
||||
@@ -122,5 +123,49 @@ function Admin.clear_reports(player,by_player,no_emit)
|
||||
end
|
||||
end
|
||||
|
||||
local confirm_report = Gui.inputs.add{
|
||||
type='button',
|
||||
name='admin-report-confirm',
|
||||
caption='utility/spawn_flag',
|
||||
tooltip={'ExpGamingAdmin.name'}
|
||||
}:on_event('click',function(event)
|
||||
local parent = event.element.parent
|
||||
local player = Game.get_player(parent.player.caption)
|
||||
local reason = parent.reason.text
|
||||
Admin.report(player,event.player_index,reason)
|
||||
Gui.center.clear(event.player_index)
|
||||
end)
|
||||
|
||||
Admin.report_btn = Gui.inputs.add{
|
||||
type='button',
|
||||
name='admin-report',
|
||||
caption='utility/spawn_flag',
|
||||
tooltip={'ExpGamingAdmin.name'}
|
||||
}:on_event('click',function(event)
|
||||
local parent = event.element.parent
|
||||
local player = Game.get_player(parent.children[1].name)
|
||||
if not player then return end
|
||||
local _player = Game.get_player(event)
|
||||
Gui.center.clear(_player)
|
||||
local frame = Gui.center.get_flow(_player).add{
|
||||
type='frame',
|
||||
name='report-gui'
|
||||
}
|
||||
_player.opened=frame
|
||||
frame.caption={'ExpGamingAdmin.name'}
|
||||
frame.add{
|
||||
type='textfield',
|
||||
name='reason'
|
||||
}.style.width = 300
|
||||
local btn = confirm_report:draw(frame)
|
||||
btn.style.height = 30
|
||||
btn.style.width = 30
|
||||
frame.add{
|
||||
type='label',
|
||||
name='player',
|
||||
caption=player.name
|
||||
}.style.visible = false
|
||||
end)
|
||||
|
||||
-- Module Return
|
||||
return ThisModule
|
||||
132
modules/ExpGamingInfo/to convert/readme.lua
Normal file
132
modules/ExpGamingInfo/to convert/readme.lua
Normal file
@@ -0,0 +1,132 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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-----------------------------------------------------------
|
||||
|
||||
local function format_label(label)
|
||||
label.style.maximal_width = 480
|
||||
label.style.single_line = false
|
||||
end
|
||||
|
||||
Gui.center.add{
|
||||
name='readme',
|
||||
caption='utility/questionmark',
|
||||
tooltip={'readme.tooltip'}
|
||||
}:add_tab('guildlines',{'readme.guildlines-name'},{'readme.guildlines-tooltip'},function(frame)
|
||||
for i = 1,10 do
|
||||
local style=nil; if i == 1 then style = 'caption_label' end
|
||||
format_label(frame.add{
|
||||
type='label',
|
||||
caption={'readme.guildlines-line'..tostring(i)},
|
||||
style=style
|
||||
})
|
||||
end
|
||||
end):add_tab('chat',{'readme.chat-name'},{'readme.chat-tooltip'},function(frame)
|
||||
format_label(frame.add{
|
||||
type='label',
|
||||
caption={'readme.chat-singleline'}
|
||||
})
|
||||
end):add_tab('commands',{'readme.commands-name'},{'readme.commands-tooltip'},function(frame)
|
||||
format_label(frame.add{
|
||||
type='label',
|
||||
caption={'readme.commands-singleline'}
|
||||
})
|
||||
Gui.bar(frame,480)
|
||||
local table = frame.add{name='command_table',type='table',column_count=2}
|
||||
table.add{
|
||||
type='label',
|
||||
caption={'readme.commands-col1'},
|
||||
style='caption_label'
|
||||
}
|
||||
table.add{
|
||||
type='label',
|
||||
caption={'readme.commands-col2'},
|
||||
style='caption_label'
|
||||
}
|
||||
table.style.width = 480
|
||||
table.draw_vertical_lines = true
|
||||
table.draw_horizontal_line_after_headers = true
|
||||
for _,command in pairs(commands.get_commands(frame.player_index)) do
|
||||
table.add{
|
||||
type='label',
|
||||
caption='/'..command.name
|
||||
}
|
||||
local discription = table.add{
|
||||
type='label',
|
||||
caption=command.description,
|
||||
}
|
||||
discription.style.maximal_width = 400
|
||||
discription.style.single_line = false
|
||||
end
|
||||
end):add_tab('links',{'readme.links-name'},{'readme.links-tooltip'},function(frame)
|
||||
local links={
|
||||
'https://discord.explosivegaming.nl',
|
||||
'https://explosivegaming.nl',
|
||||
'http://steamcommunity.com/groups/tntexplosivegaming',
|
||||
'https://www.patreon.com/badgamernl',
|
||||
'https://wiki.explosivegaming.nl/'
|
||||
}
|
||||
local function format(text_box)
|
||||
text_box.style.minimal_width=400
|
||||
text_box.read_only = true
|
||||
text_box.word_wrap = true
|
||||
text_box.selectable = true
|
||||
end
|
||||
for i,link in pairs(links) do
|
||||
frame.add{
|
||||
type="label",
|
||||
caption={'readme.links-cap'..tostring(i)},
|
||||
style='caption_label'
|
||||
}
|
||||
format(frame.add{
|
||||
type='text-box',
|
||||
text=link
|
||||
})
|
||||
end
|
||||
end):add_tab('servers',{'readme.servers-name'},{'readme.servers-tooltip'},function(frame)
|
||||
format_label(frame.add{
|
||||
type='label',
|
||||
caption={'readme.servers-singleline'}
|
||||
})
|
||||
Gui.bar(frame,480)
|
||||
for i = 1,6 do
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'readme.servers-format',tostring(i),{'readme.servers-cap'..tostring(i)}},
|
||||
style='caption_label'
|
||||
}
|
||||
format_label(frame.add{
|
||||
type='label',
|
||||
caption={'readme.servers-des'..tostring(i)}
|
||||
})
|
||||
end
|
||||
end):add_tab('rules',{'readme.rules-name'},{'readme.rules-tooltip'},function(frame)
|
||||
format_label(frame.add{
|
||||
type='label',
|
||||
caption={'readme.rules-singleline'}
|
||||
})
|
||||
Gui.bar(frame,480)
|
||||
for i = 1,20 do
|
||||
format_label(frame.add{
|
||||
type='label',
|
||||
caption={'readme.rules-format',i,{'readme.rules-rule'..tostring(i)}}
|
||||
})
|
||||
end
|
||||
end)
|
||||
|
||||
Sync.add_to_gui(Gui.inputs.add_button('readme-sync-guildlines','View Guildlines','View the guildlines in the readme',function(player,element)
|
||||
Gui.center.open_tab(player,'readme','guildlines')
|
||||
end))
|
||||
|
||||
Sync.add_to_gui(Gui.inputs.add_button('readme-sync-links','View Other Links','View the links in the readme',function(player,element)
|
||||
Gui.center.open_tab(player,'readme','links')
|
||||
end))
|
||||
|
||||
Sync.add_to_gui(Gui.inputs.add_button('readme-sync-rules','View All Rules','View the all rules in the readme',function(player,element)
|
||||
Gui.center.open_tab(player,'readme','rules')
|
||||
end))
|
||||
104
modules/ExpGamingInfo/to convert/rockets.lua
Normal file
104
modules/ExpGamingInfo/to convert/rockets.lua
Normal file
@@ -0,0 +1,104 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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-----------------------------------------------------------
|
||||
|
||||
local function _global(reset)
|
||||
global.addons = not reset and global.addons or {}
|
||||
global.addons.rockets = not reset and global.addons.rockets or {update=0,first=0,_last=0,last=0,fastest=0,milestones={m1=0,m2=0,m5=0,m10=0,m20=0,m50=0,m100=0,m200=0,m500=0,m1000=0,m2000=0,m5000=0}}
|
||||
return global.addons.rockets
|
||||
end
|
||||
Gui.left.add{
|
||||
name='rockets',
|
||||
caption='item/rocket-silo',
|
||||
tooltip={'rockets.tooltip'},
|
||||
draw=function(frame)
|
||||
frame.caption = {'rockets.name'}
|
||||
local player = Game.get_player(frame.player_index)
|
||||
local data = _global()
|
||||
local satellites = player.force.get_item_launched('satellite')
|
||||
local time = {'rockets.nan'}
|
||||
if satellites == 1 then time = tick_to_display_format(game.tick)
|
||||
elseif satellites > 1 then time = tick_to_display_format((game.tick-data.first)/satellites) end
|
||||
if satellites ~= data.update then
|
||||
data.update = satellites
|
||||
if data.first == 0 then data.first = game.tick end
|
||||
data._last = data.last
|
||||
data.last = game.tick
|
||||
if data.last-data._last < data.fastest or data.fastest == 0 then data.fastest = data.last-data._last end
|
||||
end
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'rockets.sent',satellites}
|
||||
}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'rockets.first',tick_to_display_format(data.first)}
|
||||
}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'rockets.last',tick_to_display_format(data.last-data._last)}
|
||||
}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'rockets.time',time}
|
||||
}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'rockets.fastest',tick_to_display_format(data.fastest)}
|
||||
}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'rockets.milestones'},
|
||||
style='caption_label'
|
||||
}
|
||||
local milestones = frame.add{
|
||||
type='flow',
|
||||
direction='vertical'
|
||||
}
|
||||
for milestone,time in pairs(data.milestones) do
|
||||
local milestone = tonumber(milestone:match('%d+'))
|
||||
if time == 0 and satellites == milestone then
|
||||
data.milestones['m'..milestone] = data.last
|
||||
time = data.last
|
||||
Gui.left.open('rockets')
|
||||
end
|
||||
local _time = {'rockets.nan'}
|
||||
if time > 0 then _time = tick_to_display_format(time) end
|
||||
milestones.add{
|
||||
type='label',
|
||||
caption={'rockets.format',tostring(milestone),_time}
|
||||
}
|
||||
if time == 0 then break end
|
||||
end
|
||||
end,
|
||||
can_open=function(player)
|
||||
if player.force.get_item_launched('satellite') > 0 then return true
|
||||
else return {'rockets.none'} end
|
||||
end
|
||||
}
|
||||
|
||||
Event.register(defines.events.on_rocket_launched,function(event) Gui.left.update('rockets') end)
|
||||
Sync.add_update('rockets',function()
|
||||
local _return = {}
|
||||
local data = _global()
|
||||
local satellites = game.forces.player.get_item_launched('satellite')
|
||||
local time = {'rockets.nan'}
|
||||
if satellites == 1 then time = tick_to_display_format(game.tick)
|
||||
elseif satellites > 1 then time = tick_to_display_format((game.tick-data.first)/satellites) end
|
||||
_return.total = satellites
|
||||
_return.first = Sync.tick_format(data.first)
|
||||
_return.last = Sync.tick_format(data.last-data._last)
|
||||
_return.time = Sync.tick_format(time)
|
||||
_return.fastest = Sync.tick_format(data.fastest)
|
||||
_return.milestones = {}
|
||||
for milestone,time in pairs(data.milestones) do
|
||||
_return.milestones[milestone] = Sync.tick_format(time)
|
||||
end
|
||||
return _return
|
||||
end)
|
||||
102
modules/ExpGamingInfo/to convert/science.lua
Normal file
102
modules/ExpGamingInfo/to convert/science.lua
Normal file
@@ -0,0 +1,102 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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-----------------------------------------------------------
|
||||
|
||||
local science_packs = {
|
||||
'science-pack-1',
|
||||
'science-pack-2',
|
||||
'science-pack-3',
|
||||
'military-science-pack',
|
||||
'production-science-pack',
|
||||
'high-tech-science-pack',
|
||||
'space-science-pack'
|
||||
}
|
||||
|
||||
local function _global(reset)
|
||||
global.addons = not reset and global.addons or {}
|
||||
global.addons.science = not reset and global.addons.science or {_base={update=0,_update=0,made={0,0,0,0,0,0,0},_made={0,0,0,0,0,0,0}}}
|
||||
return global.addons.science
|
||||
end
|
||||
|
||||
Gui.left.add{
|
||||
name='science',
|
||||
caption='item/lab',
|
||||
tooltip={'science.tooltip'},
|
||||
draw=function(frame)
|
||||
local data = _global()
|
||||
local player = Game.get_player(frame.player_index)
|
||||
if not data[player.force.name] then
|
||||
data[player.force.name] = table.deepcopy(data._base)
|
||||
end
|
||||
data = data[player.force.name]
|
||||
frame.caption = {'science.name'}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'science.total'},
|
||||
style='caption_label'
|
||||
}
|
||||
local totals = frame.add{
|
||||
type='flow',
|
||||
direction='vertical'
|
||||
}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'science.time'},
|
||||
style='caption_label'
|
||||
}
|
||||
local times = frame.add{
|
||||
type='flow',
|
||||
direction='vertical'
|
||||
}
|
||||
if data.update < game.tick-100 then
|
||||
data._update = data.update
|
||||
data._made = table.deepcopy(data.made)
|
||||
for i,name in pairs(science_packs) do
|
||||
data.made[i] = player.force.item_production_statistics.get_input_count(name)
|
||||
end
|
||||
data.update = game.tick
|
||||
end
|
||||
for i,name in pairs(science_packs) do
|
||||
local made = data.made[i]
|
||||
if made > 0 then
|
||||
totals.add{
|
||||
type='label',
|
||||
caption={'science.format',{'science.'..name},made}
|
||||
}
|
||||
local _made = string.format('%.2f',(made-data._made[i])/((data.update-data._update)/(3600*game.speed)))
|
||||
times.add{
|
||||
type='label',
|
||||
caption={'science.format',{'science.'..name},_made}
|
||||
}
|
||||
end
|
||||
end
|
||||
end,
|
||||
can_open=function(player)
|
||||
if player.force.item_production_statistics.get_input_count('science-pack-1') > 0 then return true
|
||||
else return {'science.none'} end
|
||||
end
|
||||
}
|
||||
|
||||
Event.register(defines.events.on_research_finished,function(event) Gui.left.update('science') end)
|
||||
Sync.add_update('science',function()
|
||||
local _return = {}
|
||||
local _data = _global()
|
||||
for force_name,data in pairs(_data) do
|
||||
if force_name ~= '_base' then
|
||||
_return[force_name] = {totals={},times={}}
|
||||
for i,name in pairs(science_packs) do
|
||||
local made = data.made[i]
|
||||
_return[force_name].totals[name] = made
|
||||
local _made = string.format('%.2f',(made-data._made[i])/((data.update-data._update)/(3600*game.speed)))
|
||||
_return[force_name].times[name] = _made
|
||||
end
|
||||
end
|
||||
end
|
||||
return _return
|
||||
end)
|
||||
193
modules/ExpGamingInfo/to convert/tasklist.lua
Normal file
193
modules/ExpGamingInfo/to convert/tasklist.lua
Normal file
@@ -0,0 +1,193 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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-----------------------------------------------------------
|
||||
|
||||
local function _global(reset)
|
||||
global.addons = not reset and global.addons or {}
|
||||
global.addons.tasklist = not reset and global.addons.tasklist or {tasks={},_edit={},_base={_edit=false,_tasks={},_editing={}}}
|
||||
return global.addons.tasklist
|
||||
end
|
||||
|
||||
local edit = Gui.inputs.add{
|
||||
name='tasklist-edit',
|
||||
type='button',
|
||||
caption='utility/rename_icon_normal'
|
||||
}:on_event('click',function(event)
|
||||
local text_flow = event.element.parent.parent.text_flow
|
||||
local data = _global()._edit[event.player_index]
|
||||
if not data._edit then data._tasks = table.deepcopy(_global().tasks) end
|
||||
if text_flow.input.type == 'label' then
|
||||
data._editing[tonumber(text_flow.parent.name)]=true
|
||||
Gui.left.update('tasklist',event.player_index)
|
||||
elseif text_flow.input.type == 'textfield' then
|
||||
local text = text_flow.input.text
|
||||
data._editing[tonumber(text_flow.parent.name)]=false
|
||||
data._tasks[tonumber(text_flow.parent.name)]=text
|
||||
Gui.left.update('tasklist',event.player_index)
|
||||
end
|
||||
end)
|
||||
|
||||
local function _edit(frame)
|
||||
local element = edit:draw(frame)
|
||||
element.style.height = 20
|
||||
element.style.width = 20
|
||||
local text_flow = element.parent.parent.text_flow
|
||||
local data = _global()._edit[frame.player_index]
|
||||
data._tasks[text_flow.parent.name]=text
|
||||
if data._editing[tonumber(text_flow.parent.name)] then
|
||||
element.style.height = 30
|
||||
element.style.width = 30
|
||||
local text = text_flow.input.caption
|
||||
text_flow.clear()
|
||||
local _text = text_flow.add{
|
||||
name='input',
|
||||
type='textfield',
|
||||
text=text
|
||||
}
|
||||
_text.style.width = 200
|
||||
element.sprite = 'utility/enter'
|
||||
end
|
||||
end
|
||||
|
||||
local remove = Gui.inputs.add{
|
||||
name='tasklist-remove',
|
||||
type='button',
|
||||
caption='utility/remove'
|
||||
}:on_event('click',function(event)
|
||||
local frame = event.element.parent.parent
|
||||
local data = _global()._edit[event.player_index]
|
||||
if data._edit then
|
||||
table.remove(data._tasks,tonumber(frame.name))
|
||||
table.remove(data._editing,tonumber(frame.name))
|
||||
else
|
||||
table.remove(_global().tasks,tonumber(frame.name))
|
||||
Gui.left.update('tasklist')
|
||||
end
|
||||
Gui.left.update('tasklist',event.player_index)
|
||||
end)
|
||||
|
||||
local add = Gui.inputs.add{
|
||||
name='tasklist-add',
|
||||
type='button',
|
||||
caption='utility/add'
|
||||
}:on_event('click',function(event)
|
||||
local frame = event.element.parent.parent
|
||||
local data = _global()._edit[event.player_index]
|
||||
if data._edit then
|
||||
table.insert(data._tasks,tonumber(frame.name)+1,'New Value')
|
||||
table.insert(data._editing,tonumber(frame.name)+1,true)
|
||||
else
|
||||
data._tasks = table.deepcopy(_global().tasks)
|
||||
table.insert(data._tasks,tonumber(frame.name)+1,'New Value')
|
||||
table.insert(data._editing,tonumber(frame.name)+1,true)
|
||||
end
|
||||
Gui.left.update('tasklist',event.player_index)
|
||||
end)
|
||||
|
||||
local function _tasks(player)
|
||||
local player = Game.get_player(player)
|
||||
local data = _global()._edit[player.index]
|
||||
if not data then return _global().tasks end
|
||||
local _edit = false
|
||||
for _,v in pairs(data._editing) do
|
||||
if v == true then
|
||||
_edit = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if data._edit and not _edit then
|
||||
_global().tasks = table.deepcopy(data._tasks)
|
||||
_global()._edit[player.index] = table.deepcopy(_global()._base)
|
||||
Gui.left.update('tasklist')
|
||||
return _global().tasks
|
||||
elseif not data._edit and _edit then
|
||||
data._edit = true
|
||||
for key,_ in pairs(data._tasks) do if not data._editing[key] then data._editing[key] = false end end
|
||||
return data._tasks
|
||||
elseif _edit then return data._tasks
|
||||
else return _global().tasks
|
||||
end
|
||||
end
|
||||
|
||||
Gui.left.add{
|
||||
name='tasklist',
|
||||
caption='utility/not_enough_repair_packs_icon',
|
||||
tooltip={'tasklist.tooltip'},
|
||||
draw=function(frame)
|
||||
frame.caption = ''
|
||||
local title = frame.add{
|
||||
type='flow',
|
||||
direction='horizontal'
|
||||
}
|
||||
title.add{
|
||||
type='label',
|
||||
caption={'tasklist.name'},
|
||||
style='caption_label'
|
||||
}
|
||||
local data = _global()
|
||||
local player = Game.get_player(frame.player_index)
|
||||
local rank = Ranking.get_rank(player)
|
||||
if rank:allowed('edit-tasklist') then
|
||||
if not data._edit[player.index] then data._edit[player.index] = table.deepcopy(data._base) end
|
||||
end
|
||||
for i,task in pairs(_tasks(player)) do
|
||||
local flow = frame.add{
|
||||
name=i,
|
||||
type='flow',
|
||||
direction='horizontal'
|
||||
}
|
||||
local text_flow = flow.add{
|
||||
name='text_flow',
|
||||
type='flow',
|
||||
direction='horizontal'
|
||||
}
|
||||
text_flow.add{
|
||||
name='input',
|
||||
type='label',
|
||||
caption=task
|
||||
}
|
||||
local button_flow = flow.add{
|
||||
type='flow',
|
||||
direction='horizontal'
|
||||
}
|
||||
if rank:allowed('edit-tasklist') then
|
||||
_edit(button_flow)
|
||||
if data._edit[player.index]._editing[i] then
|
||||
local element = remove:draw(button_flow)
|
||||
element.style.height = 30
|
||||
element.style.width = 30
|
||||
local _element = add:draw(button_flow)
|
||||
_element.style.height = 30
|
||||
_element.style.width = 30
|
||||
end
|
||||
end
|
||||
end
|
||||
if rank:allowed('edit-tasklist') then
|
||||
local flow = title.add{
|
||||
name=#_tasks(player),
|
||||
type='flow',
|
||||
direction='horizontal'
|
||||
}
|
||||
local button_flow = flow.add{
|
||||
type='flow',
|
||||
direction='horizontal'
|
||||
}
|
||||
local element = add:draw(button_flow)
|
||||
element.style.height = 20
|
||||
element.style.width = 20
|
||||
end
|
||||
if #_tasks(player) == 0 and not rank:allowed('edit-tasklist') then frame.style.visible = false end
|
||||
end,
|
||||
can_open=function(player)
|
||||
local rank = Ranking.get_rank(player)
|
||||
if rank:allowed('edit-tasklist') or #_global().tasks > 0 then return true
|
||||
else return {'tasklist.none'} end
|
||||
end,
|
||||
open_on_join=true
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
-- Module Require
|
||||
local Admin = require('ExpGamingAdmin.AdminLib@^4.0.0')
|
||||
local Game = require('FactorioStdLib.Game@^0.8.0')
|
||||
local Ranking -- ExpGamingCore.Ranking@^4.0.0
|
||||
|
||||
-- Local Varibles
|
||||
-- removed from none admin ranks, no further action
|
||||
|
||||
260
modules/ExpGamingPlayer/polls.lua
Normal file
260
modules/ExpGamingPlayer/polls.lua
Normal file
@@ -0,0 +1,260 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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-----------------------------------------------------------
|
||||
|
||||
local poll_time_out = 90 -- In seconds
|
||||
|
||||
local function _polls(reset)
|
||||
global.addons = not reset and global.addons or {}
|
||||
global.addons.polls = not reset and global.addons.polls or {active={},old={}}
|
||||
return global.addons.polls
|
||||
end
|
||||
|
||||
function _poll_end(self)
|
||||
local uuid = self.data.poll_uuid
|
||||
local poll = _polls().active[uuid]
|
||||
if not poll then return end
|
||||
local highest = {nil,-1}
|
||||
local _votes = {}
|
||||
for index,answer in pairs(poll.answers) do
|
||||
local _result = poll.votes[index] or 0
|
||||
if _result > highest[2] then highest = {answer,_result} end
|
||||
_votes[answer] = _result
|
||||
end
|
||||
local uuid = poll.uuid
|
||||
poll.uuid = nil
|
||||
poll.votes = _votes
|
||||
poll.answers = nil
|
||||
poll.voted = nil
|
||||
table.insert(_polls().old,poll)
|
||||
_polls().active[uuid] = nil
|
||||
game.print({'polls.end',poll.question},defines.textcolor.info)
|
||||
game.print({'polls.winner',highest[1]},defines.textcolor.info)
|
||||
end
|
||||
|
||||
local function _poll_data(question,answers)
|
||||
local poll = {
|
||||
uuid=Server.new_uuid(),
|
||||
question=question,
|
||||
answers=answers or {'None'},
|
||||
votes={},
|
||||
voted={}
|
||||
}
|
||||
Server.new_thread{
|
||||
data={poll_uuid=poll.uuid},
|
||||
timeout=poll_time_out*60
|
||||
}:on_event('timeout',_poll_end):open()
|
||||
-- This time out is known to cause desyncs and so I have moved it to a hard coded function
|
||||
_polls().active[poll.uuid]=poll
|
||||
return poll.uuid
|
||||
end
|
||||
|
||||
local function draw_poll(frame)
|
||||
frame.clear()
|
||||
local index = tonumber(frame.parent.current_index.caption)
|
||||
local poll = _polls().old[index]
|
||||
if not poll then
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'polls.no-poll'}
|
||||
}
|
||||
return
|
||||
end
|
||||
frame.add{
|
||||
type='label',
|
||||
caption='Question: '..poll.question
|
||||
}
|
||||
for answer,votes in pairs(poll.votes) do
|
||||
frame.add{
|
||||
type='label',
|
||||
caption=answer..') '..votes
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
local function _opptions(player,root_frame)
|
||||
local opptions = {'Please Select An Opption'}
|
||||
local uuid = root_frame.name
|
||||
local poll = _polls().active[uuid]
|
||||
if not poll then return {'Invalid Poll'} end
|
||||
for _,answer in pairs(poll.answers) do
|
||||
table.insert(opptions,answer)
|
||||
end
|
||||
return opptions
|
||||
end
|
||||
|
||||
local opption_drop_down = Gui.inputs.add_drop_down('opption-drop-down-polls',_opptions,1,function(player,selected,items,element)
|
||||
local uuid = element.parent.name
|
||||
local poll = _polls().active[uuid]
|
||||
if not poll then return end
|
||||
if poll.voted[player.index] and poll.voted[player.index] > 1 then
|
||||
local old_vote = poll.voted[player.index]
|
||||
poll.votes[old_vote-1] = poll.votes[old_vote-1] and poll.votes[old_vote-1]-1 or 0
|
||||
end
|
||||
if element.selected_index > 1 then
|
||||
poll.votes[element.selected_index-1] = poll.votes[element.selected_index-1] and poll.votes[element.selected_index-1]+1 or 1
|
||||
end
|
||||
poll.voted[player.index]=element.selected_index
|
||||
element.parent.answer.caption = 'Your Answer: '..selected
|
||||
end)
|
||||
|
||||
local prev = Gui.inputs.add{
|
||||
type='button',
|
||||
name='prev-poll',
|
||||
caption='utility/hint_arrow_left'
|
||||
}:on_event('click',function(event)
|
||||
local parent = event.element.parent
|
||||
local index = parent.parent.current_index.caption
|
||||
local _index = tonumber(index)-1
|
||||
if _index < 1 then _index = #_polls().old end
|
||||
parent.parent.current_index.caption = _index
|
||||
parent.parent.title.title.caption = 'Viewing Poll: '.._index
|
||||
draw_poll(parent.parent.poll_area)
|
||||
end)
|
||||
|
||||
local next = Gui.inputs.add{
|
||||
type='button',
|
||||
name='next-poll',
|
||||
caption='utility/hint_arrow_right'
|
||||
}:on_event('click',function(event)
|
||||
local parent = event.element.parent
|
||||
local index = parent.parent.current_index.caption
|
||||
local _index = tonumber(index)+1
|
||||
if _index > #_polls().old then _index = 1 end
|
||||
parent.parent.current_index.caption = _index
|
||||
parent.parent.title.title.caption = 'Viewing Poll: '.._index
|
||||
draw_poll(parent.parent.poll_area)
|
||||
end)
|
||||
|
||||
local poll_question_input = Gui.inputs.add_text('poll-question-input',true,'Question',function(player,text,element)
|
||||
local options = element.parent.options
|
||||
if not options.question then options.add{type='label',name='question',caption=''}
|
||||
else options.question.caption = text end
|
||||
end)
|
||||
|
||||
local _self_referace_poll_option_input = nil
|
||||
local poll_option_input = Gui.inputs.add_text('poll-option-input',true,'Enter Option',function(player,text,element)
|
||||
local options = element.parent.parent.parent.options
|
||||
if not options[element.parent.name] then options.add{type='label',name=element.parent.name,caption=text}
|
||||
else options[element.parent.name].caption = text end
|
||||
if options.last.caption == element.parent.name then
|
||||
options.last.caption = tonumber(options.last.caption)+1
|
||||
_self_referace_poll_option_input:draw(element.parent.parent.add{type='flow',name=options.last.caption}).style.minimal_width = 200
|
||||
end
|
||||
end)
|
||||
_self_referace_poll_option_input = poll_option_input
|
||||
|
||||
local function poll_assembler(frame)
|
||||
frame.clear()
|
||||
local options = frame.add{type='flow',name='options'}
|
||||
options.style.visible = false
|
||||
options.add{type='label',name='last',caption='2'}
|
||||
poll_question_input:draw(frame).style.minimal_width = 200
|
||||
local flow = frame.add{type='flow',direction='vertical'}
|
||||
poll_option_input:draw(flow.add{type='flow',name='1'}).style.minimal_width = 200
|
||||
poll_option_input:draw(flow.add{type='flow',name='2'}).style.minimal_width = 200
|
||||
end
|
||||
|
||||
local create_poll = Gui.inputs.add{
|
||||
type='button',
|
||||
name='create-poll',
|
||||
caption='utility/add'
|
||||
}:on_event('click',function(event)
|
||||
local parent = event.element.parent
|
||||
if event.element.sprite == 'utility/enter' then
|
||||
local inputs = parent.parent.poll_area.options
|
||||
if not inputs then
|
||||
event.element.sprite = 'utility/add'
|
||||
draw_poll(parent.parent.poll_area)
|
||||
return
|
||||
end
|
||||
local options = {}
|
||||
for _,option in pairs(inputs.children) do
|
||||
if option.name ~= 'question' and option.name ~= 'last' then
|
||||
if option.caption ~= 'Enter Option' and option.caption ~= '' then table.insert(options,option.caption) end
|
||||
end
|
||||
end
|
||||
if not inputs.question or #options == 0 then
|
||||
event.element.sprite = 'utility/add'
|
||||
draw_poll(parent.parent.poll_area)
|
||||
return
|
||||
end
|
||||
local uuid = _poll_data(inputs.question.caption,options)
|
||||
Gui.popup.open('polls',{uuid=uuid})
|
||||
event.element.sprite = 'utility/add'
|
||||
draw_poll(parent.parent.poll_area)
|
||||
else
|
||||
event.element.sprite = 'utility/enter'
|
||||
poll_assembler(parent.parent.poll_area)
|
||||
end
|
||||
end)
|
||||
|
||||
Gui.popup.add{
|
||||
name='polls',
|
||||
caption={'polls.name'},
|
||||
draw=function(frame,data)
|
||||
frame.style.right_padding = 5
|
||||
frame.style.bottom_padding = 5
|
||||
local uuid = data.uuid
|
||||
local poll = _polls().active[uuid]
|
||||
if not poll then return end
|
||||
local flow = frame.add{
|
||||
type='flow',
|
||||
name=uuid,
|
||||
direction='vertical'
|
||||
}
|
||||
flow.add{type='label',caption={'polls.time-left',poll_time_out}}
|
||||
flow.add{type='label',caption='Question: '..poll.question}
|
||||
flow.add{type='label',name='answer',caption='Your Answer: None'}
|
||||
opption_drop_down:draw(flow)
|
||||
end
|
||||
}:add_left{
|
||||
caption='utility/item_editor_icon',
|
||||
tooltip={'polls.tooltip'},
|
||||
draw=function(frame)
|
||||
frame.caption={'polls.name'}
|
||||
frame.add{
|
||||
type='label',
|
||||
name='current_index',
|
||||
caption=1
|
||||
}.style.visible = false
|
||||
local title = frame.add{
|
||||
type='flow',
|
||||
name='title'
|
||||
}
|
||||
local btn = prev:draw(title)
|
||||
btn.style.width = 20
|
||||
btn.style.height = 20
|
||||
title.add{
|
||||
type='label',
|
||||
name='title',
|
||||
caption='Viewing Poll: 1',
|
||||
style='caption_label'
|
||||
}
|
||||
local btn = next:draw(title)
|
||||
btn.style.width = 20
|
||||
btn.style.height = 20
|
||||
if Ranking.get_rank(frame.player_index):allowed('create-poll') then
|
||||
local btn = create_poll:draw(title)
|
||||
btn.style.width = 20
|
||||
btn.style.height = 20
|
||||
end
|
||||
local flow = frame.add{
|
||||
type='flow',
|
||||
name='poll_area',
|
||||
direction='vertical'
|
||||
}
|
||||
draw_poll(flow)
|
||||
end,
|
||||
can_open=function(player)
|
||||
if #_polls().old > 0 then return true
|
||||
elseif Ranking.get_rank(player):allowed('create-poll') then return true
|
||||
else return {'polls.no-poll'} end
|
||||
end
|
||||
}
|
||||
182
modules/GameSettingsGui/game-settings.lua
Normal file
182
modules/GameSettingsGui/game-settings.lua
Normal file
@@ -0,0 +1,182 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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-----------------------------------------------------------
|
||||
|
||||
--{type='slider',object='',key='',name='',min=x,max=y}
|
||||
--{type='function',object='',key='',name='',param={}}
|
||||
local basic_settings = {
|
||||
{type='slider',object='force',key='manual_mining_speed_modifier',name='mining-speed',min=0,max=10},
|
||||
{type='slider',object='force',key='manual_crafting_speed_modifier',name='craft-speed',min=0,max=10},
|
||||
{type='slider',object='force',key='character_running_speed_modifier',name='running-speed',min=0,max=10},
|
||||
{type='slider',object='force',key='character_build_distance_bonus',name='build-distance',min=0,max=50},
|
||||
{type='slider',object='force',key='character_reach_distance_bonus',name='reach-distance',min=0,max=50},
|
||||
{type='slider',object='force',key='worker_robots_speed_modifier',name='bot-speed',min=0,max=10},
|
||||
{type='slider',object='force',key='laboratory_speed_modifier',name='lab-speed',min=0,max=10},
|
||||
{type='slider',object='force',key='stack_inserter_capacity_bonus',name='stack-bonus',min=1,max=30}
|
||||
}
|
||||
|
||||
local advanced_settings = {
|
||||
{type='slider',object='force',key='quickbar_count',name='quickbar-count',min=1,max=5},
|
||||
{type='slider',object='force',key='character_inventory_slots_bonus',name='inventory-size',min=0,max=1000},
|
||||
{type='slider',object='force',key='mining_drill_productivity_bonus',name='mining-prod',min=0,max=10},
|
||||
{type='slider',object='game',key='speed',name='game-speed',min=0.01,max=5},
|
||||
{type='function',object='game',key='server_save',name='save'},
|
||||
{type='function',object='force',key='reset_technology_effects',name='reload-effects'},
|
||||
{type='function',object='enemy',key='kill_all_units',name='kill-biters'},
|
||||
{type='function',object='force',key='rechart',name='reload-map'},
|
||||
{type='function',object='game',key='force_crc',name='crc'},
|
||||
{type='function',object='force',key='reset',name='reset-force'}
|
||||
}
|
||||
|
||||
local personal_settings = {
|
||||
{type='slider',object='player',key='character_mining_speed_modifier',name='mining-speed',min=0,max=10},
|
||||
{type='slider',object='player',key='character_crafting_speed_modifier',name='craft-speed',min=0,max=10},
|
||||
{type='slider',object='player',key='character_running_speed_modifier',name='running-speed',min=0,max=10},
|
||||
{type='slider',object='player',key='character_build_distance_bonus',name='build-distance',min=0,max=50},
|
||||
{type='slider',object='player',key='character_reach_distance_bonus',name='reach-distance',min=0,max=50},
|
||||
{type='slider',object='player',key='character_inventory_slots_bonus',name='inventory-size',min=0,max=1000},
|
||||
{type='slider',object='player',key='quickbar_count_bonus',name='quickbar-count',min=0,max=5}
|
||||
}
|
||||
|
||||
local _root_list = {basic_settings=basic_settings,advanced_settings=advanced_settings,personal_settings=personal_settings}
|
||||
|
||||
local function _get_data(root_frame)
|
||||
local object = root_frame.name
|
||||
local key = root_frame.setting_name.caption
|
||||
for _,setting in pairs(_root_list[object]) do
|
||||
if key == setting.key then return setting end
|
||||
end
|
||||
end
|
||||
|
||||
local function _object_list(player) return {game=game,player=player,force=player.force,enemy=game.forces['enemy']} end
|
||||
|
||||
for name,group in pairs(_root_list) do
|
||||
for key,setting in pairs(group) do
|
||||
local _added = nil
|
||||
if setting.type == 'slider' then
|
||||
_added = Gui.inputs.add_slider('game-settings-'..setting.name,'horizontal',setting.min,setting.max,
|
||||
function(player,root_frame)
|
||||
local data = _get_data(root_frame)
|
||||
local objects = _object_list(player)
|
||||
local object = objects[data.object]
|
||||
return object[data.key] or 1
|
||||
end,
|
||||
function(player,value,percent,element)
|
||||
local data = _get_data(element.parent)
|
||||
local objects = _object_list(player)
|
||||
local object = objects[data.object]
|
||||
local _caption = string.format('%.2f',value); if value > 2 then _caption = string.format('%.2f',math.floor(value)) end
|
||||
object[data.key] = tonumber(_caption)
|
||||
element.parent.counter.caption = _caption
|
||||
end
|
||||
)
|
||||
elseif setting.type == 'function' then
|
||||
_added = Gui.inputs.add_checkbox('game-settings-'..setting.name,true,nil,false,function(player,element)
|
||||
local data = _get_data(element.parent.parent)
|
||||
local objects = _object_list(player)
|
||||
local object = objects[data.object]
|
||||
pcall(object[data.key],unpack(data.params))
|
||||
Server.new_thread{
|
||||
timeout=60,
|
||||
data=element
|
||||
}:on_event('timeout',function(self)
|
||||
if self.data and self.data.valid then
|
||||
element.parent.parent['game-settings-are-you-sure'].state = false
|
||||
self.data.parent.style.visible = false
|
||||
self.data.state = false
|
||||
end
|
||||
end):open()
|
||||
end)
|
||||
if not setting.params then setting.params = {} end
|
||||
end
|
||||
setting._loaded = _added
|
||||
setting._group = name
|
||||
end
|
||||
end
|
||||
|
||||
local are_you_sure = Gui.inputs.add_checkbox('game-settings-are-you-sure',true,nil,false,function(player,element)
|
||||
element.parent.sure.style.visible = true
|
||||
Server.new_thread{
|
||||
timeout=600,
|
||||
data=element
|
||||
}:on_event('timeout',function(self)
|
||||
if self.data and self.data.valid then
|
||||
self.data.state = false
|
||||
self.data.parent.sure.style.visible = false
|
||||
end
|
||||
end):open()
|
||||
end)
|
||||
|
||||
local function _draw_setting(frame,setting)
|
||||
local frame = frame.add{type='flow'}
|
||||
local frame = frame.add{
|
||||
type='flow',
|
||||
name=setting._group
|
||||
}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'game-settings.effect-'..setting.name},
|
||||
style='caption_label'
|
||||
}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption=setting.key,
|
||||
name='setting_name'
|
||||
}.style.visible = false
|
||||
if setting.type == 'slider' then
|
||||
local slider = setting._loaded:draw(frame)
|
||||
slider.style.width = 300
|
||||
local _caption = string.format('%.2f',slider.slider_value); if slider.slider_value > 2 then _caption = tostring(math.floor(slider.slider_value)) end
|
||||
frame.add{
|
||||
type='label',
|
||||
name='counter',
|
||||
caption=_caption
|
||||
}
|
||||
elseif setting.type == 'function' then
|
||||
are_you_sure:draw(frame)
|
||||
local flow = frame.add{type='flow',name='sure'}
|
||||
flow.style.visible = false
|
||||
flow.add{
|
||||
type='label',
|
||||
caption={'game-settings.sure'},
|
||||
style='bold_red_label'
|
||||
}
|
||||
setting._loaded:draw(flow)
|
||||
end
|
||||
end
|
||||
|
||||
Gui.center.add{
|
||||
name='game-settings',
|
||||
caption='utility/no_building_material_icon',
|
||||
tooltip={'game-settings.tooltip'}
|
||||
}:add_tab('basic',{'game-settings.basic-name'},{'game-settings.basic-name'},function(frame)
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'game-settings.basic-message'}
|
||||
}.style.single_line = false
|
||||
for _,setting in pairs(basic_settings) do
|
||||
_draw_setting(frame,setting)
|
||||
end
|
||||
end):add_tab('advanced',{'game-settings.advanced-name'},{'game-settings.advanced-tooltip'},function(frame)
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'game-settings.advanced-message'}
|
||||
}.style.single_line = false
|
||||
for _,setting in pairs(advanced_settings) do
|
||||
_draw_setting(frame,setting)
|
||||
end
|
||||
end):add_tab('personal',{'game-settings.personal-name'},{'game-settings.personal-tooltip'},function(frame)
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'game-settings.personal-message'}
|
||||
}.style.single_line = false
|
||||
for _,setting in pairs(personal_settings) do
|
||||
_draw_setting(frame,setting)
|
||||
end
|
||||
end)
|
||||
99
modules/GuiAnnouncements/announcements.lua
Normal file
99
modules/GuiAnnouncements/announcements.lua
Normal file
@@ -0,0 +1,99 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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-----------------------------------------------------------
|
||||
|
||||
local function _ranks(player)
|
||||
local ranks = {'Select Rank'}
|
||||
local _rank = Ranking.get_rank(player)
|
||||
for _,rank in pairs(Ranking._ranks()) do
|
||||
if rank.power >= _rank.power then
|
||||
table.insert(ranks,rank.name)
|
||||
end
|
||||
end
|
||||
return ranks
|
||||
end
|
||||
|
||||
local rank_drop_down = Gui.inputs.add_drop_down('rank-drop-down-annoncements',_ranks,1,function(player,selected,items,element)
|
||||
element.parent.rank.caption = selected
|
||||
if selected == 'Select Rank' then element.parent['send-annoncement'].style.visible = false
|
||||
else element.parent['send-annoncement'].style.visible = true end
|
||||
end)
|
||||
|
||||
local send_popup = Gui.inputs.add{
|
||||
type='button',
|
||||
name='send-annoncement',
|
||||
caption='utility/export_slot'
|
||||
}:on_event('click',function(event)
|
||||
local meta_data = Ranking.meta
|
||||
local default = Ranking.get_rank(meta_data.default)
|
||||
local player = Game.get_player(event)
|
||||
local rank = Ranking.get_rank(player)
|
||||
local _rank = Ranking.get_rank(event.element.parent.rank.caption); if not _rank then return end
|
||||
local sent_by = {'announcements.sent-by',player.name,rank.name}
|
||||
local rank_name = _rank.name..'s'; if rank_name == default.name..'s' then rank_name = 'Everyone' end
|
||||
local sent_to = {'announcements.sent-to',rank_name}
|
||||
local message = event.element.parent.parent.message.text
|
||||
for power,__rank in pairs(Ranking._ranks()) do
|
||||
if power <= _rank.power then
|
||||
Gui.popup.open('announcements',{sent_by=sent_by,sent_to=sent_to,message=message},__rank:get_players(true))
|
||||
event.element.parent.parent.message.text = ''
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Gui.popup.add{
|
||||
name='announcements',
|
||||
caption={'announcements.name'},
|
||||
draw=function(frame,data)
|
||||
frame.style.right_padding = 5
|
||||
frame.style.bottom_padding = 5
|
||||
frame.add{type='label',caption=data.sent_by,style='caption_label'}
|
||||
frame.add{type='label',caption=data.sent_to,style='caption_label'}
|
||||
local text_box = frame.add{type='text-box'}
|
||||
text_box.text = data.message
|
||||
text_box.style.width = 400
|
||||
text_box.read_only = true
|
||||
text_box.word_wrap = true
|
||||
text_box.selectable = true
|
||||
end
|
||||
}:add_left{
|
||||
caption='item/programmable-speaker',
|
||||
tooltip={'announcements.tooltip'},
|
||||
draw=function(frame)
|
||||
frame.caption = {'announcements.name'}
|
||||
local frame = frame.add{
|
||||
type='flow',
|
||||
direction='vertical'
|
||||
}
|
||||
local text_box = frame.add{
|
||||
type='text-box',
|
||||
name='message'
|
||||
}
|
||||
text_box.style.width = 400
|
||||
text_box.style.minimal_height = 100
|
||||
text_box.read_only = false
|
||||
text_box.word_wrap = true
|
||||
text_box.selectable = true
|
||||
local flow = frame.add{type='flow'}
|
||||
flow.add{
|
||||
type='label',
|
||||
caption={'announcements.select-rank'}
|
||||
}
|
||||
rank_drop_down:draw(flow)
|
||||
local btn = send_popup:draw(flow)
|
||||
btn.style.visible = false
|
||||
btn.style.height = 25
|
||||
btn.style.width = 25
|
||||
flow.add{
|
||||
type='label',
|
||||
name='rank',
|
||||
caption=''
|
||||
}.style.visible = false
|
||||
end
|
||||
}
|
||||
29
modules/HealthIndicator/health.lua
Normal file
29
modules/HealthIndicator/health.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
-- 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)
|
||||
32
modules/PlayerAutoColor/colours.lua
Normal file
32
modules/PlayerAutoColor/colours.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
-- made by cooldude - we are lazy and we want to always have the same colour, also uses std lib to auto assign random colours
|
||||
|
||||
local default_colours = {
|
||||
BADgamerNL={r=255,g=20,b=147},
|
||||
arty714={r=150,g=68,b=161},
|
||||
Cooldude2606={r=57,g=192,b=207},
|
||||
mark9064={r=99,g=0,b=255},
|
||||
eissturm={r=25,g=25,b=112},
|
||||
Sakama={r=20,g=213,b=80},
|
||||
Sakama={r=20,g=213,b=80},
|
||||
freek18={r=50,g=0,b=255},
|
||||
aldldl={r=0,g=131,b=255},
|
||||
NAD4X4={r=135,g=206,b=250},
|
||||
cydes={r=82,g=249,b=155},
|
||||
UUBlueFire={r=0,g=204,b=255}
|
||||
}
|
||||
|
||||
Event.register(defines.events.on_player_created, function(event)
|
||||
local player = game.players[event.player_index]
|
||||
local colours = table.keys(defines.color)
|
||||
player.color = defines.color.black
|
||||
while player.color.r == defines.color.black.r and player.color.g == defines.color.black.g and player.color.b == defines.color.black.b
|
||||
or player.color.r == defines.color.white.r and player.color.g == defines.color.white.g and player.color.b == defines.color.white.b do
|
||||
player.color = defines.color[colours[math.random(#colours)]]
|
||||
if default_colours[player.name] then
|
||||
local c = default_colours[player.name]
|
||||
player.color = Color.from_rgb(c.r,c.g,c.b)
|
||||
end
|
||||
end
|
||||
player.chat_color = player.color
|
||||
end)
|
||||
132
modules/RankChanger/rank-changer.lua
Normal file
132
modules/RankChanger/rank-changer.lua
Normal file
@@ -0,0 +1,132 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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-----------------------------------------------------------
|
||||
|
||||
local get_player_info = get_player_info or function(player,frame)
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'rank-changer.no-info-file'}
|
||||
}
|
||||
end
|
||||
|
||||
local function _players(_player,root_frame,state)
|
||||
local players = {'Select Player'}
|
||||
local _players = state and game.players or game.connected_players
|
||||
for _,player in pairs(_players) do
|
||||
if player.name ~= _player.name then
|
||||
if Admin.is_banned and Admin.is_banned(player) then else
|
||||
table.insert(players,player.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
return players
|
||||
end
|
||||
|
||||
local online_check = Gui.inputs.add_checkbox('online-check-rank-change',false,'Show Offline',false,function(player,element)
|
||||
element.parent['player-drop-down-rank-change'].items = _players(player,element.parent,true)
|
||||
element.parent['player-drop-down-rank-change'].selected_index = 1
|
||||
end,function(player,element)
|
||||
element.parent['player-drop-down-rank-change'].items = _players(player,element.parent,false)
|
||||
element.parent['player-drop-down-rank-change'].selected_index = 1
|
||||
end)
|
||||
|
||||
local player_drop_down = Gui.inputs.add_drop_down('player-drop-down-rank-change',_players,1,function(player,selected,items,element)
|
||||
element.parent.parent.player.caption = selected
|
||||
local player_info_flow = element.parent.parent.info_flow
|
||||
player_info_flow.clear()
|
||||
if selected == 'Select Player' then return
|
||||
else get_player_info(selected,player_info_flow,true) end
|
||||
local rank = Ranking.get_rank(player)
|
||||
local _rank = Ranking.get_rank(selected)
|
||||
if rank.power >= _rank.power then element.parent.warning.caption = {'rank-changer.warning'}
|
||||
else element.parent.warning.caption = '' end
|
||||
end)
|
||||
|
||||
local function _ranks(player)
|
||||
local ranks = {'Select Rank'}
|
||||
local _rank = Ranking.get_rank(player)
|
||||
for _,rank in pairs(Ranking._ranks()) do
|
||||
if rank.power > _rank.power then
|
||||
table.insert(ranks,rank.name)
|
||||
end
|
||||
end
|
||||
return ranks
|
||||
end
|
||||
|
||||
local rank_drop_down = Gui.inputs.add_drop_down('rank-drop-down-rank-change',_ranks,1,function(player,selected,items,element)
|
||||
element.parent.parent.rank.caption = selected
|
||||
end)
|
||||
|
||||
local set_rank = Gui.inputs.add{
|
||||
type='button',
|
||||
name='rank-change-set',
|
||||
caption={'rank-changer.set-rank'}
|
||||
}:on_event('click',function(event)
|
||||
local dropdowns = event.element.parent
|
||||
local rank = Ranking.get_rank(event.player_index)
|
||||
local _rank = Ranking.get_rank(dropdowns.parent.rank.caption)
|
||||
local _player = Game.get_player(dropdowns.parent.player.caption)
|
||||
if not _player or not _rank then dropdowns.warning.caption = {'rank-changer.invalid'} return end
|
||||
local __rank = Ranking.get_rank(_player)
|
||||
if rank.power >= __rank.power then dropdowns.warning.caption = {'rank-changer.rank-high'} return end
|
||||
Ranking.give_rank(_player,_rank,event)
|
||||
Gui.center.clear(event)
|
||||
end)
|
||||
|
||||
Gui.center.add{
|
||||
name='rank-changer',
|
||||
caption='utility/circuit_network_panel',
|
||||
tooltip={'rank-changer.tooltip'},
|
||||
draw=function(self,frame)
|
||||
frame.caption={'rank-changer.name'}
|
||||
local frame = frame.add{
|
||||
type='flow',
|
||||
direction='horizontal'
|
||||
}
|
||||
local dropdowns = frame.add{
|
||||
type='flow',
|
||||
direction='vertical'
|
||||
}
|
||||
local player_info_flow = frame.add{
|
||||
name='info_flow',
|
||||
type='flow',
|
||||
direction='vertical'
|
||||
}
|
||||
player_info_flow.style.height = 200
|
||||
player_info_flow.style.width = 200
|
||||
local label = dropdowns.add{
|
||||
type='label',
|
||||
caption={'rank-changer.message'}
|
||||
}
|
||||
label.style.single_line = false
|
||||
label.style.width = 200
|
||||
online_check:draw(dropdowns)
|
||||
player_drop_down:draw(dropdowns)
|
||||
rank_drop_down:draw(dropdowns)
|
||||
local label = dropdowns.add{
|
||||
name='warning',
|
||||
type='label',
|
||||
caption='',
|
||||
style='bold_red_label'
|
||||
}
|
||||
label.style.single_line = false
|
||||
label.style.width = 200
|
||||
set_rank:draw(dropdowns)
|
||||
frame.add{
|
||||
name='player',
|
||||
type='label',
|
||||
caption='///'
|
||||
}.style.visible = false
|
||||
frame.add{
|
||||
name='rank',
|
||||
type='label',
|
||||
caption='///'
|
||||
}.style.visible = false
|
||||
end
|
||||
}
|
||||
213
modules/SpawnArea/spawn.lua
Normal file
213
modules/SpawnArea/spawn.lua
Normal file
@@ -0,0 +1,213 @@
|
||||
|
||||
-- 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 = {
|
||||
{-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},
|
||||
{-44,20},{-44,21},{-43,-19},{-43,-18},{-43,-17},{-43,-1},{-43,0},{-43,1},{-43,2},{-43,3},{-43,4},{-43,20},{-43,21},{-43,22},{-42,-19},{-42,-18},{-42,-1},{-42,0},{-42,1},{-42,2},{-42,3},{-42,4},{-42,21},{-42,22},{-41,-25},{-41,-24},{-41,-19},{-41,-18},{-41,-13},{-41,-12},
|
||||
{-41,-11},{-41,-10},{-41,-5},{-41,-4},{-41,7},{-41,8},{-41,13},{-41,14},{-41,15},{-41,16},{-41,21},{-41,22},{-41,27},{-41,28},{-40,-26},{-40,-25},{-40,-24},{-40,-20},{-40,-19},{-40,-18},{-40,-13},{-40,-12},{-40,-11},{-40,-10},{-40,-5},{-40,-4},{-40,7},{-40,8},{-40,13},{-40,14},
|
||||
{-40,15},{-40,16},{-40,21},{-40,22},{-40,23},{-40,27},{-40,28},{-40,29},{-39,-27},{-39,-26},{-39,-25},{-39,-24},{-39,-21},{-39,-20},{-39,-19},{-39,-13},{-39,-12},{-39,-5},{-39,-4},{-39,-3},{-39,-2},{-39,-1},{-39,0},{-39,1},{-39,2},{-39,3},{-39,4},{-39,5},{-39,6},{-39,7},
|
||||
{-39,8},{-39,15},{-39,16},{-39,22},{-39,23},{-39,24},{-39,27},{-39,28},{-39,29},{-39,30},{-38,-27},{-38,-26},{-38,-25},{-38,-24},{-38,-21},{-38,-20},{-38,-13},{-38,-12},{-38,-5},{-38,-4},{-38,-3},{-38,-2},{-38,-1},{-38,0},{-38,1},{-38,2},{-38,3},{-38,4},{-38,5},{-38,6},
|
||||
{-38,7},{-38,8},{-38,15},{-38,16},{-38,23},{-38,24},{-38,27},{-38,28},{-38,29},{-38,30},{-37,-17},{-37,-16},{-37,-13},{-37,-12},{-37,-11},{-37,-10},{-37,-4},{-37,-3},{-37,-2},{-37,-1},{-37,0},{-37,3},{-37,4},{-37,5},{-37,6},{-37,7},{-37,13},{-37,14},{-37,15},{-37,16},
|
||||
{-37,19},{-37,20},{-36,-17},{-36,-16},{-36,-13},{-36,-12},{-36,-11},{-36,-10},{-36,-9},{-36,-3},{-36,-2},{-36,-1},{-36,0},{-36,3},{-36,4},{-36,5},{-36,6},{-36,12},{-36,13},{-36,14},{-36,15},{-36,16},{-36,19},{-36,20},{-35,-29},{-35,-28},{-35,-23},{-35,-22},{-35,-17},{-35,-16},
|
||||
{-35,-12},{-35,-11},{-35,-10},{-35,-9},{-35,-8},{-35,11},{-35,12},{-35,13},{-35,14},{-35,15},{-35,19},{-35,20},{-35,25},{-35,26},{-35,31},{-35,32},{-34,-30},{-34,-29},{-34,-28},{-34,-23},{-34,-22},{-34,-17},{-34,-16},{-34,-15},{-34,-11},{-34,-10},{-34,-9},{-34,-8},{-34,11},{-34,12},
|
||||
{-34,13},{-34,14},{-34,18},{-34,19},{-34,20},{-34,25},{-34,26},{-34,31},{-34,32},{-34,33},{-33,-31},{-33,-30},{-33,-29},{-33,-28},{-33,-23},{-33,-22},{-33,-16},{-33,-15},{-33,-14},{-33,-5},{-33,-4},{-33,-1},{-33,0},{-33,3},{-33,4},{-33,7},{-33,8},{-33,17},{-33,18},{-33,19},
|
||||
{-33,25},{-33,26},{-33,31},{-33,32},{-33,33},{-33,34},{-32,-32},{-32,-31},{-32,-30},{-32,-29},{-32,-28},{-32,-27},{-32,-23},{-32,-22},{-32,-21},{-32,-15},{-32,-14},{-32,-6},{-32,-5},{-32,-4},{-32,-1},{-32,0},{-32,3},{-32,4},{-32,7},{-32,8},{-32,9},{-32,17},{-32,18},{-32,24},
|
||||
{-32,25},{-32,26},{-32,30},{-32,31},{-32,32},{-32,33},{-32,34},{-32,35},{-31,-33},{-31,-32},{-31,-31},{-31,-30},{-31,-29},{-31,-28},{-31,-27},{-31,-26},{-31,-22},{-31,-21},{-31,-20},{-31,-19},{-31,-18},{-31,-11},{-31,-10},{-31,-9},{-31,-8},{-31,-7},{-31,-6},{-31,-5},{-31,-1},{-31,0},
|
||||
{-31,1},{-31,2},{-31,3},{-31,4},{-31,8},{-31,9},{-31,10},{-31,11},{-31,12},{-31,13},{-31,14},{-31,21},{-31,22},{-31,23},{-31,24},{-31,25},{-31,29},{-31,30},{-31,31},{-31,32},{-31,33},{-31,34},{-31,35},{-31,36},{-30,-33},{-30,-32},{-30,-31},{-30,-30},{-30,-29},{-30,-28},
|
||||
{-30,-27},{-30,-26},{-30,-21},{-30,-20},{-30,-19},{-30,-18},{-30,-11},{-30,-10},{-30,-9},{-30,-8},{-30,-7},{-30,-6},{-30,-1},{-30,0},{-30,1},{-30,2},{-30,3},{-30,4},{-30,9},{-30,10},{-30,11},{-30,12},{-30,13},{-30,14},{-30,21},{-30,22},{-30,23},{-30,24},{-30,29},{-30,30},
|
||||
{-30,31},{-30,32},{-30,33},{-30,34},{-30,35},{-30,36},{-29,-37},{-29,-36},{-29,-30},{-29,-29},{-29,-28},{-29,-27},{-29,-26},{-29,-15},{-29,-14},{-29,-10},{-29,-9},{-29,-8},{-29,-7},{-29,10},{-29,11},{-29,12},{-29,13},{-29,17},{-29,18},{-29,29},{-29,30},{-29,31},{-29,32},{-29,33},
|
||||
{-29,39},{-29,40},{-28,-38},{-28,-37},{-28,-36},{-28,-29},{-28,-28},{-28,-27},{-28,-26},{-28,-16},{-28,-15},{-28,-14},{-28,-9},{-28,-8},{-28,11},{-28,12},{-28,17},{-28,18},{-28,19},{-28,29},{-28,30},{-28,31},{-28,32},{-28,39},{-28,40},{-28,41},{-27,-39},{-27,-38},{-27,-37},{-27,-36},
|
||||
{-27,-23},{-27,-22},{-27,-19},{-27,-18},{-27,-17},{-27,-16},{-27,-15},{-27,-5},{-27,-4},{-27,-1},{-27,0},{-27,1},{-27,2},{-27,3},{-27,4},{-27,7},{-27,8},{-27,18},{-27,19},{-27,20},{-27,21},{-27,22},{-27,25},{-27,26},{-27,39},{-27,40},{-27,41},{-27,42},{-26,-39},{-26,-38},
|
||||
{-26,-37},{-26,-36},{-26,-24},{-26,-23},{-26,-22},{-26,-19},{-26,-18},{-26,-17},{-26,-16},{-26,-6},{-26,-5},{-26,-4},{-26,-1},{-26,0},{-26,1},{-26,2},{-26,3},{-26,4},{-26,7},{-26,8},{-26,9},{-26,19},{-26,20},{-26,21},{-26,22},{-26,25},{-26,26},{-26,27},{-26,39},{-26,40},
|
||||
{-26,41},{-26,42},{-25,-33},{-25,-32},{-25,-31},{-25,-30},{-25,-25},{-25,-24},{-25,-23},{-25,-22},{-25,-19},{-25,-18},{-25,-17},{-25,-9},{-25,-8},{-25,-7},{-25,-6},{-25,-5},{-25,-4},{-25,-1},{-25,0},{-25,1},{-25,2},{-25,3},{-25,4},{-25,7},{-25,8},{-25,9},{-25,10},{-25,11},
|
||||
{-25,12},{-25,20},{-25,21},{-25,22},{-25,25},{-25,26},{-25,27},{-25,28},{-25,33},{-25,34},{-25,35},{-25,36},{-24,-33},{-24,-32},{-24,-31},{-24,-30},{-24,-29},{-24,-25},{-24,-24},{-24,-23},{-24,-22},{-24,-19},{-24,-18},{-24,-9},{-24,-8},{-24,-7},{-24,-6},{-24,-5},{-24,-4},{-24,-1},
|
||||
{-24,0},{-24,1},{-24,2},{-24,3},{-24,4},{-24,7},{-24,8},{-24,9},{-24,10},{-24,11},{-24,12},{-24,21},{-24,22},{-24,25},{-24,26},{-24,27},{-24,28},{-24,32},{-24,33},{-24,34},{-24,35},{-24,36},{-23,-37},{-23,-36},{-23,-30},{-23,-29},{-23,-28},{-23,-19},{-23,-18},{-23,-15},
|
||||
{-23,-14},{-23,-9},{-23,-8},{-23,-7},{-23,-6},{-23,-5},{-23,0},{-23,1},{-23,2},{-23,3},{-23,8},{-23,9},{-23,10},{-23,11},{-23,12},{-23,17},{-23,18},{-23,21},{-23,22},{-23,31},{-23,32},{-23,33},{-23,39},{-23,40},{-22,-38},{-22,-37},{-22,-36},{-22,-29},{-22,-28},{-22,-19},
|
||||
{-22,-18},{-22,-15},{-22,-14},{-22,-13},{-22,-9},{-22,-8},{-22,-7},{-22,-6},{-22,1},{-22,2},{-22,9},{-22,10},{-22,11},{-22,12},{-22,16},{-22,17},{-22,18},{-22,21},{-22,22},{-22,31},{-22,32},{-22,39},{-22,40},{-22,41},{-21,-41},{-21,-40},{-21,-39},{-21,-38},{-21,-37},{-21,-29},
|
||||
{-21,-28},{-21,-25},{-21,-24},{-21,-23},{-21,-22},{-21,-21},{-21,-20},{-21,-19},{-21,-18},{-21,-15},{-21,-14},{-21,-13},{-21,-12},{-21,-3},{-21,-2},{-21,5},{-21,6},{-21,15},{-21,16},{-21,17},{-21,18},{-21,21},{-21,22},{-21,23},{-21,24},{-21,25},{-21,26},{-21,27},{-21,28},{-21,31},
|
||||
{-21,32},{-21,40},{-21,41},{-21,42},{-21,43},{-21,44},{-20,-42},{-20,-41},{-20,-40},{-20,-39},{-20,-38},{-20,-29},{-20,-28},{-20,-25},{-20,-24},{-20,-23},{-20,-22},{-20,-21},{-20,-20},{-20,-19},{-20,-18},{-20,-15},{-20,-14},{-20,-13},{-20,-12},{-20,-3},{-20,-2},{-20,-1},{-20,4},{-20,5},
|
||||
{-20,6},{-20,15},{-20,16},{-20,17},{-20,18},{-20,21},{-20,22},{-20,23},{-20,24},{-20,25},{-20,26},{-20,27},{-20,28},{-20,31},{-20,32},{-20,41},{-20,42},{-20,43},{-20,44},{-20,45},{-19,-43},{-19,-42},{-19,-41},{-19,-35},{-19,-34},{-19,-33},{-19,-32},{-19,-25},{-19,-24},{-19,-23},
|
||||
{-19,-15},{-19,-14},{-19,-13},{-19,-9},{-19,-8},{-19,-7},{-19,-6},{-19,-2},{-19,-1},{-19,0},{-19,1},{-19,2},{-19,3},{-19,4},{-19,5},{-19,9},{-19,10},{-19,11},{-19,12},{-19,16},{-19,17},{-19,18},{-19,26},{-19,27},{-19,28},{-19,35},{-19,36},{-19,37},{-19,38},{-19,44},
|
||||
{-19,45},{-19,46},{-18,-43},{-18,-42},{-18,-35},{-18,-34},{-18,-33},{-18,-32},{-18,-31},{-18,-26},{-18,-25},{-18,-24},{-18,-15},{-18,-14},{-18,-10},{-18,-9},{-18,-8},{-18,-7},{-18,-6},{-18,-1},{-18,0},{-18,1},{-18,2},{-18,3},{-18,4},{-18,9},{-18,10},{-18,11},{-18,12},{-18,13},
|
||||
{-18,17},{-18,18},{-18,27},{-18,28},{-18,29},{-18,34},{-18,35},{-18,36},{-18,37},{-18,38},{-18,45},{-18,46},{-17,-43},{-17,-42},{-17,-32},{-17,-31},{-17,-30},{-17,-27},{-17,-26},{-17,-25},{-17,-21},{-17,-20},{-17,-19},{-17,-18},{-17,-17},{-17,-16},{-17,-15},{-17,-14},{-17,-11},{-17,-10},
|
||||
{-17,-9},{-17,-8},{-17,-7},{-17,-6},{-17,0},{-17,1},{-17,2},{-17,3},{-17,9},{-17,10},{-17,11},{-17,12},{-17,13},{-17,14},{-17,17},{-17,18},{-17,19},{-17,20},{-17,21},{-17,22},{-17,23},{-17,24},{-17,28},{-17,29},{-17,30},{-17,33},{-17,34},{-17,35},{-17,45},{-17,46},
|
||||
{-16,-43},{-16,-42},{-16,-31},{-16,-30},{-16,-27},{-16,-26},{-16,-21},{-16,-20},{-16,-19},{-16,-18},{-16,-17},{-16,-16},{-16,-15},{-16,-14},{-16,-11},{-16,-10},{-16,-9},{-16,-8},{-16,-7},{-16,-6},{-16,1},{-16,2},{-16,9},{-16,10},{-16,11},{-16,12},{-16,13},{-16,14},{-16,17},{-16,18},
|
||||
{-16,19},{-16,20},{-16,21},{-16,22},{-16,23},{-16,24},{-16,29},{-16,30},{-16,33},{-16,34},{-16,45},{-16,46},{-15,-43},{-15,-42},{-15,-39},{-15,-38},{-15,-37},{-15,-36},{-15,-35},{-15,-34},{-15,-20},{-15,-19},{-15,-18},{-15,-17},{-15,-10},{-15,-9},{-15,-8},{-15,-7},{-15,-3},{-15,-2},
|
||||
{-15,1},{-15,2},{-15,5},{-15,6},{-15,10},{-15,11},{-15,12},{-15,13},{-15,20},{-15,21},{-15,22},{-15,23},{-15,37},{-15,38},{-15,39},{-15,40},{-15,41},{-15,42},{-15,45},{-15,46},{-14,-43},{-14,-42},{-14,-39},{-14,-38},{-14,-37},{-14,-36},{-14,-35},{-14,-34},{-14,-33},{-14,-19},
|
||||
{-14,-18},{-14,-9},{-14,-8},{-14,-4},{-14,-3},{-14,-2},{-14,1},{-14,2},{-14,5},{-14,6},{-14,7},{-14,11},{-14,12},{-14,21},{-14,22},{-14,36},{-14,37},{-14,38},{-14,39},{-14,40},{-14,41},{-14,42},{-14,45},{-14,46},{-13,-39},{-13,-38},{-13,-35},{-13,-34},{-13,-33},{-13,-32},
|
||||
{-13,-29},{-13,-28},{-13,-15},{-13,-14},{-13,-5},{-13,-4},{-13,-3},{-13,-2},{-13,5},{-13,6},{-13,7},{-13,8},{-13,17},{-13,18},{-13,31},{-13,32},{-13,35},{-13,36},{-13,37},{-13,38},{-13,41},{-13,42},{-12,-39},{-12,-38},{-12,-35},{-12,-34},{-12,-33},{-12,-32},{-12,-29},{-12,-28},
|
||||
{-12,-27},{-12,-16},{-12,-15},{-12,-14},{-12,-13},{-12,-5},{-12,-4},{-12,-3},{-12,-2},{-12,5},{-12,6},{-12,7},{-12,8},{-12,16},{-12,17},{-12,18},{-12,19},{-12,30},{-12,31},{-12,32},{-12,35},{-12,36},{-12,37},{-12,38},{-12,41},{-12,42},{-11,-43},{-11,-42},{-11,-34},{-11,-33},
|
||||
{-11,-32},{-11,-29},{-11,-28},{-11,-27},{-11,-26},{-11,-23},{-11,-22},{-11,-21},{-11,-20},{-11,-17},{-11,-16},{-11,-15},{-11,-14},{-11,-13},{-11,-12},{-11,-9},{-11,-8},{-11,1},{-11,2},{-11,11},{-11,12},{-11,15},{-11,16},{-11,17},{-11,18},{-11,19},{-11,20},{-11,23},{-11,24},{-11,25},
|
||||
{-11,26},{-11,29},{-11,30},{-11,31},{-11,32},{-11,35},{-11,36},{-11,37},{-11,45},{-11,46},{-10,-44},{-10,-43},{-10,-42},{-10,-33},{-10,-32},{-10,-29},{-10,-28},{-10,-27},{-10,-26},{-10,-23},{-10,-22},{-10,-21},{-10,-20},{-10,-17},{-10,-16},{-10,-15},{-10,-14},{-10,-13},{-10,-12},{-10,-9},
|
||||
{-10,-8},{-10,-7},{-10,0},{-10,1},{-10,2},{-10,3},{-10,10},{-10,11},{-10,12},{-10,15},{-10,16},{-10,17},{-10,18},{-10,19},{-10,20},{-10,23},{-10,24},{-10,25},{-10,26},{-10,29},{-10,30},{-10,31},{-10,32},{-10,35},{-10,36},{-10,45},{-10,46},{-10,47},{-9,-45},{-9,-44},
|
||||
{-9,-43},{-9,-29},{-9,-28},{-9,-27},{-9,-23},{-9,-22},{-9,-21},{-9,-20},{-9,-17},{-9,-16},{-9,-15},{-9,-14},{-9,-13},{-9,-8},{-9,-7},{-9,-6},{-9,-5},{-9,-1},{-9,0},{-9,1},{-9,2},{-9,3},{-9,4},{-9,8},{-9,9},{-9,10},{-9,11},{-9,16},{-9,17},{-9,18},
|
||||
{-9,19},{-9,20},{-9,23},{-9,24},{-9,25},{-9,26},{-9,30},{-9,31},{-9,32},{-9,46},{-9,47},{-9,48},{-8,-45},{-8,-44},{-8,-30},{-8,-29},{-8,-28},{-8,-24},{-8,-23},{-8,-22},{-8,-21},{-8,-20},{-8,-17},{-8,-16},{-8,-15},{-8,-14},{-8,-7},{-8,-6},{-8,-5},{-8,-4},
|
||||
{-8,-1},{-8,0},{-8,1},{-8,2},{-8,3},{-8,4},{-8,7},{-8,8},{-8,9},{-8,10},{-8,17},{-8,18},{-8,19},{-8,20},{-8,23},{-8,24},{-8,25},{-8,26},{-8,27},{-8,31},{-8,32},{-8,33},{-8,47},{-8,48},{-7,-45},{-7,-44},{-7,-39},{-7,-38},{-7,-37},{-7,-36},
|
||||
{-7,-31},{-7,-30},{-7,-29},{-7,-25},{-7,-24},{-7,-23},{-7,-22},{-7,-21},{-7,-11},{-7,-10},{-7,-7},{-7,-6},{-7,-5},{-7,-4},{-7,7},{-7,8},{-7,9},{-7,10},{-7,13},{-7,14},{-7,24},{-7,25},{-7,26},{-7,27},{-7,28},{-7,32},{-7,33},{-7,34},{-7,39},{-7,40},
|
||||
{-7,41},{-7,42},{-7,47},{-7,48},{-6,-46},{-6,-45},{-6,-44},{-6,-39},{-6,-38},{-6,-37},{-6,-36},{-6,-35},{-6,-31},{-6,-30},{-6,-25},{-6,-24},{-6,-23},{-6,-22},{-6,-12},{-6,-11},{-6,-10},{-6,-6},{-6,-5},{-6,8},{-6,9},{-6,13},{-6,14},{-6,15},{-6,25},{-6,26},
|
||||
{-6,27},{-6,28},{-6,33},{-6,34},{-6,38},{-6,39},{-6,40},{-6,41},{-6,42},{-6,47},{-6,48},{-6,49},{-5,-47},{-5,-46},{-5,-45},{-5,-44},{-5,-37},{-5,-36},{-5,-35},{-5,-34},{-5,-19},{-5,-18},{-5,-13},{-5,-12},{-5,-11},{-5,-10},{-5,-1},{-5,0},{-5,1},{-5,2},
|
||||
{-5,3},{-5,4},{-5,13},{-5,14},{-5,15},{-5,16},{-5,21},{-5,22},{-5,37},{-5,38},{-5,39},{-5,40},{-5,47},{-5,48},{-5,49},{-5,50},{-4,-47},{-4,-46},{-4,-45},{-4,-44},{-4,-43},{-4,-37},{-4,-36},{-4,-35},{-4,-34},{-4,-19},{-4,-18},{-4,-17},{-4,-13},{-4,-12},
|
||||
{-4,-11},{-4,-10},{-4,-2},{-4,-1},{-4,0},{-4,1},{-4,2},{-4,3},{-4,4},{-4,5},{-4,13},{-4,14},{-4,15},{-4,16},{-4,20},{-4,21},{-4,22},{-4,37},{-4,38},{-4,39},{-4,40},{-4,46},{-4,47},{-4,48},{-4,49},{-4,50},{-3,-44},{-3,-43},{-3,-42},{-3,-41},
|
||||
{-3,-40},{-3,-37},{-3,-36},{-3,-35},{-3,-34},{-3,-31},{-3,-30},{-3,-29},{-3,-28},{-3,-25},{-3,-24},{-3,-23},{-3,-22},{-3,-18},{-3,-17},{-3,-16},{-3,-7},{-3,-6},{-3,-3},{-3,-2},{-3,-1},{-3,0},{-3,3},{-3,4},{-3,5},{-3,6},{-3,9},{-3,10},{-3,19},{-3,20},
|
||||
{-3,21},{-3,25},{-3,26},{-3,27},{-3,28},{-3,31},{-3,32},{-3,33},{-3,34},{-3,37},{-3,38},{-3,39},{-3,40},{-3,43},{-3,44},{-3,45},{-3,46},{-3,47},{-2,-43},{-2,-42},{-2,-41},{-2,-40},{-2,-37},{-2,-36},{-2,-35},{-2,-34},{-2,-31},{-2,-30},{-2,-29},{-2,-28},
|
||||
{-2,-25},{-2,-24},{-2,-23},{-2,-22},{-2,-21},{-2,-17},{-2,-16},{-2,-15},{-2,-8},{-2,-7},{-2,-6},{-2,-3},{-2,-2},{-2,-1},{-2,0},{-2,3},{-2,4},{-2,5},{-2,6},{-2,9},{-2,10},{-2,11},{-2,18},{-2,19},{-2,20},{-2,24},{-2,25},{-2,26},{-2,27},{-2,28},
|
||||
{-2,31},{-2,32},{-2,33},{-2,34},{-2,37},{-2,38},{-2,39},{-2,40},{-2,43},{-2,44},{-2,45},{-2,46},{-1,-47},{-1,-46},{-1,-43},{-1,-42},{-1,-41},{-1,-40},{-1,-37},{-1,-36},{-1,-29},{-1,-28},{-1,-25},{-1,-24},{-1,-23},{-1,-22},{-1,-21},{-1,-20},{-1,-17},{-1,-16},
|
||||
{-1,-15},{-1,-14},{-1,-13},{-1,-12},{-1,-9},{-1,-8},{-1,-7},{-1,-6},{-1,-3},{-1,-2},{-1,5},{-1,6},{-1,9},{-1,10},{-1,11},{-1,12},{-1,15},{-1,16},{-1,17},{-1,18},{-1,19},{-1,20},{-1,23},{-1,24},{-1,25},{-1,26},{-1,27},{-1,28},{-1,31},{-1,32},
|
||||
{-1,39},{-1,40},{-1,43},{-1,44},{-1,45},{-1,46},{-1,49},{-1,50},{0,-47},{0,-46},{0,-43},{0,-42},{0,-41},{0,-40},{0,-37},{0,-36},{0,-29},{0,-28},{0,-25},{0,-24},{0,-23},{0,-22},{0,-21},{0,-20},{0,-17},{0,-16},{0,-15},{0,-14},{0,-13},{0,-12},
|
||||
{0,-9},{0,-8},{0,-7},{0,-6},{0,-3},{0,-2},{0,5},{0,6},{0,9},{0,10},{0,11},{0,12},{0,15},{0,16},{0,17},{0,18},{0,19},{0,20},{0,23},{0,24},{0,25},{0,26},{0,27},{0,28},{0,31},{0,32},{0,39},{0,40},{0,43},{0,44},
|
||||
{0,45},{0,46},{0,49},{0,50},{1,-43},{1,-42},{1,-41},{1,-40},{1,-37},{1,-36},{1,-35},{1,-34},{1,-31},{1,-30},{1,-29},{1,-28},{1,-25},{1,-24},{1,-23},{1,-22},{1,-21},{1,-17},{1,-16},{1,-15},{1,-8},{1,-7},{1,-6},{1,-3},{1,-2},{1,-1},
|
||||
{1,0},{1,3},{1,4},{1,5},{1,6},{1,9},{1,10},{1,11},{1,18},{1,19},{1,20},{1,24},{1,25},{1,26},{1,27},{1,28},{1,31},{1,32},{1,33},{1,34},{1,37},{1,38},{1,39},{1,40},{1,43},{1,44},{1,45},{1,46},{2,-44},{2,-43},
|
||||
{2,-42},{2,-41},{2,-40},{2,-37},{2,-36},{2,-35},{2,-34},{2,-31},{2,-30},{2,-29},{2,-28},{2,-25},{2,-24},{2,-23},{2,-22},{2,-18},{2,-17},{2,-16},{2,-7},{2,-6},{2,-3},{2,-2},{2,-1},{2,0},{2,3},{2,4},{2,5},{2,6},{2,9},{2,10},
|
||||
{2,19},{2,20},{2,21},{2,25},{2,26},{2,27},{2,28},{2,31},{2,32},{2,33},{2,34},{2,37},{2,38},{2,39},{2,40},{2,43},{2,44},{2,45},{2,46},{2,47},{3,-47},{3,-46},{3,-45},{3,-44},{3,-43},{3,-37},{3,-36},{3,-35},{3,-34},{3,-19},
|
||||
{3,-18},{3,-17},{3,-13},{3,-12},{3,-11},{3,-10},{3,-2},{3,-1},{3,0},{3,1},{3,2},{3,3},{3,4},{3,5},{3,13},{3,14},{3,15},{3,16},{3,20},{3,21},{3,22},{3,37},{3,38},{3,39},{3,40},{3,46},{3,47},{3,48},{3,49},{3,50},
|
||||
{4,-47},{4,-46},{4,-45},{4,-44},{4,-37},{4,-36},{4,-35},{4,-34},{4,-19},{4,-18},{4,-13},{4,-12},{4,-11},{4,-10},{4,-1},{4,0},{4,1},{4,2},{4,3},{4,4},{4,13},{4,14},{4,15},{4,16},{4,21},{4,22},{4,37},{4,38},{4,39},{4,40},
|
||||
{4,47},{4,48},{4,49},{4,50},{5,-46},{5,-45},{5,-44},{5,-39},{5,-38},{5,-37},{5,-36},{5,-35},{5,-31},{5,-30},{5,-25},{5,-24},{5,-23},{5,-22},{5,-12},{5,-11},{5,-10},{5,-6},{5,-5},{5,8},{5,9},{5,13},{5,14},{5,15},{5,25},{5,26},
|
||||
{5,27},{5,28},{5,33},{5,34},{5,38},{5,39},{5,40},{5,41},{5,42},{5,47},{5,48},{5,49},{6,-45},{6,-44},{6,-39},{6,-38},{6,-37},{6,-36},{6,-31},{6,-30},{6,-29},{6,-25},{6,-24},{6,-23},{6,-22},{6,-21},{6,-11},{6,-10},{6,-7},{6,-6},
|
||||
{6,-5},{6,-4},{6,7},{6,8},{6,9},{6,10},{6,13},{6,14},{6,24},{6,25},{6,26},{6,27},{6,28},{6,32},{6,33},{6,34},{6,39},{6,40},{6,41},{6,42},{6,47},{6,48},{7,-45},{7,-44},{7,-30},{7,-29},{7,-28},{7,-24},{7,-23},{7,-22},
|
||||
{7,-21},{7,-20},{7,-17},{7,-16},{7,-15},{7,-14},{7,-7},{7,-6},{7,-5},{7,-4},{7,-1},{7,0},{7,1},{7,2},{7,3},{7,4},{7,7},{7,8},{7,9},{7,10},{7,17},{7,18},{7,19},{7,20},{7,23},{7,24},{7,25},{7,26},{7,27},{7,31},
|
||||
{7,32},{7,33},{7,47},{7,48},{8,-45},{8,-44},{8,-43},{8,-29},{8,-28},{8,-27},{8,-23},{8,-22},{8,-21},{8,-20},{8,-17},{8,-16},{8,-15},{8,-14},{8,-13},{8,-8},{8,-7},{8,-6},{8,-5},{8,-1},{8,0},{8,1},{8,2},{8,3},{8,4},{8,8},
|
||||
{8,9},{8,10},{8,11},{8,16},{8,17},{8,18},{8,19},{8,20},{8,23},{8,24},{8,25},{8,26},{8,30},{8,31},{8,32},{8,46},{8,47},{8,48},{9,-44},{9,-43},{9,-42},{9,-33},{9,-32},{9,-29},{9,-28},{9,-27},{9,-26},{9,-23},{9,-22},{9,-21},
|
||||
{9,-20},{9,-17},{9,-16},{9,-15},{9,-14},{9,-13},{9,-12},{9,-9},{9,-8},{9,-7},{9,0},{9,1},{9,2},{9,3},{9,10},{9,11},{9,12},{9,15},{9,16},{9,17},{9,18},{9,19},{9,20},{9,23},{9,24},{9,25},{9,26},{9,29},{9,30},{9,31},
|
||||
{9,32},{9,35},{9,36},{9,45},{9,46},{9,47},{10,-43},{10,-42},{10,-34},{10,-33},{10,-32},{10,-29},{10,-28},{10,-27},{10,-26},{10,-23},{10,-22},{10,-21},{10,-20},{10,-17},{10,-16},{10,-15},{10,-14},{10,-13},{10,-12},{10,-9},{10,-8},{10,1},{10,2},{10,11},
|
||||
{10,12},{10,15},{10,16},{10,17},{10,18},{10,19},{10,20},{10,23},{10,24},{10,25},{10,26},{10,29},{10,30},{10,31},{10,32},{10,35},{10,36},{10,37},{10,45},{10,46},{11,-39},{11,-38},{11,-35},{11,-34},{11,-33},{11,-32},{11,-29},{11,-28},{11,-27},{11,-16},
|
||||
{11,-15},{11,-14},{11,-13},{11,-5},{11,-4},{11,-3},{11,-2},{11,5},{11,6},{11,7},{11,8},{11,16},{11,17},{11,18},{11,19},{11,30},{11,31},{11,32},{11,35},{11,36},{11,37},{11,38},{11,41},{11,42},{12,-39},{12,-38},{12,-35},{12,-34},{12,-33},{12,-32},
|
||||
{12,-29},{12,-28},{12,-15},{12,-14},{12,-5},{12,-4},{12,-3},{12,-2},{12,5},{12,6},{12,7},{12,8},{12,17},{12,18},{12,31},{12,32},{12,35},{12,36},{12,37},{12,38},{12,41},{12,42},{13,-43},{13,-42},{13,-39},{13,-38},{13,-37},{13,-36},{13,-35},{13,-34},
|
||||
{13,-33},{13,-19},{13,-18},{13,-9},{13,-8},{13,-4},{13,-3},{13,-2},{13,1},{13,2},{13,5},{13,6},{13,7},{13,11},{13,12},{13,21},{13,22},{13,36},{13,37},{13,38},{13,39},{13,40},{13,41},{13,42},{13,45},{13,46},{14,-43},{14,-42},{14,-39},{14,-38},
|
||||
{14,-37},{14,-36},{14,-35},{14,-34},{14,-20},{14,-19},{14,-18},{14,-17},{14,-10},{14,-9},{14,-8},{14,-7},{14,-3},{14,-2},{14,1},{14,2},{14,5},{14,6},{14,10},{14,11},{14,12},{14,13},{14,20},{14,21},{14,22},{14,23},{14,37},{14,38},{14,39},{14,40},
|
||||
{14,41},{14,42},{14,45},{14,46},{15,-43},{15,-42},{15,-31},{15,-30},{15,-27},{15,-26},{15,-21},{15,-20},{15,-19},{15,-18},{15,-17},{15,-16},{15,-15},{15,-14},{15,-11},{15,-10},{15,-9},{15,-8},{15,-7},{15,-6},{15,1},{15,2},{15,9},{15,10},{15,11},{15,12},
|
||||
{15,13},{15,14},{15,17},{15,18},{15,19},{15,20},{15,21},{15,22},{15,23},{15,24},{15,29},{15,30},{15,33},{15,34},{15,45},{15,46},{16,-43},{16,-42},{16,-32},{16,-31},{16,-30},{16,-27},{16,-26},{16,-25},{16,-21},{16,-20},{16,-19},{16,-18},{16,-17},{16,-16},
|
||||
{16,-15},{16,-14},{16,-11},{16,-10},{16,-9},{16,-8},{16,-7},{16,-6},{16,0},{16,1},{16,2},{16,3},{16,9},{16,10},{16,11},{16,12},{16,13},{16,14},{16,17},{16,18},{16,19},{16,20},{16,21},{16,22},{16,23},{16,24},{16,28},{16,29},{16,30},{16,33},
|
||||
{16,34},{16,35},{16,45},{16,46},{17,-43},{17,-42},{17,-35},{17,-34},{17,-33},{17,-32},{17,-31},{17,-26},{17,-25},{17,-24},{17,-15},{17,-14},{17,-10},{17,-9},{17,-8},{17,-7},{17,-6},{17,-1},{17,0},{17,1},{17,2},{17,3},{17,4},{17,9},{17,10},{17,11},
|
||||
{17,12},{17,13},{17,17},{17,18},{17,27},{17,28},{17,29},{17,34},{17,35},{17,36},{17,37},{17,38},{17,45},{17,46},{18,-43},{18,-42},{18,-41},{18,-35},{18,-34},{18,-33},{18,-32},{18,-25},{18,-24},{18,-23},{18,-15},{18,-14},{18,-13},{18,-9},{18,-8},{18,-7},
|
||||
{18,-6},{18,-2},{18,-1},{18,0},{18,1},{18,2},{18,3},{18,4},{18,5},{18,9},{18,10},{18,11},{18,12},{18,16},{18,17},{18,18},{18,26},{18,27},{18,28},{18,35},{18,36},{18,37},{18,38},{18,44},{18,45},{18,46},{19,-42},{19,-41},{19,-40},{19,-39},
|
||||
{19,-38},{19,-29},{19,-28},{19,-25},{19,-24},{19,-23},{19,-22},{19,-21},{19,-20},{19,-19},{19,-18},{19,-15},{19,-14},{19,-13},{19,-12},{19,-3},{19,-2},{19,-1},{19,4},{19,5},{19,6},{19,15},{19,16},{19,17},{19,18},{19,21},{19,22},{19,23},{19,24},{19,25},
|
||||
{19,26},{19,27},{19,28},{19,31},{19,32},{19,41},{19,42},{19,43},{19,44},{19,45},{20,-41},{20,-40},{20,-39},{20,-38},{20,-37},{20,-29},{20,-28},{20,-25},{20,-24},{20,-23},{20,-22},{20,-21},{20,-20},{20,-19},{20,-18},{20,-15},{20,-14},{20,-13},{20,-12},{20,-3},
|
||||
{20,-2},{20,5},{20,6},{20,15},{20,16},{20,17},{20,18},{20,21},{20,22},{20,23},{20,24},{20,25},{20,26},{20,27},{20,28},{20,31},{20,32},{20,40},{20,41},{20,42},{20,43},{20,44},{21,-38},{21,-37},{21,-36},{21,-29},{21,-28},{21,-19},{21,-18},{21,-15},
|
||||
{21,-14},{21,-13},{21,-9},{21,-8},{21,-7},{21,-6},{21,1},{21,2},{21,9},{21,10},{21,11},{21,12},{21,16},{21,17},{21,18},{21,21},{21,22},{21,31},{21,32},{21,39},{21,40},{21,41},{22,-37},{22,-36},{22,-30},{22,-29},{22,-28},{22,-19},{22,-18},{22,-15},
|
||||
{22,-14},{22,-9},{22,-8},{22,-7},{22,-6},{22,-5},{22,0},{22,1},{22,2},{22,3},{22,8},{22,9},{22,10},{22,11},{22,12},{22,17},{22,18},{22,21},{22,22},{22,31},{22,32},{22,33},{22,39},{22,40},{23,-33},{23,-32},{23,-31},{23,-30},{23,-29},{23,-25},
|
||||
{23,-24},{23,-23},{23,-22},{23,-19},{23,-18},{23,-9},{23,-8},{23,-7},{23,-6},{23,-5},{23,-4},{23,-1},{23,0},{23,1},{23,2},{23,3},{23,4},{23,7},{23,8},{23,9},{23,10},{23,11},{23,12},{23,21},{23,22},{23,25},{23,26},{23,27},{23,28},{23,32},
|
||||
{23,33},{23,34},{23,35},{23,36},{24,-33},{24,-32},{24,-31},{24,-30},{24,-25},{24,-24},{24,-23},{24,-22},{24,-19},{24,-18},{24,-17},{24,-9},{24,-8},{24,-7},{24,-6},{24,-5},{24,-4},{24,-1},{24,0},{24,1},{24,2},{24,3},{24,4},{24,7},{24,8},{24,9},
|
||||
{24,10},{24,11},{24,12},{24,20},{24,21},{24,22},{24,25},{24,26},{24,27},{24,28},{24,33},{24,34},{24,35},{24,36},{25,-39},{25,-38},{25,-37},{25,-36},{25,-24},{25,-23},{25,-22},{25,-19},{25,-18},{25,-17},{25,-16},{25,-6},{25,-5},{25,-4},{25,-1},{25,0},
|
||||
{25,1},{25,2},{25,3},{25,4},{25,7},{25,8},{25,9},{25,19},{25,20},{25,21},{25,22},{25,25},{25,26},{25,27},{25,39},{25,40},{25,41},{25,42},{26,-39},{26,-38},{26,-37},{26,-36},{26,-23},{26,-22},{26,-19},{26,-18},{26,-17},{26,-16},{26,-15},{26,-5},
|
||||
{26,-4},{26,-1},{26,0},{26,1},{26,2},{26,3},{26,4},{26,7},{26,8},{26,18},{26,19},{26,20},{26,21},{26,22},{26,25},{26,26},{26,39},{26,40},{26,41},{26,42},{27,-38},{27,-37},{27,-36},{27,-29},{27,-28},{27,-27},{27,-26},{27,-16},{27,-15},{27,-14},
|
||||
{27,-9},{27,-8},{27,11},{27,12},{27,17},{27,18},{27,19},{27,29},{27,30},{27,31},{27,32},{27,39},{27,40},{27,41},{28,-37},{28,-36},{28,-30},{28,-29},{28,-28},{28,-27},{28,-26},{28,-15},{28,-14},{28,-10},{28,-9},{28,-8},{28,-7},{28,10},{28,11},{28,12},
|
||||
{28,13},{28,17},{28,18},{28,29},{28,30},{28,31},{28,32},{28,33},{28,39},{28,40},{29,-33},{29,-32},{29,-31},{29,-30},{29,-29},{29,-28},{29,-27},{29,-26},{29,-21},{29,-20},{29,-19},{29,-18},{29,-11},{29,-10},{29,-9},{29,-8},{29,-7},{29,-6},{29,-1},{29,0},
|
||||
{29,1},{29,2},{29,3},{29,4},{29,9},{29,10},{29,11},{29,12},{29,13},{29,14},{29,21},{29,22},{29,23},{29,24},{29,29},{29,30},{29,31},{29,32},{29,33},{29,34},{29,35},{29,36},{30,-33},{30,-32},{30,-31},{30,-30},{30,-29},{30,-28},{30,-27},{30,-26},
|
||||
{30,-22},{30,-21},{30,-20},{30,-19},{30,-18},{30,-11},{30,-10},{30,-9},{30,-8},{30,-7},{30,-6},{30,-5},{30,-1},{30,0},{30,1},{30,2},{30,3},{30,4},{30,8},{30,9},{30,10},{30,11},{30,12},{30,13},{30,14},{30,21},{30,22},{30,23},{30,24},{30,25},
|
||||
{30,29},{30,30},{30,31},{30,32},{30,33},{30,34},{30,35},{30,36},{31,-32},{31,-31},{31,-30},{31,-29},{31,-28},{31,-27},{31,-23},{31,-22},{31,-21},{31,-15},{31,-14},{31,-6},{31,-5},{31,-4},{31,-1},{31,0},{31,3},{31,4},{31,7},{31,8},{31,9},{31,17},
|
||||
{31,18},{31,24},{31,25},{31,26},{31,30},{31,31},{31,32},{31,33},{31,34},{31,35},{32,-31},{32,-30},{32,-29},{32,-28},{32,-23},{32,-22},{32,-16},{32,-15},{32,-14},{32,-5},{32,-4},{32,-1},{32,0},{32,3},{32,4},{32,7},{32,8},{32,17},{32,18},{32,19},
|
||||
{32,25},{32,26},{32,31},{32,32},{32,33},{32,34},{33,-30},{33,-29},{33,-28},{33,-23},{33,-22},{33,-17},{33,-16},{33,-15},{33,-11},{33,-10},{33,-9},{33,-8},{33,11},{33,12},{33,13},{33,14},{33,18},{33,19},{33,20},{33,25},{33,26},{33,31},{33,32},{33,33},
|
||||
{34,-29},{34,-28},{34,-23},{34,-22},{34,-17},{34,-16},{34,-12},{34,-11},{34,-10},{34,-9},{34,-8},{34,11},{34,12},{34,13},{34,14},{34,15},{34,19},{34,20},{34,25},{34,26},{34,31},{34,32},{35,-17},{35,-16},{35,-13},{35,-12},{35,-11},{35,-10},{35,-9},{35,-3},
|
||||
{35,-2},{35,-1},{35,0},{35,3},{35,4},{35,5},{35,6},{35,12},{35,13},{35,14},{35,15},{35,16},{35,19},{35,20},{36,-17},{36,-16},{36,-13},{36,-12},{36,-11},{36,-10},{36,-4},{36,-3},{36,-2},{36,-1},{36,0},{36,3},{36,4},{36,5},{36,6},{36,7},
|
||||
{36,13},{36,14},{36,15},{36,16},{36,19},{36,20},{37,-27},{37,-26},{37,-25},{37,-24},{37,-21},{37,-20},{37,-13},{37,-12},{37,-5},{37,-4},{37,-3},{37,-2},{37,-1},{37,0},{37,1},{37,2},{37,3},{37,4},{37,5},{37,6},{37,7},{37,8},{37,15},{37,16},
|
||||
{37,23},{37,24},{37,27},{37,28},{37,29},{37,30},{38,-27},{38,-26},{38,-25},{38,-24},{38,-21},{38,-20},{38,-19},{38,-13},{38,-12},{38,-5},{38,-4},{38,-3},{38,-2},{38,-1},{38,0},{38,1},{38,2},{38,3},{38,4},{38,5},{38,6},{38,7},{38,8},{38,15},
|
||||
{38,16},{38,22},{38,23},{38,24},{38,27},{38,28},{38,29},{38,30},{39,-26},{39,-25},{39,-24},{39,-20},{39,-19},{39,-18},{39,-13},{39,-12},{39,-11},{39,-10},{39,-5},{39,-4},{39,7},{39,8},{39,13},{39,14},{39,15},{39,16},{39,21},{39,22},{39,23},{39,27},
|
||||
{39,28},{39,29},{40,-25},{40,-24},{40,-19},{40,-18},{40,-13},{40,-12},{40,-11},{40,-10},{40,-5},{40,-4},{40,7},{40,8},{40,13},{40,14},{40,15},{40,16},{40,21},{40,22},{40,27},{40,28},{41,-19},{41,-18},{41,-1},{41,0},{41,1},{41,2},{41,3},{41,4},
|
||||
{41,21},{41,22},{42,-19},{42,-18},{42,-17},{42,-1},{42,0},{42,1},{42,2},{42,3},{42,4},{42,20},{42,21},{42,22},{43,-18},{43,-17},{43,-16},{43,-15},{43,-14},{43,-13},{43,-12},{43,-9},{43,-8},{43,-1},{43,0},{43,1},{43,2},{43,3},{43,4},{43,11},
|
||||
{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)
|
||||
237
modules/WarpPoints/warp-system.lua
Normal file
237
modules/WarpPoints/warp-system.lua
Normal file
@@ -0,0 +1,237 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
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-----------------------------------------------------------
|
||||
|
||||
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 warp_radius = 4
|
||||
local spawn_warp_scale = 5
|
||||
local warp_tile = 'tutorial-grid'
|
||||
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
|
||||
|
||||
local function remove_warp_point(name)
|
||||
local warp = _warps().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
|
||||
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}}}
|
||||
for _,entity in pairs(entities) do if entity.name ~= 'player' then entity.destroy() end end
|
||||
end
|
||||
end
|
||||
end
|
||||
surface.set_tiles(tiles)
|
||||
if warp.tag.valid then warp.tag.destroy() end
|
||||
_warps().warps[name] = nil
|
||||
Gui.left.update('warp-list')
|
||||
end
|
||||
|
||||
local function make_warp_point(position,surface,force,name)
|
||||
local warp = _warps().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
|
||||
if x^2+y^2 < warp_radius^2 then
|
||||
table.insert(base_tiles,{name=warp_tile,position={x+offset.x,y+offset.y}})
|
||||
end
|
||||
end
|
||||
end
|
||||
surface.set_tiles(base_tiles)
|
||||
-- this adds the patern and entities
|
||||
for _,position in pairs(warp_tiles) do
|
||||
table.insert(tiles,{name=warp_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(warp_entities) 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
|
||||
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')
|
||||
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{
|
||||
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)
|
||||
end)
|
||||
|
||||
local go_to_warp = Gui.inputs.add{
|
||||
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]
|
||||
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 Ranking.get_rank(player):allowed('always-warp') then
|
||||
event.element.parent.parent.parent.parent.style.visible = false
|
||||
_warps().cooldowns[event.player_index] = warp_limit
|
||||
end
|
||||
end)
|
||||
|
||||
Gui.left.add{
|
||||
name='warp-list',
|
||||
caption='item/'..warp_item,
|
||||
tooltip={'warp-system.tooltip'},
|
||||
draw=function(frame)
|
||||
local player = Game.get_player(frame.player_index)
|
||||
frame.caption={'warp-system.name'}
|
||||
local warp_list = frame.add{
|
||||
type='scroll-pane',
|
||||
direction='vertical',
|
||||
vertical_scroll_policy='auto',
|
||||
horizontal_scroll_policy='never'
|
||||
}
|
||||
warp_list.vertical_scroll_policy = 'auto'
|
||||
warp_list.style.maximal_height = 150
|
||||
local table = warp_list.add{
|
||||
type='table',
|
||||
column_count=2
|
||||
}
|
||||
for name,warp in pairs(_warps().warps) do
|
||||
if not warp.tag or not warp.tag.valid then
|
||||
player.force.add_chart_tag(warp.surface,{
|
||||
position=warp.position,
|
||||
text='Warp: '..name,
|
||||
icon={type='item',name=warp_item}
|
||||
})
|
||||
end
|
||||
table.add{
|
||||
type='label',
|
||||
caption=name,
|
||||
style='caption_label'
|
||||
}
|
||||
local _flow = table.add{
|
||||
type='flow',
|
||||
name=name
|
||||
}
|
||||
local btn = go_to_warp:draw(_flow)
|
||||
btn.style.height = 20
|
||||
btn.style.width = 20
|
||||
if Ranking.get_rank(player):allowed('make-warp') and name ~= 'Spawn' then
|
||||
local btn = remove_warp:draw(_flow)
|
||||
btn.style.height = 20
|
||||
btn.style.width = 20
|
||||
end
|
||||
end
|
||||
local cooldown = _warps().cooldowns[player.index] or 0
|
||||
if cooldown > 0 then frame.style.visible = false return
|
||||
elseif Ranking.get_rank(player):allowed('always-warp') then return
|
||||
elseif player.surface.get_tile(player.position).name == warp_tile
|
||||
and player.surface.name == 'nauvis'
|
||||
then return
|
||||
elseif player.position.x^2+player.position.y^2 < (warp_radius*spawn_warp_scale)^2 then return
|
||||
else frame.style.visible = false end
|
||||
end,
|
||||
can_open=function(player)
|
||||
local cooldown = _warps().cooldowns[player.index] or 0
|
||||
if Ranking.get_rank(player):allowed('always-warp') then return true
|
||||
elseif player.surface.get_tile(player.position).name == warp_tile
|
||||
and player.surface.name == 'nauvis'
|
||||
then return true
|
||||
elseif player.position.x^2+player.position.y^2 < (warp_radius*spawn_warp_scale)^2 then return true
|
||||
elseif cooldown > 0 then return {'warp-system.cooldown',cooldown}
|
||||
else return {'warp-system.not-on-warp'} end
|
||||
end,
|
||||
open_on_join=true
|
||||
}
|
||||
|
||||
Event.register(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
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Event.register(defines.events.on_player_changed_position, function(event)
|
||||
local player = Game.get_player(event)
|
||||
local cooldown = _warps().cooldowns[player.index] or 0
|
||||
local tile = player.surface.get_tile(player.position).name
|
||||
if not Ranking.get_rank(player):allowed('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
|
||||
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
|
||||
end
|
||||
end)
|
||||
|
||||
Event.register(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}})
|
||||
local tag = player.force.add_chart_tag(player.surface,{
|
||||
position={0,0},
|
||||
text='Warp: Spawn',
|
||||
icon={type='item',name=warp_item}
|
||||
})
|
||||
_warps().warps['Spawn'] = {tag=tag,surface=player.surface,position={0,0}}
|
||||
end
|
||||
end)
|
||||
145
modules/WornPaths/paths.lua
Normal file
145
modules/WornPaths/paths.lua
Normal file
@@ -0,0 +1,145 @@
|
||||
-- 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
|
||||
]]
|
||||
Reference in New Issue
Block a user