diff --git a/control.lua b/control.lua index 4d0f80a3..3f9026db 100644 --- a/control.lua +++ b/control.lua @@ -1 +1 @@ -itemRotated={}entityRemoved={}entityCache={}guis={frames={},buttons={}}warningAllowed=nil;timeForRegular=180;CHUNK_SIZE=32;local function a(b,c)if b.find_entities_filtered{area=c,type="decorative"}then for d,e in pairs(b.find_entities_filtered{area=c,type="decorative"})do if e.name~="red-bottleneck"and e.name~="yellow-bottleneck"and e.name~="green-bottleneck"then e.destroy()end end end end;local function f(b,g,h,i,j)a(b,{{g,h},{g+i,h+j}})end;local function k()local b=game.surfaces["nauvis"]for l in b.get_chunks()do f(b,l.x*CHUNK_SIZE,l.y*CHUNK_SIZE,CHUNK_SIZE-1,CHUNK_SIZE-1)end;callAdmin("Decoratives have been removed")end;script.on_event(defines.events.on_chunk_generated,function(m)a(m.surface,m.area)end)function ticktohour(n)local o=tostring(math.floor(n*1/(60*game.speed)/3600))return o end;function ticktominutes(n)local p=math.floor(n*1/(60*game.speed)/60)return p end;function callAdmin(q)for d,r in pairs(game.connected_players)do if r.admin then r.print(q)end end end;function autoMessage()game.print('There are '..#game.connected_players..' players online')game.print('This map has been on for '..ticktohour(game.tick)..' Hours and '..ticktominutes(game.tick)-60*ticktohour(game.tick)..' Minutes')game.print('Please join us on:')game.print('Discord: https://discord.gg/RPCxzgt')game.print('Forum: explosivegaming.nl')game.print('Steam: http://steamcommunity.com/groups/tntexplosivegaming')game.print('To see these links again goto: Readme > Server Info')end;function addFrame(s)guis.frames[s]={}addButton('close',function(r,t)t.parent.parent.parent.destroy()end)end;function addTab(s,u,v,w)guis.frames[s][u]={u,v,w}addButton(u,function(r,t)openTab(r,t.parent.parent.parent.name,t.parent.parent.parent.tab,t.name)end)end;function addButton(x,y)guis.buttons[x]={x,y}end;function drawButton(s,x,z,v)s.add{name=x,type="button",caption=z,tooltip=v}end;function openTab(r,A,B,u)local C=r.gui.center[A].tabBarScroll.tabBar;for d,D in pairs(guis.frames[A])do if D[1]==u then C[D[1]].style.font_color={r=255,g=255,b=255,a=255}clearElement(B)D[3](r,B)else C[D[1]].style.font_color={r=100,g=100,b=100,a=255}end end end;function drawFrame(r,A,u)if r.gui.center[A]then r.gui.center[A].destroy()end;local s=r.gui.center.add{name=A,type='frame',caption=A,direction='vertical'}local E=s.add{type="scroll-pane",name="tabBarScroll",vertical_scroll_policy="never",horizontal_scroll_policy="always"}local C=E.add{type='flow',direction='horizontal',name='tabBar'}local B=s.add{type="scroll-pane",name="tab",vertical_scroll_policy="auto",horizontal_scroll_policy="never"}for d,D in pairs(guis.frames[A])do drawButton(C,D[1],D[1],D[2])end;openTab(r,A,B,u)drawButton(C,'close','Close','Close this window')B.style.minimal_height=300;B.style.maximal_height=300;B.style.minimal_width=500;B.style.maximal_width=500;E.style.minimal_height=60;E.style.maximal_height=60;E.style.minimal_width=500;E.style.maximal_width=500 end;function toggleVisable(s)if s then if s.style.visible==nil then s.style.visible=false else s.style.visible=not s.style.visible end end end;function clearElement(F)if F~=nil then for G,t in pairs(F.children_names)do F[t].destroy()end end end;script.on_event(defines.events.on_player_created,function(m)local r=game.players[m.player_index]r.insert{name="iron-plate",count=8}r.insert{name="pistol",count=1}r.insert{name="firearm-magazine",count=10}r.insert{name="burner-mining-drill",count=1}r.insert{name="stone-furnace",count=1}if r.name=="badgamernl"or r.name=="BADgamerNL"then r.insert{name="blueprint",count=1}r.insert{name="deconstruction-planner",count=1}end;r.force.chart(r.surface,{{r.position.x-200,r.position.y-200},{r.position.x+200,r.position.y+200}})end)script.on_event(defines.events.on_player_respawned,function(m)local r=game.players[m.player_index]drawPlayerList()r.insert{name="pistol",count=1}r.insert{name="firearm-magazine",count=10}end)script.on_event(defines.events.on_player_joined_game,function(m)local r=game.players[m.player_index]r.print({"","Welcome"})if r.gui.left.PlayerList~=nil then r.gui.left.PlayerList.destroy()end;if r.gui.center.README~=nil then r.gui.center.README.destroy()end;if r.gui.top.PlayerList~=nil then r.gui.top.PlayerList.destroy()end;drawPlayerList()drawToolbar()local H=encode(game.players,"players",{"name","admin","online_time","connected","index"})game.write_file("players.json",H,false)if not r.admin and ticktominutes(r.online_time)<1 then drawFrame(r,'Readme','Rules')end end)script.on_event(defines.events.on_player_left_game,function(m)local r=game.players[m.player_index]drawPlayerList()end)script.on_event(defines.events.on_gui_click,function(m)local r=game.players[m.player_index]for d,I in pairs(guis.buttons)do if I[1]==m.element.name then if I[2]then I[2](r,m.element)else game.print('Invaid Button'..I[1])end;break end end end)script.on_event(defines.events.on_gui_text_changed,function(m)local r=game.players[m.player_index]if m.element.parent.parent.filterTable then local s=m.element;local J={}local K=false;if s.parent.parent.parent.name=='Admin'then K=true;J[#J+1]='online'end;if s.parent.parent.filterTable.status_input and not K then local L=s.parent.parent.filterTable.status_input.text;if L=='yes'or L=='online'or L=='true'or L=='y'then J[#J+1]='online'elseif L~=''then J[#J+1]='offline'end end;if s.parent.parent.filterTable.hours_input then local M=s.parent.parent.filterTable.hours_input.text;if tonumber(M)and tonumber(M)>0 then J[#J+1]=tonumber(M)end end;if s.parent.parent.filterTable.name_input then local N=s.parent.parent.filterTable.name_input.text;if N then J[#J+1]=N end end;if s.parent.parent.playerTable then s.parent.parent.playerTable.destroy()end;drawPlayerTable(r,s.parent.parent,K,J)end end)script.on_event(defines.events.on_marked_for_deconstruction,function(m)local O=game.players[m.player_index]if not O.admin and ticktominutes(O.online_time)=timeForRegular then Z.gui.left.PlayerList.PlayerListScroll.add{type="label",name=r.name,style="caption_label_style",caption={"",ticktohour(r.online_time)," H - ",r.name}}Z.gui.left.PlayerList.PlayerListScroll[r.name].style.font_color={r=24,g=172,b=188}r.tag="[Regular]"elseif r.name=="explosivegaming"then for G=10,1,-1 do Z.gui.left.PlayerList.PlayerListScroll.add{type="label",name=r.name..G,style="caption_label_style",caption={"",ticktohour(r.online_time)," H - ",r.name,G}}Z.gui.left.PlayerList.PlayerListScroll[r.name..G].style.font_color={r=24,g=172,b=188}r.tag="[TEST]"end else Z.gui.left.PlayerList.PlayerListScroll.add{type="label",name=r.name,style="caption_label_style",caption={"",ticktohour(r.online_time)," H - ",r.name}}Z.gui.left.PlayerList.PlayerListScroll[r.name].style.font_color={r=255,g=159,b=27}r.tag="[Guest]"end end end end end end;addButton('goto',function(r,s)local _=game.players[s.parent.name]r.teleport(game.surfaces[_.surface.name].find_non_colliding_position("player",_.position,32,1))end)addButton('bring',function(r,s)local _=game.players[s.parent.name]_.teleport(game.surfaces[r.surface.name].find_non_colliding_position("player",r.position,32,1))end)addButton('jail',function(r,s)local _=game.players[s.parent.name]if _.character then if _.character.active then _.character.active=false;_.tag='[Jail]'drawPlayerList()else _.character.active=true;_.tag='[Guest]'drawPlayerList()end end end)addButton('kill',function(r,s)local _=game.players[s.parent.name]if _.character then _.character.die()end end)function drawPlayerTable(r,s,K,J)s.add{name='playerTable',type="table",colspan=5}s.playerTable.style.minimal_width=500;s.playerTable.style.maximal_width=500;s.playerTable.style.horizontal_spacing=10;s.playerTable.add{name="id",type="label",caption="Id "}s.playerTable.add{name="name",type="label",caption="Name "}if not K then s.playerTable.add{name="status",type="label",caption="Status "}end;s.playerTable.add{name="online_time",type="label",caption="Online Time "}s.playerTable.add{name="rank",type="label",caption="Rank "}if K then s.playerTable.add{name="commands",type="label",caption="Commands"}end;for G,_ in pairs(game.players)do local a0=true;for d,a1 in pairs(J)do if a1=='admin'then if _.admin==false then a0=false;break end elseif a1=='online'then if _.connected==false then a0=false;break end elseif a1=='offline'then if _.connected==true then a0=false;break end elseif type(a1)=='number'then if a1>ticktominutes(_.online_time)then a0=false;break end elseif type(a1)=='string'then if _.name:lower():find(a1:lower())==nil then a0=false;break end end end;if a0==true and r.name~=_.name then if s.playerTable[_.name]==nil then s.playerTable.add{name=G.."id",type="label",caption=G}s.playerTable.add{name=_.name..'_name',type="label",caption=_.name}if not K then if _.connected==true then s.playerTable.add{name=_.name.."Status",type="label",caption="ONLINE"}else s.playerTable.add{name=_.name.."Status",type="label",caption="OFFLINE"}end end;s.playerTable.add{name=_.name.."Online_Time",type="label",caption=ticktohour(_.online_time)..'H '..ticktominutes(_.online_time)-60*ticktohour(_.online_time)..'M'}s.playerTable.add{name=_.name.."Rank",type="label",caption=_.tag}if K then s.playerTable.add{name=_.name,type="flow"}drawButton(s.playerTable[_.name],'goto','Tp','Goto to the players location')drawButton(s.playerTable[_.name],'bring','Br','Bring a player to your location')if _.tag=='[Owner]'or _.tag=='[Developer]'or _.tag=='[Com Mngr]'then else drawButton(s.playerTable[_.name],'jail','Ja','Jail/Unjail a player')drawButton(s.playerTable[_.name],'kill','Ki','Kill this player')end end end end end end;addFrame('Readme')addTab('Readme','Rules','The rules of the server',function(r,s)local a2={"Hacking/cheating, exploiting and abusing bugs is not allowed.","Do not disrespect any player in the server (This includes staff).","Do not spam, this includes stuff such as chat spam, item spam, chest spam etc.","Do not laydown concrete with bots when you dont have permission to.","Do not walk in a random direction for no reason(to save map size).","Do not make train roundabouts.","Do not complain about lag, low fps and low ups or other things like that.","Do not ask for rank.","Left Hand Drive (LHD) only.","Use common sense."}for G,a3 in pairs(a2)do s.add{name=G,type="label",caption={"",G,". ",a3}}end end)addTab('Readme','Server Info','Info about the server',function(r,s)local a4={"Discord voice and chat server:","https://discord.gg/RPCxzgt","Our forum:","explosivegaming.nl","Steam:","http://steamcommunity.com/groups/tntexplosivegaming"}for G,a5 in pairs(a4)do s.add{name=G,type="label",caption={"",a5}}end end)addTab('Readme','How to chat','Just in case you dont know how to chat',function(r,s)local a6={"Chatting for new players can be difficult because it’s different than other games!","It’s very simple, the button you need to press is the “GRAVE/TILDE key”","it’s located under the “ESC key”. If you would like to change the key go to your","controls tab in options. The key you need to change is “Toggle Lua console”","it’s located in the second column 2nd from bottom."}for G,a5 in pairs(a6)do s.add{name=G,type="label",caption={"",a5}}end end)addTab('Readme','Admins','List of all the people who can ban you :P',function(r,s)local a7={"This list contains all the people that are admin in this world. Do you want to become","an admin dont ask for it! an admin will see what you've made and the time you put","in the server."}for G,a5 in pairs(a7)do s.add{name=G,type="label",caption={"",a5}}end;drawPlayerTable(r,s,false,{'admin'})end)addTab('Readme','Players','List of all the people who have been on the server',function(r,s)local a8={"These are the players who have supported us in the making of this factory. Without","you the player we wouldn't have been as far as we are now."}for G,a5 in pairs(a8)do s.add{name=G,type="label",caption={"",a5}}end;s.add{name='filterTable',type='table',colspan=3}s.filterTable.add{name='name_label',type='label',caption='Name'}s.filterTable.add{name='status_label',type='label',caption='Online?'}s.filterTable.add{name='hours_label',type='label',caption='Online Time (minutes)'}s.filterTable.add{name='name_input',type='textfield'}s.filterTable.add{name='status_input',type='textfield'}s.filterTable.add{name='hours_input',type='textfield'}drawPlayerTable(r,s,false,{})end)addFrame('Admin')addButton('btn_toolbar_automessage',function()autoMessage()end)addButton('revive_dead_entitys',function(r,s)for a9,e in pairs(game.surfaces[1].find_entities_filtered({type="entity-ghost"}))do e.revive()end end)addButton('revive_dead_entitys_range',function(r,s)if tonumber(s.parent.range.text)then local aa=tonumber(s.parent.range.text)for a9,e in pairs(game.surfaces[1].find_entities_filtered({area={{r.position.x-aa,r.position.y-aa},{r.position.x+aa,r.position.y+aa}},type="entity-ghost"}))do e.revive()end end end)addButton('remove_biters',function(r,s)for a9,e in pairs(game.surfaces[1].find_entities_filtered({force='enemy'}))do e.destroy()end end)addButton('tp_all',function(r,s)for G,_ in pairs(game.connected_players)do local ab=game.surfaces[r.surface.name].find_non_colliding_position("player",r.position,32,1)if _~=r then _.teleport(ab)end end end)addButton('toggle_cheat',function(r,s)r.cheat_mode=not r.cheat_mode end)addButton("btn_Modifier_apply",function(r,s)local ac={"manual_mining_speed_modifier","manual_crafting_speed_modifier","character_running_speed_modifier","worker_robots_speed_modifier","worker_robots_storage_bonus","character_build_distance_bonus","character_item_drop_distance_bonus","character_reach_distance_bonus","character_resource_reach_distance_bonus","character_item_pickup_distance_bonus","character_loot_pickup_distance_bonus"}for G,ad in pairs(ac)do local ae=tonumber(s.parent.parent.modifierTable[ad.."_input"].text:match("[%d]+[.%d+]"))if ae~=nil then if ae>=0 and ae<50 and ae~=r.force[ad]then r.force[ad]=ae;r.print(ad.." changed to number: "..tostring(ae))elseif ae==r.force[ad]then r.print(ad.." Did not change")else r.print(ad.." needs to be a higher number or it contains an letter")end end end end)addTab('Admin','Commands','Random useful commands',function(r,s)drawButton(s,'btn_toolbar_automessage','Auto Message','Send the auto message to all online players')drawButton(s,'revive_dead_entitys','Revive All Entitys','Brings all dead machines back to life')drawButton(s,'revive_dead_entitys_range','Revive Entitys','Brings all dead machines back to life in a range')s.add{type='textfield',name='range',text='Range'}drawButton(s,'remove_biters','Kill Biters','Removes all biters in map')drawButton(s,'tp_all','TP All Here','Brings all players to you')drawButton(s,'toggle_cheat','Toggle Cheat Mode','Toggle your cheat mode')end)addTab('Admin','Modifiers','Edit in game modifiers',function(r,s)local ac={"manual_mining_speed_modifier","manual_crafting_speed_modifier","character_running_speed_modifier","worker_robots_speed_modifier","worker_robots_storage_bonus","character_build_distance_bonus","character_item_drop_distance_bonus","character_reach_distance_bonus","character_resource_reach_distance_bonus","character_item_pickup_distance_bonus","character_loot_pickup_distance_bonus"}s.add{type="flow",name="flowNavigation",direction="horizontal"}s.add{name="modifierTable",type="table",colspan=3}s.modifierTable.add{name="name",type="label",caption="name"}s.modifierTable.add{name="input",type="label",caption="input"}s.modifierTable.add{name="current",type="label",caption="current"}for G,ad in pairs(ac)do s.modifierTable.add{name=ad,type="label",caption=ad}s.modifierTable.add{name=ad.."_input",type="textfield",caption="inputTextField"}s.modifierTable.add{name=ad.."_current",type="label",caption=tostring(r.force[ad])}end;drawButton(s.flowNavigation,"btn_Modifier_apply","Apply","Apply the new values to the game")end)addTab('Admin','Player List','Send a message to all players',function(r,s)s.add{name='filterTable',type='table',colspan=2}s.filterTable.add{name='name_label',type='label',caption='Name'}s.filterTable.add{name='hours_label',type='label',caption='Online Time (minutes)'}s.filterTable.add{name='name_input',type='textfield'}s.filterTable.add{name='hours_input',type='textfield'}drawPlayerTable(r,s,true,{'online'})end) \ No newline at end of file +itemRotated={}entityRemoved={}entityCache={}guis={frames={},buttons={}}warningAllowed=nil;timeForRegular=180;CHUNK_SIZE=32;local function a(b,c)if b.find_entities_filtered{area=c,type="decorative"}then for d,e in pairs(b.find_entities_filtered{area=c,type="decorative"})do if e.name~="red-bottleneck"and e.name~="yellow-bottleneck"and e.name~="green-bottleneck"then e.destroy()end end end end;local function f(b,g,h,i,j)a(b,{{g,h},{g+i,h+j}})end;local function k()local b=game.surfaces["nauvis"]for l in b.get_chunks()do f(b,l.x*CHUNK_SIZE,l.y*CHUNK_SIZE,CHUNK_SIZE-1,CHUNK_SIZE-1)end;callAdmin("Decoratives have been removed")end;script.on_event(defines.events.on_chunk_generated,function(m)a(m.surface,m.area)end)function ticktohour(n)local o=tostring(math.floor(n*1/(60*game.speed)/3600))return o end;function ticktominutes(n)local p=math.floor(n*1/(60*game.speed)/60)return p end;function callAdmin(q)for d,r in pairs(game.connected_players)do if r.admin then r.print(q)end end end;function autoMessage()game.print('There are '..#game.connected_players..' players online')game.print('This map has been on for '..ticktohour(game.tick)..' Hours and '..ticktominutes(game.tick)-60*ticktohour(game.tick)..' Minutes')game.print('Please join us on:')game.print('Discord: https://discord.gg/RPCxzgt')game.print('Forum: explosivegaming.nl')game.print('Steam: http://steamcommunity.com/groups/tntexplosivegaming')game.print('To see these links again goto: Readme > Server Info')end;function addFrame(s)guis.frames[s]={}addButton('close',function(r,t)t.parent.parent.parent.destroy()end)end;function addTab(s,u,v,w)guis.frames[s][u]={u,v,w}addButton(u,function(r,t)openTab(r,t.parent.parent.parent.name,t.parent.parent.parent.tab,t.name)end)end;function addButton(x,y)guis.buttons[x]={x,y}end;function drawButton(s,x,z,v)s.add{name=x,type="button",caption=z,tooltip=v}end;function openTab(r,A,B,u)local C=r.gui.center[A].tabBarScroll.tabBar;for d,D in pairs(guis.frames[A])do if D[1]==u then C[D[1]].style.font_color={r=255,g=255,b=255,a=255}clearElement(B)D[3](r,B)else C[D[1]].style.font_color={r=100,g=100,b=100,a=255}end end end;function drawFrame(r,A,u)if r.gui.center[A]then r.gui.center[A].destroy()end;local s=r.gui.center.add{name=A,type='frame',caption=A,direction='vertical'}local E=s.add{type="scroll-pane",name="tabBarScroll",vertical_scroll_policy="never",horizontal_scroll_policy="always"}local C=E.add{type='flow',direction='horizontal',name='tabBar'}local B=s.add{type="scroll-pane",name="tab",vertical_scroll_policy="auto",horizontal_scroll_policy="never"}for d,D in pairs(guis.frames[A])do drawButton(C,D[1],D[1],D[2])end;openTab(r,A,B,u)drawButton(C,'close','Close','Close this window')B.style.minimal_height=300;B.style.maximal_height=300;B.style.minimal_width=500;B.style.maximal_width=500;E.style.minimal_height=60;E.style.maximal_height=60;E.style.minimal_width=500;E.style.maximal_width=500 end;function toggleVisable(s)if s then if s.style.visible==nil then s.style.visible=false else s.style.visible=not s.style.visible end end end;function clearElement(F)if F~=nil then for G,t in pairs(F.children_names)do F[t].destroy()end end end;script.on_event(defines.events.on_player_created,function(m)local r=game.players[m.player_index]r.insert{name="iron-plate",count=8}r.insert{name="pistol",count=1}r.insert{name="firearm-magazine",count=10}r.insert{name="burner-mining-drill",count=1}r.insert{name="stone-furnace",count=1}r.force.chart(r.surface,{{r.position.x-200,r.position.y-200},{r.position.x+200,r.position.y+200}})end)script.on_event(defines.events.on_player_respawned,function(m)local r=game.players[m.player_index]drawPlayerList()r.insert{name="pistol",count=1}r.insert{name="firearm-magazine",count=10}end)script.on_event(defines.events.on_player_joined_game,function(m)local r=game.players[m.player_index]r.print({"","Welcome"})if r.gui.left.PlayerList~=nil then r.gui.left.PlayerList.destroy()end;if r.gui.center.README~=nil then r.gui.center.README.destroy()end;if r.gui.top.PlayerList~=nil then r.gui.top.PlayerList.destroy()end;drawPlayerList()drawToolbar()local H=encode(game.players,"players",{"name","admin","online_time","connected","index"})game.write_file("players.json",H,false)if not r.admin and ticktominutes(r.online_time)<1 then drawFrame(r,'Readme','Rules')end end)script.on_event(defines.events.on_player_left_game,function(m)local r=game.players[m.player_index]drawPlayerList()end)script.on_event(defines.events.on_gui_click,function(m)local r=game.players[m.player_index]for d,I in pairs(guis.buttons)do if I[1]==m.element.name then if I[2]then I[2](r,m.element)else game.print('Invaid Button'..I[1])end;break end end end)script.on_event(defines.events.on_gui_text_changed,function(m)local r=game.players[m.player_index]if m.element.parent.parent.filterTable then local s=m.element;local J={}local K=false;if s.parent.parent.parent.name=='Admin'then K=true;J[#J+1]='online'end;if s.parent.parent.filterTable.status_input and not K then local L=s.parent.parent.filterTable.status_input.text;if L=='yes'or L=='online'or L=='true'or L=='y'then J[#J+1]='online'elseif L~=''then J[#J+1]='offline'end end;if s.parent.parent.filterTable.hours_input then local M=s.parent.parent.filterTable.hours_input.text;if tonumber(M)and tonumber(M)>0 then J[#J+1]=tonumber(M)end end;if s.parent.parent.filterTable.name_input then local N=s.parent.parent.filterTable.name_input.text;if N then J[#J+1]=N end end;if s.parent.parent.playerTable then s.parent.parent.playerTable.destroy()end;drawPlayerTable(r,s.parent.parent,K,J)end end)script.on_event(defines.events.on_marked_for_deconstruction,function(m)local O=game.players[m.player_index]if not O.admin and ticktominutes(O.online_time)=timeForRegular then Z.gui.left.PlayerList.PlayerListScroll.add{type="label",name=r.name,style="caption_label_style",caption={"",ticktohour(r.online_time)," H - ",r.name}}Z.gui.left.PlayerList.PlayerListScroll[r.name].style.font_color={r=24,g=172,b=188}r.tag="[Regular]"elseif r.name=="explosivegaming"then for G=10,1,-1 do Z.gui.left.PlayerList.PlayerListScroll.add{type="label",name=r.name..G,style="caption_label_style",caption={"",ticktohour(r.online_time)," H - ",r.name,G}}Z.gui.left.PlayerList.PlayerListScroll[r.name..G].style.font_color={r=24,g=172,b=188}r.tag="[TEST]"end else Z.gui.left.PlayerList.PlayerListScroll.add{type="label",name=r.name,style="caption_label_style",caption={"",ticktohour(r.online_time)," H - ",r.name}}Z.gui.left.PlayerList.PlayerListScroll[r.name].style.font_color={r=255,g=159,b=27}r.tag="[Guest]"end end end end end end;addButton('goto',function(r,s)local _=game.players[s.parent.name]r.teleport(game.surfaces[_.surface.name].find_non_colliding_position("player",_.position,32,1))end)addButton('bring',function(r,s)local _=game.players[s.parent.name]_.teleport(game.surfaces[r.surface.name].find_non_colliding_position("player",r.position,32,1))end)addButton('jail',function(r,s)local _=game.players[s.parent.name]if _.character then if _.character.active then _.character.active=false;_.tag='[Jail]'drawPlayerList()else _.character.active=true;_.tag='[Guest]'drawPlayerList()end end end)addButton('kill',function(r,s)local _=game.players[s.parent.name]if _.character then _.character.die()end end)function drawPlayerTable(r,s,K,J)s.add{name='playerTable',type="table",colspan=5}s.playerTable.style.minimal_width=500;s.playerTable.style.maximal_width=500;s.playerTable.style.horizontal_spacing=10;s.playerTable.add{name="id",type="label",caption="Id "}s.playerTable.add{name="name",type="label",caption="Name "}if not K then s.playerTable.add{name="status",type="label",caption="Status "}end;s.playerTable.add{name="online_time",type="label",caption="Online Time "}s.playerTable.add{name="rank",type="label",caption="Rank "}if K then s.playerTable.add{name="commands",type="label",caption="Commands"}end;for G,_ in pairs(game.players)do local a0=true;for d,a1 in pairs(J)do if a1=='admin'then if _.admin==false then a0=false;break end elseif a1=='online'then if _.connected==false then a0=false;break end elseif a1=='offline'then if _.connected==true then a0=false;break end elseif type(a1)=='number'then if a1>ticktominutes(_.online_time)then a0=false;break end elseif type(a1)=='string'then if _.name:lower():find(a1:lower())==nil then a0=false;break end end end;if a0==true and r.name~=_.name then if s.playerTable[_.name]==nil then s.playerTable.add{name=G.."id",type="label",caption=G}s.playerTable.add{name=_.name..'_name',type="label",caption=_.name}if not K then if _.connected==true then s.playerTable.add{name=_.name.."Status",type="label",caption="ONLINE"}else s.playerTable.add{name=_.name.."Status",type="label",caption="OFFLINE"}end end;s.playerTable.add{name=_.name.."Online_Time",type="label",caption=ticktohour(_.online_time)..'H '..ticktominutes(_.online_time)-60*ticktohour(_.online_time)..'M'}s.playerTable.add{name=_.name.."Rank",type="label",caption=_.tag}if K then s.playerTable.add{name=_.name,type="flow"}drawButton(s.playerTable[_.name],'goto','Tp','Goto to the players location')drawButton(s.playerTable[_.name],'bring','Br','Bring a player to your location')if _.tag=='[Owner]'or _.tag=='[Developer]'or _.tag=='[Com Mngr]'then else drawButton(s.playerTable[_.name],'jail','Ja','Jail/Unjail a player')drawButton(s.playerTable[_.name],'kill','Ki','Kill this player')end end end end end end;addFrame('Readme')addTab('Readme','Rules','The rules of the server',function(r,s)local a2={"Hacking/cheating, exploiting and abusing bugs is not allowed.","Do not disrespect any player in the server (This includes staff).","Do not spam, this includes stuff such as chat spam, item spam, chest spam etc.","Do not laydown concrete with bots when you dont have permission to.","Do not walk in a random direction for no reason(to save map size).","Do not make train roundabouts.","Do not complain about lag, low fps and low ups or other things like that.","Do not ask for rank.","Left Hand Drive (LHD) only.","Use common sense."}for G,a3 in pairs(a2)do s.add{name=G,type="label",caption={"",G,". ",a3}}end end)addTab('Readme','Server Info','Info about the server',function(r,s)local a4={"Discord voice and chat server:","https://discord.gg/RPCxzgt","Our forum:","explosivegaming.nl","Steam:","http://steamcommunity.com/groups/tntexplosivegaming"}for G,a5 in pairs(a4)do s.add{name=G,type="label",caption={"",a5}}end end)addTab('Readme','How to chat','Just in case you dont know how to chat',function(r,s)local a6={"Chatting for new players can be difficult because it’s different than other games!","It’s very simple, the button you need to press is the “GRAVE/TILDE key”","it’s located under the “ESC key”. If you would like to change the key go to your","controls tab in options. The key you need to change is “Toggle Lua console”","it’s located in the second column 2nd from bottom."}for G,a5 in pairs(a6)do s.add{name=G,type="label",caption={"",a5}}end end)addTab('Readme','Admins','List of all the people who can ban you :P',function(r,s)local a7={"This list contains all the people that are admin in this world. Do you want to become","an admin dont ask for it! an admin will see what you've made and the time you put","in the server."}for G,a5 in pairs(a7)do s.add{name=G,type="label",caption={"",a5}}end;drawPlayerTable(r,s,false,{'admin'})end)addTab('Readme','Players','List of all the people who have been on the server',function(r,s)local a8={"These are the players who have supported us in the making of this factory. Without","you the player we wouldn't have been as far as we are now."}for G,a5 in pairs(a8)do s.add{name=G,type="label",caption={"",a5}}end;s.add{name='filterTable',type='table',colspan=3}s.filterTable.add{name='name_label',type='label',caption='Name'}s.filterTable.add{name='status_label',type='label',caption='Online?'}s.filterTable.add{name='hours_label',type='label',caption='Online Time (minutes)'}s.filterTable.add{name='name_input',type='textfield'}s.filterTable.add{name='status_input',type='textfield'}s.filterTable.add{name='hours_input',type='textfield'}drawPlayerTable(r,s,false,{})end)addFrame('Admin')addButton('btn_toolbar_automessage',function()autoMessage()end)addButton('revive_dead_entitys',function(r,s)for a9,e in pairs(game.surfaces[1].find_entities_filtered({type="entity-ghost"}))do e.revive()end end)addButton('revive_dead_entitys_range',function(r,s)if tonumber(s.parent.range.text)then local aa=tonumber(s.parent.range.text)for a9,e in pairs(game.surfaces[1].find_entities_filtered({area={{r.position.x-aa,r.position.y-aa},{r.position.x+aa,r.position.y+aa}},type="entity-ghost"}))do e.revive()end end end)addButton('remove_biters',function(r,s)for a9,e in pairs(game.surfaces[1].find_entities_filtered({force='enemy'}))do e.destroy()end end)addButton('tp_all',function(r,s)for G,_ in pairs(game.connected_players)do local ab=game.surfaces[r.surface.name].find_non_colliding_position("player",r.position,32,1)if _~=r then _.teleport(ab)end end end)addButton('toggle_cheat',function(r,s)r.cheat_mode=not r.cheat_mode end)addButton('add_dev_items',function(r,s)r.insert{name="deconstruction-planner",count=1}r.insert{name="blueprint-book",count=1}r.insert{name="blueprint",count=20}end)addButton("btn_Modifier_apply",function(r,s)local ac={"manual_mining_speed_modifier","manual_crafting_speed_modifier","character_running_speed_modifier","worker_robots_speed_modifier","worker_robots_storage_bonus","character_build_distance_bonus","character_item_drop_distance_bonus","character_reach_distance_bonus","character_resource_reach_distance_bonus","character_item_pickup_distance_bonus","character_loot_pickup_distance_bonus"}for G,ad in pairs(ac)do local ae=tonumber(s.parent.parent.modifierTable[ad.."_input"].text:match("[%d]+[.%d+]"))if ae~=nil then if ae>=0 and ae<50 and ae~=r.force[ad]then r.force[ad]=ae;r.print(ad.." changed to number: "..tostring(ae))elseif ae==r.force[ad]then r.print(ad.." Did not change")else r.print(ad.." needs to be a higher number or it contains an letter")end end end end)addTab('Admin','Commands','Random useful commands',function(r,s)drawButton(s,'btn_toolbar_automessage','Auto Message','Send the auto message to all online players')drawButton(s,'add_dev_items','Get Blueprints','Get all the blueprints')drawButton(s,'revive_dead_entitys','Revive All Entitys','Brings all dead machines back to life')drawButton(s,'revive_dead_entitys_range','Revive Entitys','Brings all dead machines back to life in a range')s.add{type='textfield',name='range',text='Range'}drawButton(s,'remove_biters','Kill Biters','Removes all biters in map')drawButton(s,'tp_all','TP All Here','Brings all players to you')drawButton(s,'toggle_cheat','Toggle Cheat Mode','Toggle your cheat mode')end)addTab('Admin','Modifiers','Edit in game modifiers',function(r,s)local ac={"manual_mining_speed_modifier","manual_crafting_speed_modifier","character_running_speed_modifier","worker_robots_speed_modifier","worker_robots_storage_bonus","character_build_distance_bonus","character_item_drop_distance_bonus","character_reach_distance_bonus","character_resource_reach_distance_bonus","character_item_pickup_distance_bonus","character_loot_pickup_distance_bonus"}s.add{type="flow",name="flowNavigation",direction="horizontal"}s.add{name="modifierTable",type="table",colspan=3}s.modifierTable.add{name="name",type="label",caption="name"}s.modifierTable.add{name="input",type="label",caption="input"}s.modifierTable.add{name="current",type="label",caption="current"}for G,ad in pairs(ac)do s.modifierTable.add{name=ad,type="label",caption=ad}s.modifierTable.add{name=ad.."_input",type="textfield",caption="inputTextField"}s.modifierTable.add{name=ad.."_current",type="label",caption=tostring(r.force[ad])}end;drawButton(s.flowNavigation,"btn_Modifier_apply","Apply","Apply the new values to the game")end)addTab('Admin','Player List','Send a message to all players',function(r,s)s.add{name='filterTable',type='table',colspan=2}s.filterTable.add{name='name_label',type='label',caption='Name'}s.filterTable.add{name='hours_label',type='label',caption='Online Time (minutes)'}s.filterTable.add{name='name_input',type='textfield'}s.filterTable.add{name='hours_input',type='textfield'}drawPlayerTable(r,s,true,{'online'})end) \ No newline at end of file diff --git a/source.lua b/source.lua index e52483f1..3e583b83 100644 --- a/source.lua +++ b/source.lua @@ -149,11 +149,6 @@ script.on_event(defines.events.on_player_created, function(event) player.insert{name="firearm-magazine", count=10} player.insert{name="burner-mining-drill", count = 1} player.insert{name="stone-furnace", count = 1} - --developer items - if player.name == "badgamernl" or player.name == "BADgamerNL" then - player.insert{name="blueprint", count = 1} - player.insert{name="deconstruction-planner", count = 1} - end player.force.chart(player.surface, {{player.position.x - 200, player.position.y - 200}, {player.position.x + 200, player.position.y + 200}}) end) @@ -577,6 +572,7 @@ addButton('revive_dead_entitys_range',function(player,frame) if tonumber(frame.p addButton('remove_biters',function(player,frame) for key, entity in pairs(game.surfaces[1].find_entities_filtered({force='enemy'})) do entity.destroy() end end) addButton('tp_all',function(player,frame) for i,p in pairs(game.connected_players) do local pos = game.surfaces[player.surface.name].find_non_colliding_position("player", player.position, 32, 1) if p ~= player then p.teleport(pos) end end end) addButton('toggle_cheat',function(player,frame) player.cheat_mode = not player.cheat_mode end) +addButton('add_dev_items',function(player,frame) player.insert{name="deconstruction-planner", count = 1} player.insert{name="blueprint-book", count = 1} player.insert{name="blueprint", count = 20} end) addButton("btn_Modifier_apply", function(player,frame) local forceModifiers = { @@ -610,6 +606,7 @@ addButton("btn_Modifier_apply", addTab('Admin', 'Commands', 'Random useful commands', function(player, frame) drawButton(frame,'btn_toolbar_automessage','Auto Message','Send the auto message to all online players') + drawButton(frame,'add_dev_items','Get Blueprints','Get all the blueprints') drawButton(frame,'revive_dead_entitys','Revive All Entitys','Brings all dead machines back to life') drawButton(frame,'revive_dead_entitys_range','Revive Entitys','Brings all dead machines back to life in a range') frame.add{type='textfield',name='range',text='Range'}