mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 04:21:41 +09:00
Sorted items that need converting
This commit is contained in:
132
modules/ExpGamingInfo/to convert/readme.lua
Normal file
132
modules/ExpGamingInfo/to convert/readme.lua
Normal file
@@ -0,0 +1,132 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
This file can be used with permission but this and the credit below must remain in the file.
|
||||
Contact a member of management on our discord to seek permission to use our code.
|
||||
Any changes that you may make to the code are yours but that does not make the script yours.
|
||||
Discord: https://discord.gg/r6dC2uK
|
||||
]]
|
||||
--Please Only Edit Below This Line-----------------------------------------------------------
|
||||
|
||||
local function format_label(label)
|
||||
label.style.maximal_width = 480
|
||||
label.style.single_line = false
|
||||
end
|
||||
|
||||
Gui.center.add{
|
||||
name='readme',
|
||||
caption='utility/questionmark',
|
||||
tooltip={'readme.tooltip'}
|
||||
}:add_tab('guildlines',{'readme.guildlines-name'},{'readme.guildlines-tooltip'},function(frame)
|
||||
for i = 1,10 do
|
||||
local style=nil; if i == 1 then style = 'caption_label' end
|
||||
format_label(frame.add{
|
||||
type='label',
|
||||
caption={'readme.guildlines-line'..tostring(i)},
|
||||
style=style
|
||||
})
|
||||
end
|
||||
end):add_tab('chat',{'readme.chat-name'},{'readme.chat-tooltip'},function(frame)
|
||||
format_label(frame.add{
|
||||
type='label',
|
||||
caption={'readme.chat-singleline'}
|
||||
})
|
||||
end):add_tab('commands',{'readme.commands-name'},{'readme.commands-tooltip'},function(frame)
|
||||
format_label(frame.add{
|
||||
type='label',
|
||||
caption={'readme.commands-singleline'}
|
||||
})
|
||||
Gui.bar(frame,480)
|
||||
local table = frame.add{name='command_table',type='table',column_count=2}
|
||||
table.add{
|
||||
type='label',
|
||||
caption={'readme.commands-col1'},
|
||||
style='caption_label'
|
||||
}
|
||||
table.add{
|
||||
type='label',
|
||||
caption={'readme.commands-col2'},
|
||||
style='caption_label'
|
||||
}
|
||||
table.style.width = 480
|
||||
table.draw_vertical_lines = true
|
||||
table.draw_horizontal_line_after_headers = true
|
||||
for _,command in pairs(commands.get_commands(frame.player_index)) do
|
||||
table.add{
|
||||
type='label',
|
||||
caption='/'..command.name
|
||||
}
|
||||
local discription = table.add{
|
||||
type='label',
|
||||
caption=command.description,
|
||||
}
|
||||
discription.style.maximal_width = 400
|
||||
discription.style.single_line = false
|
||||
end
|
||||
end):add_tab('links',{'readme.links-name'},{'readme.links-tooltip'},function(frame)
|
||||
local links={
|
||||
'https://discord.explosivegaming.nl',
|
||||
'https://explosivegaming.nl',
|
||||
'http://steamcommunity.com/groups/tntexplosivegaming',
|
||||
'https://www.patreon.com/badgamernl',
|
||||
'https://wiki.explosivegaming.nl/'
|
||||
}
|
||||
local function format(text_box)
|
||||
text_box.style.minimal_width=400
|
||||
text_box.read_only = true
|
||||
text_box.word_wrap = true
|
||||
text_box.selectable = true
|
||||
end
|
||||
for i,link in pairs(links) do
|
||||
frame.add{
|
||||
type="label",
|
||||
caption={'readme.links-cap'..tostring(i)},
|
||||
style='caption_label'
|
||||
}
|
||||
format(frame.add{
|
||||
type='text-box',
|
||||
text=link
|
||||
})
|
||||
end
|
||||
end):add_tab('servers',{'readme.servers-name'},{'readme.servers-tooltip'},function(frame)
|
||||
format_label(frame.add{
|
||||
type='label',
|
||||
caption={'readme.servers-singleline'}
|
||||
})
|
||||
Gui.bar(frame,480)
|
||||
for i = 1,6 do
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'readme.servers-format',tostring(i),{'readme.servers-cap'..tostring(i)}},
|
||||
style='caption_label'
|
||||
}
|
||||
format_label(frame.add{
|
||||
type='label',
|
||||
caption={'readme.servers-des'..tostring(i)}
|
||||
})
|
||||
end
|
||||
end):add_tab('rules',{'readme.rules-name'},{'readme.rules-tooltip'},function(frame)
|
||||
format_label(frame.add{
|
||||
type='label',
|
||||
caption={'readme.rules-singleline'}
|
||||
})
|
||||
Gui.bar(frame,480)
|
||||
for i = 1,20 do
|
||||
format_label(frame.add{
|
||||
type='label',
|
||||
caption={'readme.rules-format',i,{'readme.rules-rule'..tostring(i)}}
|
||||
})
|
||||
end
|
||||
end)
|
||||
|
||||
Sync.add_to_gui(Gui.inputs.add_button('readme-sync-guildlines','View Guildlines','View the guildlines in the readme',function(player,element)
|
||||
Gui.center.open_tab(player,'readme','guildlines')
|
||||
end))
|
||||
|
||||
Sync.add_to_gui(Gui.inputs.add_button('readme-sync-links','View Other Links','View the links in the readme',function(player,element)
|
||||
Gui.center.open_tab(player,'readme','links')
|
||||
end))
|
||||
|
||||
Sync.add_to_gui(Gui.inputs.add_button('readme-sync-rules','View All Rules','View the all rules in the readme',function(player,element)
|
||||
Gui.center.open_tab(player,'readme','rules')
|
||||
end))
|
||||
104
modules/ExpGamingInfo/to convert/rockets.lua
Normal file
104
modules/ExpGamingInfo/to convert/rockets.lua
Normal file
@@ -0,0 +1,104 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
This file can be used with permission but this and the credit below must remain in the file.
|
||||
Contact a member of management on our discord to seek permission to use our code.
|
||||
Any changes that you may make to the code are yours but that does not make the script yours.
|
||||
Discord: https://discord.gg/r6dC2uK
|
||||
]]
|
||||
--Please Only Edit Below This Line-----------------------------------------------------------
|
||||
|
||||
local function _global(reset)
|
||||
global.addons = not reset and global.addons or {}
|
||||
global.addons.rockets = not reset and global.addons.rockets or {update=0,first=0,_last=0,last=0,fastest=0,milestones={m1=0,m2=0,m5=0,m10=0,m20=0,m50=0,m100=0,m200=0,m500=0,m1000=0,m2000=0,m5000=0}}
|
||||
return global.addons.rockets
|
||||
end
|
||||
Gui.left.add{
|
||||
name='rockets',
|
||||
caption='item/rocket-silo',
|
||||
tooltip={'rockets.tooltip'},
|
||||
draw=function(frame)
|
||||
frame.caption = {'rockets.name'}
|
||||
local player = Game.get_player(frame.player_index)
|
||||
local data = _global()
|
||||
local satellites = player.force.get_item_launched('satellite')
|
||||
local time = {'rockets.nan'}
|
||||
if satellites == 1 then time = tick_to_display_format(game.tick)
|
||||
elseif satellites > 1 then time = tick_to_display_format((game.tick-data.first)/satellites) end
|
||||
if satellites ~= data.update then
|
||||
data.update = satellites
|
||||
if data.first == 0 then data.first = game.tick end
|
||||
data._last = data.last
|
||||
data.last = game.tick
|
||||
if data.last-data._last < data.fastest or data.fastest == 0 then data.fastest = data.last-data._last end
|
||||
end
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'rockets.sent',satellites}
|
||||
}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'rockets.first',tick_to_display_format(data.first)}
|
||||
}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'rockets.last',tick_to_display_format(data.last-data._last)}
|
||||
}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'rockets.time',time}
|
||||
}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'rockets.fastest',tick_to_display_format(data.fastest)}
|
||||
}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'rockets.milestones'},
|
||||
style='caption_label'
|
||||
}
|
||||
local milestones = frame.add{
|
||||
type='flow',
|
||||
direction='vertical'
|
||||
}
|
||||
for milestone,time in pairs(data.milestones) do
|
||||
local milestone = tonumber(milestone:match('%d+'))
|
||||
if time == 0 and satellites == milestone then
|
||||
data.milestones['m'..milestone] = data.last
|
||||
time = data.last
|
||||
Gui.left.open('rockets')
|
||||
end
|
||||
local _time = {'rockets.nan'}
|
||||
if time > 0 then _time = tick_to_display_format(time) end
|
||||
milestones.add{
|
||||
type='label',
|
||||
caption={'rockets.format',tostring(milestone),_time}
|
||||
}
|
||||
if time == 0 then break end
|
||||
end
|
||||
end,
|
||||
can_open=function(player)
|
||||
if player.force.get_item_launched('satellite') > 0 then return true
|
||||
else return {'rockets.none'} end
|
||||
end
|
||||
}
|
||||
|
||||
Event.register(defines.events.on_rocket_launched,function(event) Gui.left.update('rockets') end)
|
||||
Sync.add_update('rockets',function()
|
||||
local _return = {}
|
||||
local data = _global()
|
||||
local satellites = game.forces.player.get_item_launched('satellite')
|
||||
local time = {'rockets.nan'}
|
||||
if satellites == 1 then time = tick_to_display_format(game.tick)
|
||||
elseif satellites > 1 then time = tick_to_display_format((game.tick-data.first)/satellites) end
|
||||
_return.total = satellites
|
||||
_return.first = Sync.tick_format(data.first)
|
||||
_return.last = Sync.tick_format(data.last-data._last)
|
||||
_return.time = Sync.tick_format(time)
|
||||
_return.fastest = Sync.tick_format(data.fastest)
|
||||
_return.milestones = {}
|
||||
for milestone,time in pairs(data.milestones) do
|
||||
_return.milestones[milestone] = Sync.tick_format(time)
|
||||
end
|
||||
return _return
|
||||
end)
|
||||
102
modules/ExpGamingInfo/to convert/science.lua
Normal file
102
modules/ExpGamingInfo/to convert/science.lua
Normal file
@@ -0,0 +1,102 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
This file can be used with permission but this and the credit below must remain in the file.
|
||||
Contact a member of management on our discord to seek permission to use our code.
|
||||
Any changes that you may make to the code are yours but that does not make the script yours.
|
||||
Discord: https://discord.gg/r6dC2uK
|
||||
]]
|
||||
--Please Only Edit Below This Line-----------------------------------------------------------
|
||||
|
||||
local science_packs = {
|
||||
'science-pack-1',
|
||||
'science-pack-2',
|
||||
'science-pack-3',
|
||||
'military-science-pack',
|
||||
'production-science-pack',
|
||||
'high-tech-science-pack',
|
||||
'space-science-pack'
|
||||
}
|
||||
|
||||
local function _global(reset)
|
||||
global.addons = not reset and global.addons or {}
|
||||
global.addons.science = not reset and global.addons.science or {_base={update=0,_update=0,made={0,0,0,0,0,0,0},_made={0,0,0,0,0,0,0}}}
|
||||
return global.addons.science
|
||||
end
|
||||
|
||||
Gui.left.add{
|
||||
name='science',
|
||||
caption='item/lab',
|
||||
tooltip={'science.tooltip'},
|
||||
draw=function(frame)
|
||||
local data = _global()
|
||||
local player = Game.get_player(frame.player_index)
|
||||
if not data[player.force.name] then
|
||||
data[player.force.name] = table.deepcopy(data._base)
|
||||
end
|
||||
data = data[player.force.name]
|
||||
frame.caption = {'science.name'}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'science.total'},
|
||||
style='caption_label'
|
||||
}
|
||||
local totals = frame.add{
|
||||
type='flow',
|
||||
direction='vertical'
|
||||
}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'science.time'},
|
||||
style='caption_label'
|
||||
}
|
||||
local times = frame.add{
|
||||
type='flow',
|
||||
direction='vertical'
|
||||
}
|
||||
if data.update < game.tick-100 then
|
||||
data._update = data.update
|
||||
data._made = table.deepcopy(data.made)
|
||||
for i,name in pairs(science_packs) do
|
||||
data.made[i] = player.force.item_production_statistics.get_input_count(name)
|
||||
end
|
||||
data.update = game.tick
|
||||
end
|
||||
for i,name in pairs(science_packs) do
|
||||
local made = data.made[i]
|
||||
if made > 0 then
|
||||
totals.add{
|
||||
type='label',
|
||||
caption={'science.format',{'science.'..name},made}
|
||||
}
|
||||
local _made = string.format('%.2f',(made-data._made[i])/((data.update-data._update)/(3600*game.speed)))
|
||||
times.add{
|
||||
type='label',
|
||||
caption={'science.format',{'science.'..name},_made}
|
||||
}
|
||||
end
|
||||
end
|
||||
end,
|
||||
can_open=function(player)
|
||||
if player.force.item_production_statistics.get_input_count('science-pack-1') > 0 then return true
|
||||
else return {'science.none'} end
|
||||
end
|
||||
}
|
||||
|
||||
Event.register(defines.events.on_research_finished,function(event) Gui.left.update('science') end)
|
||||
Sync.add_update('science',function()
|
||||
local _return = {}
|
||||
local _data = _global()
|
||||
for force_name,data in pairs(_data) do
|
||||
if force_name ~= '_base' then
|
||||
_return[force_name] = {totals={},times={}}
|
||||
for i,name in pairs(science_packs) do
|
||||
local made = data.made[i]
|
||||
_return[force_name].totals[name] = made
|
||||
local _made = string.format('%.2f',(made-data._made[i])/((data.update-data._update)/(3600*game.speed)))
|
||||
_return[force_name].times[name] = _made
|
||||
end
|
||||
end
|
||||
end
|
||||
return _return
|
||||
end)
|
||||
193
modules/ExpGamingInfo/to convert/tasklist.lua
Normal file
193
modules/ExpGamingInfo/to convert/tasklist.lua
Normal file
@@ -0,0 +1,193 @@
|
||||
--[[
|
||||
Explosive Gaming
|
||||
|
||||
This file can be used with permission but this and the credit below must remain in the file.
|
||||
Contact a member of management on our discord to seek permission to use our code.
|
||||
Any changes that you may make to the code are yours but that does not make the script yours.
|
||||
Discord: https://discord.gg/r6dC2uK
|
||||
]]
|
||||
--Please Only Edit Below This Line-----------------------------------------------------------
|
||||
|
||||
local function _global(reset)
|
||||
global.addons = not reset and global.addons or {}
|
||||
global.addons.tasklist = not reset and global.addons.tasklist or {tasks={},_edit={},_base={_edit=false,_tasks={},_editing={}}}
|
||||
return global.addons.tasklist
|
||||
end
|
||||
|
||||
local edit = Gui.inputs.add{
|
||||
name='tasklist-edit',
|
||||
type='button',
|
||||
caption='utility/rename_icon_normal'
|
||||
}:on_event('click',function(event)
|
||||
local text_flow = event.element.parent.parent.text_flow
|
||||
local data = _global()._edit[event.player_index]
|
||||
if not data._edit then data._tasks = table.deepcopy(_global().tasks) end
|
||||
if text_flow.input.type == 'label' then
|
||||
data._editing[tonumber(text_flow.parent.name)]=true
|
||||
Gui.left.update('tasklist',event.player_index)
|
||||
elseif text_flow.input.type == 'textfield' then
|
||||
local text = text_flow.input.text
|
||||
data._editing[tonumber(text_flow.parent.name)]=false
|
||||
data._tasks[tonumber(text_flow.parent.name)]=text
|
||||
Gui.left.update('tasklist',event.player_index)
|
||||
end
|
||||
end)
|
||||
|
||||
local function _edit(frame)
|
||||
local element = edit:draw(frame)
|
||||
element.style.height = 20
|
||||
element.style.width = 20
|
||||
local text_flow = element.parent.parent.text_flow
|
||||
local data = _global()._edit[frame.player_index]
|
||||
data._tasks[text_flow.parent.name]=text
|
||||
if data._editing[tonumber(text_flow.parent.name)] then
|
||||
element.style.height = 30
|
||||
element.style.width = 30
|
||||
local text = text_flow.input.caption
|
||||
text_flow.clear()
|
||||
local _text = text_flow.add{
|
||||
name='input',
|
||||
type='textfield',
|
||||
text=text
|
||||
}
|
||||
_text.style.width = 200
|
||||
element.sprite = 'utility/enter'
|
||||
end
|
||||
end
|
||||
|
||||
local remove = Gui.inputs.add{
|
||||
name='tasklist-remove',
|
||||
type='button',
|
||||
caption='utility/remove'
|
||||
}:on_event('click',function(event)
|
||||
local frame = event.element.parent.parent
|
||||
local data = _global()._edit[event.player_index]
|
||||
if data._edit then
|
||||
table.remove(data._tasks,tonumber(frame.name))
|
||||
table.remove(data._editing,tonumber(frame.name))
|
||||
else
|
||||
table.remove(_global().tasks,tonumber(frame.name))
|
||||
Gui.left.update('tasklist')
|
||||
end
|
||||
Gui.left.update('tasklist',event.player_index)
|
||||
end)
|
||||
|
||||
local add = Gui.inputs.add{
|
||||
name='tasklist-add',
|
||||
type='button',
|
||||
caption='utility/add'
|
||||
}:on_event('click',function(event)
|
||||
local frame = event.element.parent.parent
|
||||
local data = _global()._edit[event.player_index]
|
||||
if data._edit then
|
||||
table.insert(data._tasks,tonumber(frame.name)+1,'New Value')
|
||||
table.insert(data._editing,tonumber(frame.name)+1,true)
|
||||
else
|
||||
data._tasks = table.deepcopy(_global().tasks)
|
||||
table.insert(data._tasks,tonumber(frame.name)+1,'New Value')
|
||||
table.insert(data._editing,tonumber(frame.name)+1,true)
|
||||
end
|
||||
Gui.left.update('tasklist',event.player_index)
|
||||
end)
|
||||
|
||||
local function _tasks(player)
|
||||
local player = Game.get_player(player)
|
||||
local data = _global()._edit[player.index]
|
||||
if not data then return _global().tasks end
|
||||
local _edit = false
|
||||
for _,v in pairs(data._editing) do
|
||||
if v == true then
|
||||
_edit = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if data._edit and not _edit then
|
||||
_global().tasks = table.deepcopy(data._tasks)
|
||||
_global()._edit[player.index] = table.deepcopy(_global()._base)
|
||||
Gui.left.update('tasklist')
|
||||
return _global().tasks
|
||||
elseif not data._edit and _edit then
|
||||
data._edit = true
|
||||
for key,_ in pairs(data._tasks) do if not data._editing[key] then data._editing[key] = false end end
|
||||
return data._tasks
|
||||
elseif _edit then return data._tasks
|
||||
else return _global().tasks
|
||||
end
|
||||
end
|
||||
|
||||
Gui.left.add{
|
||||
name='tasklist',
|
||||
caption='utility/not_enough_repair_packs_icon',
|
||||
tooltip={'tasklist.tooltip'},
|
||||
draw=function(frame)
|
||||
frame.caption = ''
|
||||
local title = frame.add{
|
||||
type='flow',
|
||||
direction='horizontal'
|
||||
}
|
||||
title.add{
|
||||
type='label',
|
||||
caption={'tasklist.name'},
|
||||
style='caption_label'
|
||||
}
|
||||
local data = _global()
|
||||
local player = Game.get_player(frame.player_index)
|
||||
local rank = Ranking.get_rank(player)
|
||||
if rank:allowed('edit-tasklist') then
|
||||
if not data._edit[player.index] then data._edit[player.index] = table.deepcopy(data._base) end
|
||||
end
|
||||
for i,task in pairs(_tasks(player)) do
|
||||
local flow = frame.add{
|
||||
name=i,
|
||||
type='flow',
|
||||
direction='horizontal'
|
||||
}
|
||||
local text_flow = flow.add{
|
||||
name='text_flow',
|
||||
type='flow',
|
||||
direction='horizontal'
|
||||
}
|
||||
text_flow.add{
|
||||
name='input',
|
||||
type='label',
|
||||
caption=task
|
||||
}
|
||||
local button_flow = flow.add{
|
||||
type='flow',
|
||||
direction='horizontal'
|
||||
}
|
||||
if rank:allowed('edit-tasklist') then
|
||||
_edit(button_flow)
|
||||
if data._edit[player.index]._editing[i] then
|
||||
local element = remove:draw(button_flow)
|
||||
element.style.height = 30
|
||||
element.style.width = 30
|
||||
local _element = add:draw(button_flow)
|
||||
_element.style.height = 30
|
||||
_element.style.width = 30
|
||||
end
|
||||
end
|
||||
end
|
||||
if rank:allowed('edit-tasklist') then
|
||||
local flow = title.add{
|
||||
name=#_tasks(player),
|
||||
type='flow',
|
||||
direction='horizontal'
|
||||
}
|
||||
local button_flow = flow.add{
|
||||
type='flow',
|
||||
direction='horizontal'
|
||||
}
|
||||
local element = add:draw(button_flow)
|
||||
element.style.height = 20
|
||||
element.style.width = 20
|
||||
end
|
||||
if #_tasks(player) == 0 and not rank:allowed('edit-tasklist') then frame.style.visible = false end
|
||||
end,
|
||||
can_open=function(player)
|
||||
local rank = Ranking.get_rank(player)
|
||||
if rank:allowed('edit-tasklist') or #_global().tasks > 0 then return true
|
||||
else return {'tasklist.none'} end
|
||||
end,
|
||||
open_on_join=true
|
||||
}
|
||||
Reference in New Issue
Block a user