mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 03:25:23 +09:00
1 line
28 KiB
Lua
1 line
28 KiB
Lua
entityRemoved={}entityCache={}guis={frames={},buttons={}}defaults={itemRotated={},ranks={{name='Owner',shortHand='Owner',tag='[Owner]',power=0,colour={r=170,g=0,b=0}},{name='Community Manager',shortHand='CM',tag='[Com Mngr]',power=1,colour={r=150,g=68,b=161}},{name='Developer',shortHand='Dev',tag='[Dev]',power=1,colour={r=179,g=125,b=46}},{name='Admin',shortHand='Admin',tag='[Admin]',power=2,colour={r=170,g=41,b=170}},{name='Mod',shortHand='Mod',tag='[Mod]',power=3,colour={r=233,g=63,b=233}},{name='Donator',shortHand='P2W',tag='[P2W]',power=4,colour={r=233,g=63,b=233}},{name='Member',shortHand='Mem',tag='[Member]',power=5,colour={r=24,g=172,b=188}},{name='Regular',shortHand='Reg',tag='[Regukar]',power=5,colour={r=24,g=172,b=188}},{name='Guest',shortHand='',tag='[Guest]',power=6,colour={r=255,g=159,b=27}},{name='Jail',shortHand='Jail',tag='[Jail]',power=7,colour={r=50,g=50,b=50}}},autoRanks={Owner={'badgamernl'},['Community Manager']={'arty714'},Developer={'Cooldude2606'},Admin={'eissturm','PropangasEddy'},Mod={'Alanore','Aquaday','cafeslacker','CrashKonijn','Drahc_pro','Flip','freek18','Hobbitkicker','hud','Matthias','MeDDish','Mindxt20','MottledPetrel','Mr_Happy_212','Phoenix27833','Sand3r205','ScarbVis','Smou','steentje77','TopHatGaming123'},Donator={},Member={},Regular={},Guest={},Jail={}},selected={},jail={}}warningAllowed=nil;timeForRegular=180;CHUNK_SIZE=32;function loadVar(a)if a==nil then local b=nil;if game.players[1].gui.left.hidden then b=game.players[1].gui.left.hidden.caption else b=game.players[1].gui.left.add{type='frame',name='hidden',caption=table.tostring(defaults)}.caption;game.players[1].gui.left.hidden.style.visible=false end;gTable=loadstring('return '..b)()else gTable=a end;itemRotated=gTable.itemRotated;ranks=gTable.ranks;autoRanks=gTable.autoRanks;selected=gTable.selected;jail=gTable.jail end;loadVar(defaults)function saveVar()gTable.itemRotated=itemRotated;gTable.ranks=ranks;gTable.autoRanks=autoRanks;gTable.selected=selected;gTable.jail=jail;game.players[1].gui.left.hidden.caption=table.tostring(gTable)end;function getRank(c)if c then for d,rank in pairs(ranks)do if c.permission_group==game.permissions.get_group(rank.name)then return rank end end;return stringToRank('Guest')end end;function stringToRank(string)if type(string)=='string'then local e={}for d,rank in pairs(ranks)do if rank.name:lower()==string:lower()then return rank end;if rank.name:lower():find(string:lower())then table.insert(e,rank)end end;if#e==1 then return e[1]end end end;function callRank(f,rank,g)local rank=stringToRank(rank)or stringToRank('Mod')local g=g or false;for d,c in pairs(game.players)do rankPower=getRank(c).power;if g then if rankPower>=rank.power then c.print('[Everyone]: '..f)end else if rankPower<=rank.power then if rank.shortHand~=''then c.print('['..rank.shortHand..']: '..f)else c.print('[Everyone]: '..f)end end end end end;function giveRank(c,rank,h,i)local h=h or'system'local rank=stringToRank(rank)or rank;local j=getRank(c)local k='demoted'if rank.power<=j.power then k='promoted'end;if h.name then callRank(c.name..' was '..k..' to '..rank.name..' by '..h.name,j.name)else callRank(c.name..' was '..k..' to '..rank.name..' by <system>',j.name)end;c.permission_group=game.permissions.get_group(rank.name)drawToolbar(c)drawPlayerList()if i then else game.print(jail[c.index][1])game.print(rank.name)game.print(jail[c.index][1]and rank.name~='Jail')if rank.name=='Jail'and not jail[c.index][1]then jailPlayer(c,h)elseif jail[c.index][1]and rank.name~='Jail'then game.print('Unjail')jail[c.index][1]=false;c.character.active=true end end end;function autoRank(c)local l=getRank(c)local m=nil;for rank,n in pairs(autoRanks)do local o=false;for d,p in pairs(n)do if c.name==p then m=stringToRank(rank)o=true;break end end;if o then break end end;if m then if l.power>m.power then c.permission_group=game.permissions.get_group(m.name)end elseif ticktominutes(c.online_time)>=timeForRegular then c.permission_group=game.permissions.get_group('Regular')end;if getRank(c).power<=3 and not c.admin then callRank(c.name..' needs to be promoted.')end;if jail[c.index]==nil then jail[c.index]={false,getRank(c).name}end;if jail[c.index][1]then c.permission_group=game.permissions.get_group('Jail')if c.character then c.character.active=false end end;saveVar()end;function jailPlayer(c,q)if c.character then if c.character.active then jail[c.index][1]=true;jail[c.index][2]=getRank(c).name;giveRank(c,'Jail',q,true)c.character.active=false else jail[c.index][1]=false;local rank=jail[c.index][2]or'Guest'giveRank(c,rank,q,true)c.character.active=true end;saveVar()end end;function ticktohour(r)local s=tostring(math.floor(r/(216000*game.speed)))return s end;function ticktominutes(r)local t=math.floor(r/(3600*game.speed))return t end;function clearSelection(c)selected[c.index]={}end;function autoMessage()local u='Regular'local v='Mod'callRank('There are '..#game.connected_players..' players online',v,true)callRank('This map has been on for '..ticktohour(game.tick)..' Hours and '..ticktominutes(game.tick)-60*ticktohour(game.tick)..' Minutes',v,true)callRank('Please join us on:',u,true)callRank('Discord: https://discord.gg/RPCxzgt',u,true)callRank('Forum: explosivegaming.nl',u,true)callRank('Steam: http://steamcommunity.com/groups/tntexplosivegaming',u,true)callRank('To see these links again goto: Readme > Server Info',u,true)end;function table.val_to_str(w)if"string"==type(w)then w=string.gsub(w,"\n","\\n")if string.match(string.gsub(w,"[^'\"]",""),'^"+$')then return"'"..w.."'"end;return'"'..string.gsub(w,'"','\\"')..'"'else return"table"==type(w)and table.tostring(w)or tostring(w)end end;function table.key_to_str(x)if"string"==type(x)and string.match(x,"^[_%player][_%player%d]*$")then return x else return"["..table.val_to_str(x).."]"end end;function table.tostring(y)local z,A={},{}for x,w in ipairs(y)do table.insert(z,table.val_to_str(w))A[x]=true end;for x,w in pairs(y)do if not A[x]then table.insert(z,table.key_to_str(x).."="..table.val_to_str(w))end end;return"{"..table.concat(z,",").."}"end;function addFrame(B,rank,C,D,E)guis.frames[B]={{require=rank,caption=D,tooltip=E}}addButton('close',function(c,F)F.parent.parent.parent.destroy()end)addButton('btn_'..B,function(c,F)if c.gui.center[B]then c.gui.center[B].destroy()else drawFrame(c,B,C)end end)end;function addTab(B,G,H,I)guis.frames[B][G]={G,H,I}addButton(G,function(c,F)openTab(c,F.parent.parent.parent.name,F.parent.parent.parent.tab,F.name)end)end;function addButton(J,K)guis.buttons[J]={J,K}end;function drawButton(B,J,D,H)B.add{name=J,type="button",caption=D,tooltip=H}end;function openTab(c,L,M,G)local N=c.gui.center[L].tabBarScroll.tabBar;for d,a in pairs(guis.frames[L])do if d~=1 then if a[1]==G then N[a[1]].style.font_color={r=255,g=255,b=255,player=255}M.clear()a[3](c,M)else N[a[1]].style.font_color={r=100,g=100,b=100,player=255}end end end end;function drawFrame(c,L,G)if getRank(c).power<=guis.frames[L][1].require then if c.gui.center[L]then c.gui.center[L].destroy()end;local B=c.gui.center.add{name=L,type='frame',caption=L,direction='vertical'}local O=B.add{type="scroll-pane",name="tabBarScroll",vertical_scroll_policy="never",horizontal_scroll_policy="always"}local N=O.add{type='flow',direction='horizontal',name='tabBar'}local M=B.add{type="scroll-pane",name="tab",vertical_scroll_policy="auto",horizontal_scroll_policy="never"}for d,a in pairs(guis.frames[L])do if d~=1 then drawButton(N,a[1],a[1],a[2])end end;openTab(c,L,M,G)drawButton(N,'close','Close','Close this window')M.style.minimal_height=300;M.style.maximal_height=300;M.style.minimal_width=500;M.style.maximal_width=500;O.style.minimal_height=60;O.style.maximal_height=60;O.style.minimal_width=500;O.style.maximal_width=500 end end;function toggleVisable(B)if B then if B.style.visible==nil then B.style.visible=false else B.style.visible=not B.style.visible end end end;script.on_event(defines.events.on_player_created,function(P)local c=game.players[P.player_index]c.insert{name="iron-plate",count=8}c.insert{name="pistol",count=1}c.insert{name="firearm-magazine",count=10}c.insert{name="burner-mining-drill",count=1}c.insert{name="stone-furnace",count=1}c.force.chart(c.surface,{{c.position.x-200,c.position.y-200},{c.position.x+200,c.position.y+200}})end)script.on_event(defines.events.on_player_respawned,function(P)local c=game.players[P.player_index]drawPlayerList()c.insert{name="pistol",count=1}c.insert{name="firearm-magazine",count=10}end)script.on_event(defines.events.on_player_joined_game,function(P)loadVar()if#game.players==1 then for d,rank in pairs(ranks)do game.permissions.create_group(rank.name)end end;local c=game.players[P.player_index]autoRank(c)c.print({"","Welcome"})if c.gui.left.PlayerList~=nil then c.gui.left.PlayerList.destroy()end;if c.gui.center.README~=nil then c.gui.center.README.destroy()end;if c.gui.top.PlayerList~=nil then c.gui.top.PlayerList.destroy()end;drawPlayerList()drawToolbar(c)local Q=encode(game.players,"players",{"name","admin","online_time","connected","index"})game.write_file("players.json",Q,false,0)if not c.admin and ticktominutes(c.online_time)<1 then drawFrame(c,'Readme','Rules')end end)script.on_event(defines.events.on_player_left_game,function(P)local c=game.players[P.player_index]drawPlayerList()end)script.on_event(defines.events.on_gui_click,function(P)local c=game.players[P.player_index]if P.element.type=='button'then for d,R in pairs(guis.buttons)do if R[1]==P.element.name then if R[2]then R[2](c,P.element)else callRank('Invaid Button'..R[1],'Mod')end;break end end elseif P.element.type=='checkbox'then if P.element.name=='select'then if not selected[P.player_index]then selected[P.player_index]={}end;if P.element.state then table.insert(selected[P.player_index],P.element.parent.name)else for d,S in pairs(selected[P.player_index])do if S==P.element.parent.name then table.remove(selected[P.player_index],d)break end end end end;saveVar()end end)script.on_event(defines.events.on_gui_text_changed,function(P)local c=game.players[P.player_index]if P.element.parent.name=='filterTable'then local B=P.element;local T={}local U=false;local V=false;if B.parent.parent.parent.name=='Admin'and not B.parent.sel_input then U=true;T[#T+1]='online'end;if B.parent.parent.parent.name=='Admin'and B.parent.sel_input then V=true;T[#T+1]='lower'end;if B.parent.parent.filterTable.status_input and not U then local W=B.parent.parent.filterTable.status_input.text;if W=='yes'or W=='online'or W=='true'or W=='y'then T[#T+1]='online'elseif W~=''then T[#T+1]='offline'end end;if B.parent.parent.filterTable.hours_input then local X=B.parent.parent.filterTable.hours_input.text;if tonumber(X)and tonumber(X)>0 then T[#T+1]=tonumber(X)end end;if B.parent.parent.filterTable.name_input then local Y=B.parent.parent.filterTable.name_input.text;if Y then T[#T+1]=Y end end;if B.parent.parent.filterTable.sel_input then local Z=B.parent.parent.filterTable.sel_input.text;if Z=='yes'or Z=='online'or Z=='true'or Z=='y'then T[#T+1]='selected'end end;if B.parent.parent.playerTable then B.parent.parent.playerTable.destroy()end;drawPlayerTable(c,B.parent.parent,U,V,T)end end)script.on_event(defines.events.on_marked_for_deconstruction,function(P)local _=game.players[P.player_index]if not _.admin and ticktominutes(_.online_time)<timeForRegular then if P.entity.type~="tree"and P.entity.type~="simple-entity"then P.entity.cancel_deconstruction("player")_.print("You are not allowed to do this yet, play for player bit longer. Try again in about: "..math.floor(timeForRegular-ticktominutes(_.online_time)).." minutes")callRank(_.name.." tryed to deconstruced something")end elseif P.entity.type=="tree"or P.entity.type=="simple-entity"then P.entity.destroy()end end)script.on_event(defines.events.on_built_entity,function(P)local _=game.players[P.player_index]local timeForRegular=120;if not _.admin and ticktominutes(_.online_time)<timeForRegular then if P.created_entity.type=="tile-ghost"then P.created_entity.destroy()_.print("You are not allowed to do this yet, play for player bit longer. Try: "..math.floor(timeForRegular-ticktominutes(_.online_time)).." minutes")callRank(_.name.." tryed to place concrete/stone with robots")end end end)script.on_event(defines.events.on_rocket_launched,function(P)local a0=P.rocket.force;if P.rocket.get_item_count("satellite")==0 then if#game.players<=1 then game.show_message_dialog{text={"gui-rocket-silo.rocket-launched-without-satellite"}}else for a1,c in pairs(a0.players)do c.print({"gui-rocket-silo.rocket-launched-without-satellite"})end end;return end;if not global.satellite_sent then global.satellite_sent={}end;if global.satellite_sent[a0.name]then global.satellite_sent[a0.name]=global.satellite_sent[a0.name]+1 else game.set_game_state{game_finished=true,player_won=true,can_continue=true}global.satellite_sent[a0.name]=1 end;for a1,c in pairs(a0.players)do if c.gui.left.rocket_score then c.gui.left.rocket_score.rocket_count.caption=tostring(global.satellite_sent[a0.name])else local B=c.gui.left.add{name="rocket_score",type="frame",direction="horizontal",caption={"score"}}B.add{name="rocket_count_label",type="label",caption={"",{"rockets-sent"},":"}}B.add{name="rocket_count",type="label",caption=tostring(global.satellite_sent[a0.name])}end end end)script.on_event(defines.events.on_tick,function(P)if game.tick/(3600*game.speed)%15==0 then autoMessage()end end)function encode(table,S,a2)local a3;local a4;local a5;for a6,a7 in pairs(table)do a5=nil;for a6,a8 in pairs(a2)do if type(a7[a8])=="string"then if a5~=nil then a5=a5 ..",\""..a8 .."\": \""..a7[a8].."\""else a5="\""..a8 .."\": \""..a7[a8].."\""end elseif type(a7[a8])=="number"then if a5~=nil then a5=a5 ..",\""..a8 .."\": "..tostring(a7[a8])else a5="\""..a8 .."\": "..tostring(a7[a8])end elseif type(a7[a8])=="boolean"then if a5~=nil then a5=a5 ..",\""..a8 .."\": "..tostring(a7[a8])else a5="\""..a8 .."\": "..tostring(a7[a8])end end end;if a5~=nil and a4~=nil then a4=a4 ..", {"..a5 .."}"else a4="{"..a5 .."}"end end;a3="{".."\""..S.."\": ["..a4 .."]}"return a3 end;addButton("btn_toolbar_playerList",function(c)toggleVisable(c.gui.left.PlayerList)end)function drawToolbar(c)local B=c.gui.top;B.clear()drawButton(B,"btn_toolbar_playerList","Playerlist","Adds player player list to your game.")for d,a9 in pairs(guis.frames)do if getRank(c).power<=a9[1].require then drawButton(B,"btn_"..d,a9[1].caption,a9[1].tooltip)end end end;function drawPlayerList()for a6,c in pairs(game.connected_players)do if c.gui.left.PlayerList==nil then c.gui.left.add{type="frame",name="PlayerList",direction="vertical"}.add{type="scroll-pane",name="PlayerListScroll",direction="vertical",vertical_scroll_policy="always",horizontal_scroll_policy="never"}end;Plist=c.gui.left.PlayerList.PlayerListScroll;Plist.clear()Plist.style.maximal_height=200;for a6,c in pairs(game.connected_players)do playerRank=getRank(c)if playerRank.power<=3 then if playerRank.shortHand~=''then Plist.add{type="label",name=c.name,style="caption_label_style",caption={"",ticktohour(c.online_time)," H - ",c.name,' - '..playerRank.shortHand}}else Plist.add{type="label",name=c.name,style="caption_label_style",caption={"",ticktohour(c.online_time)," H - ",c.name}}end;Plist[c.name].style.font_color=playerRank.colour;c.tag=playerRank.tag end end;for a6,c in pairs(game.connected_players)do playerRank=getRank(c)if playerRank.power>3 then if playerRank.shortHand~=''then Plist.add{type="label",name=c.name,style="caption_label_style",caption={"",ticktohour(c.online_time)," H - ",c.name,' - '..playerRank.shortHand}}else Plist.add{type="label",name=c.name,style="caption_label_style",caption={"",ticktohour(c.online_time)," H - ",c.name}}end;Plist[c.name].style.font_color=playerRank.colour;c.tag=playerRank.tag end end end end;addButton('goto',function(c,B)local p=game.players[B.parent.name]c.teleport(game.surfaces[p.surface.name].find_non_colliding_position("player",p.position,32,1))end)addButton('bring',function(c,B)local p=game.players[B.parent.name]p.teleport(game.surfaces[c.surface.name].find_non_colliding_position("player",c.position,32,1))end)addButton('jail',function(c,B)jailPlayer(game.players[B.parent.name],c)end)addButton('kill',function(c,B)local p=game.players[B.parent.name]if p.character then p.character.die()end end)function drawPlayerTable(c,B,U,V,T)if B.playerTable then B.playerTable.destroy()end;B.add{name='playerTable',type="table",colspan=5}B.playerTable.style.minimal_width=500;B.playerTable.style.maximal_width=500;B.playerTable.style.horizontal_spacing=10;B.playerTable.add{name="id",type="label",caption="Id "}B.playerTable.add{name="Pname",type="label",caption="Name "}if U==false and V==false then B.playerTable.add{name="status",type="label",caption="Status "}end;B.playerTable.add{name="online_time",type="label",caption="Online Time "}B.playerTable.add{name="rank",type="label",caption="Rank "}if U then B.playerTable.add{name="commands",type="label",caption="Commands"}end;if V then B.playerTable.add{name="select_label",type="label",caption="Selection"}end;for a6,p in pairs(game.players)do local aa=true;for d,ab in pairs(T)do if ab=='admin'then if p.admin==false then aa=false;break end elseif ab=='online'then if p.connected==false then aa=false;break end elseif ab=='offline'then if p.connected==true then aa=false;break end elseif ab=='lower'then if getRank(p).power<=getRank(c).power then aa=false;break end elseif ab=='selected'then local o=nil;for d,S in pairs(selected[c.index])do if S==p.name then o=true;break end end;if not o then aa=false;break end elseif type(ab)=='number'then if ab>ticktominutes(p.online_time)then aa=false;break end elseif type(ab)=='string'then if p.name:lower():find(ab:lower())==nil then aa=false;break end end end;if aa==true and c.name~=p.name then if B.playerTable[p.name]==nil then B.playerTable.add{name=a6 .."id",type="label",caption=a6}B.playerTable.add{name=p.name..'_name',type="label",caption=p.name}if not U and not V then if p.connected==true then B.playerTable.add{name=p.name.."Status",type="label",caption="ONLINE"}else B.playerTable.add{name=p.name.."Status",type="label",caption="OFFLINE"}end end;B.playerTable.add{name=p.name.."Online_Time",type="label",caption=ticktohour(p.online_time)..'H '..ticktominutes(p.online_time)-60*ticktohour(p.online_time)..'M'}B.playerTable.add{name=p.name.."Rank",type="label",caption=p.tag}if U then B.playerTable.add{name=p.name,type="flow"}drawButton(B.playerTable[p.name],'goto','Tp','Goto to the players location')drawButton(B.playerTable[p.name],'bring','Br','Bring player player to your location')if getRank(p).power>getRank(c).power then drawButton(B.playerTable[p.name],'jail','Ja','Jail/Unjail player')drawButton(B.playerTable[p.name],'kill','Ki','Kill this player')end elseif V then B.playerTable.add{name=p.name,type="flow"}local ac=false;for d,S in pairs(selected[c.index])do if S==p.name then ac=true;break end end;B.playerTable[p.name].add{name='select',type="checkbox",state=ac}end end end end end;addFrame('Readme',6,'Rules','Readme','Rules, Server info, How to chat, Playerlist, Adminlist.')addTab('Readme','Rules','The rules of the server',function(c,B)local ad={"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 without permission.","Do not use active provider chests without permission.","Do not remove/move major parts of the factory without permission.","Do not walk in player random direction for no reason(to save map size).","Do not remove stuff just because you don't like it, tell people first.","Do not make train roundabouts.","Trains are Left Hand Drive (LHD) only.","Do not complain about lag, low fps and low ups or other things like that.","Do not ask for rank.","Use common sense and what an admin says goes."}for a6,ae in pairs(ad)do B.add{name=a6,type="label",caption={"",a6,". ",ae}}end end)addTab('Readme','Server Info','Info about the server',function(c,B)B.add{name=1,type="label",caption={"","Discord voice and chat server:"}}B.add{name=2,type='textfield',text='https://discord.gg/RPCxzgt'}.style.minimal_width=400;B.add{name=3,type="label",caption={"","Our forum:"}}B.add{name=4,type='textfield',text='https://explosivegaming.nl'}.style.minimal_width=400;B.add{name=5,type="label",caption={"","Steam:"}}B.add{name=6,type='textfield',text='http://steamcommunity.com/groups/tntexplosivegaming'}.style.minimal_width=400 end)addTab('Readme','How to chat','Just in case you dont know how to chat',function(c,B)local af={"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 a6,ag in pairs(af)do B.add{name=a6,type="label",caption={"",ag}}end end)addTab('Readme','Admins','List of all the people who can ban you :P',function(c,B)local ah={"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 a6,ag in pairs(ah)do B.add{name=a6,type="label",caption={"",ag}}end;drawPlayerTable(c,B,false,false,{'admin'})end)addTab('Readme','Players','List of all the people who have been on the server',function(c,B)local n={"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 a6,ag in pairs(n)do B.add{name=a6,type="label",caption={"",ag}}end;B.add{name='filterTable',type='table',colspan=3}B.filterTable.add{name='name_label',type='label',caption='Name'}B.filterTable.add{name='status_label',type='label',caption='Online?'}B.filterTable.add{name='hours_label',type='label',caption='Online Time (minutes)'}B.filterTable.add{name='name_input',type='textfield'}B.filterTable.add{name='status_input',type='textfield'}B.filterTable.add{name='hours_input',type='textfield'}drawPlayerTable(c,B,false,false,{})end)addFrame('Admin',2,'Player List','Admin',"All admin fuctions are here")addButton('btn_toolbar_automessage',function()autoMessage()end)addButton('tp_all',function(c,B)for a6,p in pairs(game.connected_players)do local ai=game.surfaces[c.surface.name].find_non_colliding_position("player",c.position,32,1)if p~=c then p.teleport(ai)end end end)addButton('revive_dead_entitys_range',function(c,B)if tonumber(B.parent.range.text)then local aj=tonumber(B.parent.range.text)for ak,al in pairs(game.surfaces[1].find_entities_filtered({area={{c.position.x-aj,c.position.y-aj},{c.position.x+aj,c.position.y+aj}},type="entity-ghost"}))do al.revive()end end end)addButton('add_dev_items',function(c,B)c.insert{name="deconstruction-planner",count=1}c.insert{name="blueprint-book",count=1}c.insert{name="blueprint",count=20}end)addButton('sendMessage',function(c,B)local rank=stringToRank(B.parent.message.rank.text)if rank then callRank(B.parent.message.message.text,rank.name)else for d,rank in pairs(ranks)do c.print(rank.name)end end end)addButton('setRanks',function(c,B)rank=stringToRank(B.parent.rank_input.text)if rank then for d,am in pairs(selected[c.index])do p=game.players[am]if getRank(c).power<getRank(p).power and rank.power>getRank(c).power then giveRank(p,rank,c)else c.print('You can not edit '..p.name.."'s rank there rank is too high (or the rank you have slected is above you)")end end else c.print(B.parent.rank_input.text..' is not a Rank, Ranks are:')for d,rank in pairs(ranks)do if rank.power>getRank(c).power then c.print(rank.name)end end end end)addButton('clearSelection',function(c,B)clearSelection(c)drawPlayerTable(c,B.parent.parent,false,true,{})end)addTab('Admin','Commands','Random useful commands',function(c,B)drawButton(B,'btn_toolbar_automessage','Auto Message','Send the auto message to all online players')drawButton(B,'add_dev_items','Get Blueprints','Get all the blueprints')drawButton(B,'revive_dead_entitys_range','Revive Entitys','Brings all dead machines back to life in player range')B.add{type='textfield',name='range',text='Range'}B.add{type='flow',name='message'}B.message.add{type='textfield',name='message',text='Enter message'}B.message.add{type='textfield',name='rank',text='Enter rank'}drawButton(B,'sendMessage','Send Message','Send a message to all ranks higher than the slected')drawButton(B,'tp_all','TP All Here','Brings all players to you')end)addTab('Admin','Edit Ranks','Edit the ranks of players below you',function(c,B)clearSelection(c)B.add{name='filterTable',type='table',colspan=2}B.filterTable.add{name='name_label',type='label',caption='Name'}B.filterTable.add{name='sel_label',type='label',caption='Selected?'}B.filterTable.add{name='name_input',type='textfield'}B.filterTable.add{name='sel_input',type='textfield'}B.add{type='flow',name='rank',direction='horizontal'}B.rank.add{name='rank_label',type='label',caption='Rank'}B.rank.add{name='rank_input',type='textfield'}drawButton(B.rank,'setRanks','Set Ranks','Sets the rank of all selected players')drawButton(B.rank,'clearSelection','Clear Selection','Clears all currently selected players')drawPlayerTable(c,B,false,true,{'lower'})end)addTab('Admin','Player List','Send player message to all players',function(c,B)B.add{name='filterTable',type='table',colspan=2}B.filterTable.add{name='name_label',type='label',caption='Name'}B.filterTable.add{name='hours_label',type='label',caption='Online Time (minutes)'}B.filterTable.add{name='name_input',type='textfield'}B.filterTable.add{name='hours_input',type='textfield'}drawPlayerTable(c,B,true,false,{'online'})end)addFrame('Admin+',1,'Modifiers','Admin+',"Because we are better")addButton('remove_biters',function(c,B)for ak,al in pairs(game.surfaces[1].find_entities_filtered({force='enemy'}))do al.destroy()end end)addButton('toggle_cheat',function(c,B)c.cheat_mode=not c.cheat_mode end)addButton('revive_dead_entitys',function(c,B)for ak,al in pairs(game.surfaces[1].find_entities_filtered({type="entity-ghost"}))do al.revive()end end)addButton("btn_Modifier_apply",function(c,B)local an={"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 a6,ao in pairs(an)do local ap=tonumber(B.parent.parent.modifierTable[ao.."_input"].text:match("[%d]+[.%d+]"))if ap~=nil then if ap>=0 and ap<50 and ap~=c.force[ao]then c.force[ao]=ap;c.print(ao.." changed to number: "..tostring(ap))elseif ap==c.force[ao]then c.print(ao.." Did not change")else c.print(ao.." needs to be player higher number or it contains an letter")end end end end)addTab('Admin+','Commands','Random useful commands',function(c,B)drawButton(B,'btn_toolbar_automessage','Auto Message','Send the auto message to all online players')drawButton(B,'add_dev_items','Get Blueprints','Get all the blueprints')drawButton(B,'revive_dead_entitys','Revive All Entitys','Brings all dead machines back to life')drawButton(B,'revive_dead_entitys_range','Revive Entitys','Brings all dead machines back to life in player range')B.add{type='textfield',name='range',text='Range'}drawButton(B,'remove_biters','Kill Biters','Removes all biters in map')drawButton(B,'tp_all','TP All Here','Brings all players to you')drawButton(B,'toggle_cheat','Toggle Cheat Mode','Toggle your cheat mode')end)addTab('Admin+','Modifiers','Edit in game modifiers',function(c,B)local an={"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"}B.add{type="flow",name="flowNavigation",direction="horizontal"}B.add{name="modifierTable",type="table",colspan=3}B.modifierTable.add{name="Mname",type="label",caption="name"}B.modifierTable.add{name="input",type="label",caption="input"}B.modifierTable.add{name="current",type="label",caption="current"}for a6,ao in pairs(an)do B.modifierTable.add{name=ao,type="label",caption=ao}B.modifierTable.add{name=ao.."_input",type="textfield",caption="inputTextField"}B.modifierTable.add{name=ao.."_current",type="label",caption=tostring(c.force[ao])}end;drawButton(B.flowNavigation,"btn_Modifier_apply","Apply","Apply the new values to the game")end) |