diff --git a/control.lua b/control.lua index d0411445..ef5494cc 100644 --- a/control.lua +++ b/control.lua @@ -1 +1,827 @@ -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/(216000*game.speed)))return o end;function ticktominutes(n)local p=math.floor(n/(3600*game.speed))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,0)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;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 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 a 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 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)s.add{name=1,type="label",caption={"","Discord voice and chat server:"}}s.add{name=2,type='textfield',text='https://discord.gg/RPCxzgt'}.style.minimal_width=400;s.add{name=3,type="label",caption={"","Our forum:"}}s.add{name=4,type='textfield',text='https://explosivegaming.nl'}.style.minimal_width=400;s.add{name=5,type="label",caption={"","Steam:"}}s.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(r,s)local a4={"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(a4)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 a6={"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(a6)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 a7={"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(a7)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 a8,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 a9=tonumber(s.parent.range.text)for a8,e in pairs(game.surfaces[1].find_entities_filtered({area={{r.position.x-a9,r.position.y-a9},{r.position.x+a9,r.position.y+a9}},type="entity-ghost"}))do e.revive()end end end)addButton('remove_biters',function(r,s)for a8,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 aa=game.surfaces[r.surface.name].find_non_colliding_position("player",r.position,32,1)if _~=r then _.teleport(aa)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 ab={"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,ac in pairs(ab)do local ad=tonumber(s.parent.parent.modifierTable[ac.."_input"].text:match("[%d]+[.%d+]"))if ad~=nil then if ad>=0 and ad<50 and ad~=r.force[ac]then r.force[ac]=ad;r.print(ac.." changed to number: "..tostring(ad))elseif ad==r.force[ac]then r.print(ac.." Did not change")else r.print(ac.." 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 ab={"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,ac in pairs(ab)do s.modifierTable.add{name=ac,type="label",caption=ac}s.modifierTable.add{name=ac.."_input",type="textfield",caption="inputTextField"}s.modifierTable.add{name=ac.."_current",type="label",caption=tostring(r.force[ac])}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 +require("silo-script") +require "mod-gui" +local version = 1 +entityRemoved = {} +entityCache = {} +guis = {frames={},buttons={}} +--functions can not be included in the default list or be added by code +defaults = { + itemRotated = {}, + --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 + ranks={ + {name='Owner',shortHand='Owner',tag='[Owner]',power=0,colour={r=170,g=0,b=0},disallow={}}, + {name='Community Manager',shortHand='Com Mngr',tag='[Com Mngr]',power=1,colour={r=150,g=68,b=161},disallow={}}, + {name='Developer',shortHand='Dev',tag='[Dev]',power=1,colour={r=179,g=125,b=46},disallow={}}, + {name='Admin',shortHand='Admin',tag='[Admin]',power=2,colour={r=170,g=41,b=170},disallow={'set_allow_commands','edit_permission_group','delete_permission_group','add_permission_group'}}, + {name='Mod',shortHand='Mod',tag='[Mod]',power=3,colour={r=233,g=63,b=233},disallow={'set_allow_commands','server_command','edit_permission_group','delete_permission_group','add_permission_group'}}, + {name='Donator',shortHand='P2W',tag='[P2W]',power=4,colour={r=233,g=63,b=233},disallow={'set_allow_commands','server_command','edit_permission_group','delete_permission_group','add_permission_group'}}, + {name='Member',shortHand='Mem',tag='[Member]',power=5,colour={r=24,g=172,b=188},disallow={'set_allow_commands','server_command','edit_permission_group','delete_permission_group','add_permission_group'}}, + {name='Regular',shortHand='Reg',tag='[Regukar]',power=5,colour={r=24,g=172,b=188},disallow={'set_auto_launch_rocket','change_programmable_speaker_alert_parameters','reset_assembling_machine','drop_item','set_allow_commands','server_command','edit_permission_group','delete_permission_group','add_permission_group'}}, + {name='Guest',shortHand='',tag='[Guest]',power=6,colour={r=255,g=159,b=27},disallow={'build_terrain','remove_cables','launch_rocket','cancel_research','set_auto_launch_rocket','change_programmable_speaker_alert_parameters','reset_assembling_machine','drop_item','set_allow_commands','server_command','edit_permission_group','delete_permission_group','add_permission_group'}}, + {name='Jail',shortHand='Jail',tag='[Jail]',power=7,colour={r=50,g=50,b=50},disallow={'open_character_gui','begin_mining','start_walking','player_leave_game','build_terrain','remove_cables','launch_rocket','cancel_research','set_auto_launch_rocket','change_programmable_speaker_alert_parameters','reset_assembling_machine','drop_item','set_allow_commands','server_command','edit_permission_group','delete_permission_group','add_permission_group'}} + }, + autoRanks={ + Owner={'badgamernl','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={}, + oldRanks={} +} + +warningAllowed = nil +timeForRegular = 180 +CHUNK_SIZE = 32 + +function loadVar(t) + if t == nil then + local g = nil + if game.players[1].gui.left.hidden then + g = game.players[1].gui.left.hidden.caption + else + g = 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 '..g)() + else gTable = t end + itemRotated = gTable.itemRotated + ranks= gTable.ranks + autoRanks= gTable.autoRanks + selected= gTable.selected + oldRanks= gTable.oldRanks +end +loadVar(defaults) +function saveVar() + gTable.itemRotated = itemRotated + gTable.ranks = ranks + gTable.autoRanks = autoRanks + gTable.selected= selected + gTable.oldRanks= oldRanks + game.players[1].gui.left.hidden.caption = table.tostring(gTable) +end +---------------------------------------------------------------------------------------- +---------------------------Factorio Code Do Not Remove---------------------------------- +---------------------------------------------------------------------------------------- +script.on_init(function() + global.version = version + silo_script.init() +end) + +script.on_event(defines.events.on_rocket_launched, function(event) + silo_script.on_rocket_launched(event) +end) + +script.on_configuration_changed(function(event) + if global.version ~= version then + global.version = version + end + silo_script.on_configuration_changed(event) +end) + +silo_script.add_remote_interface() +---------------------------------------------------------------------------------------- +---------------------------------------------------------------------------------------- +---------------------------Rank functions----------------------------------------------- +---------------------------------------------------------------------------------------- +function getRank(player) + if player then + for _,rank in pairs(ranks) do + if player.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 Foundranks={} + for _,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(Foundranks,rank) end + end + if #Foundranks == 1 then return Foundranks[1] end + end +end + +function callRank(msg, rank, inv) + local rank = stringToRank(rank) or stringToRank('Mod') -- default mod or higher + local inv = inv or false + for _, player in pairs(game.players) do + rankPower = getRank(player).power + if inv then + if rankPower >= rank.power then + player.print(('[Everyone]: '..msg)) + end + else + if rankPower <= rank.power then + if rank.shortHand ~= '' then player.print(('['..(rank.shortHand)..']: '..msg)) else player.print(('[Everyone]: '..msg)) end + end + end + end +end + +function giveRank(player,rank,byPlayer) + local byPlayer = byPlayer or 'system' + local rank = stringToRank(rank) or rank or stringToRank('Guest') + local oldRank = getRank(player) + local message = 'demoted' + if rank.power <= oldRank.power then message = 'promoted' end + if byPlayer.name then + callRank(player.name..' was '..message..' to '..rank.name..' by '..byPlayer.name,oldRank.name) + else + callRank(player.name..' was '..message..' to '..rank.name..' by ',oldRank.name) + end + player.permission_group = game.permissions.get_group(rank.name) + drawToolbar(player) + drawPlayerList() + oldRanks[player.index]=oldRank.name + saveVar() +end + +function revertRank(player,byPlayer) + local rank = stringToRank(oldRanks[player.index]) + giveRank(player,rank,byPlayer) +end + +function autoRank(player) + local currentRank = getRank(player) + local playerAutoRank = nil + local oldRank = getRank(player) + for rank,players in pairs(autoRanks) do + local Break = false + for _,p in pairs(players) do + if player.name == p then playerAutoRank = stringToRank(rank) Break = true break end + end + if Break then break end + end + if playerAutoRank then + if currentRank.power > playerAutoRank.power then + player.permission_group=game.permissions.get_group(playerAutoRank.name) + end + elseif ticktominutes(player.online_time) >= timeForRegular then giveRank(player,'Regular') + else player.permission_group=game.permissions.get_group(stringToRank('Guest')) end + if getRank(player).power <= 3 and not player.admin then callRank(player.name..' needs to be promoted.') end + if oldRank.name ~= getRank(player).name then oldRanks[player.index]=oldRank.name end + saveVar() +end +---------------------------------------------------------------------------------------- +---------------------------Common use functions----------------------------------------- +---------------------------------------------------------------------------------------- +function ticktohour (tick) + local hour = tostring(math.floor(tick/(216000*game.speed))) + return hour +end + +function ticktominutes (tick) + local minutes = math.floor(tick/(3600*game.speed)) + return minutes +end + +function clearSelection(player) + selected[player.index] = {} +end + +function autoMessage() + local lrank = 'Regular' + local hrank = 'Mod' + callRank('There are '..#game.connected_players..' players online',hrank,true) + callRank('This map has been on for '..ticktohour(game.tick)..' Hours and '..(ticktominutes(game.tick)-60*ticktohour(game.tick))..' Minutes',hrank,true) + callRank('Please join us on:',lrank,true) + callRank('Discord: https://discord.gg/RPCxzgt',lrank,true) + callRank('Forum: explosivegaming.nl',lrank,true) + callRank('Steam: http://steamcommunity.com/groups/tntexplosivegaming',lrank,true) + callRank('To see these links again goto: Readme > Server Info',lrank,true) + for _,player in pairs(game.connected_players) do autoRank(player) end +end +---------------------------------------------------------------------------------------- +---------------------------Table Functions---------------------------------------------- +---------------------------------------------------------------------------------------- +function table.val_to_str ( v ) + if "string" == type( v ) then + v = string.gsub( v, "\n", "\\n" ) + if string.match( string.gsub(v,"[^'\"]",""), '^"+$' ) then + return "'" .. v .. "'" + end + return '"' .. string.gsub(v,'"', '\\"' ) .. '"' + else + return "table" == type( v ) and table.tostring( v ) or + tostring( v ) + end +end + +function table.key_to_str ( k ) + if "string" == type( k ) and string.match( k, "^[_%player][_%player%d]*$" ) then + return k + else + return "[" .. table.val_to_str( k ) .. "]" + end +end + +function table.tostring( tbl ) + local result, done = {}, {} + for k, v in ipairs( tbl ) do + table.insert( result, table.val_to_str( v ) ) + done[ k ] = true + end + for k, v in pairs( tbl ) do + if not done[ k ] then + table.insert( result, + table.key_to_str( k ) .. "=" .. table.val_to_str( v ) ) + end + end + return "{" .. table.concat( result, "," ) .. "}" +end +---------------------------------------------------------------------------------------- +---------------------------Gui Functions------------------------------------------------ +---------------------------------------------------------------------------------------- +function addFrame(frame,rank,open,caption,tooltip,sprite) + guis.frames[frame] = {{require=rank,caption=caption,tooltip=tooltip,sprite=sprite}} + addButton('close', function(player,element) element.parent.parent.parent.destroy() end) + addButton('btn_'..frame, function(player,element) if player.gui.center[frame] then player.gui.center[frame].destroy() else drawFrame(player,frame,open) end end) +end + +function addTab(frame, tabName, describtion, drawTab) + guis.frames[frame][tabName] = {tabName, describtion, drawTab} + addButton(tabName, function(player, element) openTab(player, element.parent.parent.parent.name, element.parent.parent.parent.tab, element.name) end) +end + +function addButton(btnName, onClick) + guis.buttons[btnName] = {btnName, onClick} +end + +function drawButton(frame, btnName, caption, describtion, sprite) + if sprite then + frame.add{name=btnName, type = "sprite-button", sprite=sprite, tooltip=describtion, style = mod_gui.button_style} + else + frame.add{name=btnName, type = "button", caption=caption, tooltip=describtion, style = mod_gui.button_style} + end +end + +function openTab(player, frameName, tab, tabName) + local tabBar = player.gui.center[frameName].tabBarScroll.tabBar + for _,t in pairs(guis.frames[frameName]) do + if _ ~= 1 then + if t[1] == tabName then + tabBar[t[1]].style.font_color = {r = 255, g = 255, b = 255, player = 255} + tab.clear() + t[3](player, tab) + else + tabBar[t[1]].style.font_color = {r = 100, g = 100, b = 100, player = 255} + end + end + end +end + +function drawFrame(player, frameName, tabName) + if getRank(player).power <= guis.frames[frameName][1].require then + if player.gui.center[frameName] then player.gui.center[frameName].destroy() end + local frame = player.gui.center.add{name=frameName,type='frame',caption=frameName,direction='vertical',style=mod_gui.frame_style} + local tabBarScroll = frame.add{type = "scroll-pane", name= "tabBarScroll", vertical_scroll_policy="never", horizontal_scroll_policy="always"} + local tabBar = tabBarScroll.add{type='flow',direction='horizontal',name='tabBar'} + local tab = frame.add{type = "scroll-pane", name= "tab", vertical_scroll_policy="auto", horizontal_scroll_policy="never"} + for _,t in pairs(guis.frames[frameName]) do + if _ ~= 1 then drawButton(tabBar, t[1], t[1], t[2]) end + end + openTab(player, frameName, tab, tabName) + drawButton(tabBar, 'close', 'Close', 'Close this window') + tab.style.minimal_height = 300 + tab.style.maximal_height = 300 + tab.style.minimal_width = 500 + tab.style.maximal_width = 500 + tabBarScroll.style.minimal_height = 60 + tabBarScroll.style.maximal_height = 60 + tabBarScroll.style.minimal_width = 500 + tabBarScroll.style.maximal_width = 500 + end +end + +function toggleVisable(frame) + if frame then + if frame.style.visible == nil then + frame.style.visible = false + else + frame.style.visible = not frame.style.visible + end + end +end +---------------------------------------------------------------------------------------- +---------------------------Player Events------------------------------------------------ +---------------------------------------------------------------------------------------- +script.on_event(defines.events.on_player_created, function(event) + local player = game.players[event.player_index] + player.force.friendly_fire = false + player.insert{name="iron-plate", count=8} + player.insert{name="pistol", count=1} + player.insert{name="firearm-magazine", count=10} + player.insert{name="burner-mining-drill", count = 1} + player.insert{name="stone-furnace", count = 1} + player.force.chart(player.surface, {{player.position.x - 200, player.position.y - 200}, {player.position.x + 200, player.position.y + 200}}) +end) + +script.on_event(defines.events.on_player_respawned, function(event) + local player = game.players[event.player_index] + drawPlayerList() + player.insert{name="pistol", count=1} + player.insert{name="firearm-magazine", count=10} +end) + +script.on_event(defines.events.on_player_joined_game, function(event) + loadVar() + --runs when the first player joins to make the permission groups + if #game.players == 1 then + for _,rank in pairs(ranks) do + game.permissions.create_group(rank.name) + for _,toRemove in pairs(rank.disallow) do + game.permissions.get_group(rank.name).set_allows_action(defines.input_action[toRemove],false) + end + end + end + --Standard start up + local player = game.players[event.player_index] + autoRank(player) + player.print({"", "Welcome"}) + drawPlayerList() + drawToolbar(player) + local playerStringTable = encode(game.players, "players", {"name", "admin", "online_time", "connected", "index"}) + game.write_file("players.json", playerStringTable, false, 0) + if not player.admin and ticktominutes(player.online_time) < 1 then drawFrame(player,'Readme','Rules') end +end) + +script.on_event(defines.events.on_player_left_game, function(event) + local player = game.players[event.player_index] + drawPlayerList() +end) +---------------------------------------------------------------------------------------- +---------------------------Gui Events--------------------------------------------------- +---------------------------------------------------------------------------------------- +script.on_event(defines.events.on_gui_click, function(event) + silo_script.on_gui_click(event) + local player = game.players[event.player_index] + if event.element.type == 'button' or event.element.type == 'sprite-button' then + for _,btn in pairs(guis.buttons) do + if btn[1] == event.element.name then + if btn[2] then btn[2](player,event.element) else callRank('Invaid Button'..btn[1],'Mod') end + break + end + end + elseif event.element.type == 'checkbox' then + if event.element.name == 'select' then + if not selected[event.player_index] then selected[event.player_index] = {} end + if event.element.state then + table.insert(selected[event.player_index],event.element.parent.name) + else + for _,name in pairs(selected[event.player_index]) do + if name == event.element.parent.name then table.remove(selected[event.player_index],_) break end + end + end + end + saveVar() + end +end) + +script.on_event(defines.events.on_gui_text_changed, function(event) + local player = game.players[event.player_index] + if event.element.parent.name == 'filterTable' then + local frame = event.element + local filters = {} + local commands = false + local select = false + if frame.parent.parent.parent.name == 'Admin' and not frame.parent.sel_input then commands = true filters[#filters+1] = 'online' end + if frame.parent.parent.parent.name == 'Admin' and frame.parent.sel_input then select = true filters[#filters+1] = 'lower' end + if frame.parent.parent.filterTable.status_input and not commands then + local status_input = frame.parent.parent.filterTable.status_input.text + if status_input == 'yes' or status_input == 'online' or status_input == 'true' or status_input == 'y' then filters[#filters+1] = 'online' + elseif status_input ~= '' then filters[#filters+1] = 'offline' end + end if frame.parent.parent.filterTable.hours_input then + local hours_input = frame.parent.parent.filterTable.hours_input.text + if tonumber(hours_input) and tonumber(hours_input) > 0 then filters[#filters+1] = tonumber(hours_input) end + end if frame.parent.parent.filterTable.name_input then + local name_input = frame.parent.parent.filterTable.name_input.text + if name_input then filters[#filters+1] = name_input end + end if frame.parent.parent.filterTable.sel_input then + local sel_input = frame.parent.parent.filterTable.sel_input.text + if sel_input == 'yes' or sel_input == 'online' or sel_input == 'true' or sel_input == 'y' then filters[#filters+1] = 'selected' end + end + drawPlayerTable(player, frame.parent.parent, commands, select, filters) + end +end) +---------------------------------------------------------------------------------------- +---------------------------Grefer Events------------------------------------------------ +---------------------------------------------------------------------------------------- +script.on_event(defines.events.on_marked_for_deconstruction, function(event) + local eplayer = game.players[event.player_index] + if not eplayer.admin and ticktominutes(eplayer.online_time) < timeForRegular then + if event.entity.type ~= "tree" and event.entity.type ~= "simple-entity" then + event.entity.cancel_deconstruction("player") + eplayer.print("You are not allowed to do this yet, play for player bit longer. Try again in about: " .. math.floor((timeForRegular - ticktominutes(eplayer.online_time))) .. " minutes") + callRank(eplayer.name .. " tryed to deconstruced something") + end + elseif event.entity.type == "tree" or event.entity.type == "simple-entity" then + event.entity.destroy() + end +end) + +script.on_event(defines.events.on_built_entity, function(event) + local eplayer = game.players[event.player_index] + local timeForRegular = 120 + if not eplayer.admin and ticktominutes(eplayer.online_time) < timeForRegular then + if event.created_entity.type == "tile-ghost" then + event.created_entity.destroy() + eplayer.print("You are not allowed to do this yet, play for player bit longer. Try: " .. math.floor((timeForRegular - ticktominutes(eplayer.online_time))) .. " minutes") + callRank(eplayer.name .. " tryed to place concrete/stone with robots") + end + end +end) +---------------------------------------------------------------------------------------- +---------------------------Other Events------------------------------------------------- +---------------------------------------------------------------------------------------- +script.on_event(defines.events.on_tick, function(event) if (game.tick/(3600*game.speed)) % 15 == 0 then autoMessage() end end) +---------------------------------------------------------------------------------------- +---------------------------IDK What There Do Functions---------------------------------- +---------------------------------------------------------------------------------------- +function encode ( table, name, items ) + local encodeString + local encodeSubString + local encodeSubSubString + for i, keyTable in pairs(table) do + encodeSubSubString = nil + for i, keyItem in pairs(items) do + if type(keyTable[keyItem]) == "string" then + if encodeSubSubString ~= nil then + encodeSubSubString = encodeSubSubString .. ",\"" .. keyItem .. "\": \"" .. keyTable[keyItem] .. "\"" + else + encodeSubSubString = "\"" .. keyItem .. "\": \"" .. keyTable[keyItem] .. "\"" + end + elseif type(keyTable[keyItem]) == "number" then + if encodeSubSubString ~= nil then + encodeSubSubString = encodeSubSubString .. ",\"" .. keyItem .. "\": " .. tostring(keyTable[keyItem]) + else + encodeSubSubString = "\"" .. keyItem .. "\": " .. tostring(keyTable[keyItem]) + end + elseif type(keyTable[keyItem]) == "boolean" then + if encodeSubSubString ~= nil then + encodeSubSubString = encodeSubSubString .. ",\"" .. keyItem .. "\": " .. tostring(keyTable[keyItem]) + else + encodeSubSubString = "\"" .. keyItem .. "\": " .. tostring(keyTable[keyItem]) + end + end + end + if encodeSubSubString ~= nil and encodeSubString ~= nil then + encodeSubString = encodeSubString .. ", {" .. encodeSubSubString .. "}" + else + encodeSubString = "{" .. encodeSubSubString .. "}" + end + end + encodeString = "{" .. "\"" .. name .. "\": [" .. encodeSubString .. "]}" + return encodeString +end +---------------------------------------------------------------------------------------- +---------------------------Tool Bar----------------------------------------------------- +---------------------------------------------------------------------------------------- +addButton("btn_toolbar_playerList", function(player) toggleVisable(mod_gui.get_frame_flow(player).PlayerList) end) +function drawToolbar(player) + local frame = mod_gui.get_button_flow(player) + frame.clear() + drawButton(frame,"btn_toolbar_playerList", "Playerlist", "Adds/removes the player list to/from your game.",'entity/player') + for _,f in pairs(guis.frames) do + if getRank(player).power <= f[1].require then drawButton(frame,"btn_".._, f[1].caption, f[1].tooltip, f[1].sprite) end + end +end +---------------------------------------------------------------------------------------- +---------------------------Player List-------------------------------------------------- +---------------------------------------------------------------------------------------- +function drawPlayerList() + for i, player in pairs(game.connected_players) do + local flow = mod_gui.get_frame_flow(player) + if flow.PlayerList == nil then + flow.add{type = "frame", name= "PlayerList", direction = "vertical",style=mod_gui.frame_style} + .add{type = "scroll-pane", name= "PlayerListScroll", direction = "vertical", vertical_scroll_policy="always", horizontal_scroll_policy="never"} + end + local Plist= flow.PlayerList.PlayerListScroll + Plist.clear() + Plist.style.maximal_height = 200 + for i, player in pairs(game.connected_players) do + playerRank = getRank(player) + if playerRank.power <= 3 or playerRank.name == 'Jail' then + if playerRank.shortHand ~= '' then Plist.add{type = "label", name=player.name, style="caption_label_style", caption={"", ticktohour(player.online_time), " H - " , player.name , ' - '..playerRank.shortHand..' '}} + else Plist.add{type = "label", name=player.name, style="caption_label_style", caption={"", ticktohour(player.online_time), " H - " , player.name..' '}} end + Plist[player.name].style.font_color = playerRank.colour + player.tag = playerRank.tag + end + end + for i, player in pairs(game.connected_players) do + playerRank = getRank(player) + if playerRank.power > 3 and playerRank.name ~= 'Jail' then + if playerRank.shortHand ~= '' then Plist.add{type = "label", name=player.name, style="caption_label_style", caption={"", ticktohour(player.online_time), " H - " , player.name , ' - '..playerRank.shortHand..' '}} + else Plist.add{type = "label", name=player.name, style="caption_label_style", caption={"", ticktohour(player.online_time), " H - " , player.name..' '}} end + Plist[player.name].style.font_color = playerRank.colour + player.tag = playerRank.tag + end + end + end +end + +addButton('goto', + function(player,frame) + local p = game.players[frame.parent.name] + player.teleport(game.surfaces[p.surface.name].find_non_colliding_position("player", p.position, 32, 1)) +end) +addButton('bring', + function(player,frame) + local p = game.players[frame.parent.name] + p.teleport(game.surfaces[player.surface.name].find_non_colliding_position("player", player.position, 32, 1)) +end) +addButton('jail',function(player,frame) + local p=game.players[frame.parent.name] + if p.permission_group.name ~= 'Jail' then giveRank(p,'Jail',player) + else revertRank(p,player) end +end) +addButton('kill', + function(player,frame) + local p = game.players[frame.parent.name] + if p.character then p.character.die() end +end) +addButton('revert', + function(player,frame) + local p = game.players[frame.parent.name] + revertRank(p,player) +end) +function drawPlayerTable(player, frame, commands, select,filters) + --setup the table + if frame.playerTable then frame.playerTable.destroy() end + pTable = frame.add{name='playerTable', type="table", colspan=5} + pTable.style.minimal_width = 500 + pTable.style.maximal_width = 500 + pTable.style.horizontal_spacing = 10 + pTable.add{name="id", type="label", caption="Id"} + pTable.add{name="Pname", type="label", caption="Name"} + if commands==false and select ==false then pTable.add{name="status", type="label", caption="Status"} end + pTable.add{name="online_time", type="label", caption="Online Time"} + pTable.add{name="rank", type="label", caption="Rank"} + if commands then pTable.add{name="commands", type="label", caption="Commands"} end + if select then pTable.add{name="select_label", type="label", caption="Selection"} end + --filter checking + for i, p in pairs(game.players) do + local addPlayer = true + for _,filter in pairs(filters) do + if filter == 'admin' then if p.admin == false then addPlayer = false break end + elseif filter == 'online' then if p.connected == false then addPlayer = false break end + elseif filter == 'offline' then if p.connected == true then addPlayer = false break end + elseif filter == 'lower' then if getRank(p).power <= getRank(player).power then addPlayer = false break end + elseif filter == 'selected' then local Break = nil for _,name in pairs(selected[player.index]) do if name == p.name then Break = true break end end if not Break then addPlayer = false break end + elseif type(filter)=='number' then if filter > ticktominutes(p.online_time) then addPlayer = false break end + elseif type(filter)=='string' then if p.name:lower():find(filter:lower()) == nil then addPlayer = false break end + end + end + --addes the player to the list + if addPlayer == true and player.name ~= p.name then + if pTable[p.name] == nil then + pTable.add{name=i .. "id", type="label", caption=i} + pTable.add{name=p.name..'_name', type="label", caption=p.name} + --status + if not commands and not select then + if p.connected == true + then pTable.add{name=p.name .. "Status", type="label", caption="ONLINE"} + else pTable.add{name=p.name .. "Status", type="label", caption="OFFLINE"} + end + end + --time and rank + pTable.add{name=p.name .. "Online_Time", type="label", caption=(ticktohour(p.online_time)..'H '..(ticktominutes(p.online_time)-60*ticktohour(p.online_time))..'M')} + pTable.add{name=p.name .. "Rank", type="label", caption=getRank(p).shortHand} + --commands + if commands then + pTable.add{name=p.name, type="flow"} + drawButton(pTable[p.name],'goto','Tp','Goto to the players location') + drawButton(pTable[p.name],'bring','Br','Bring player player to your location') + if getRank(p).power > getRank(player).power then + drawButton(pTable[p.name],'jail','Ja','Jail/Unjail player') + drawButton(pTable[p.name],'revert','Re','Set A players rank to their forma one') + drawButton(pTable[p.name],'kill','Ki','Kill this player') + end + --player slecction + elseif select then + pTable.add{name=p.name, type="flow"} + local state = false + for _,name in pairs(selected[player.index]) do if name == p.name then state = true break end end + pTable[p.name].add{name='select', type="checkbox",state=state} + end + end + end + end +end +---------------------------------------------------------------------------------------- +---------------------------Read Me Gui-------------------------------------------------- +---------------------------------------------------------------------------------------- +addFrame('Readme',6, 'Rules','Readme', 'Rules, Server info, How to chat, Playerlist, Adminlist.') + +addTab('Readme','Rules','The rules of the server', + function(player,frame) + local rules = { + "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 i, rule in pairs(rules) do + frame.add{name=i, type="label", caption={"", i ,". ", rule}} + end + end) +addTab('Readme','Server Info','Info about the server', + function(player,frame) + frame.add{name=1, type="label", caption={"", "Discord voice and chat server:"}} + frame.add{name=2, type='textfield', text='https://discord.gg/RPCxzgt'}.style.minimal_width=400 + frame.add{name=3, type="label", caption={"", "Our forum:"}} + frame.add{name=4, type='textfield', text='https://explosivegaming.nl'}.style.minimal_width=400 + frame.add{name=5, type="label", caption={"", "Steam:"}} + frame.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(player,frame) + local chat = "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." + frame.add{name=i, type="label", caption={"", chat}, single_line=false}.style.maximal_width=480 + end) +addTab('Readme','Admins','List of all the people who can ban you :P', + function(player,frame) + local admins = { + "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 i, line in pairs(admins) do + frame.add{name=i, type="label", caption={"", line}, single_line=false} + end + drawPlayerTable(player, frame, false, false,{'admin'}) + end) +addTab('Readme','Players','List of all the people who have been on the server', + function(player,frame) + local players = { + "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 i, line in pairs(players) do + frame.add{name=i, type="label", caption={"", line}} + end + frame.add{name='filterTable',type='table',colspan=3} + frame.filterTable.add{name='name_label',type='label',caption='Name'} + frame.filterTable.add{name='status_label',type='label',caption='Online?'} + frame.filterTable.add{name='hours_label',type='label',caption='Online Time (minutes)'} + frame.filterTable.add{name='name_input',type='textfield'} + frame.filterTable.add{name='status_input',type='textfield'} + frame.filterTable.add{name='hours_input',type='textfield'} + drawPlayerTable(player, frame, false, false, {}) + end) +---------------------------------------------------------------------------------------- +---------------------------Admin Gui---------------------------------------------------- +---------------------------------------------------------------------------------------- +addFrame('Admin',3,'Player List','Admin',"All admin fuctions are here") + +addButton('btn_toolbar_automessage',function() autoMessage() 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('revive_dead_entitys_range',function(player,frame) if tonumber(frame.parent.range.text) then local range = tonumber(frame.parent.range.text) for key, entity in pairs(game.surfaces[1].find_entities_filtered({area={{player.position.x-range,player.position.y-range},{player.position.x+range,player.position.y+range}},type = "entity-ghost"})) do entity.revive() end end 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('sendMessage',function(player,frame) local rank = stringToRank(frame.parent.message.rank.text) if rank then callRank(frame.parent.message.message.text,rank.name) else for _,rank in pairs(ranks) do player.print(rank.name) end end end) +addButton('setRanks', + function(player,frame) + rank = stringToRank(frame.parent.rank_input.items[frame.parent.rank_input.selected_index]) + if rank then + for _,playerName in pairs(selected[player.index]) do + p=game.players[playerName] + if getRank(player).power < getRank(p).power and rank.power > getRank(player).power then + giveRank(p,rank,player) + else + player.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 + end + end) +addButton('clearSelection',function(player,frame) clearSelection(player) drawPlayerTable(player, frame.parent.parent, false, true, {}) end) + +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_range','Revive Entitys','Brings all dead machines back to life in player range') + frame.add{type='textfield',name='range',text='Range'} + frame.add{type='flow',name='message'} + frame.message.add{type='textfield',name='message',text='Enter message'} + frame.message.add{type='textfield',name='rank',text='Enter rank'} + drawButton(frame,'sendMessage','Send Message','Send a message to all ranks higher than the slected') + drawButton(frame,'tp_all','TP All Here','Brings all players to you') + end) +addTab('Admin','Edit Ranks', 'Edit the ranks of players below you', + function(player,frame) + clearSelection(player) + frame.add{name='filterTable',type='table',colspan=2} + frame.filterTable.add{name='name_label',type='label',caption='Name'} + frame.filterTable.add{name='sel_label',type='label',caption='Selected?'} + frame.filterTable.add{name='name_input',type='textfield'} + frame.filterTable.add{name='sel_input',type='textfield'} + frame.add{type='flow',name='rank',direction='horizontal'} + frame.rank.add{name='rank_label',type='label',caption='Rank'} + frame.rank.add{name='rank_input',type='drop-down'} + for _,rank in pairs(ranks) do if rank.power > getRank(player).power then frame.rank.rank_input.add_item(rank.name) end end + drawButton(frame.rank,'setRanks','Set Ranks','Sets the rank of all selected players') + drawButton(frame.rank,'clearSelection','Clear Selection','Clears all currently selected players') + drawPlayerTable(player, frame, false, true, {'lower'}) + end) +addTab('Admin', 'Player List', 'Send player message to all players', + function(player, frame) + frame.add{name='filterTable',type='table',colspan=2} + frame.filterTable.add{name='name_label',type='label',caption='Name'} + frame.filterTable.add{name='hours_label',type='label',caption='Online Time (minutes)'} + frame.filterTable.add{name='name_input',type='textfield'} + frame.filterTable.add{name='hours_input',type='textfield'} + drawPlayerTable(player, frame, true,false, {'online'}) + end) +---------------------------------------------------------------------------------------- +---------------------------Admin+ Gui--------------------------------------------------- +---------------------------------------------------------------------------------------- +addFrame('Admin+',2,'Modifiers','Admin+',"Because we are better") + +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('toggle_cheat',function(player,frame) player.cheat_mode = not player.cheat_mode end) +addButton('revive_dead_entitys',function(player,frame) for key, entity in pairs(game.surfaces[1].find_entities_filtered({type = "entity-ghost"})) do entity.revive() end end) +addButton("btn_Modifier_apply", + function(player,frame) + local forceModifiers = { + "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 i, modifier in pairs(forceModifiers) do + local number = tonumber(( frame.parent.parent.modifierTable[modifier .. "_input"].text):match("[%d]+[.%d+]")) + if number ~= nil then + if number >= 0 and number < 50 and number ~= player.force[modifier] then + player.force[modifier] = number + player.print(modifier .. " changed to number: " .. tostring(number)) + elseif number == player.force[modifier] then + player.print(modifier .. " Did not change") + else + player.print(modifier .. " needs to be player higher number or it contains an letter") + end + end + end + end) + +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 player range') + frame.add{type='textfield',name='range',text='Range'} + drawButton(frame,'remove_biters','Kill Biters','Removes all biters in map') + drawButton(frame,'tp_all','TP All Here','Brings all players to you') + drawButton(frame,'toggle_cheat','Toggle Cheat Mode','Toggle your cheat mode') + end) + +addTab('Admin+', 'Modifiers', 'Edit in game modifiers', + function(player,frame) + local forceModifiers = { + "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" + } + frame.add{type = "flow", name= "flowNavigation",direction = "horizontal"} + frame.add{name="modifierTable", type="table", colspan=3} + frame.modifierTable.add{name="Mname", type="label", caption="name"} + frame.modifierTable.add{name="input", type="label", caption="input"} + frame.modifierTable.add{name="current", type="label", caption="current"} + for i, modifier in pairs(forceModifiers) do + frame.modifierTable.add{name=modifier, type="label", caption=modifier} + frame.modifierTable.add{name=modifier .. "_input", type="textfield", caption="inputTextField"} + frame.modifierTable.add{name=modifier .. "_current", type="label", caption=tostring(player.force[modifier])} + end + drawButton(frame.flowNavigation,"btn_Modifier_apply","Apply","Apply the new values to the game") +end) \ No newline at end of file diff --git a/info.json b/info.json index 2c63c085..19765bd5 100644 --- a/info.json +++ b/info.json @@ -1,2 +1 @@ -{ -} +null diff --git a/level-init.dat b/level-init.dat deleted file mode 100644 index 3bd3840d..00000000 Binary files a/level-init.dat and /dev/null differ diff --git a/level.dat b/level.dat deleted file mode 100644 index 3bd3840d..00000000 Binary files a/level.dat and /dev/null differ diff --git a/locale/ar/freeplay.cfg b/locale/ar/freeplay.cfg index efcd74c6..612f03e2 100644 --- a/locale/ar/freeplay.cfg +++ b/locale/ar/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=.نييلصألا ناكسلا نم كسفن ةيامح ىسنت الو ةياهنلا ىلإ لصتل كتقيرطب لمعأو ،رفصلا نم أدبتس .خيراوصلا عماوص حتف لجأ نم ةمدقتم ايجولونكت نع ثحبلل جاتحت فوس .ةيعانصلا رامقألاب خيراوصلا قالطإو خيراوصلا عماوص ءانب قيرط نع كلذب مايقلا عيطتست .ءاضفلل اخوراص قلطت نا يه كتمهم .Factorio ـل رحلا بعللا وه اذه -rocket-launched-without-satellite=.هلخادب يعانصلا رمقلا عضت مل كنكلو ،خوراصلا تقلطأ -rockets-sent=ةيعانص رامقأ قالطإ -score=ةجيتنلا diff --git a/locale/be/freeplay.cfg b/locale/be/freeplay.cfg index 5785f13d..fcc564b3 100644 --- a/locale/be/freeplay.cfg +++ b/locale/be/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Гэта рэжым свабоднай гульні Factorio. Вашая мэта - запусціць ракету ў космас. Дзеля гэтага вам трэба пабудаваць ракетную шахту і саму ракету з спадарожнікам. Вы мусіце даследваць перадавыя тэхналогіі, каб навучыцца будаваць ракетную шахту. Пачынайце з малога, працуйце над аўтаматызацыяй вытворчасці, даследуйце новыя тэхналогіі і не забывайцеся на абарону ад "тутэйшых"! -rocket-launched-without-satellite=Вы запусцілі ракету, аднак не змясцілі ў ёй спадарожнік. -rockets-sent=Запушчана спадарожнікаў -score=Вынік diff --git a/locale/bg/freeplay.cfg b/locale/bg/freeplay.cfg index fd4f9bfe..219fd494 100644 --- a/locale/bg/freeplay.cfg +++ b/locale/bg/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Това е режимът на свободна игра. Задачата ви е да изстреляте ракета в космоса. За това ще е нужно да построите ракетна шахта и изстреляте ракетата със спътник. Ще трябва да проучите развити технологии, които ще отключат ракетната шахта. Започнете с малко и постепенно автоматизирайте процеса, като не забравяте да се защитавате от местните форми на живот. -rocket-launched-without-satellite=Изстреляхте ракетата, но не сложихте спътник. -rockets-sent=Изстреляни спътници -score=Резултат diff --git a/locale/ca/freeplay.cfg b/locale/ca/freeplay.cfg index 838ec2eb..923fb552 100644 --- a/locale/ca/freeplay.cfg +++ b/locale/ca/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Aquest és el mode lliure del Factorio. La vostra tasca és construir un coet i enviar-lo a l'espai. Ho haureu de fer construint un centre de coets espacials i llençant un coet amb un satèl·lit. Necessitareu investigar tecnologies avançades per poder-ho fer. Aneu pas a pas, avanceu cap a l'automatització i no oblideu protegir-vos dels natius. -rocket-launched-without-satellite=S'ha llençat el coet, però no hi heu posat un satèl·lit a dins. -rockets-sent=Satèl·lits llançats -score=Puntuació diff --git a/locale/cs/freeplay.cfg b/locale/cs/freeplay.cfg index 651b4f8b..07164f2b 100644 --- a/locale/cs/freeplay.cfg +++ b/locale/cs/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Toto je volná hra Factorio. Tvým úkolem je vypustit raketu do vesmíru. Postav raketové silo a vypusť raketu se satelitem. Pro odemknutí raketového sila budeš muset vyzkoumat pokročilé technologie. Začni v malém, postupuj s automatizací a nezapomeň se chránit před domorodci. -rocket-launched-without-satellite=Poslal jsi raketu, ale nedal jsi dovnitř satelit. -rockets-sent=Satelity vypuštěny -score=Skóre diff --git a/locale/da/freeplay.cfg b/locale/da/freeplay.cfg index 9aca353c..37490dbe 100644 --- a/locale/da/freeplay.cfg +++ b/locale/da/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Det her er Factorio fri leg. Din opgave er at affyre en raket for at udforske rummet. For at gøre det skal du bygge en raket silo og affyre en raket med en satellit i. Du bliver nød til at udforske avancerede teknologier for at at kunne bygge en raket silo. Start småt, og arbejd din vej op med hjælp af automatisering, glem ikke at beskytte dig fra de indfødte. -rocket-launched-without-satellite=Du affyrede raketten, men du glemte at placere en satellit i den. -rockets-sent=Satellitter opsendt -score=Point diff --git a/locale/de/freeplay.cfg b/locale/de/freeplay.cfg index 702ab082..df819fcb 100644 --- a/locale/de/freeplay.cfg +++ b/locale/de/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Dies ist das freie Spiel von Factorio. Deine Aufgabe ist es, eine Rakete in den Weltraum zu starten. Dazu musst du ein Raketensilo bauen und eine Rakete mit einem Satelliten starten. Du wirst erweiterte Technologien erforschen müssen um das Raketensilo freizuschalten. Fange klein an, arbeite dich durch Automatisierung hoch und vergiss nicht, dich vor den Einheimischen zu schützen. -rocket-launched-without-satellite=Du hast die Rakete gestartet, aber keinen Satelliten vorher eingesetzt. -rockets-sent=Satelliten gestartet -score=Punktestand diff --git a/locale/el/freeplay.cfg b/locale/el/freeplay.cfg index 53d4ed77..a714c2cb 100644 --- a/locale/el/freeplay.cfg +++ b/locale/el/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Αυτό είναι το ελεύθερο παιχνίδι του Factorio. Ο στόχος σας είναι να εκτοξεύσετε έναν πύραυλο στο διάστημα. Αυτό το κάνετε με την κατασκευή ενός σιλό πυραύλων και την εκτόξευση ενός πυραύλου με δορυφόρο. Θα πρέπει να ερευνήσετε τις προηγμένες τεχνολογίες για να ξεκλειδώσετε το σιλό πυραύλων. Ξεκινήστε μικρά, δουλέψτε στο δρόμο σας επάνω με την αυτοματοποίηση και μην ξεχάσετε να προστατέψετε τον εαυτό σας από τους ντόπιους. -rocket-launched-without-satellite=Εκτόξευσες τον πύραυλο, αλλά δεν έβαλες έναν δορυφόρο μέσα. -rockets-sent=Οι δορυφόροι εκτοξεύτικαν -score=Σκορ diff --git a/locale/en/freeplay.cfg b/locale/en/freeplay.cfg index b584b167..ffe14750 100644 --- a/locale/en/freeplay.cfg +++ b/locale/en/freeplay.cfg @@ -1,4 +1 @@ msg-intro=This is the Factorio freeplay. Your task is to launch a rocket into space. Do this by constructing a Rocket Silo and launching a rocket with a satellite. You will need to research advanced technologies in order to unlock the Rocket Silo. Start small, work your way up with automation and don't forget to protect yourself from the natives. -rocket-launched-without-satellite=You launched the rocket, but you didn't put a satellite inside. -score=Score -rockets-sent=Satellites launched diff --git a/locale/eo/freeplay.cfg b/locale/eo/freeplay.cfg index 08435eba..5c38f105 100644 --- a/locale/eo/freeplay.cfg +++ b/locale/eo/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Tio estas la Factorio Freeplay. Via tasko estas ĵeti raketon en spacon. Fari tiun per konstruanta Raketo Silo kaj ĵeti raketon kun satelito. Vi bezonos esplori altnivelaj teknologioj por malŝlosi la Raketo Silo. Start malgranda, labori vian vojon supren per aŭtomatigo kaj ne forgesu protekti vin mem de la indiĝenoj. -rocket-launched-without-satellite=Vi lanĉis la raketon, sed vi ne metis sateliton ene. -rockets-sent=Satelitoj lanĉis -score=Partituro diff --git a/locale/es-ES/freeplay.cfg b/locale/es-ES/freeplay.cfg index 78aab16b..9822231a 100644 --- a/locale/es-ES/freeplay.cfg +++ b/locale/es-ES/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Este es el modo de juego libre de Factorio. Tu tarea es la de lanzar un cohete al espacio. Logra esto construyendo un Silo de Cohetes y lanzando un cohete con un satélite. Necesitarás investigar tecnologías avanzadas para poder desbloquear el Silo de Cohetes. Comienza poco a poco, trabaja en tu sistema de automatización y no te olvides de protegerte de los nativos. -rocket-launched-without-satellite=Lanzaste el cohete, pero no colocaste un satélite dentro. -rockets-sent=Satélites lanzados -score=Puntuación diff --git a/locale/et/freeplay.cfg b/locale/et/freeplay.cfg index 79152526..c3a45120 100644 --- a/locale/et/freeplay.cfg +++ b/locale/et/freeplay.cfg @@ -1,4 +1,2 @@ msg-intro=See on Factorio vabamängumood. Sinu eesmärgiks on saata rakett avakosmosesse. Seda saad teha ehitades Raketti Silotorni ja heites rakketi koos satelliidiga. Selleks pead õppima selgeks keerukad tehnoloogiaharud, et Raketti Silotorni lahti lukustada. Alusta väikselt, tööta selle kallal automatsiooni abil ja ära unusta ennast kaitsta kohalike eluvormide eest. -rocket-launched-without-satellite=Sa lennutasid raketi teele, aga ei pannud selle sisse satelliidi. -score=Skoor diff --git a/locale/fi/freeplay.cfg b/locale/fi/freeplay.cfg index 3f3e7803..6e983ac6 100644 --- a/locale/fi/freeplay.cfg +++ b/locale/fi/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Tämä on Factorion vapaapelimuoto. Tavoitteesi on lähettää satelliitti ulkoavaruuteen rakentamalla rakettisiilo ja laukaisemalla raketti. Rakettisiilon voit rakentaa vasta, kun olet kehittänyt siihen tarvittavat huipputeknologiat. Aloita pienestä ja automatisoi kaikki tarvittava, äläkä unohda suojella itseäsi alkuasukkailta. -rocket-launched-without-satellite=Laukaisit raketin, mutta et laittanut satelliittia sen sisään. -rockets-sent=Satelliitteja laukaistu -score=Pistemäärä diff --git a/locale/fr/freeplay.cfg b/locale/fr/freeplay.cfg index 16eb0901..4886258e 100644 --- a/locale/fr/freeplay.cfg +++ b/locale/fr/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Il s'agit du mode de jeu libre de Factorio. Votre tâche consiste à lancer une fusée dans l'espace. Ceci en construisant un silo à fusée, et en lançant un satellite avec la fusée. Vous aurez besoin de rechercher des technologies de pointe afin de débloquer le silo. Commencez petit, évoluez en automatisant et n'oubliez pas de vous protéger contre les autochtones. -rocket-launched-without-satellite=Vous avez lancé la fusée, mais vous n'avez pas mis de satellite à l'intérieur. -rockets-sent=Satellites lancés -score=Score diff --git a/locale/he/freeplay.cfg b/locale/he/freeplay.cfg index 27216b9e..16486f7e 100644 --- a/locale/he/freeplay.cfg +++ b/locale/he/freeplay.cfg @@ -1,5 +1,2 @@ -msg-intro=.םיימוקמה םירוציה ינפמ םכמצע לע ןגהל וחכשת לאו ,יטמוטוא ןוכימ תועצמאב םכלש הישעתה תא וביחרה ,ןטקב וליחתה .ןקתמה תיינב תא רשפאל ידכ תומדקתמ תויגולונכט רוקחל םכילע היהי .ןייוול ליכמה ליט ותועצמאב רגשלו םיליט רוגיש ןקתמ תונבל םכילע .ללחה רקחל שמשיש ליט חולשל איה םכתמישמ .ויִרֹוטְקַפ לש ישפוחה שיחרתה והז -rocket-launched-without-satellite=.ןייוול המינפ תסנכה אל ךא ,ליטה תא תרגיש -rockets-sent=ורגושש םיניוול -score=דוקינ +msg-intro=.םיימוקמה ינפמ םכמצע לע ןגהל וחכשת לאו ,יטמוטוא ןוכימ תועצמאב םכלש הישעתה תא וביחרה ,ןטקב וליחתה .ןקתמה תיינב תא רשפאל ידכ תומדקתמ תויגולונכט רוקחל םכילע היהי .ןייוול ליכמה ליט ותועצמאב רגשלו םיליט רוגיש ןקתמ תונבל םכילע .ללחה לא ליט חולשל איה םכתמישמ .ויִרֹוטְקַפ לש ישפוחה שיחרתה והז diff --git a/locale/hu/freeplay.cfg b/locale/hu/freeplay.cfg index c7730ae8..17a08f9a 100644 --- a/locale/hu/freeplay.cfg +++ b/locale/hu/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Ez a Factorio szabad játék módja. A feladatod az, hogy kilőj egy rakétát az űr felderítésére. Ehhez egy Rakétasilót kell építened, melyből aztán egy műholddal felszerelt rakétát kell kilőnöd. A Rakétasiló kifejlesztéséhez különféle technológiákat kell fejlesztened. Kezdj kicsiben és küzdd fel magad az automatizálásban. Ne felejts el védekezni a honos fajok ellen. -rocket-launched-without-satellite=Kilőtted a rakétát, de nem helyeztél el benne műholdat. -rockets-sent=Műholdak elindítva -score=Pontszám diff --git a/locale/it/freeplay.cfg b/locale/it/freeplay.cfg index 30fe5d1f..c4c27e01 100644 --- a/locale/it/freeplay.cfg +++ b/locale/it/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Questa è la modalità libera di Factorio. Il tuo obiettivo è quello di lanciare il razzo nello spazio. Completalo costruendo un Silo per Razzi e lanciando il razzo con il satellite. Avrai bisogno di ricercare tecnologie avanzate per riuscire a sbloccare il Silo per Razzi. Inizia in piccolo, espandi con l'automazione e non dimenticare di proteggerti dai nativi. -rocket-launched-without-satellite=Hai lanciato il razzo, ma non hai inserito il satellite al suo interno. -rockets-sent=Satellite lanciato -score=Punteggio diff --git a/locale/ja/freeplay.cfg b/locale/ja/freeplay.cfg index 719734bf..1d545443 100644 --- a/locale/ja/freeplay.cfg +++ b/locale/ja/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=これは、Factorioのフリープレイです。ロケットサイロを建造し、衛星を載せたロケットを宇宙へ打ち上げるのがあなたの任務です。ロケットサイロをアンロックするためには高度な技術研究をする必要があります。小規模に始め、自動化しつつ進み、原住生物から身を守ることも忘れないでください。 -rocket-launched-without-satellite=衛星を積まずにロケットを打ち上げてしまいました。 -rockets-sent=打ち上げた衛星 -score=スコア diff --git a/locale/ko/freeplay.cfg b/locale/ko/freeplay.cfg index 78531d5f..0f3188f4 100644 --- a/locale/ko/freeplay.cfg +++ b/locale/ko/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Factorio 자유플레이입니다. 당신의 목표는 우주로 로켓을 발사하는 것입니다. 로켓 격납고를 건설하고 인공위성을 탑재한 로켓을 발사해서 이 목표를 달성하세요. 로켓 격납고의 잠금을 해제하기 위해 고급 기술들을 연구할 필요가 있습니다. 작은 것부터 시작해 자동화로 차근차근 발전하고, 토착 생물들로부터 자신을 보호하는 것도 잊지 마세요. -rocket-launched-without-satellite=로켓을 발사했지만, 로켓 내부에 인공위성을 넣지 않았습니다. -rockets-sent=발사된 인공위성 -score=점수 diff --git a/locale/lt/freeplay.cfg b/locale/lt/freeplay.cfg index 9d082ddb..3ddb933b 100644 --- a/locale/lt/freeplay.cfg +++ b/locale/lt/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Tai Factorio laisvas žaidimas. Jūsų užduotis - paleisti raketą į kosmosą. Tam reikia pastatyti Raketos šachtą ir paleisti raketą su palydovu. Reikės atrasti pažangias technologijas kad atrakintumėte Raketos šachtą. Pradėkite palengva, tobulinkite automatiką ir neužmirškite apsisaugoti nuo vietinių. -rocket-launched-without-satellite=Paleidote raketą, bet neįdėjote palydovo į ja. -rockets-sent=Palydovai paleisti -score=Rezultatas diff --git a/locale/lv/freeplay.cfg b/locale/lv/freeplay.cfg index b6dab311..581e4b52 100644 --- a/locale/lv/freeplay.cfg +++ b/locale/lv/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Šis ir Factorio brīvais režīms. Tavs uzdevums ir palaist raķeti kosmosā. Lai to izdarītu, tev vajadzēs uzbūvēt palaišanas platformu un palaist raķeti ar satelītu. Tev būs jāizpēta sarežģītas tehnoloģijas, lai atbloķētu palaišanas platformu. Sāc no mazumiņa, strādā un neaizmirsti pasargāt sevi no šīs planētas iemītniekiem... -rocket-launched-without-satellite=Tu palaidi raķeti, bet neievietoji tajā satelītu. -rockets-sent=Satelīti palaidās -score=Rezultāts diff --git a/locale/nl/freeplay.cfg b/locale/nl/freeplay.cfg index e69de347..3c22639b 100644 --- a/locale/nl/freeplay.cfg +++ b/locale/nl/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Dit is Factorio vrij spel. Je taak is om een raket te lanceren in de ruimte. Bouw hiervoor een raket-silo en lanceer een raket met een satelliet. Je zult geavanceerde technologieën moeten onderzoeken om de raket-silo vrij te spelen. Begin op kleine schaal, breidt uit en automatiseer je fabriek en vergeet niet jezelf te beschermen tegen de inheemse bewoners. -rocket-launched-without-satellite=Je hebt de raket gelanceerd, maar zonder een satelliet aan boord te brengen. -rockets-sent=Satellieten gelanceerd -score=Score diff --git a/locale/no/freeplay.cfg b/locale/no/freeplay.cfg index 5efcf6e5..876e2f4e 100644 --- a/locale/no/freeplay.cfg +++ b/locale/no/freeplay.cfg @@ -1,5 +1,2 @@ -msg-intro=Dette er Factorio frispilling. Din oppgave er å sende en rakett til verdensrommet. Bygg en rakettsilo og send opp en rakett med en satellitt på. Du blir nødt til å utforske avanserte teknologier for å få tilgang til rakettsiloen. Begynn i det små, jobb deg oppover med hjelp av automatisering og ikke glem å beskytte deg mot de innfødte. -rocket-launched-without-satellite=Du skjøt opp raketten, men du satte ikke inn en satelitt. -rockets-sent=Satellitter skutt ut -score=Poengsum +msg-intro=Dette er Factorio frispilling. Din oppgave er å sende en rakett til verdensrommet. Bygg en rakettsilo og send opp en rakett med en satellitt. Du blir nødt til å utforske avanserte teknologier for å få tilgang til rakettsiloen. Begynn i det små, jobb deg oppover med hjelp av automatisering og ikke glem å beskytte deg mot de innfødte. diff --git a/locale/pl/freeplay.cfg b/locale/pl/freeplay.cfg index 4b1b1e0d..7c1d92b6 100644 --- a/locale/pl/freeplay.cfg +++ b/locale/pl/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=To jest swobodna rozgrywka Factorio. Twoim zadaniem jest wysłanie rakiety w kosmos. Skonstruuj silos rakietowy i wystrzel z niego rakietę z satelitą. Żeby odblokować silos rakietowy będziesz musiał odkryć zaawansowane technologie. Rozpocznij od podstaw, rozwijaj się wykorzystując automatyzację i nie zapomnij o obronie przed rodzimymi mieszkańcami planety. -rocket-launched-without-satellite=Wystrzeliłeś rakietę, ale nie umieściłeś w niej satelity. -rockets-sent=Wysłane satelity -score=Wynik diff --git a/locale/pt-BR/freeplay.cfg b/locale/pt-BR/freeplay.cfg index 168a16db..c59d512c 100644 --- a/locale/pt-BR/freeplay.cfg +++ b/locale/pt-BR/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Este é o modo livre do Factorio. Sua missão é lançar um foguete no espaço. Para fazer isso construa um centro de lançamento de foguetes e lance o foguete com um satélite. Você vai precisar pesquisar tecnologias avançadas para conseguir desbloquear um Centro de lançamento. Comece do começo, continue na automação e não se esqueça de se proteger dos nativos. -rocket-launched-without-satellite=Você lançou o foguete, mas não colocou o satélite dentro. -rockets-sent=Satélites lançados -score=Pontuação diff --git a/locale/pt-PT/freeplay.cfg b/locale/pt-PT/freeplay.cfg index ce7c9f83..7faa1fce 100644 --- a/locale/pt-PT/freeplay.cfg +++ b/locale/pt-PT/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Este é o jogo livre Factorio. A tua tarefa é lançar um foguetão para explorar o espaço. Faça isto, construindo um Silo de Foguetão e lançar um foguetão com um satélite. Tu vais precisar de pesquisar tecnologias avançadas para poderes desbloquear o Silo de Foguetão. Começa simples, trabalha e evolui com a automação e não te esqueças de proteger-te dos nativos. -rocket-launched-without-satellite=Lançou o foguetão, mas não colocou um satélite lá dentro. -rockets-sent=Satélites lançados -score=Pontuação diff --git a/locale/ro/freeplay.cfg b/locale/ro/freeplay.cfg index 0f582237..1d226e8c 100644 --- a/locale/ro/freeplay.cfg +++ b/locale/ro/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Acesta este modul Factorio freeplay. Sarcina ta este de a lansa o rachetă în spațiu. Fă acest lucru prin construirea unui siloz de rachete și lansarea unei rachete cu satelit. Va trebui să cercetezi tehnologiile avansate pentru a debloca silozul de rachete. Începe încet, avansează cu automatizarea și nu uita să te protejezi de inamici. -rocket-launched-without-satellite=Ai lansat racheta, dar nu ai pus și satelitul în interior. -rockets-sent=Sateliții au fost lansați -score=Scor diff --git a/locale/ru/freeplay.cfg b/locale/ru/freeplay.cfg index 77931e05..5266aa77 100644 --- a/locale/ru/freeplay.cfg +++ b/locale/ru/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Это режим свободной игры Factorio. Ваша задача запустить спутник в космос. Для его запуска потребуется создать ракету и ракетную шахту. Начните с малого, работайте над автоматизацией производства, исследуйте новые технологии и не забывайте о защите от местных форм жизни. -rocket-launched-without-satellite=Вы запустили ракету, но не поместили спутник в неё. -rockets-sent=Спутников запущено -score=Счёт diff --git a/locale/sr/freeplay.cfg b/locale/sr/freeplay.cfg index f9cd949b..3a449cd4 100644 --- a/locale/sr/freeplay.cfg +++ b/locale/sr/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Ово је Factorio freeplay. Твој задатак је да лансираш ракету са сателитом у свемир. Уради ово грађом ракетног силоса. Треба да истражиш пуно напредних технологија да би откључао ракетни силос. Почни мало, а онда напредуј са аутоматизацијом и не заборави да се заштитиш од ванземаљаца. -rocket-launched-without-satellite=Лансирао си ракету али ниси ставио сателит унутра. -rockets-sent=Satelit lansiran -score=Rezultat diff --git a/locale/sv-SE/freeplay.cfg b/locale/sv-SE/freeplay.cfg index d205ceed..5081d889 100644 --- a/locale/sv-SE/freeplay.cfg +++ b/locale/sv-SE/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Det här är Factorio frispel. Ditt uppdrag är att avfyra en raket till rymden. Gör det genom att tillverka en raket silo och avfyra en raket med en satellit. Du kommer att behöva forska fram avancerade teknologier för att låsa upp raket silon. Börja litet, jobba dig uppåt med hjälp av automatisering och glöm inte att försvara dig själv mot infödingarna. -rocket-launched-without-satellite=Du avfyrade raketen, men du satte aldrig i en satellit. -rockets-sent=Satelliter uppskjutna -score=Poäng diff --git a/locale/th/freeplay.cfg b/locale/th/freeplay.cfg index ad442468..2bb63126 100644 --- a/locale/th/freeplay.cfg +++ b/locale/th/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=นี้คือโหมดอิสระของ Factorio ภารกิจของคุณคือส่งจรวดสู่อวกาศ ซึ่งทำได้โดยการสร้างไซโลจรวดและส่งจรวดขึ้นไปพร้อมกับดาวเทียม คุณต้องวิจัยค้นคว้าเทคโนโลยีขั้นสูงเพื่อปลดล็อคไซโลจรวด เริ่มจากเล็กๆไปเรื่อยๆด้วยระบบอัตโนมัติและอย่าลืมป้องกันตัวเองจากคนพื้นเมืองด้วย -rocket-launched-without-satellite=คุณสั่งใช้งานจรวดแล้ว แต่คุณยังไม่ได้ติดตั้งดาวเทียมภายในตัวจรวด -rockets-sent=ส่งดาวเทียมเรียบร้อย -score=คะแนน diff --git a/locale/tr/freeplay.cfg b/locale/tr/freeplay.cfg index 6cea3487..f57e33ad 100644 --- a/locale/tr/freeplay.cfg +++ b/locale/tr/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Bu Factorio'nun serbest oynanışı. Görevin roketleri uzaya yollamak. Bunu Roket Silosu yaparak ve uyduyla roket yollayarak yapacaksın. Roket Silo'sunu açmak için gelişmiş teknolojileri sırayla açmalısın. Yavaş başla, otomatikleş ve yerlilerden kendini korumayı untuma. -rocket-launched-without-satellite=Roketi yolladın, ama içine uydu koymadın. -rockets-sent=Uydu fırlatıldı -score=Skor diff --git a/locale/uk/freeplay.cfg b/locale/uk/freeplay.cfg index f5f07206..a550ef55 100644 --- a/locale/uk/freeplay.cfg +++ b/locale/uk/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Це один з типів гри в Factorio - "Вільна гра". Ваше завдання - запустити ракету у космічний простір. Зробіть це, побудувавши ракетну шахту та запустивши ракету зі супутником. Вам потрібно дослідити передові технології, щоб мати змогу побудувати ракетну шахту. Починайте з малого, розвивайтеся за допомогою автоматизації, але не забувайте і про оборону! -rocket-launched-without-satellite=Ви запустили ракету, однак не завантажили супутник всередину. -rockets-sent=Супутники запущені -score=Рахунок diff --git a/locale/vi/freeplay.cfg b/locale/vi/freeplay.cfg index a4607987..a354e0db 100644 --- a/locale/vi/freeplay.cfg +++ b/locale/vi/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=Đầy là chế độ freeplay của Factorio. Nhiệm cụ của bạn là phóng một chiếc tên lửa lên vũ trụ. Hãy xây dựng một bệ phóng tên lửa để phóng một chiếc tên lửa kèm theo vệ tinh. Bạn sẽ cần phải nghiên cứu nhiều công nghệ tiên tiến để có thể xây dựng bệ phóng tên lửa. Bắt đầu từ quy mô nhỏ, phát triển dần dần bằng tự động hóa, và đừng quên bảo vệ bản thân mình khỏi những sinh vật sinh sống ở đây. -rocket-launched-without-satellite=Bạn đã phóng tên lửa, nhưng bạn đã không đặt vệ tinh vào trong. -rockets-sent=Vệ tinh đã phóng -score=Điểm số diff --git a/locale/zh-CN/freeplay.cfg b/locale/zh-CN/freeplay.cfg index b0e233b7..1e1b36a4 100644 --- a/locale/zh-CN/freeplay.cfg +++ b/locale/zh-CN/freeplay.cfg @@ -1,5 +1,2 @@ -msg-intro=欢迎来到 Factorio 标准模式 (freeplay) ,您的目标是要把火箭发射到太空。为此,您需要研发一系列高等科技,解锁并修建火箭发射井,直到把携带有卫星的火箭发射出去。从小作坊生产起步,逐渐建立起属于自己的自动化大工厂吧!同时,别忘了防范异星虫子的骚扰 ... -rocket-launched-without-satellite=您已经发射了火箭,但并未将卫星置于其中。 -rockets-sent=已发射卫星 -score=得分 +msg-intro=欢迎来到 Factorio 标准模式 (freeplay) ,你的目标是要把火箭发射到太空。为此你需要研发一系列高等科技,解锁并修建火箭发射井,直到把携带有卫星的火箭发射出去。从小作坊生产起步,逐渐建立起属于自己的自动化大工厂吧!同时,别忘了防范异星虫子的骚扰 ... diff --git a/locale/zh-TW/freeplay.cfg b/locale/zh-TW/freeplay.cfg index 85dea3d4..b83dca41 100644 --- a/locale/zh-TW/freeplay.cfg +++ b/locale/zh-TW/freeplay.cfg @@ -1,5 +1,2 @@ msg-intro=這是異星工廠的自由模式。你的任務是發射火箭探索外太空。請建造一個火箭發射井並於攜帶衛星後發射。你會需要研究大量的進階科技以解鎖火箭發射井。從頭開始,靠著自動化的協助邁向目標的同時,也別忘了從外星住民手中保護你自己。 -rocket-launched-without-satellite=你發射了火箭,但是你沒有把衛星放在裡面。 -rockets-sent=發射衛星 -score=分數 diff --git a/preview.png b/preview.png new file mode 100644 index 00000000..c57a4045 Binary files /dev/null and b/preview.png differ diff --git a/replay.dat b/replay.dat deleted file mode 100644 index e69de29b..00000000 diff --git a/script.dat b/script.dat index b5a60d42..ebac4e5d 100644 Binary files a/script.dat and b/script.dat differ diff --git a/source.lua b/source.lua deleted file mode 100644 index ee933247..00000000 --- a/source.lua +++ /dev/null @@ -1,648 +0,0 @@ - -itemRotated = {} -entityRemoved = {} -entityCache = {} -guis = {frames={},buttons={}} - -warningAllowed = nil -timeForRegular = 180 -CHUNK_SIZE = 32 - ----------------------------------------------------------------------------------------- ----------------------------Remove decorations------------------------------------------- ----------------------------------------------------------------------------------------- -local function removeDecorationsArea(surface, area ) - if surface.find_entities_filtered{area = area, type="decorative"} then - for _, entity in pairs(surface.find_entities_filtered{area = area, type="decorative"}) do - if (entity.name ~= "red-bottleneck" and entity.name ~= "yellow-bottleneck" and entity.name ~= "green-bottleneck") then - entity.destroy() - end - end - end -end - -local function removeDecorations(surface, x, y, width, height ) - removeDecorationsArea(surface, {{x, y}, {x + width, y + height}}) -end - -local function clearDecorations() - local surface = game.surfaces["nauvis"] - for chunk in surface.get_chunks() do - removeDecorations(surface, chunk.x * CHUNK_SIZE, chunk.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(event) - removeDecorationsArea( event.surface, event.area ) -end) - ----------------------------------------------------------------------------------------- ----------------------------Common use functions--------------------------------------- ----------------------------------------------------------------------------------------- -function ticktohour (tick) - local hour = tostring(math.floor(tick/(216000*game.speed))) - return hour -end - -function ticktominutes (tick) - local minutes = math.floor(tick/(3600*game.speed)) - return minutes -end - -function callAdmin(msg) - for _, player in pairs(game.connected_players) do - if player.admin then - player.print(msg) - 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 ----------------------------------------------------------------------------------------- ----------------------------Gui Functions------------------------------------------------ ----------------------------------------------------------------------------------------- -function addFrame(frame) - guis.frames[frame] = {} - addButton('close', function(player,element) element.parent.parent.parent.destroy() end) -end - -function addTab(frame, tabName, describtion, drawTab) - guis.frames[frame][tabName] = {tabName, describtion, drawTab} - addButton(tabName, function(player, element) openTab(player, element.parent.parent.parent.name, element.parent.parent.parent.tab, element.name) end) -end - -function addButton(btnName, onClick) - guis.buttons[btnName] = {btnName, onClick} -end - -function drawButton(frame, btnName, caption, describtion) - frame.add{name=btnName, type = "button", caption=caption, tooltip=describtion} -end - -function openTab(player, frameName, tab, tabName) - local tabBar = player.gui.center[frameName].tabBarScroll.tabBar - for _,t in pairs(guis.frames[frameName]) do - if t[1] == tabName then - tabBar[t[1]].style.font_color = {r = 255, g = 255, b = 255, a = 255} - clearElement(tab) - t[3](player, tab) - else - tabBar[t[1]].style.font_color = {r = 100, g = 100, b = 100, a = 255} - end - end -end - -function drawFrame(player, frameName, tabName) - if player.gui.center[frameName] then player.gui.center[frameName].destroy() end - local frame = player.gui.center.add{name=frameName,type='frame',caption=frameName,direction='vertical'} - local tabBarScroll = frame.add{type = "scroll-pane", name= "tabBarScroll", vertical_scroll_policy="never", horizontal_scroll_policy="always"} - local tabBar = tabBarScroll.add{type='flow',direction='horizontal',name='tabBar'} - local tab = frame.add{type = "scroll-pane", name= "tab", vertical_scroll_policy="auto", horizontal_scroll_policy="never"} - for _,t in pairs(guis.frames[frameName]) do - drawButton(tabBar, t[1], t[1], t[2]) - end - openTab(player, frameName, tab, tabName) - drawButton(tabBar, 'close', 'Close', 'Close this window') - tab.style.minimal_height = 300 - tab.style.maximal_height = 300 - tab.style.minimal_width = 500 - tab.style.maximal_width = 500 - tabBarScroll.style.minimal_height = 60 - tabBarScroll.style.maximal_height = 60 - tabBarScroll.style.minimal_width = 500 - tabBarScroll.style.maximal_width = 500 -end - -function toggleVisable(frame) - if frame then - if frame.style.visible == nil then - frame.style.visible = false - else - frame.style.visible = not frame.style.visible - end - end -end - -function clearElement (elementToClear) - if elementToClear ~= nil then - for i, element in pairs(elementToClear.children_names) do - elementToClear[element].destroy() - end - end -end ----------------------------------------------------------------------------------------- ----------------------------Player Events------------------------------------------------ ----------------------------------------------------------------------------------------- -script.on_event(defines.events.on_player_created, function(event) - local player = game.players[event.player_index] - player.insert{name="iron-plate", count=8} - player.insert{name="pistol", count=1} - player.insert{name="firearm-magazine", count=10} - player.insert{name="burner-mining-drill", count = 1} - player.insert{name="stone-furnace", count = 1} - player.force.chart(player.surface, {{player.position.x - 200, player.position.y - 200}, {player.position.x + 200, player.position.y + 200}}) -end) - -script.on_event(defines.events.on_player_respawned, function(event) - local player = game.players[event.player_index] - drawPlayerList() - player.insert{name="pistol", count=1} - player.insert{name="firearm-magazine", count=10} -end) - -script.on_event(defines.events.on_player_joined_game, function(event) - local player = game.players[event.player_index] - player.print({"", "Welcome"}) - if player.gui.left.PlayerList ~= nil then - player.gui.left.PlayerList.destroy() - end - if player.gui.center.README ~= nil then - player.gui.center.README.destroy() - end - if player.gui.top.PlayerList ~= nil then - player.gui.top.PlayerList.destroy() - end - drawPlayerList() - drawToolbar() - local playerStringTable = encode(game.players, "players", {"name", "admin", "online_time", "connected", "index"}) - game.write_file("players.json", playerStringTable, false, 0) - if not player.admin and ticktominutes(player.online_time) < 1 then - drawFrame(player,'Readme','Rules') - end -end) - -script.on_event(defines.events.on_player_left_game, function(event) - local player = game.players[event.player_index] - drawPlayerList() -end) ----------------------------------------------------------------------------------------- ----------------------------Gui Events--------------------------------------------------- ----------------------------------------------------------------------------------------- -script.on_event(defines.events.on_gui_click, function(event) - local player = game.players[event.player_index] - for _,btn in pairs(guis.buttons) do - if btn[1] == event.element.name then - if btn[2] then btn[2](player,event.element) else game.print('Invaid Button'..btn[1]) end - break - end - end -end) - -script.on_event(defines.events.on_gui_text_changed, function(event) - local player = game.players[event.player_index] - if event.element.parent.parent.filterTable then - local frame = event.element - local filters = {} - local commands = false - if frame.parent.parent.parent.name == 'Admin' then commands = true filters[#filters+1] = 'online' end - if frame.parent.parent.filterTable.status_input and not commands then - local status_input = frame.parent.parent.filterTable.status_input.text - if status_input == 'yes' or status_input == 'online' or status_input == 'true' or status_input == 'y' then filters[#filters+1] = 'online' - elseif status_input ~= '' then filters[#filters+1] = 'offline' end - end if frame.parent.parent.filterTable.hours_input then - local hours_input = frame.parent.parent.filterTable.hours_input.text - if tonumber(hours_input) and tonumber(hours_input) > 0 then filters[#filters+1] = tonumber(hours_input) end - end if frame.parent.parent.filterTable.name_input then - local name_input = frame.parent.parent.filterTable.name_input.text - if name_input then filters[#filters+1] = name_input end - end - if frame.parent.parent.playerTable then frame.parent.parent.playerTable.destroy() end - drawPlayerTable(player, frame.parent.parent, commands, filters) - end -end) ----------------------------------------------------------------------------------------- ----------------------------Grefer Events------------------------------------------------ ----------------------------------------------------------------------------------------- -script.on_event(defines.events.on_marked_for_deconstruction, function(event) - local eplayer = game.players[event.player_index] - if not eplayer.admin and ticktominutes(eplayer.online_time) < timeForRegular then - if event.entity.type ~= "tree" and event.entity.type ~= "simple-entity" then - event.entity.cancel_deconstruction("player") - eplayer.print("You are not allowed to do this yet, play for a bit longer. Try again in about: " .. math.floor((timeForRegular - ticktominutes(eplayer.online_time))) .. " minutes") - callAdmin(eplayer.name .. " tryed to deconstruced something") - end - elseif event.entity.type == "tree" or event.entity.type == "simple-entity" then - event.entity.destroy() - end -end) - -script.on_event(defines.events.on_built_entity, function(event) - local eplayer = game.players[event.player_index] - local timeForRegular = 120 - if not eplayer.admin and ticktominutes(eplayer.online_time) < timeForRegular then - if event.created_entity.type == "tile-ghost" then - event.created_entity.destroy() - eplayer.print("You are not allowed to do this yet, play for a bit longer. Try: " .. math.floor((timeForRegular - ticktominutes(eplayer.online_time))) .. " minutes") - callAdmin(eplayer.name .. " tryed to place concrete/stone with robots") - end - end -end) ----------------------------------------------------------------------------------------- ----------------------------Other Events------------------------------------------------- ----------------------------------------------------------------------------------------- -script.on_event(defines.events.on_rocket_launched, function(event) - local force = event.rocket.force - if event.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 index, player in pairs(force.players) do - player.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[force.name] then - global.satellite_sent[force.name] = global.satellite_sent[force.name] + 1 - else - game.set_game_state{game_finished=true, player_won=true, can_continue=true} - global.satellite_sent[force.name] = 1 - end - for index, player in pairs(force.players) do - if player.gui.left.rocket_score then - player.gui.left.rocket_score.rocket_count.caption = tostring(global.satellite_sent[force.name]) - else - local frame = player.gui.left.add{name = "rocket_score", type = "frame", direction = "horizontal", caption={"score"}} - frame.add{name="rocket_count_label", type = "label", caption={"", {"rockets-sent"}, ":"}} - frame.add{name="rocket_count", type = "label", caption=tostring(global.satellite_sent[force.name])} - end - end -end) - -script.on_event(defines.events.on_tick, function(event) if (game.tick/(3600*game.speed)) % 15 == 0 then autoMessage() end end) ----------------------------------------------------------------------------------------- ----------------------------IDK What There Do Functions---------------------------------- ----------------------------------------------------------------------------------------- -function encode ( table, name, items ) - local encodeString - local encodeSubString - local encodeSubSubString - for i, keyTable in pairs(table) do - encodeSubSubString = nil - for i, keyItem in pairs(items) do - if type(keyTable[keyItem]) == "string" then - if encodeSubSubString ~= nil then - encodeSubSubString = encodeSubSubString .. ",\"" .. keyItem .. "\": \"" .. keyTable[keyItem] .. "\"" - else - encodeSubSubString = "\"" .. keyItem .. "\": \"" .. keyTable[keyItem] .. "\"" - end - elseif type(keyTable[keyItem]) == "number" then - if encodeSubSubString ~= nil then - encodeSubSubString = encodeSubSubString .. ",\"" .. keyItem .. "\": " .. tostring(keyTable[keyItem]) - else - encodeSubSubString = "\"" .. keyItem .. "\": " .. tostring(keyTable[keyItem]) - end - elseif type(keyTable[keyItem]) == "boolean" then - if encodeSubSubString ~= nil then - encodeSubSubString = encodeSubSubString .. ",\"" .. keyItem .. "\": " .. tostring(keyTable[keyItem]) - else - encodeSubSubString = "\"" .. keyItem .. "\": " .. tostring(keyTable[keyItem]) - end - end - end - if encodeSubSubString ~= nil and encodeSubString ~= nil then - encodeSubString = encodeSubString .. ", {" .. encodeSubSubString .. "}" - else - encodeSubString = "{" .. encodeSubSubString .. "}" - end - end - encodeString = "{" .. "\"" .. name .. "\": [" .. encodeSubString .. "]}" - return encodeString -end ----------------------------------------------------------------------------------------- ----------------------------Tool Bar----------------------------------------------------- ----------------------------------------------------------------------------------------- -addButton("btn_toolbar_playerList", function(player) toggleVisable(player.gui.left.PlayerList) end) -addButton("btn_toolbar_rocket_score",function(player) toggleVisable(player.gui.left.rocket_score) end) -addButton("btn_readme",function(player) if player.gui.center.Readme then player.gui.center.Readme.destroy() else drawFrame(player,'Readme','Rules') end end) -addButton("btn_admin",function(player) if player.gui.center.Admin then player.gui.center.Admin.destroy() else drawFrame(player,'Admin','Modifiers') end end) -function drawToolbar() - for i, a in pairs(game.connected_players) do - local frame = a.gui.top - clearElement(frame) - drawButton(frame,"btn_toolbar_playerList", "Playerlist", "Adds a player list to your game.") - drawButton(frame,"btn_toolbar_rocket_score", "Rocket score", "Show the satellite launched counter if a satellite has launched.") - drawButton(frame,"btn_readme", "Readme", "Rules, Server info, How to chat, Playerlist, Adminlist.") - if a.tag == '[Owner]' or a.tag == '[Developer]' or a.tag == '[Com Mngr]' or a.tag == '[Admin]' then - drawButton(frame,"btn_admin", "Admin", "All admin fuctions are here") - end - end -end ----------------------------------------------------------------------------------------- ----------------------------Player List-------------------------------------------------- ----------------------------------------------------------------------------------------- -function drawPlayerList() - for i, a in pairs(game.connected_players) do - if a.gui.left.PlayerList == nil then - a.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 - clearElement(a.gui.left.PlayerList.PlayerListScroll) - a.gui.left.PlayerList.PlayerListScroll.style.maximal_height = 200 - for i, player in pairs(game.connected_players) do - if player.character then - if player.tag == '[Jail]' or player.character.active == false then - a.gui.left.PlayerList.PlayerListScroll.add{type = "label", name=player.name, style="caption_label_style", caption={"", ticktohour(player.online_time), " H - " , player.name , " - Jail"}} - a.gui.left.PlayerList.PlayerListScroll[player.name].style.font_color = {r=50,g=50,b=50} - player.character.active = false - player.tag = '[Jail]' - end - end - if player.admin == true and player.tag ~= '[Jail]' then - if player.name == "badgamernl" or player.name == "BADgamerNL" then - a.gui.left.PlayerList.PlayerListScroll.add{type = "label", name=player.name, style="caption_label_style", caption={"", ticktohour(player.online_time), " H - " , player.name , " - OWNER"}} - a.gui.left.PlayerList.PlayerListScroll[player.name].style.font_color = {r=170,g=0,b=0} - player.tag = "[Owner]" - elseif player.name == "eissturm" or player.name == "PropangasEddy" then - a.gui.left.PlayerList.PlayerListScroll.add{type = "label", name=player.name, style="caption_label_style", caption={"", ticktohour(player.online_time), " H - " , player.name , " - ADMIN"}} - a.gui.left.PlayerList.PlayerListScroll[player.name].style.font_color = {r=170,g=41,b=170} - player.tag = "[Admin]" - elseif player.name == "Cooldude2606" then - a.gui.left.PlayerList.PlayerListScroll.add{type = "label", name=player.name, style="caption_label_style", caption={"", ticktohour(player.online_time), " H - " , player.name , " - DEV"}} - a.gui.left.PlayerList.PlayerListScroll[player.name].style.font_color = {r=179,g=125,b=46} - player.tag = "[Developer]" - elseif player.name == "arty714" then - a.gui.left.PlayerList.PlayerListScroll.add{type = "label", name=player.name, style="caption_label_style", caption={"", ticktohour(player.online_time), " H - " , player.name , " - CM"}} - a.gui.left.PlayerList.PlayerListScroll[player.name].style.font_color = {r=150,g=68,b=161} - player.tag = "[Com Mngr]" - else - a.gui.left.PlayerList.PlayerListScroll.add{type = "label", name=player.name, style="caption_label_style", caption={"", ticktohour(player.online_time), " H - " , player.name , " - MOD"}} - a.gui.left.PlayerList.PlayerListScroll[player.name].style.font_color = {r=233,g=63,b=233} - player.tag = "[Moderator]" - end - end - end - for i, player in pairs(game.connected_players) do - if player.admin == false and player.tag ~= '[Jail]' then - if ticktominutes(player.online_time) >= timeForRegular then - a.gui.left.PlayerList.PlayerListScroll.add{type = "label", name=player.name, style="caption_label_style", caption={"", ticktohour(player.online_time), " H - " , player.name}} - a.gui.left.PlayerList.PlayerListScroll[player.name].style.font_color = {r=24,g=172,b=188} - player.tag = "[Regular]" - elseif player.name == "explosivegaming" then - for i=10,1,-1 do - a.gui.left.PlayerList.PlayerListScroll.add{type = "label", name=player.name .. i, style="caption_label_style", caption={"", ticktohour(player.online_time), " H - " , player.name , i}} - a.gui.left.PlayerList.PlayerListScroll[player.name .. i].style.font_color = {r=24,g=172,b=188} - player.tag = "[TEST]" - end - else - a.gui.left.PlayerList.PlayerListScroll.add{type = "label", name=player.name, style="caption_label_style", caption={"", ticktohour(player.online_time), " H - " , player.name}} - a.gui.left.PlayerList.PlayerListScroll[player.name].style.font_color = {r=255,g=159,b=27} - player.tag = "[Guest]" - end - end - end - end -end - -addButton('goto', - function(player,frame) - local p = game.players[frame.parent.name] - player.teleport(game.surfaces[p.surface.name].find_non_colliding_position("player", p.position, 32, 1)) -end) -addButton('bring', - function(player,frame) - local p = game.players[frame.parent.name] - p.teleport(game.surfaces[player.surface.name].find_non_colliding_position("player", player.position, 32, 1)) -end) -addButton('jail', - function(player,frame) - local p = game.players[frame.parent.name] - if p.character then - if p.character.active then - p.character.active = false - p.tag = '[Jail]' - drawPlayerList() - else - p.character.active = true - p.tag = '[Guest]' - drawPlayerList() - end - end -end) -addButton('kill', - function(player,frame) - local p = game.players[frame.parent.name] - if p.character then p.character.die() end -end) -function drawPlayerTable(player, frame, commands, filters) - frame.add{name='playerTable', type="table", colspan=5} - frame.playerTable.style.minimal_width = 500 - frame.playerTable.style.maximal_width = 500 - frame.playerTable.style.horizontal_spacing = 10 - frame.playerTable.add{name="id", type="label", caption="Id "} - frame.playerTable.add{name="name", type="label", caption="Name "} - if not commands then frame.playerTable.add{name="status", type="label", caption="Status "} end - frame.playerTable.add{name="online_time", type="label", caption="Online Time "} - frame.playerTable.add{name="rank", type="label", caption="Rank "} - if commands then frame.playerTable.add{name="commands", type="label", caption="Commands"} end - for i, p in pairs(game.players) do - local addPlayer = true - for _,filter in pairs(filters) do - if filter == 'admin' then if p.admin == false then addPlayer = false break end - elseif filter == 'online' then if p.connected == false then addPlayer = false break end - elseif filter == 'offline' then if p.connected == true then addPlayer = false break end - elseif type(filter)=='number' then if filter > ticktominutes(p.online_time) then addPlayer = false break end - elseif type(filter)=='string' then if p.name:lower():find(filter:lower()) == nil then addPlayer = false break end - end - end - if addPlayer == true and player.name ~= p.name then - if frame.playerTable[p.name] == nil then - frame.playerTable.add{name=i .. "id", type="label", caption=i} - frame.playerTable.add{name=p.name..'_name', type="label", caption=p.name} - if not commands then - if p.connected == true then - frame.playerTable.add{name=p.name .. "Status", type="label", caption="ONLINE"} - else - frame.playerTable.add{name=p.name .. "Status", type="label", caption="OFFLINE"} - end - end - frame.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')} - frame.playerTable.add{name=p.name .. "Rank", type="label", caption=p.tag} - if commands then - frame.playerTable.add{name=p.name, type="flow"} - drawButton(frame.playerTable[p.name],'goto','Tp','Goto to the players location') - drawButton(frame.playerTable[p.name],'bring','Br','Bring a player to your location') - if p.tag == '[Owner]' or p.tag == '[Developer]' or p.tag == '[Com Mngr]' then else - drawButton(frame.playerTable[p.name],'jail','Ja','Jail/Unjail a player') - drawButton(frame.playerTable[p.name],'kill','Ki','Kill this player') - end - end - end - end - end -end ----------------------------------------------------------------------------------------- ----------------------------Read Me Gui-------------------------------------------------- ----------------------------------------------------------------------------------------- -addFrame('Readme') - -addTab('Readme','Rules','The rules of the server', - function(player,frame) - local rules = { - "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 a 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 i, rule in pairs(rules) do - frame.add{name=i, type="label", caption={"", i ,". ", rule}} - end - end) -addTab('Readme','Server Info','Info about the server', - function(player,frame) - frame.add{name=1, type="label", caption={"", "Discord voice and chat server:"}} - frame.add{name=2, type='textfield', text='https://discord.gg/RPCxzgt'}.style.minimal_width=400 - frame.add{name=3, type="label", caption={"", "Our forum:"}} - frame.add{name=4, type='textfield', text='https://explosivegaming.nl'}.style.minimal_width=400 - frame.add{name=5, type="label", caption={"", "Steam:"}} - frame.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(player,frame) - local chat = { - "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 i, line in pairs(chat) do - frame.add{name=i, type="label", caption={"", line}} - end - end) -addTab('Readme','Admins','List of all the people who can ban you :P', - function(player,frame) - local admins = { - "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 i, line in pairs(admins) do - frame.add{name=i, type="label", caption={"", line}} - end - drawPlayerTable(player, frame, false, {'admin'}) - end) -addTab('Readme','Players','List of all the people who have been on the server', - function(player,frame) - local players = { - "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 i, line in pairs(players) do - frame.add{name=i, type="label", caption={"", line}} - end - frame.add{name='filterTable',type='table',colspan=3} - frame.filterTable.add{name='name_label',type='label',caption='Name'} - frame.filterTable.add{name='status_label',type='label',caption='Online?'} - frame.filterTable.add{name='hours_label',type='label',caption='Online Time (minutes)'} - frame.filterTable.add{name='name_input',type='textfield'} - frame.filterTable.add{name='status_input',type='textfield'} - frame.filterTable.add{name='hours_input',type='textfield'} - drawPlayerTable(player, frame, false, {}) - end) ----------------------------------------------------------------------------------------- ----------------------------Modifier Gui------------------------------------------------- ----------------------------------------------------------------------------------------- -addFrame('Admin') - -addButton('btn_toolbar_automessage',function() autoMessage() end) -addButton('revive_dead_entitys',function(player,frame) for key, entity in pairs(game.surfaces[1].find_entities_filtered({type = "entity-ghost"})) do entity.revive() end end) -addButton('revive_dead_entitys_range',function(player,frame) if tonumber(frame.parent.range.text) then local range = tonumber(frame.parent.range.text) for key, entity in pairs(game.surfaces[1].find_entities_filtered({area={{player.position.x-range,player.position.y-range},{player.position.x+range,player.position.y+range}},type = "entity-ghost"})) do entity.revive() end end end) -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 = { - "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 i, modifier in pairs(forceModifiers) do - local number = tonumber(( frame.parent.parent.modifierTable[modifier .. "_input"].text):match("[%d]+[.%d+]")) - if number ~= nil then - if number >= 0 and number < 50 and number ~= player.force[modifier] then - player.force[modifier] = number - player.print(modifier .. " changed to number: " .. tostring(number)) - elseif number == player.force[modifier] then - player.print(modifier .. " Did not change") - else - player.print(modifier .. " needs to be a higher number or it contains an letter") - end - end - end - end) - -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'} - drawButton(frame,'remove_biters','Kill Biters','Removes all biters in map') - drawButton(frame,'tp_all','TP All Here','Brings all players to you') - drawButton(frame,'toggle_cheat','Toggle Cheat Mode','Toggle your cheat mode') - end) -addTab('Admin', 'Modifiers', 'Edit in game modifiers', - function(player,frame) - local forceModifiers = { - "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" - } - frame.add{type = "flow", name= "flowNavigation",direction = "horizontal"} - frame.add{name="modifierTable", type="table", colspan=3} - frame.modifierTable.add{name="name", type="label", caption="name"} - frame.modifierTable.add{name="input", type="label", caption="input"} - frame.modifierTable.add{name="current", type="label", caption="current"} - for i, modifier in pairs(forceModifiers) do - frame.modifierTable.add{name=modifier, type="label", caption=modifier} - frame.modifierTable.add{name=modifier .. "_input", type="textfield", caption="inputTextField"} - frame.modifierTable.add{name=modifier .. "_current", type="label", caption=tostring(player.force[modifier])} - end - drawButton(frame.flowNavigation,"btn_Modifier_apply","Apply","Apply the new values to the game") -end) -addTab('Admin', 'Player List', 'Send a message to all players', - function(player, frame) - frame.add{name='filterTable',type='table',colspan=2} - frame.filterTable.add{name='name_label',type='label',caption='Name'} - frame.filterTable.add{name='hours_label',type='label',caption='Online Time (minutes)'} - frame.filterTable.add{name='name_input',type='textfield'} - frame.filterTable.add{name='hours_input',type='textfield'} - drawPlayerTable(player, frame, true, {'online'}) - end) \ No newline at end of file