mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-12 23:54:53 +09:00
Globle Var step 1
This commit is contained in:
1 parent
a0ab66d70a
commit
8772358aa3
2 files changed
+48
-1
No files matched your search
+1
-1
@@ -1 +1 @@
|
||||
itemRotated={}entityRemoved={}entityCache={}guis={frames={},buttons={}}warningAllowed=nil;timeForRegular=180;CHUNK_SIZE=32;local function a(b,c)if b.find_entities_filtered{area=c,type="decorative"}then for d,e in pairs(b.find_entities_filtered{area=c,type="decorative"})do if e.name~="red-bottleneck"and e.name~="yellow-bottleneck"and e.name~="green-bottleneck"then e.destroy()end end end end;local function f(b,g,h,i,j)a(b,{{g,h},{g+i,h+j}})end;local function k()local b=game.surfaces["nauvis"]for l in b.get_chunks()do f(b,l.x*CHUNK_SIZE,l.y*CHUNK_SIZE,CHUNK_SIZE-1,CHUNK_SIZE-1)end;callAdmin("Decoratives have been removed")end;script.on_event(defines.events.on_chunk_generated,function(m)a(m.surface,m.area)end)function ticktohour(n)local o=tostring(math.floor(n/(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.paLine truncated
|
||||
itemRotated={}entityRemoved={}entityCache={}guis={frames={},buttons={}}defaults={test={1,2,3},test2='test',test3=5}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 initVar()local s=nil;if game.players[1].gui.left.hidden then s=game.players[1].gui.left.hidden.caption else s=game.players[1].gui.left.add{type='frame',name='hidden',caption=table.tostring(defaults)}.caption end;gTable=loadstring('return '..s)()game.print(s)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 table.val_to_str(t)if"string"==type(t)then t=string.gsub(t,"\n","\\n")if string.match(string.gsub(t,"[^'\"]",""),'^"+$')then return"'"..t.."'"end;return'"'..string.gsub(t,'"','\\"')..'"'else return"table"==type(t)and table.tostring(t)or tostring(t)end end;function table.key_to_str(u)if"string"==type(u)and string.match(u,"^[_%a][_%a%d]*$")then return u else return"["..table.val_to_str(u).."]"end end;function table.tostring(v)local w,x={},{}for u,t in ipairs(v)do table.insert(w,table.val_to_str(t))x[u]=true end;for u,t in pairs(v)do if not x[u]then table.insert(w,table.key_to_str(u).."="..table.val_to_str(t))end end;return"{"..table.concat(w,",").."}"end;function addFrame(y)guis.frames[y]={}addButton('close',function(r,z)z.parent.parent.parent.destroy()end)end;function addTab(y,A,B,C)guis.frames[y][A]={A,B,C}addButton(A,function(r,z)openTab(r,z.parent.parent.parent.name,z.parent.parent.parent.tab,z.name)end)end;function addButton(D,E)guis.buttons[D]={D,E}end;function drawButton(y,D,F,B)y.add{name=D,type="button",caption=F,tooltip=B}end;function openTab(r,G,H,A)local I=r.gui.center[G].tabBarScroll.tabBar;for d,J in pairs(guis.frames[G])do if J[1]==A then I[J[1]].style.font_color={r=255,g=255,b=255,a=255}clearElement(H)J[3](r,H)else I[J[1]].style.font_color={r=100,g=100,b=100,a=255}end end end;function drawFrame(r,G,A)if r.gui.center[G]then r.gui.center[G].destroy()end;local y=r.gui.center.add{name=G,type='frame',caption=G,direction='vertical'}local K=y.add{type="scroll-pane",name="tabBarScroll",vertical_scroll_policy="never",horizontal_scroll_policy="always"}local I=K.add{type='flow',direction='horizontal',name='tabBar'}local H=y.add{type="scroll-pane",name="tab",vertical_scroll_policy="auto",horizontal_scroll_policy="never"}for d,J in pairs(guis.frames[G])do drawButton(I,J[1],J[1],J[2])end;openTab(r,G,H,A)drawButton(I,'close','Close','Close this window')H.style.minimal_height=300;H.style.maximal_height=300;H.style.minimal_width=500;H.style.maximal_width=500;K.style.minimal_height=60;K.style.maximal_height=60;K.style.minimal_width=500;K.style.maximal_width=500 end;function toggleVisable(y)if y then if y.style.visible==nil then y.style.visible=false else y.style.visible=not y.style.visible end end end;function clearElement(L)if L~=nil then for M,z in pairs(L.children_names)do L[z].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)initVar()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.PlayeLine truncated
|
||||
+47
@@ -3,6 +3,7 @@ itemRotated = {}
|
||||
entityRemoved = {}
|
||||
entityCache = {}
|
||||
guis = {frames={},buttons={}}
|
||||
defaults = {test={1,2,3},test2='test',test3=5}
|
||||
|
||||
warningAllowed = nil
|
||||
timeForRegular = 180
|
||||
@@ -58,6 +59,13 @@ function callAdmin(msg)
|
||||
end
|
||||
end
|
||||
|
||||
function initVar()
|
||||
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 end
|
||||
gTable = loadstring('return '..g)()
|
||||
game.print(g)
|
||||
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')
|
||||
@@ -68,6 +76,44 @@ function autoMessage()
|
||||
game.print('To see these links again goto: Readme > Server Info')
|
||||
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, "^[_%a][_%a%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)
|
||||
@@ -160,6 +206,7 @@ script.on_event(defines.events.on_player_respawned, function(event)
|
||||
end)
|
||||
|
||||
script.on_event(defines.events.on_player_joined_game, function(event)
|
||||
initVar()
|
||||
local player = game.players[event.player_index]
|
||||
player.print({"", "Welcome"})
|
||||
if player.gui.left.PlayerList ~= nil then
|
||||
|
||||
Reference in new issue
Block a user