From f73f1011d452bf4d281965de0b68fd934e47d76d Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Sun, 24 Jun 2018 19:14:28 +0100 Subject: [PATCH] Added Modules to be converted --- to convert/Addons/Admin/admin.lua | 229 +++++++++++++++ to convert/Addons/Admin/afk-kick.lua | 39 +++ to convert/Addons/Admin/auto-chat.lua | 134 +++++++++ to convert/Addons/Admin/auto-message.lua | 61 ++++ to convert/Addons/Admin/base-damage.lua | 47 ++++ to convert/Addons/Admin/discord.lua | 54 ++++ to convert/Addons/Admin/inventory-search.lua | 79 ++++++ to convert/Addons/Admin/player-info.lua | 40 +++ to convert/Addons/Admin/reports.lua | 276 +++++++++++++++++++ to convert/Addons/Admin/tree-decon.lua | 54 ++++ to convert/Addons/Commands/admin.lua | 81 ++++++ to convert/Addons/Commands/bonus.lua | 66 +++++ to convert/Addons/Commands/cheat-mode.lua | 15 + to convert/Addons/Commands/home.lua | 37 +++ to convert/Addons/Commands/kill.lua | 21 ++ to convert/Addons/Commands/repair.lua | 47 ++++ to convert/Addons/Commands/tags.lua | 30 ++ to convert/Addons/Commands/tp.lua | 31 +++ to convert/Addons/Guis/admin-gui.lua | 177 ++++++++++++ to convert/Addons/Guis/announcements.lua | 99 +++++++ to convert/Addons/Guis/game-settings.lua | 182 ++++++++++++ to convert/Addons/Guis/player-list.lua | 115 ++++++++ to convert/Addons/Guis/polls.lua | 260 +++++++++++++++++ to convert/Addons/Guis/rank-changer.lua | 132 +++++++++ to convert/Addons/Guis/readme.lua | 132 +++++++++ to convert/Addons/Guis/reports.lua | 53 ++++ to convert/Addons/Guis/rockets.lua | 104 +++++++ to convert/Addons/Guis/science.lua | 102 +++++++ to convert/Addons/Guis/tasklist.lua | 193 +++++++++++++ to convert/Addons/Guis/warp-system.lua | 237 ++++++++++++++++ to convert/Addons/load.lua | 49 ++++ to convert/Addons/playerRanks.lua | 224 +++++++++++++++ to convert/StandAlone/body-marker.lua | 28 ++ to convert/StandAlone/colours.lua | 32 +++ to convert/StandAlone/health.lua | 29 ++ to convert/StandAlone/load.lua | 16 ++ to convert/StandAlone/paths.lua | 103 +++++++ to convert/StandAlone/spawn.lua | 213 ++++++++++++++ to convert/StandAlone/starting-items.lua | 32 +++ 39 files changed, 3853 insertions(+) create mode 100644 to convert/Addons/Admin/admin.lua create mode 100644 to convert/Addons/Admin/afk-kick.lua create mode 100644 to convert/Addons/Admin/auto-chat.lua create mode 100644 to convert/Addons/Admin/auto-message.lua create mode 100644 to convert/Addons/Admin/base-damage.lua create mode 100644 to convert/Addons/Admin/discord.lua create mode 100644 to convert/Addons/Admin/inventory-search.lua create mode 100644 to convert/Addons/Admin/player-info.lua create mode 100644 to convert/Addons/Admin/reports.lua create mode 100644 to convert/Addons/Admin/tree-decon.lua create mode 100644 to convert/Addons/Commands/admin.lua create mode 100644 to convert/Addons/Commands/bonus.lua create mode 100644 to convert/Addons/Commands/cheat-mode.lua create mode 100644 to convert/Addons/Commands/home.lua create mode 100644 to convert/Addons/Commands/kill.lua create mode 100644 to convert/Addons/Commands/repair.lua create mode 100644 to convert/Addons/Commands/tags.lua create mode 100644 to convert/Addons/Commands/tp.lua create mode 100644 to convert/Addons/Guis/admin-gui.lua create mode 100644 to convert/Addons/Guis/announcements.lua create mode 100644 to convert/Addons/Guis/game-settings.lua create mode 100644 to convert/Addons/Guis/player-list.lua create mode 100644 to convert/Addons/Guis/polls.lua create mode 100644 to convert/Addons/Guis/rank-changer.lua create mode 100644 to convert/Addons/Guis/readme.lua create mode 100644 to convert/Addons/Guis/reports.lua create mode 100644 to convert/Addons/Guis/rockets.lua create mode 100644 to convert/Addons/Guis/science.lua create mode 100644 to convert/Addons/Guis/tasklist.lua create mode 100644 to convert/Addons/Guis/warp-system.lua create mode 100644 to convert/Addons/load.lua create mode 100644 to convert/Addons/playerRanks.lua create mode 100644 to convert/StandAlone/body-marker.lua create mode 100644 to convert/StandAlone/colours.lua create mode 100644 to convert/StandAlone/health.lua create mode 100644 to convert/StandAlone/load.lua create mode 100644 to convert/StandAlone/paths.lua create mode 100644 to convert/StandAlone/spawn.lua create mode 100644 to convert/StandAlone/starting-items.lua diff --git a/to convert/Addons/Admin/admin.lua b/to convert/Addons/Admin/admin.lua new file mode 100644 index 00000000..7523c739 --- /dev/null +++ b/to convert/Addons/Admin/admin.lua @@ -0,0 +1,229 @@ +--[[ +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----------------------------------------------------------- + +Admin = Admin or {} + +local function append_name(reason,name) + local reason = reason or 'No Reason' + if not string.find(string.lower(reason),string.lower(name)) then return reason..' - '..name + else return reason end +end + +local function open(player,pre_select_player,pre_select_action) + if Admin.center then Gui.center.clear(player) Admin.center.open(player,pre_select_player,pre_select_action) end +end + +function Admin.allowed(player) + local player = Game.get_player(player) + local lowest_admin_power = Ranking.get_group('Admin').lowest.power + return lowest_admin_power >= Ranking.get_rank(player).power +end + +function Admin.btn_flow(frame,buttons) + local frame = frame.add{ + type='flow', + name='admin' + } + frame.add{ + type='label', + caption='', + name='player' + }.style.visible = false + local function format(btn) + btn.style.height = 30 + btn.style.width = 30 + end + if not buttons or buttons.ban then format(Admin.ban_btn:draw(frame)) end + if not buttons or buttons.kick then format(Admin.kick_btn:draw(frame)) end + if not buttons or buttons.jail then format(Admin.jail_btn:draw(frame)) end + if not buttons or buttons.go_to then format(Admin.go_to_btn:draw(frame)) end + if not buttons or buttons.bring then format(Admin.bring_btn:draw(frame)) end + return frame.player +end + +function Admin.take_action(action,player,by_player,reason) + if action == 'Ban' then Admin.ban(player,by_player,reason) + elseif action == 'Temp Ban' and Admin.temp_ban then Admin.temp_ban(player,by_player,reason) + elseif action == 'Kick' then Admin.kick(player,by_player,reason) + elseif action == 'Jail' then Admin.jail(player,by_player,reason) + elseif action == 'GoTo' then Admin.go_to(player,by_player) + elseif action == 'Bring' then Admin.bring(player,by_player) + end +end + +local inventorys = { + defines.inventory.player_main, + defines.inventory.player_quickbar, + defines.inventory.player_trash, + defines.inventory.player_guns, + defines.inventory.player_ammo, + defines.inventory.player_armor, + defines.inventory.player_armor +} + +function Admin.move_item_to_spawn(item,surface,chests) + local chests = chests or surface.find_entities_filtered{area={{-10,-10},{10,10}},name='iron-chest'} or {} + local chest = nil + while not chest or not chest.get_inventory(defines.inventory.chest).can_insert(item) do + chest = table.remove(chests,1) + if not chest then chest = surface.create_entity{ + name='iron-chest', + position=surface.find_non_colliding_position('iron-chest',{0,0},32,1) + } end + end + chest.get_inventory(defines.inventory.chest).insert(item) + table.insert(chests,chest) + return chests +end + +function Admin.move_inventory(player) + local player = Game.get_player(player) + if not player then return end + local chests = player.surface.find_entities_filtered{area={{-10,-10},{10,10}},name='iron-chest'} or {} + for _,_inventory in pairs(inventorys) do + local inventory = player.get_inventory(_inventory) + if inventory then + for item,count in pairs(inventory.get_contents()) do + local item = {name=item,count=count} + chests = Admin.move_item_to_spawn(item,player.surface,chests) + end + inventory.clear() + end + end +end + +Admin.ban_btn = Gui.inputs.add{ + type='button', + name='admin-ban', + caption='utility/danger_icon', + tooltip={'admin-commands.tooltip-ban'} +}:on_event('click',function(event) + local parent = event.element.parent + pre_select_player = parent.player and parent.player.caption or nil + open(event.player_index,pre_select_player,'Ban') +end) + +function Admin.ban(player,by_player,reason) + local player = Game.get_player(player) + local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '' + local reason = append_name(reason,by_player_name) + Sync.emit_embeded{ + title='Player Ban', + color=Color.to_hex(defines.text_color.crit), + description='There was a player banned.', + ['Player:']='<>'..player.name, + ['By:']='<>'..by_player_name, + ['Reason:']=reason + } + Admin.move_inventory(player) + Server.interface(game.ban_player,true,player,reason) +end + +Admin.kick_btn = Gui.inputs.add{ + type='button', + name='admin-kick', + caption='utility/warning_icon', + tooltip={'admin-commands.tooltip-kick'} +}:on_event('click',function(event) + local parent = event.element.parent + pre_select_player = parent.player and parent.player.caption or nil + open(event.player_index,pre_select_player,'Kick') +end) + +function Admin.kick(player,by_player,reason) + local player = Game.get_player(player) + local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '' + local reason = append_name(reason,by_player_name) + Sync.emit_embeded{ + title='Player Kick', + color=Color.to_hex(defines.text_color.high), + description='There was a player kicked.', + ['Player:']='<>'..player.name, + ['By:']='<>'..by_player_name, + ['Reason:']=reason + } + Admin.move_inventory(player) + Server.interface(game.kick_player,true,player,reason) +end + +Admin.jail_btn = Gui.inputs.add{ + type='button', + name='admin-jail', + caption='utility/clock', + tooltip={'admin-commands.tooltip-jail'} +}:on_event('click',function(event) + local parent = event.element.parent + pre_select_player = parent.player and parent.player.caption or nil + open(event.player_index,pre_select_player,'Jail') +end) + +function Admin.jail(player,by_player,reason) + local player = Game.get_player(player) + local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '' + local reason = append_name(reason,by_player_name) + Sync.emit_embeded{ + title='Player Jail', + color=Color.to_hex(defines.text_color.med), + description='There was a player jailed.', + ['Player:']='<>'..player.name, + ['By:']='<>'..by_player_name, + ['Reason:']=reason + } + Admin.move_inventory(player) + Ranking._presets().last_jail = player.name + Server.interface(Ranking.give_rank,true,player,'Jail',by_player_name) +end + +Admin.go_to_btn = Gui.inputs.add{ + type='button', + name='admin-go-to', + caption='utility/export_slot', + tooltip={'admin-commands.tooltip-go-to'} +}:on_event('click',function(event) + local parent = event.element.parent + pre_select_player = parent.player and parent.player.caption or nil + Admin.go_to(pre_select_player,event.player_index) +end) + +function Admin.go_to(player,by_player) + local player = Game.get_player(player) + local _player = Game.get_player(by_player) + _player.teleport(player.surface.find_non_colliding_position('player',player.position,32,1),player.surface) +end + +Admin.bring_btn = Gui.inputs.add{ + type='button', + name='admin-bring', + caption='utility/import_slot', + tooltip={'admin-commands.tooltip-bring'} +}:on_event('click',function(event) + local parent = event.element.parent + pre_select_player = parent.player and parent.player.caption or nil + Admin.bring(pre_select_player,event.player_index) +end) + +function Admin.bring(player,by_player) + local player = Game.get_player(player) + local _player = Game.get_player(by_player) + if not player or not _player then return end + player.teleport(_player.surface.find_non_colliding_position('player',_player.position,32,1),_player.surface) +end + +function Admin.tp(from_playaer, to_player) + local _from_player = Game.get_player(from_player) + local _to_player = Game.get_player(to_player) + + if not _from_player or not _to_player then return end + + if Game.players[_from_player].health >= 0 then return end + if Game.players[_to_player].health >= 0 then return end + + _from_player.teleport(_to_player.surface.find_non_colliding_position('player',_to_player.position,32,1),_to_player.surface) +end diff --git a/to convert/Addons/Admin/afk-kick.lua b/to convert/Addons/Admin/afk-kick.lua new file mode 100644 index 00000000..68a66a00 --- /dev/null +++ b/to convert/Addons/Admin/afk-kick.lua @@ -0,0 +1,39 @@ +--[[ +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----------------------------------------------------------- + +function get_allowed_afk_time(player) + local rank = Ranking.get_rank(player) + local count = #game.connected_players + local base = rank.base_afk_time or false + if not base then return false end + return (base/5)*count +end + +Event.register(-1,function(event) + Server.new_thread{ + name='afk-kick', + }:on_event('tick',function(self) + if (game.tick%3600) ~= 0 then return end + for _,player in pairs(game.connected_players) do + local afk = #game.connected_players < 3 and 10 or get_allowed_afk_time(player) + if afk then + if player.afk_time > afk*3600 then game.kick_player(player,'AFK For Too Long ('..math.floor(afk)..' Minutes)') end + end + end + end):on_event('error',function(self,err) + Sync.emit_embeded{ + title='Auto Kick Error', + color=Color.to_hex(defines.text_color.bg), + description='Auto Kick Error - Closed Thread', + Error=err + } + self:close() + end):open() +end) diff --git a/to convert/Addons/Admin/auto-chat.lua b/to convert/Addons/Admin/auto-chat.lua new file mode 100644 index 00000000..2fd5cd8f --- /dev/null +++ b/to convert/Addons/Admin/auto-chat.lua @@ -0,0 +1,134 @@ +--[[ +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----------------------------------------------------------- + +-- white spaces removed and made into lower +-- these messages are sent only to the player +local messages = { + ['discord']={'chat-bot.discord'}, + ['expgaming']={'chat-bot.website'}, + ['website']={'chat-bot.website'}, + ['command']={'chat-bot.custom-commands'}, + ['commands']={'chat-bot.custom-commands'}, + ['softmod']={'chat-bot.softmod'}, + ['script']={'chat-bot.softmod'}, + ['link']={'chat-bot.links'}, + ['links']={'chat-bot.links'}, + ['loop']={'chat-bot.loops'}, + ['loops']={'chat-bot.loops'}, + --Thadius suggestion start + ['rhd']={'chat-bot.lhd'}, + --Thadius suggestion end + ['roundabout']={'chat-bot.loops'}, + ['roundabouts']={'chat-bot.loops'}, + ['afk']=function(_player) local max=_player for _,player in pairs(game.connected_players) do if max.afk_time < player.afk_time then max=player end end return {'chat-bot.afk',max.name,tick_to_display_format(max.afk_time)} end +} +-- white spaces removed and made into lower +-- these are global chat commands that can be used +-- comands start with ! (all messages are also commands) +local command_syntax = '!' +local commands = { + ['online']=function(player) return {'chat-bot.players-online',#game.connected_players} end, + ['playtime']=function(player) return {'chat-bot.map-time',tick_to_display_format(game.tick)} end, + ['players']=function(player) return {'chat-bot.players',#game.players} end, + ['dev']={'chat-bot.not-real-dev'}, + ['blame']=function(player) local names = {'Cooldude2606','arty714','badgamernl',player.name} return {'chat-bot.blame',names[math.random(#names)]} end, + ['readme']={'chat-bot.read-readme'}, + ['magic']={'chat-bot.magic'}, + ['aids']={'chat-bot.aids'}, + ['riot']={'chat-bot.riot'}, + ['lenny']={'chat-bot.lenny'}, + ['wiki']={'chat-bot.wiki'}, + ['evolution']=function(player) return {'chat-bot.current-evolution',string.format('%.2f',game.forces['enemy'].evolution_factor)} end, + --Jokes about food and drink + ['whattoeat']={'chat-bot.food'}, + ['makepopcorn']=function(player) Server.new_thread{ + timeout=math.floor(180*(math.random()+0.5)),data=player.name + }:on_event('timeout',function(self) + if self.data then game.print{'chat-bot.message',{'chat-bot.get-popcorn-2',self.data}} end + end):open() return {'chat-bot.get-popcorn-1'} end, + ['orderpizza']=function(player) Server.new_thread{ + timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true + }:on_event('timeout',function(self) + if self.data[2]==0 then game.print{'chat-bot.message',{'chat-bot.order-pizza-2',self.data[1]}} + elseif self.data[2]==1 then game.print{'chat-bot.message',{'chat-bot.order-pizza-3',self.data[1]}} self.reopen = false + end + self.data[2]=self.data[2]+1 + end):open() return {'chat-bot.order-pizza-1'} end, + ['passsomesnaps']=function(player) Server.new_thread{ + timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true + }:on_event('timeout',function(self) + if self.data[2]==0 then game.print{'chat-bot.message',{'chat-bot.get-snaps-2',self.data[1]}} + elseif self.data[2]==1 then game.print{'chat-bot.message',{'chat-bot.get-snaps-3',self.data[1]}} self.reopen = false + end + self.data[2]=self.data[2]+1 + end):open() return {'chat-bot.get-snaps-1'} end, + ['makecocktail']=function(player) Server.new_thread{ + timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true + }:on_event('timeout',function(self) + if self.data[2]==0 then game.print{'chat-bot.message',{'chat-bot.get-cocktail-2',self.data[1]}} + elseif self.data[2]==1 then game.print{'chat-bot.message',{'chat-bot.get-cocktail-3',self.data[1]}} self.reopen = false + end + self.data[2]=self.data[2]+1 + end):open() return {'chat-bot.get-cocktail-1'} end, + ['makecoffee']=function(player) Server.new_thread{ + timeout=math.floor(180*(math.random()+0.5)),data=player.name + }:on_event('timeout',function(self) + if self.data then game.print{'chat-bot.message',{'chat-bot.make-coffee-2',self.data}} end + end):open() return {'chat-bot.make-coffee-1'} end, + ['orderpizza']=function(player) Server.new_thread{ + timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true + }:on_event('timeout',function(self) + if self.data[2]==0 then game.print{'chat-bot.message',{'chat-bot.order-pizza-2',self.data[1]}} + elseif self.data[2]==1 then game.print{'chat-bot.message',{'chat-bot.order-pizza-3',self.data[1]}} self.reopen = false + end + self.data[2]=self.data[2] + 1 + end):open() return {'chat-bot.order-pizza-1'} end, + ['maketea']=function(player) Server.new_thread{ + timeout=math.floor(180*(math.random()+0.5)),data=player.name + }:on_event('timeout',function(self) + if self.data then game.print{'chat-bot.message',{'chat-bot.make-tea-2',self.data}} end + end):open() return {'chat-bot.make-tea-1'} end, + ['meadplease']=function(player) Server.new_thread{ + timeout=math.floor(180*(math.random()+0.5)),data=player.name + }:on_event('timeout',function(self) + if self.data then game.print{'chat-bot.message',{'chat-bot.get-mead-2',self.data}} end + end):open() return {'chat-bot.get-mead-1'} end, + ['passabeer']=function(player) Server.new_thread{ + timeout=math.floor(180*(math.random()+0.5)),data=player.name + }:on_event('timeout',function(self) + if self.data then game.print{'chat-bot.message',{'chat-bot.get-beer-2',self.data}} end + end):open() return {'chat-bot.get-beer-1'} end +} + +Event.register(defines.events.on_console_chat,function(event) + local player = Game.get_player(event) + if not player then return end + local player_message = event.message:lower():gsub("%s+", "") + local allowed = Ranking.get_rank(player):allowed('global-chat') + for to_find,message in pairs(messages) do + if player_message:match(command_syntax..to_find) then + if allowed then + if is_type(message,'function') then message=message(player) end + game.print{'chat-bot.message',message} + else player_return({'chat-bot.rank-error'},nil,player) end + elseif player_message:match(to_find) then + if is_type(message,'function') then message=message(player) end + player_return({'chat-bot.message',message},nil,player) + end + end + for to_find,message in pairs(commands) do + if player_message:match(command_syntax..to_find) then + if allowed then + if is_type(message,'function') then message=message(player) end + game.print{'chat-bot.message',message} + else player_return({'chat-bot.rank-error'},nil,player) end + end + end +end) diff --git a/to convert/Addons/Admin/auto-message.lua b/to convert/Addons/Admin/auto-message.lua new file mode 100644 index 00000000..9e0deb5b --- /dev/null +++ b/to convert/Addons/Admin/auto-message.lua @@ -0,0 +1,61 @@ +--[[ +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='auto-message', + timeout=54000, -- 3240000 = 15 hours dont make the mistake i did, 54000 is 15 minutes + reopen=true, + data={ + high_rank= 'Owner', + low_rank= 'Regular', + low={ + {'chat-bot.join-us'}, + {'chat-bot.discord'}, + {'chat-bot.website'}, + {'chat-bot.custom-commands'}, + {'chat-bot.read-readme'} + } + } + }:on_event('timeout',function(self) + local data = self.data + if not data.high_rank or not data.low_rank + or not data.low then self.reopen = false return end + local _high = Ranking.get_rank(data.high_rank) + game.print{'chat-bot.message',{'chat-bot.players-online',#game.connected_players}} + game.print{'chat-bot.message',{'chat-bot.map-time',tick_to_display_format(game.tick)}} + --[[local _low = Ranking.get_rank(data.low_rank) + Ranking.print(_high,{'chat-bot.players-online',#game.connected_players},nil,true) + Ranking.print(_high,{'chat-bot.map-time',tick_to_display_format(game.tick)},nil,true) + for _,line in pairs(data.low) do + Ranking.print(_low,line,nil,true) + end]] + self.reopen = true + end):on_event(defines.events.on_player_joined_game,function(self,event) + local player = Game.get_player(event) + if not player then return end + local data = self.data + if not data.high_rank or not data.low_rank + or not data.low then self.reopen = false return end + -- idk but this stoped working for no appent reason so i added more checks for nil values + if Ranking.get_rank(player).power <= Ranking.get_rank(data.low_rank).power then return end + for _,message in pairs(data.low) do + player_return({'chat-bot.message',message},nil,player) + end + end):on_event('error',function(self,err) + Sync.emit_embeded{ + title='Auto Message Error', + color=Color.to_hex(defines.text_color.bg), + description='Auto Message Error - Closed Thread', + Error=err + } + self.reopen = false + self:close() + end):open() +end) \ No newline at end of file diff --git a/to convert/Addons/Admin/base-damage.lua b/to convert/Addons/Admin/base-damage.lua new file mode 100644 index 00000000..7954705d --- /dev/null +++ b/to convert/Addons/Admin/base-damage.lua @@ -0,0 +1,47 @@ +--[[ +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----------------------------------------------------------- + +-- alot of this is copied from redmew - but it has been reworked to use the ExpCore +-- https://github.com/Valansch/RedMew/blob/develop/nuke_control.lua + +local function _damage(reset) + global.addons = not reset and global.addons or {} + global.addons.damage = not reset and global.addons.damage or {} + return global.addons.damage +end + +Event.register(defines.events.on_entity_damaged,function(event) + if event.force == nil or event.force ~= event.entity.force then return end + if event.cause == nil or event.cause.name ~= 'player' then return end + local player = Game.get_player(event.cause.player) + if Ranking.get_rank(player):allowed('base-damage') then return end + if not _damage()[player.index] then _damage()[player.index] = {0,0} end + _damage()[player.index][1] = _damage()[player.index][1]+event.final_damage_amount + if _damage()[player.index][2] < event.tick-300 then + _damage()[player.index][2] = event.tick + player_return({'base-damage.used'},defines.text_color.med,player) + Admin.give_warning(player,'','Damaged something inside the base. Total Delt: '.._damage()[player.index][1],4) + end +end) + +Event.register(defines.events.on_player_ammo_inventory_changed,function(event) + local player = Game.get_player(event) + if Ranking.get_rank(player):allowed('nuke') then return end + local found = player.remove_item({name='atomic-bomb',count=1000}) + if not _damage()[player.index] then _damage()[player.index] = {0,0} end + if found > 0 then + Admin.move_item_to_spawn({name='atomic-bomb',count=found},player.surface) + player_return({'base-damage.nuke'},defines.text_color.med,player) + if _damage()[player.index][2] < event.tick-300 then + _damage()[player.index][2] = event.tick + Admin.give_warning(player,'','Nukes are not allowed for your rank.',4) + end + end +end) \ No newline at end of file diff --git a/to convert/Addons/Admin/discord.lua b/to convert/Addons/Admin/discord.lua new file mode 100644 index 00000000..9ec03be5 --- /dev/null +++ b/to convert/Addons/Admin/discord.lua @@ -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(defines.events.on_console_command,function(event) + local command = event.command + local args = {} + if event.parameters then for word in event.parameters:gmatch('%S+') do table.insert(args,word) end end + local data = {} + data.title = string.gsub(command,'^%l',string.upper) + data.by = event.player_index and game.players[event.player_index].name or '' + if data.by == '' then return end + if command == 'config' or command == 'banlist' then + Sync.emit_embeded{ + title='Edit To '..data.title, + color=Color.to_hex(defines.text_color.bg), + description='A player edited the '..command..'.', + ['By:']=data.by, + ['Edit:']=table.concat(args,' ',1) + } + else + if command == 'ban' then + data.colour = Color.to_hex(defines.text_color.crit) + data.reason = table.concat(args,' ',2) + elseif command == 'kick' then + data.colour = Color.to_hex(defines.text_color.high) + data.reason = table.concat(args,' ',2) + elseif command == 'unban' then data.colour = Color.to_hex(defines.text_color.low) + elseif command == 'mute' then data.colour = Color.to_hex(defines.text_color.med) + elseif command == 'unmute' then data.colour = Color.to_hex(defines.text_color.low) + elseif command == 'promote' then data.colour = Color.to_hex(defines.text_color.info) + elseif command == 'demote' then data.colour = Color.to_hex(defines.text_color.info) + elseif command == 'purge' then data.colour = Color.to_hex(defines.text_color.med) + else return end + data.username = args[1] + if not Game.get_player(data.username) then return end + if string.sub(command,-1) == 'e' then data.command = command..'d' else data.command = command..'ed' end + data.reason = data.reason and data.reason ~= '' and data.reason or 'No Reason Required' + Sync.emit_embeded{ + title='Player '..data.title, + color=data.colour, + description='There was a player '..data.command..'.', + ['Player:']='<>'..data.username, + ['By:']='<>'..data.by, + ['Reason:']=data.reason + } + end +end) \ No newline at end of file diff --git a/to convert/Addons/Admin/inventory-search.lua b/to convert/Addons/Admin/inventory-search.lua new file mode 100644 index 00000000..0ce81b4f --- /dev/null +++ b/to convert/Addons/Admin/inventory-search.lua @@ -0,0 +1,79 @@ +--[[ +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----------------------------------------------------------- + +-- removed from none admin ranks, no further action +local low_items = { + 'loader', + 'fast-loader', + 'express-loader', + 'small-plane', + 'player-port', + 'coin', + 'programmable-speaker' +} + +-- removed for admin and non-admin ranks, gives warnings to non-admins +local med_items = { + 'railgun', + 'railgun-dart', + 'belt-immunity-equipment' +} + +-- temp-ban for any rank, this is a very hard enforcement, admin ranks lose rank +local high_items = { + 'electric-energy-interface', + 'infinity-chest' +} + +local inventorys = { + defines.inventory.player_main, + defines.inventory.player_quickbar, + defines.inventory.player_trash +} + +local _root_tree = {low_items=low_items,med_items=med_items,high_items=high_items} + +local function take_action(player,item_name,category) + if category == 'low_items' then player_return({'inventory-search.low',item_name},defines.text_color.med,player) + elseif category == 'med_items' then player_return({'inventory-search.med',item_name},defines.text_color.high,player) Admin.give_warning(player,'','Found A Banned Item',5) + elseif category == 'high_items' then player_return({'inventory-search.high',item_name},defines.text_color.crit,player) Admin.temp_ban(player,'','Found A Banned Item') + else return end +end + +function search_player(player) + for category,items in pairs(_root_tree) do + if category ~= 'low_items' or not Ranking.get_rank(player):allowed('admin-items') then + for _,_inventory in pairs(inventorys) do + local inventory = player.get_inventory(_inventory) + if inventory then + for _,item in pairs(items) do + local found = inventory.remove(item) + if found > 0 then take_action(player,item,category) end + end + end + end + end + end +end + +Event.register({defines.events.on_player_main_inventory_changed,defines.events.on_player_quickbar_inventory_changed},function(event) + local player = Game.get_player(event) + if player and player.name == 'freek18' then search_player(player) end +end) + +Event.register(defines.events.on_tick,function(event) + if (game.tick%900) == 0 then + local players = game.connected_players + if #players == 0 then return end + local player = players[math.random(#players)] + if Ranking.get_rank(player):allowed('all-items') then return end + search_player(player) + end +end) \ No newline at end of file diff --git a/to convert/Addons/Admin/player-info.lua b/to convert/Addons/Admin/player-info.lua new file mode 100644 index 00000000..465a8a21 --- /dev/null +++ b/to convert/Addons/Admin/player-info.lua @@ -0,0 +1,40 @@ +--[[ +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----------------------------------------------------------- + +function get_player_info(player,frame,add_cam) + local player = Game.get_player(player) + if not player then return {} end + local _player = {} + _player.index = player.index + _player.name = player.name + _player.online = player.connected + _player.tag = player.tag + _player.color = player.color + _player.admin = player.admin + _player.online_time = player.online_time + _player.rank = Ranking.get_rank(player).name + _player.group = Ranking.get_group(player).name + if frame then + local frame = frame.add{type='frame',direction='vertical',style='image_frame'} + frame.style.width = 200 + frame.style.height = 275 + frame.add{type='label',caption={'player-info.name',_player.index,_player.name},style='caption_label'} + local _online = {'player-info.no'}; if _player.online then _online = {'player-info.yes'} end + frame.add{type='label',caption={'player-info.online',_online,tick_to_display_format(_player.online_time)}} + local _admin = {'player-info.no'}; if _player.admin then _admin = {'player-info.yes'} end + frame.add{type='label',caption={'player-info.admin',_admin}} + frame.add{type='label',caption={'player-info.group',_player.group}} + frame.add{type='label',caption={'player-info.rank',_player.rank}} + if add_cam then + Gui.cam_link{entity=player.character,frame=frame,width=200,height=150,zoom=0.5,respawn_open=true} + end + end + return _player +end \ No newline at end of file diff --git a/to convert/Addons/Admin/reports.lua b/to convert/Addons/Admin/reports.lua new file mode 100644 index 00000000..ccea1637 --- /dev/null +++ b/to convert/Addons/Admin/reports.lua @@ -0,0 +1,276 @@ +--[[ +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 report_to_warnings = 1 -- used in count_reports +local varified_to_warings = 3 -- used in count_reports +local reports_needed_for_jail = 6 +local min_time_to_remove_warning = 18000 -- this is in ticks +local take_action = 8 -- below this number no action is taken, the first admin given warning jumps to this number +local punishments = { + {'nothing'}, + {'nothing'}, + {'nothing'}, + {'nothing'}, + {'nothing'}, + {'message',{'reports.message'},defines.text_color.info}, + {'message',{'reports.message'},defines.text_color.info}, + {'report',{'reports.reported'},defines.text_color.med}, + {'message',{'reports.kick-warn'},defines.text_color.med}, + {'kick'}, + {'message',{'reports.temp-warn'},defines.text_color.high}, + {'temp-ban'}, + {'message',{'reports.ban-warn'},defines.text_color.high}, + {'message',{'reports.last-warn'},defines.text_color.crit}, + {'ban'} +} + +local actions = { + none=0, + report=1, + jail=2, + kick=3, + temp=4, + ban=5 +} + +local function valid_players(player,by_player) + local player = Game.get_player(player) + local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '' + local rank = Ranking.get_rank(by_player_name) + return player, by_player_name, rank +end + +local function _reports(reset) + global.addons = not reset and global.addons or {} + global.addons.reports = not reset and global.addons.reports or {warnings={},reports={},varified={},actions={}} + return global.addons.reports +end + +local function get_warnings(player) + local player = Game.get_player(player) + return _reports().warnings[player.name] or 0 +end + +local function report_message(player,by_player,reason) + local low_rank = Ranking.get_group('User').highest + local high_rank = Ranking.get_group('Admin').lowest + local player, by_player_name = valid_players(player,by_player) + if not player then return end + if _reports().actions[player.name] == actions.report then return end + Ranking.print(low_rank,{'reports.low-print',player.name,reason},defines.text_color.info,true) + Ranking.print(high_rank,{'reports.high-print',player.name,by_player_name,reason},defines.text_color.med) + Sync.emit_embeded{ + title='Player Report', + color=Color.to_hex(defines.text_color.med), + description='A player was reported.', + ['Player:']='<>'..player.name, + ['By:']='<>'..by_player_name, + ['Reason:']=reason + } +end + +local function count_reports(player) + local player = Game.get_player(player) + if not player then return 0 end + local _count = 0 + local data = _reports() + if data.reports[player.name] then + for _,report in pairs(data.reports[player.name]) do + _count=_count+report_to_warnings + end + end + if data.varified[player.name] then + for _,report in pairs(data.varified[player.name]) do + _count=_count+varified_to_warings + end + end + return _count +end + +local function cheak_reports(player) + local player = Game.get_player(player) + if not player then return end + local reports = count_reports(player) + if reports >= reports_needed_for_jail and _reports().actions[player.name] ~= 'report-jail' and Ranking.get_rank(player).group.name ~= 'Jail' then + _reports().actions[player.name] = actions.report + Admin.jail(player,'','Too many user reports. Contact an Admin to be unjailed.') + end +end + +local function give_punishment(player,by_player,reason) + local player, by_player_name = valid_players(player,by_player) + local warnings = get_warnings(player) + local punishment = punishments[warnings] + local reason = reason or 'No Other Reason' + if not punishment or punishment[1] == 'nothing' then return + elseif punishment[1] == 'message' then + local message = punishment[2] + local colour = punishment[3] + player_return(message,colour,player) + elseif punishment[1] == 'report' then + local message = punishment[2] + local colour = punishment[3] + player_return(message,colour,player) + report_message(player,'',reason) + elseif punishment[1] == 'kick' then + _reports().actions[player.name] = actions.kick + Admin.kick(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason) + elseif punishment[1] == 'temp-ban' then + --_reports().actions[player.name] = actions.temp -- see Admin.temp-ban + Admin.temp_ban(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason) + elseif punishment[1] == 'ban' then + _reports().actions[player.name] = actions.ban + Admin.ban(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason) + end +end + +function Admin.give_warning(player,by_player,reason,min) + local player, by_player_name = valid_players(player,by_player) + if not player then return end + local min = Game.get_player(by_player) and take_action or min or 0 + local warnings = get_warnings(player) + if warnings < min then warnings = min end + warnings = warnings+1 + _reports().warnings[player.name] = warnings + if warnings > take_action then + player_return({'reports.warning-given-by',by_player_name},defines.text_color.info,player) + game.print({'reports.player-warning',player.name,by_player_name,reason}) + end + give_punishment(player,by_player,reason) +end + +function Admin.report(player,by_player,reason) + local player, by_player_name = valid_players(player,by_player) + if not player or Ranking.get_rank(player):allowed('no-report') then return end + if Admin.is_banned(by_player) or Ranking.get_group(by_player).name == 'Jail' then return end + if Ranking.get_rank(by_player):allowed('varified') then + _reports().varified[player.name] = _reports().varified[player.name] or {} + local reports = _reports().varified[player.name] + for _,value in pairs(reports) do + if value[1] == by_player_name then return end + end + table.insert(reports,{by_player_name,reason}) + else + _reports().reports[player.name] = _reports().reports[player.name] or {} + local reports = _reports().reports[player.name] + for _,value in pairs(reports) do + if value[1] == by_player_name then return end + end + table.insert(reports,{by_player_name,reason}) + end + report_message(player,by_player,reason) + cheak_reports(player) +end + +function Admin.clear_warings(player,by_player,no_emit) + local player, by_player_name = valid_players(player,by_player) + if not player then return end + _reports().warnings[player.name]=0 + if not no_emit then + Sync.emit_embeded{ + title='Player Clear', + color=Color.to_hex(defines.text_color.low), + description='A player had their warnings cleared.', + ['Player:']='<>'..player.name, + ['By:']='<>'..by_player_name, + } + end +end + +function Admin.clear_reports(player,by_player,no_emit) + local player, by_player_name = valid_players(player,by_player) + if not player then return end + _reports().reports[player.name]={} + _reports().varified[player.name]={} + if not no_emit then + Sync.emit_embeded{ + title='Player Clear', + color=Color.to_hex(defines.text_color.low), + description='A player had their reports cleared.', + ['Player:']='<>'..player.name, + ['By:']='<>'..by_player_name, + } + end +end + +function Admin.clear_player(player,by_player) + local player, by_player_name = valid_players(player,by_player) + if not player then return end + Admin.clear_warings(player,by_player,true) + Admin.clear_reports(player,by_player,true) + _reports().actions[player.name]=actions.none + if Ranking.get_rank(player).group.name == 'Jail' then Server.interface(Ranking.revert,true,player,by_player) end + Sync.emit_embeded{ + title='Player Clear', + color=Color.to_hex(defines.text_color.low), + description='A player had their reports and warnings cleared.', + ['Player:']='<>'..player.name, + ['By:']='<>'..by_player_name, + } +end + +function Admin.temp_ban(player,by_player,reason) + local function append_name(reason,name) + local reason = reason or 'No Reason' + if not string.find(string.lower(reason),string.lower(name)) then return reason..' - '..name + else return reason end + end + local player, by_player_name = valid_players(player,by_player) + if not player or Admin.is_banned(player) then return end + _reports().actions[player.name] = actions.temp + Sync.emit_embeded{ + title='Player Temp-Ban', + color=Color.to_hex(defines.text_color.high), + description='A player was jailed.', + ['Player:']='<>'..player.name, + ['By:']='<>'..by_player_name, + ['Reason:']=append_name(reason,by_player_name) + } + game.print({'reports.temp-ban',player.name,by_player_name,reason},defines.text_color.info) + Admin.move_inventory(player) + Ranking._presets().last_jail = player.name + Server.interface(Ranking.give_rank,true,player,'Jail',by_player_name) +end + +function Admin.is_banned(player) + local player=Game.get_player(player) + if not player then return false end + local action = _reports().actions[player.name] + if action == actions.temp then return 'temp' + elseif action == actions.ban then return true + else return false end +end + +Event.register(defines.events.on_tick,function(event) + if not _reports().remove_warnings_time then + _reports().remove_warnings_time = {} + local highest = nil + for power,rank in pairs(Ranking._ranks()) do + if not highest and not rank:allowed('no-report') then highest = power-1 end + local _power = power; if highest then _power = power-highest end + if rank:allowed('no-report') then _reports().remove_warnings_time[power] = 0 + else _reports().remove_warnings_time[power] = min_time_to_remove_warning*_power end + end + end + if (game.tick % min_time_to_remove_warning) == 0 then + for name,warnings in pairs(_reports().warnings) do + if warnings > 0 then + local rank = Ranking.get_rank(name) + local time_to_remove = _reports().remove_warnings_time[rank.power] + if (game.tick % time_to_remove) == 0 then + _reports().warnings[name]=warnings-1 + if _reports().warnings[name] > 5 then + player_return({'reports.remove-warn',_reports().warnings[name],tick_to_display_format(time_to_remove)},defines.text_color.low,name) + end + end + end + end + end +end) diff --git a/to convert/Addons/Admin/tree-decon.lua b/to convert/Addons/Admin/tree-decon.lua new file mode 100644 index 00000000..78aa7bc1 --- /dev/null +++ b/to convert/Addons/Admin/tree-decon.lua @@ -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.text_color.crit,player) + local rank = Ranking.get_group('Admin').lowest + Ranking.print(rank,{'tree-decon.rank-print',player.name},defines.text_color.info) + Admin.give_warning(player,'','Trying To Decon The Base') + end + self.data.clear = game.tick + 10 + end + end + end):open() +end) \ No newline at end of file diff --git a/to convert/Addons/Commands/admin.lua b/to convert/Addons/Commands/admin.lua new file mode 100644 index 00000000..775df6d1 --- /dev/null +++ b/to convert/Addons/Commands/admin.lua @@ -0,0 +1,81 @@ +--[[ +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----------------------------------------------------------- + +commands.add_command('report', 'Reports a player', {'player','reason',true}, function(event,args) + local _player = Game.get_player(event) + local player = Game.get_player(args.player) + local reason = args.reason + if not player then player_return({'commands.invalid-player',args.player}) return commands.error end + if Admin.is_banned(player) then player_return({'reports.cant-report-ban',args.player}) return commands.error end + if Ranking.get_rank(player):allowed('no-report') then player_return({'reports.cant-report',args.player}) return commands.error end + for _,report in pairs(global.addons.reports.reports) do if report[1] == _player.name then player_return({'reports.cant-report',args.player}) return commands.error end end + for _,report in pairs(global.addons.reports.varified) do if report[1] == _player.name then player_return({'reports.cant-report',args.player}) return commands.error end end + Admin.report(player,event.player_index,reason) +end) + +commands.add_command('warn', 'Gives a player a warning', {'player','reason',true}, function(event,args) + local player = Game.get_player(args.player) + local reason = args.reason + if not player then player_return({'commands.invalid-player',args.player}) return commands.error end + if Admin.is_banned(player) then player_return({'reports.cant-report-ban',args.player}) return commands.error end + if Ranking.get_rank(player):allowed('no-report') then player_return({'reports.cant-report',args.player}) return commands.error end + Admin.give_warning(player,event.player_index,reason) +end) + +commands.add_command('jail', 'Jails a player', {'player','reason',true}, function(event,args) + local player = Game.get_player(args.player) + local reason = args.reason + if not player then player_return({'commands.invalid-player',args.player}) return commands.error end + if Ranking.get_rank(player):allowed('no-report') then player_return({'reports.cant-report',args.player}) return commands.error end + if Admin.is_banned(player) then player_return({'commands.cant-report-ban',args.player}) return commands.error end + Admin.jail(player,event.player_index,reason) +end) + +commands.add_command('unjail', 'Returns a player\'s old rank', {'player',true}, function(event,args) + local player = Game.get_player(args.player) + if not player then player_return({'commands.invalid-player',args.player}) return commands.error end + if Admin.is_banned(player) then player_return({'commands.cant-report-ban',args.player}) return commands.error end + Server.interface(Ranking.revert,true,player,event.player_index) +end) + +commands.add_command('temp-ban', 'Temporarily ban a player', {'player','reason',true}, function(event,args) + local player = Game.get_player(args.player) + local reason = args.reason + if not player then player_return({'commands.invalid-player',args.player}) return commands.error end + if Admin.is_banned(player) then player_return({'reports.cant-report-ban',args.player}) return commands.error end + Admin.temp_ban(player,event.player_index,reason) +end) + +commands.add_command('clear-inv', 'Clears a player\'s invetory', {'player'}, function(event,args) + local player = Game.get_player(args.player) + if not player then player_return({'commands.invalid-player',args.player}) return commands.error end + if Admin.is_banned(player) then player_return({'reports.cant-report-ban',args.player}) return commands.error end + Admin.move_inventory(player) +end) + +commands.add_command('clear-warnings', 'Clears a player\'s warnings', {'player'}, function(event,args) + local player = Game.get_player(args.player) + if not player then player_return({'commands.invalid-player',args.player}) return commands.error end + if Admin.is_banned(player) then player_return({'reports.cant-report-ban',args.player}) return commands.error end + Admin.clear_warings(player,event.player_index) +end) + +commands.add_command('clear-reports', 'Clears a player\'s reports', {'player'}, function(event,args) + local player = Game.get_player(args.player) + if not player then player_return({'commands.invalid-player',args.player}) return commands.error end + if Admin.is_banned(player) then player_return({'reports.cant-report-ban',args.player}) return commands.error end + Admin.clear_reports(player,event.player_index) +end) + +commands.add_command('clear-all', 'Clears a player of any temp-ban, reports or warnings', {'player'}, function(event,args) + local player = Game.get_player(args.player) + if not player then player_return({'commands.invalid-player',args.player}) return commands.error end + Admin.clear_player(player,event.player_index) +end) diff --git a/to convert/Addons/Commands/bonus.lua b/to convert/Addons/Commands/bonus.lua new file mode 100644 index 00000000..d38af150 --- /dev/null +++ b/to convert/Addons/Commands/bonus.lua @@ -0,0 +1,66 @@ +--[[ +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 settings = { + {key='character_mining_speed_modifier',scale=3}, + {key='character_crafting_speed_modifier',scale=3}, + {key='character_running_speed_modifier',scale=3}, + {key='character_build_distance_bonus',scale=20}, + {key='character_reach_distance_bonus',scale=20}, + {key='character_inventory_slots_bonus',scale=200} +} + +local function _bonus(reset) + global.addons = not reset and global.addons or {} + global.addons.bonus = not reset and global.addons.bonus or {} + return global.addons.bonus +end + +commands.add_command('bonus', 'Set your player bonus (default is 20, guest has 0)', {'bonus'}, function(event,args) + local player = Game.get_player(event) + local bonus = tonumber(args.bonus) + if not bonus or bonus < 0 or bonus > 50 then player_return{'commands.invalid-range',0,50} return commands.error end + for _,setting in pairs(settings) do player[setting.key] = setting.scale*math.floor(bonus)*0.01 end + _bonus()[player.index]=bonus + player_return('Bonus set to: '..math.floor(bonus)..'%') +end) + +Event.register(defines.events.rank_change,function(event) + local player = Game.get_player(event) + if event.new_rank:allowed('bonus') then + for _,setting in pairs(settings) do player[setting.key] = setting.scale*0.2 end + _bonus()[player.index]=20 + else + for _,setting in pairs(settings) do player[setting.key] = 0 end + _bonus()[player.index]=nil + end +end) + +Event.register(defines.events.on_player_respawned,function(event) + local player = Game.get_player(event) + local bonus = _bonus()[player.index] + if bonus then + for _,setting in pairs(settings) do player[setting.key] = setting.scale*math.floor(bonus)*0.01 end + end +end) + +Event.register(defines.events.on_pre_player_died,function(event) + local player = Game.get_player(event) + if Ranking.get_rank(player):allowed('bonus-respawn') then + player.ticks_to_respawn = 120 + -- manually dispatch death event because it is not fired when ticks_to_respawn is set pre death + Event.dispatch{ + name=defines.events.on_player_died, + tick=event.tick, + player_index=event.player_index, + cause = event.cause + } + end +end) diff --git a/to convert/Addons/Commands/cheat-mode.lua b/to convert/Addons/Commands/cheat-mode.lua new file mode 100644 index 00000000..7fc17e17 --- /dev/null +++ b/to convert/Addons/Commands/cheat-mode.lua @@ -0,0 +1,15 @@ +--[[ +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----------------------------------------------------------- + +commands.add_command('cheat-mode', 'Toggles cheat mode for a player', {'player'}, function(event,args) + local player = Game.get_player(args.player) + if not player then player_return({'commands.invalid-player',args.player}) return commands.error end + if player.cheat_mode == true then player.cheat_mode = false else player.cheat_mode = true end +end) diff --git a/to convert/Addons/Commands/home.lua b/to convert/Addons/Commands/home.lua new file mode 100644 index 00000000..5f7d92d8 --- /dev/null +++ b/to convert/Addons/Commands/home.lua @@ -0,0 +1,37 @@ +--[[ +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 _homes(reset) + global.addons = not reset and global.addons or {} + global.addons.homes = not reset and global.addons.homes or {} + return global.addons.homes +end + +commands.add_command('set-home', 'Set your home position', {}, function(event,args) + local player = Game.get_player(event) + if not _homes()[player.index] then _homes()[player.index] = {player.force.get_spawn_position(player.surface),player.force.get_spawn_position(player.surface)} end + _homes()[player.index][1] = {math.floor(player.position.x),math.floor(player.position.y)} + player_return('Home set at: ('..math.floor(player.position.x)..','..math.floor(player.position.y)..')') +end) + +commands.add_command('home', 'Go to you home position', {}, function(event,args) + local player = Game.get_player(event) + if not _homes()[player.index] then _homes()[player.index] = {player.force.get_spawn_position(player.surface),player.force.get_spawn_position(player.surface)} end + _homes()[player.index][2] = {math.floor(player.position.x),math.floor(player.position.y)} + player.teleport(player.surface.find_non_colliding_position('player',_homes()[player.index][1],32,1),player.surface) +end) + +commands.add_command('return', 'Return to your previous position after using /home', {}, function(event,args) + local player = Game.get_player(event) + if not _homes()[player.index] then _homes()[player.index] = {player.force.get_spawn_position(player.surface),player.force.get_spawn_position(player.surface)} end + local _temp = {math.floor(player.position.x),math.floor(player.position.y)} + player.teleport(player.surface.find_non_colliding_position('player',_homes()[player.index][2],32,1),player.surface) + _homes()[player.index][2] = _temp +end) diff --git a/to convert/Addons/Commands/kill.lua b/to convert/Addons/Commands/kill.lua new file mode 100644 index 00000000..a48f9143 --- /dev/null +++ b/to convert/Addons/Commands/kill.lua @@ -0,0 +1,21 @@ +--[[ +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----------------------------------------------------------- + +commands.add_command('kill', 'Kills a player. Must be either yourself (/kill self) or a person of a lower rank', {'player'}, function(event,args) + local _player = Game.get_player(event) + local player = Game.get_player(args.player) + if args.player ~= 'self' and not player then player_return({'commands.invalid-player',args.player}) return commands.error end + if args.player == 'self' or _player.name == player.name then + if _player.character then _player.character.die() else player_return({'commands.dead-player'}) return commands.error end + elseif Ranking.get_rank(player).power > Ranking.get_rank(_player).power then + if player.connected then else player_return({'commands.offline-player'}) return commands.error end + if player.character then player.character.die() else player_return({'commands.dead-player'}) return commands.error end + else player_return({'commands.unauthorized'}) return commands.error end +end) diff --git a/to convert/Addons/Commands/repair.lua b/to convert/Addons/Commands/repair.lua new file mode 100644 index 00000000..ed6a534f --- /dev/null +++ b/to convert/Addons/Commands/repair.lua @@ -0,0 +1,47 @@ +--[[ +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----------------------------------------------------------- + +-- Set an item to true to disallow it from being repaired +local disallow = { + ['loader']=true, + ['fast-loader']=true, + ['express-loader']=true, + ['electric-energy-interface']=true, + ['infinity-chest']=true +} + +local const = 100 +-- Given const = 100: admin+ has unlimited, admin has const (100), mod has const / 2 (50), member has const / 5 (20) + +commands.add_command('repair', 'Repairs all destoryed and damaged entites in an area.', {'range'}, function(event,args) + local range = tonumber(args.range) + local player = Game.get_player(event) + local rank = Ranking.get_rank(player) + local highest_admin_power = Ranking.get_group('Admin').highest.power-1 + local max_range = rank.power-highest_admin_power > 0 and const/(rank.power-highest_admin_power) or nil + local center = player and player.position or {x=0,y=0} + if not range or max_range and range > max_range then player_return({'commands.invalid-range',0,math.floor(max_range)}) return commands.error end + local area = {{center.x-range,center.y-range},{center.x+range,center.y+range}} + local max_time_to_live = 2^32 - 1 + local sq_range = range^2 + for key, entity in pairs(player.surface.find_entities_filtered({area=area,type='entity-ghost'})) do + if entity.force == player.force and (entity.position.x-center.x)^2+(entity.position.y-center.y)^2 < sq_range then + if disallow[entity.ghost_prototype.name] then + player_return('You have repaired: '..entity.name..' this item is not allowed.',defines.text_color.crit,player) + Admin.temp_ban(player,'','Attempt To Repair A Banned Item') + entity.destroy() + elseif entity.time_to_live ~= max_time_to_live then + entity.revive() end + end + end + for key, entity in pairs(player.surface.find_entities(area)) do + if entity.force == player.force and (entity.position.x-center.x)^2+(entity.position.y-center.y)^2 < sq_range and entity.health then entity.health = 10000 end + end +end) diff --git a/to convert/Addons/Commands/tags.lua b/to convert/Addons/Commands/tags.lua new file mode 100644 index 00000000..2b1defc5 --- /dev/null +++ b/to convert/Addons/Commands/tags.lua @@ -0,0 +1,30 @@ +--[[ +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 const = 20 +-- this is the max lenth of a tag + +commands.add_command('tag', 'Give yourself a custom tag. Use /tag-clear self to remove tag', {'tag',true}, function(event,args) + local player = Game.get_player(event) + local rank = Ranking.get_rank(player) + if string.len(args.tag) > const then player_return({'commands.invalid-length',const}) return commands.error end + player.tag = rank.tag..' - '..args.tag +end) + +commands.add_command('tag-clear', 'Removes a custom tag. Player can be self (/tag-clear self)', {'player'}, function(event,args) + local _player = Game.get_player(event) + local _rank = Ranking.get_rank(_player) + local player = Game.get_player(args.player) + local rank = Ranking.get_rank(player) + if args.player ~= 'self' and not player then player_return({'commands.invalid-player',args.player}) return commands.error end + if args.player == 'self' or _player.name == player.name then _player.tag = _rank.tag + elseif _rank.power < rank.power then player.tag = rank.tag + else player_return({'commands.unauthorized'}) return commands.error end +end) diff --git a/to convert/Addons/Commands/tp.lua b/to convert/Addons/Commands/tp.lua new file mode 100644 index 00000000..852f379d --- /dev/null +++ b/to convert/Addons/Commands/tp.lua @@ -0,0 +1,31 @@ +--[[ +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----------------------------------------------------------- + +commands.add_command('go-to', 'Go to a player\'s location', {'player'}, function(event,args) + local player = Game.get_player(args.player) + if not player then player_return({'commands.invalid-player',args.player}) return commands.error end + Admin.go_to(player,event) +end) + +commands.add_command('bring', 'Bring a player to your location', {'player'}, function(event,args) + local player = Game.get_player(args.player) + if not player then player_return({'commands.invalid-player',args.player}) return commands.error end + Admin.bring(player,event) +end) + +commands.add_command('tp', 'Teleport a player to another player\'s location', {'from', 'to'}, function(event,args) + local from_player = Game.get_player(args.from) + if not from_player then player_return({'commands.invalid-player',args.from_player}) return commands.error end + + local to_player = Game.get_player(args.to) + if not to_player then player_return({'commands.invalid-player',args.to_player}) return commands.error end + + Admin.tp(from_player, to_player) +end) diff --git a/to convert/Addons/Guis/admin-gui.lua b/to convert/Addons/Guis/admin-gui.lua new file mode 100644 index 00000000..3360a321 --- /dev/null +++ b/to convert/Addons/Guis/admin-gui.lua @@ -0,0 +1,177 @@ +--[[ +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----------------------------------------------------------- + +Admin = Admin or {} + +local get_player_info = get_player_info or function(player,frame) + frame.add{ + type='label', + caption={'admin-commands.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-admin-commands',false,'Show Offline',false,function(player,element) + element.parent['player-drop-down-admin-commands'].items = _players(player,element.parent,true) + element.parent['player-drop-down-admin-commands'].selected_index = 1 +end,function(player,element) + element.parent['player-drop-down-admin-commands'].items = _players(player,element.parent,false) + element.parent['player-drop-down-admin-commands'].selected_index = 1 +end) + +local player_drop_down = Gui.inputs.add_drop_down('player-drop-down-admin-commands',_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 = {'admin-commands.warning'} + else element.parent.warning.caption = '' end +end) + +local reason_input = Gui.inputs.add_text('reason-input-admin-commands',false,'Enter Reason',function(player,text,element) + if string.len(text) < 20 or text == 'Enter Reason' then + element.parent.warning.caption = {'admin-commands.short-reason'} + else + element.parent.warning.caption = '' + end +end) + +local function _actions(player) + return { + 'Select Action', + 'GoTo', + 'Bring', + 'Jail', + 'Kick', + 'Temp Ban', + 'Ban' + } +end + +local action_drop_down = Gui.inputs.add_drop_down('action-drop-down-rank-change',_actions,1,function(player,selected,items,element) + element.parent.parent.action.caption = selected + if selected == 'Jail' or selected == 'Kick' or selected == 'Ban' or selected == 'Temp Ban' then + element.parent['reason-input-admin-commands'].style.visible = true + else + element.parent['reason-input-admin-commands'].style.visible = false + end +end) + +local take_action = Gui.inputs.add{ + type='button', + name='admin-commands-take', + caption={'admin-commands.take-action'} +}:on_event('click',function(event) + local dropdowns = event.element.parent + local rank = Ranking.get_rank(event.player_index) + local _action= dropdowns.parent.action.caption ~= 'Select Action' and dropdowns.parent.action.caption or nil + local _player = Game.get_player(dropdowns.parent.player.caption) + if not _player or not _action then dropdowns.warning.caption = {'admin-commands.invalid'} return end + local _rank = Ranking.get_rank(_player) + if rank.power >= _rank.power then dropdowns.warning.caption = {'admin-commands.rank-high'} return end + local _reason = dropdowns['reason-input-admin-commands'] and dropdowns['reason-input-admin-commands'].text + if (_action == 'Jail' or _action == 'Kick' or _action == 'Ban' or _action == 'Temp Ban') and (_reason == 'Enter Reason' or string.len(_reason) < 20) then return end + Admin.take_action(_action,_player,event.player_index,_reason) + Gui.center.clear(event) +end) + +Admin.center = Gui.center.add{ + name='admin-commands', + caption='utility/danger_icon', + tooltip={'admin-commands.tooltip'}, + open=function(event,pre_select_player,pre_select_action) + local _player = Game.get_player(pre_select_player) + local player = Game.get_player(event) + local _center = Gui._get_data('center')['admin-commands'] + local center_flow = Gui.center.get_flow(player) + if center_flow[_center.name] then Gui.center.clear(player) return end + local center_frame = center_flow.add{ + name=_center.name, + type='frame', + direction='vertical', + style=mod_gui.frame_style + } + -- only edit i made was passing diffrent arguments to the draw function + local success, err = pcall(_center.draw,center_frame,_player,pre_select_action) + if not success then error(err) end + player.opened=center_frame + end, + draw=function(frame,pre_select_player,pre_select_action) + frame.caption={'admin-commands.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 = 280 + player_info_flow.style.width = 200 + local label = dropdowns.add{ + type='label', + caption={'admin-commands.message'} + } + label.style.single_line = false + label.style.width = 200 + online_check:draw(dropdowns) + local _drop = player_drop_down:draw(dropdowns) + if pre_select_player then Gui.set_dropdown_index(_drop,pre_select_player.name) end + local _drop = action_drop_down:draw(dropdowns) + Gui.set_dropdown_index(_drop,pre_select_action) + local _text = reason_input:draw(dropdowns) + if pre_select_action == 'Jail' or pre_select_action == 'Kick' or pre_select_action == 'Ban' then + _text.style.visible = true else _text.style.visible = false + end + if pre_select_player then get_player_info(pre_select_player,player_info_flow,true) end + _text.style.width = 200 + local label = dropdowns.add{ + name='warning', + type='label', + caption='', + style='bold_red_label' + } + label.style.single_line = false + label.style.width = 200 + take_action:draw(dropdowns) + local _caption = pre_select_player and pre_select_player.name or '' + frame.add{ + name='player', + type='label', + caption=_caption + }.style.visible = false + local _caption = pre_select_action or '' + frame.add{ + name='action', + type='label', + caption=_caption + }.style.visible = false + end +} \ No newline at end of file diff --git a/to convert/Addons/Guis/announcements.lua b/to convert/Addons/Guis/announcements.lua new file mode 100644 index 00000000..9de20b06 --- /dev/null +++ b/to convert/Addons/Guis/announcements.lua @@ -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._presets().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 +} \ No newline at end of file diff --git a/to convert/Addons/Guis/game-settings.lua b/to convert/Addons/Guis/game-settings.lua new file mode 100644 index 00000000..949a494f --- /dev/null +++ b/to convert/Addons/Guis/game-settings.lua @@ -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) \ No newline at end of file diff --git a/to convert/Addons/Guis/player-list.lua b/to convert/Addons/Guis/player-list.lua new file mode 100644 index 00000000..ff04748f --- /dev/null +++ b/to convert/Addons/Guis/player-list.lua @@ -0,0 +1,115 @@ +--[[ +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.player_list = not reset and global.addons.player_list or {update=0,delay=10,intervial=54000} + return global.addons.player_list +end + +local get_player_info = get_player_info or function(player,frame) + frame.add{ + type='label', + caption={'player-list.no-info-file'} + } +end + +local function update() + Gui.left.update('player-list') +end + +local function queue_update(tick) + local data = _global() + local tick = is_type(tick,'table') and tick.tick or is_type(tick,'number') and tick or game.tick + if tick + data.delay > data.update - data.intervial then + data.update = tick + data.delay + end +end + +local back_btn = Gui.inputs.add{ + type='button', + caption='utility/enter', + name='player-list-back' +}:on_event('click',function(event) + event.element.parent.parent.scroll.style.visible = true + event.element.parent.destroy() +end) + +Gui.left.add{ + name='player-list', + caption='entity/player', + tooltip={'player-list.tooltip'}, + draw=function(frame) + frame.caption = '' + local player_list = frame.add{ + name='scroll', + type = 'scroll-pane', + direction = 'vertical', + vertical_scroll_policy='auto', + horizontal_scroll_policy='never' + } + player_list.vertical_scroll_policy = 'auto' + player_list.style.maximal_height=195 + for _,rank in pairs(Ranking._ranks()) do + for _,player in pairs(rank:get_players(true)) do + local flow = player_list.add{type='flow'} + if rank.short_hand == '' then + flow.add{ + type='label', + name=player.name, + style='caption_label', + caption={'player-list.format-nil',tick_to_display_format(player.online_time),player.name} + }.style.font_color = rank.colour + else + flow.add{ + type='label', + name=player.name, + style='caption_label', + caption={'player-list.format',tick_to_display_format(player.online_time),player.name,rank.short_hand} + }.style.font_color = rank.colour + end + if Admin.report_btn then + if not rank:allowed('no-report') and player.index ~= frame.player_index then + local btn = Admin.report_btn:draw(flow) + btn.style.height = 20 + btn.style.width = 20 + end + end + end + end + end, + open_on_join=true +} + +Event.register(defines.events.on_tick,function(event) + local data = _global() + if event.tick > data.update then + update() + data.update = event.tick + data.intervial + end +end) + +Event.register(defines.events.on_gui_click,function(event) + if event.element and event.element.valid + and event.element.parent and event.element.parent.parent and event.element.parent.parent.parent + and event.element.parent.parent.parent.name == 'player-list' then else return end + if event.button == defines.mouse_button_type.right then else return end + local player_list = event.element.parent.parent.parent + player_list.scroll.style.visible = false + local flow = player_list.add{type='flow',direction='vertical'} + back_btn:draw(flow) + get_player_info(event.element.name,flow,true) + if Game.get_player(event.element.name) and event.player_index == Game.get_player(event.element.name).index then return end + if Admin and Admin.allowed(event.player_index) then Admin.btn_flow(flow).caption = event.element.name end +end) + +Event.register(defines.events.on_player_joined_game,queue_update) +Event.register(defines.events.on_player_left_game,queue_update) +Event.register(defines.events.rank_change,queue_update) \ No newline at end of file diff --git a/to convert/Addons/Guis/polls.lua b/to convert/Addons/Guis/polls.lua new file mode 100644 index 00000000..eb6d5c5c --- /dev/null +++ b/to convert/Addons/Guis/polls.lua @@ -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.text_color.info) + game.print({'polls.winner',highest[1]},defines.text_color.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 +} diff --git a/to convert/Addons/Guis/rank-changer.lua b/to convert/Addons/Guis/rank-changer.lua new file mode 100644 index 00000000..86c72a8b --- /dev/null +++ b/to convert/Addons/Guis/rank-changer.lua @@ -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 +} \ No newline at end of file diff --git a/to convert/Addons/Guis/readme.lua b/to convert/Addons/Guis/readme.lua new file mode 100644 index 00000000..09c2a895 --- /dev/null +++ b/to convert/Addons/Guis/readme.lua @@ -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)) diff --git a/to convert/Addons/Guis/reports.lua b/to convert/Addons/Guis/reports.lua new file mode 100644 index 00000000..5205775c --- /dev/null +++ b/to convert/Addons/Guis/reports.lua @@ -0,0 +1,53 @@ +--[[ +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 confirm_report = Gui.inputs.add{ + type='button', + name='admin-report-confirm', + caption='utility/spawn_flag', + tooltip={'reports.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={'reports.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={'reports.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) \ No newline at end of file diff --git a/to convert/Addons/Guis/rockets.lua b/to convert/Addons/Guis/rockets.lua new file mode 100644 index 00000000..6ef4ce44 --- /dev/null +++ b/to convert/Addons/Guis/rockets.lua @@ -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) \ No newline at end of file diff --git a/to convert/Addons/Guis/science.lua b/to convert/Addons/Guis/science.lua new file mode 100644 index 00000000..1cdf7887 --- /dev/null +++ b/to convert/Addons/Guis/science.lua @@ -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) \ No newline at end of file diff --git a/to convert/Addons/Guis/tasklist.lua b/to convert/Addons/Guis/tasklist.lua new file mode 100644 index 00000000..f4cb2262 --- /dev/null +++ b/to convert/Addons/Guis/tasklist.lua @@ -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 +} \ No newline at end of file diff --git a/to convert/Addons/Guis/warp-system.lua b/to convert/Addons/Guis/warp-system.lua new file mode 100644 index 00000000..b6f5c93f --- /dev/null +++ b/to convert/Addons/Guis/warp-system.lua @@ -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.text_color.med) return commands.error end + if _warps().warps[name] then player_return({'warp-system.name-used'},defines.text_color.med) return commands.error end + if position.x^2 + position.y^2 < 100 then player_return({'warp-system.too-close'},defines.text_color.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.text_color.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) \ No newline at end of file diff --git a/to convert/Addons/load.lua b/to convert/Addons/load.lua new file mode 100644 index 00000000..f5e4f41d --- /dev/null +++ b/to convert/Addons/load.lua @@ -0,0 +1,49 @@ +--[[ +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----------------------------------------------------------- +-- This file just contains all the diffrent requires + +-- Admin dir +verbose('Begain Admin Loading') +require('Admin/player-info') +require('Admin/admin') -- Used with Guis/admin-gui, but can work without +require('Admin/reports') -- This adds onto Admin/admin, adds report command and warnings, and temp ban +require('Admin/discord') +require('Admin/auto-message') +require('Admin/tree-decon') +require('Admin/inventory-search') +require('Admin/base-damage') +require('Admin/afk-kick') +require('Admin/auto-chat') + +-- Commands dir +verbose('Begain Command Loading') +require('Commands/cheat-mode') +require('Commands/kill') +require('Commands/repair') +require('Commands/bonus') +require('Commands/tags') +require('Commands/home') +require('Commands/tp') -- Requires Admin/admin +require('Commands/admin') -- Requires Admin/reports + +-- GUIs dir +verbose('Begain Gui Loading') +require('Guis/readme') +require('Guis/science') +require('Guis/rockets') +require('Guis/player-list') +require('Guis/tasklist') +require('Guis/warp-system') +require('Guis/polls') -- Too many desyncs +require('Guis/announcements') +require('Guis/rank-changer') +require('Guis/admin-gui') -- Used with Admin/admin, requires Admin/admin +require('Guis/reports') -- Requires Admin/reports +require('Guis/game-settings') \ No newline at end of file diff --git a/to convert/Addons/playerRanks.lua b/to convert/Addons/playerRanks.lua new file mode 100644 index 00000000..e4e532b1 --- /dev/null +++ b/to convert/Addons/playerRanks.lua @@ -0,0 +1,224 @@ +--[[ +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----------------------------------------------------------- + +--[[ + How to use groups: +name The name that you can use to reference it. +disallow If present then all ranks in this group will have this added to their disallow. +allow If present then all ranks in this group will have this added to their allow. +highest Assigned by the script to show the highest rank in this group. +lowest Assigned by the script to show the lowest rank in this group. +How to add ranks: +Name What will be used in the scripts and is often the best choice for display in text. +short_hand What can be used when short on space but the rank still need to be displayed. +tag The tag the player will gain when moved to the rank, it can be nil. +time Used for auto-rank feature where you are moved to the rank after a certain play time in minutes. +colour The RGB value that can be used to emphasise GUI elements based on rank. +power Assigned by the script based on their index in ranks, you can insert new ranks between current ones. +group Assigned by the script to show the group this rank is in. +disallow A list containing input actions that the user can not perform. +allow A list of custom commands and effects that that rank can use, all defined in the scripts. + +For allow, add the allow as the key and the value as true +Example: test for 'server-interface' => allow['server-interface'] = true + +For disallow, add to the list the end part of the input action +Example: defines.input_action.drop_item -> 'drop_item' +http://lua-api.factorio.com/latest/defines.html#defines.input_action +--]] + +-- See ExpCore/ranks.lua for examples - you add your own and edit pre-made ones here. + +local groups = Ranking._groups(true) + +groups['Root']:edit('allow',false,{ + ['player-list']=true, + ['readme']=true, + ['rockets']=true, + ['science']=true, + ['tasklist']=true, + ['rank-changer']=true, + ['admin-commands']=true, + ['warn']=true, + ['temp-ban']=true, + ['clear-warings']=true, + ['clear-reports']=true, + ['clear-all']=true, + ['clear-inv']=true, + ['announcements']=true, + ['warp-list']=true, + ['polls']=true, + ['admin-items']=true, + ['all-items']=true, + ['repair']=true, + ['global-chat']=true +}) +groups['Admin']:edit('allow',false,{ + ['player-list']=true, + ['readme']=true, + ['rockets']=true, + ['science']=true, + ['tasklist']=true, + ['rank-changer']=true, + ['admin-commands']=true, + ['warn']=true, + ['temp-ban']=true, + ['clear-warings']=true, + ['clear-reports']=true, + ['clear-all']=true, + ['clear-inv']=true, + ['announcements']=true, + ['warp-list']=true, + ['polls']=true, + ['global-chat']=true +}) +groups['User']:edit('allow',false,{ + ['player-list']=true, + ['readme']=true, + ['rockets']=true, + ['science']=true, + ['tasklist']=true, + ['report']=true, + ['warp-list']=true, + ['polls']=true +}) +groups['Jail']:edit('allow',false,{ + +}) + + + +groups['Root']:add_rank{ + name='Owner', + short_hand='Owner', + tag='[Owner]', + time=nil, + colour={r=170,g=0,b=0}, + is_admin = true, + is_spectator=true, + base_afk_time=false +} +groups['Root']:add_rank{ + name='Community Manager', + short_hand='Com Mngr', + tag='[Com Mngr]', + colour={r=150,g=68,b=161}, + is_admin = true, + is_spectator=true, + base_afk_time=false +} +groups['Root']:add_rank{ + name='Developer', + short_hand='Dev', + tag='[Dev]', + colour={r=179,g=125,b=46}, + is_admin = true, + is_spectator=true, + base_afk_time=false +} + +groups['Admin']:add_rank{ + name='Mod', + short_hand='Mod', + tag='[Mod]', + colour={r=0,g=170,b=0}, + disallow={ + 'server_command' + }, + is_admin = true, + is_spectator=true, + base_afk_time=false +} + +groups['User']:add_rank{ + name='Donator', + short_hand='P2W', + tag='[P2W]', + colour={r=233,g=63,b=233}, + power=0, + is_spectator=true, + base_afk_time=120 +} +groups['User']:add_rank{ + name='Veteran', + short_hand='Vet', + tag='[Veteran]', + time=600, + colour={r=140,g=120,b=200}, + power=1, + base_afk_time=60 +} +groups['User']:add_rank{ + name='Regular', + short_hand='Reg', + tag='[Regular]', + time=180, + colour={r=24,g=172,b=188}, + power=3, + base_afk_time=30 +} + +local ranks = Ranking._ranks(true) + +ranks['Developer']:edit('allow',false,{ + ['cheat-mode']=true +}) + +ranks['Admin']:edit('allow',false,{ + ['game-settings']=true, + ['always-warp']=true, + ['admin-items']=true +}) +ranks['Mod']:edit('allow',false,{ + ['go-to']=true, + ['bring']=true, + ['no-report']=true +}) + +ranks['Donator']:edit('allow',false,{ + ['global-chat']=true, + ['jail']=true, + ['unjail']=true, + ['set-home']=true, + ['home']=true, + ['return']=true, + ['bonus']=true, + ['bonus-respawn']=true +}) +ranks['Veteran']:edit('allow',false,{ + ['tree-decon']=true, + ['create-poll']=true, + ['repair']=true +}) +ranks['Member']:edit('allow',false,{ + ['edit-tasklist']=true, + ['make-warp']=true, + ['nuke']=true, + ['base-damage']=true, + ['varified']=true +}) +ranks['Regular']:edit('allow',false,{ + ['kill']=true, + ['decon']=true, + ['capsules']=true +}) +ranks['Guest']:edit('allow',false,{ + ['tag']=true, + ['tag-clear']=true, + ['report']=true +}) + +Ranking._base_preset{ + ['badgamernl']='Owner', + ['arty714']='Community Manager', + ['cooldude2606']='Developer', + ['mark9064']='Admin', + ['propangaseddy']='Admin' +} diff --git a/to convert/StandAlone/body-marker.lua b/to convert/StandAlone/body-marker.lua new file mode 100644 index 00000000..92ed9666 --- /dev/null +++ b/to convert/StandAlone/body-marker.lua @@ -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) \ No newline at end of file diff --git a/to convert/StandAlone/colours.lua b/to convert/StandAlone/colours.lua new file mode 100644 index 00000000..2bdb3299 --- /dev/null +++ b/to convert/StandAlone/colours.lua @@ -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) diff --git a/to convert/StandAlone/health.lua b/to convert/StandAlone/health.lua new file mode 100644 index 00000000..d753c72b --- /dev/null +++ b/to convert/StandAlone/health.lua @@ -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) \ No newline at end of file diff --git a/to convert/StandAlone/load.lua b/to convert/StandAlone/load.lua new file mode 100644 index 00000000..16841b94 --- /dev/null +++ b/to convert/StandAlone/load.lua @@ -0,0 +1,16 @@ +--[[ +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----------------------------------------------------------- +-- this file will just contain all the diffrent requires +require('colours') +require('health') +require('spawn') +require('starting-items') +require('paths') +require('body-marker') \ No newline at end of file diff --git a/to convert/StandAlone/paths.lua b/to convert/StandAlone/paths.lua new file mode 100644 index 00000000..a73439fb --- /dev/null +++ b/to convert/StandAlone/paths.lua @@ -0,0 +1,103 @@ +-- made by cooldude +-- idea from Mylon - Dirt Path + +local adjacency_boost = 10 -- makes paths more lickly to be next to each other +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']={40,'concrete'}, + ['refined-hazard-concrete-right']={40,'hazard-concrete-right'}, + ['refined-hazard-concrete-left']={40,'hazard-concrete-left'}, + ['concrete']={30,'stone-path'}, + ['hazard-concrete-right']={30,'stone-path'}, + ['hazard-concrete-left']={30,'stone-path'}, + ['stone-path']={25,'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 + 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 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 chance=chance*(adjacency_boost/count) count=count+1 end + end end + if math.random() < chance then + down_grade(surface,pos) + 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 +]] \ No newline at end of file diff --git a/to convert/StandAlone/spawn.lua b/to convert/StandAlone/spawn.lua new file mode 100644 index 00000000..49ff3e09 --- /dev/null +++ b/to convert/StandAlone/spawn.lua @@ -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) \ No newline at end of file diff --git a/to convert/StandAlone/starting-items.lua b/to convert/StandAlone/starting-items.lua new file mode 100644 index 00000000..5a3db04f --- /dev/null +++ b/to convert/StandAlone/starting-items.lua @@ -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) \ No newline at end of file