mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 12:31:41 +09:00
Moved more stuff to done
This commit is contained in:
105
old/modules/DONE/Guis/Rockets/control.lua
Normal file
105
old/modules/DONE/Guis/Rockets/control.lua
Normal file
@@ -0,0 +1,105 @@
|
||||
--- Adds a rocket count gui to the game that shows milestones and average rocket time
|
||||
-- @module ExpGamingInfo.Rockets
|
||||
-- @author Cooldude2606
|
||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||
-- @alias ThisModule
|
||||
|
||||
-- Module Require
|
||||
local Gui = require('ExpGamingCore.Gui')
|
||||
local Game = require('FactorioStdLib.Game')
|
||||
|
||||
-- Module Define
|
||||
local module_verbose = false
|
||||
local ThisModule = {
|
||||
on_init=function()
|
||||
if loaded_modules['ExpGamingCore.Sync^4.0.0'] then require(module_path..'/src/sync') end
|
||||
end
|
||||
}
|
||||
|
||||
-- Global Define
|
||||
local global = {
|
||||
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}
|
||||
}
|
||||
Global.register(global,function(tbl) global = tbl end)
|
||||
|
||||
-- Function Define
|
||||
ThisModule.Gui = Gui.left{
|
||||
name='rockets',
|
||||
caption='item/rocket-silo',
|
||||
tooltip={'ExpGamingInfo-Rockets.tooltip'},
|
||||
draw=function(self,frame)
|
||||
frame.caption = {'ExpGamingInfo-Rockets.name'}
|
||||
local player = Game.get_player(frame.player_index)
|
||||
local satellites = player.force.get_item_launched('satellite')
|
||||
local time = {'ExpGamingInfo-Rockets.nan'}
|
||||
if satellites == 1 then time = tick_to_display_format(game.tick)
|
||||
elseif satellites > 1 then time = tick_to_display_format((game.tick-global.first)/satellites) end
|
||||
if satellites ~= global.update then
|
||||
global.update = satellites
|
||||
if global.first == 0 then global.first = game.tick end
|
||||
global._last = global.last
|
||||
global.last = game.tick
|
||||
if global.last-global._last < global.fastest or global.fastest == 0 then global.fastest = global.last-global._last end
|
||||
end
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'ExpGamingInfo-Rockets.sent',satellites}
|
||||
}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'ExpGamingInfo-Rockets.first',tick_to_display_format(global.first)}
|
||||
}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'ExpGamingInfo-Rockets.last',tick_to_display_format(global.last-global._last)}
|
||||
}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'ExpGamingInfo-Rockets.time',time}
|
||||
}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'ExpGamingInfo-Rockets.fastest',tick_to_display_format(global.fastest)}
|
||||
}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'ExpGamingInfo-Rockets.milestones'},
|
||||
style='caption_label'
|
||||
}
|
||||
local milestones = frame.add{
|
||||
type='flow',
|
||||
direction='vertical'
|
||||
}
|
||||
for milestone,next_time in pairs(global.milestones) do
|
||||
milestone = tonumber(milestone:match('%d+'))
|
||||
if next_time == 0 and satellites == milestone then
|
||||
global.milestones['m'..milestone] = global.last
|
||||
next_time = global.last
|
||||
Gui.left.open('rockets')
|
||||
end
|
||||
local _time = {'ExpGamingInfo-Rockets.nan'}
|
||||
if next_time > 0 then _time = tick_to_display_format(next_time) end
|
||||
milestones.add{
|
||||
type='label',
|
||||
caption={'ExpGamingInfo-Rockets.format',tostring(milestone),_time}
|
||||
}
|
||||
if next_time == 0 then break end
|
||||
end
|
||||
end,
|
||||
can_open=function(player)
|
||||
if player.force.get_item_launched('satellite') > 0 then return true
|
||||
else return {'ExpGamingInfo-Rockets.none'} end
|
||||
end
|
||||
}
|
||||
|
||||
-- Event Define
|
||||
Event.add(defines.events.on_rocket_launched,function(event) Gui.left.update('rockets') end)
|
||||
|
||||
-- Module Return
|
||||
-- when called will toggle the gui for that player, updates gui if no player given
|
||||
return setmetatable(ThisModule,{__call=function(self,...) self.Gui(...) end})
|
||||
12
old/modules/DONE/Guis/Rockets/locale/de.cfg
Normal file
12
old/modules/DONE/Guis/Rockets/locale/de.cfg
Normal file
@@ -0,0 +1,12 @@
|
||||
[ExpGamingInfo-Rockets]
|
||||
name=Raketeninfo
|
||||
tooltip=Detailliste über gestartete Raketen.
|
||||
none=Es wurden noch keine Rakten gestartet.
|
||||
nan=NaN
|
||||
sent=Gestartete Raketen: __1__
|
||||
first=Erster Start: __1__
|
||||
last=Dauer bis zum letzten Start: __1__
|
||||
time=Durchschnittliche Starzeit: __1__
|
||||
fastest=Schnellster Start: __1__
|
||||
milestones=Meilensteine:
|
||||
format=__1__: __2__
|
||||
12
old/modules/DONE/Guis/Rockets/locale/en.cfg
Normal file
12
old/modules/DONE/Guis/Rockets/locale/en.cfg
Normal file
@@ -0,0 +1,12 @@
|
||||
[ExpGamingInfo-Rockets]
|
||||
name=Rocket Info
|
||||
tooltip=List of details about the rockets sent.
|
||||
none=No rockets have been sent yet.
|
||||
nan=Not available
|
||||
sent=Rockets Sent: __1__
|
||||
first=First Lanuched At: __1__
|
||||
last=Last Launch Took: __1__
|
||||
time=Average Launch Time: __1__
|
||||
fastest=Fastest Launch: __1__
|
||||
milestones=Milestones:
|
||||
format=__1__: __2__
|
||||
12
old/modules/DONE/Guis/Rockets/locale/fr.cfg
Normal file
12
old/modules/DONE/Guis/Rockets/locale/fr.cfg
Normal file
@@ -0,0 +1,12 @@
|
||||
[ExpGamingInfo-Rockets]
|
||||
name=Rocket Info
|
||||
tooltip=List of details about the rockets sent.
|
||||
none=No rockets have been sent yet.
|
||||
nan=NaN
|
||||
sent=Rockets Sent: __1__
|
||||
first=First Lanuched At: __1__
|
||||
last=Last Launch Took: __1__
|
||||
time=Average Launch Time: __1__
|
||||
fastest=Fastest Launch: __1__
|
||||
milestones=Milestones:
|
||||
format=__1__: __2__
|
||||
12
old/modules/DONE/Guis/Rockets/locale/nl.cfg
Normal file
12
old/modules/DONE/Guis/Rockets/locale/nl.cfg
Normal file
@@ -0,0 +1,12 @@
|
||||
[ExpGamingInfo-Rockets]
|
||||
name=Raket Info
|
||||
tooltip=Lijst met details over de verstuurde raketten.
|
||||
none=Er zijn nog geen raketten verstuurd.
|
||||
nan=Niet beschikbaar
|
||||
sent=Raketten verstuurd: __1__
|
||||
first=Eerste raket gelanceerd op: __1__
|
||||
last=Meest recente lancering: __1__
|
||||
time=Gemiddelde lanceertijd: __1__
|
||||
fastest=Snelste lancering: __1__
|
||||
milestones=Mijlpalen:
|
||||
format=__1__: __2__
|
||||
13
old/modules/DONE/Guis/Rockets/locale/sv-SE.cfg
Normal file
13
old/modules/DONE/Guis/Rockets/locale/sv-SE.cfg
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
[ExpGamingInfo-Rockets]
|
||||
name=Raketinformation
|
||||
tooltip=Lista över detaljerna kring skickade raketer.
|
||||
none=Inga raketer har blivit skickade ännu.
|
||||
nan=Inte tillgängligt
|
||||
sent=Skickade raketer: __1__
|
||||
first=Första uppskjutningen skedde: __1__
|
||||
last=Senaste uppskjutningen tog: __1__
|
||||
time=Genomsnittlig uppskjutningstid: __1__
|
||||
fastest=Snabbaste uppskjutning: __1__
|
||||
milestones=Milstolpar:
|
||||
format=__1__: __2__
|
||||
23
old/modules/DONE/Guis/Rockets/softmod.json
Normal file
23
old/modules/DONE/Guis/Rockets/softmod.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "ExpGamingInfo.Rockets",
|
||||
"version": "4.0.0",
|
||||
"description": "Adds a rocket count gui to the game that shows milestones and average rocket time",
|
||||
"location": "FSM_ARCHIVE",
|
||||
"keywords": [
|
||||
"Gui",
|
||||
"Info",
|
||||
"ExpGaming",
|
||||
"Rockets"
|
||||
],
|
||||
"author": "<blank>",
|
||||
"contact": "<blank>",
|
||||
"license": "<blank>",
|
||||
"dependencies": {
|
||||
"ExpGamingCore.Gui": "^4.0.0",
|
||||
"FactorioStdLib.Game": "^0.8.0",
|
||||
"ExpGamingCore.Sync": "?^4.0.0",
|
||||
"ExpGamingCore.Sync^4.0.0": "?*"
|
||||
},
|
||||
"submodules": {},
|
||||
"collection": "ExpGamingInfo@4.0.0"
|
||||
}
|
||||
20
old/modules/DONE/Guis/Rockets/src/sync.lua
Normal file
20
old/modules/DONE/Guis/Rockets/src/sync.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
local Sync = require('ExpGamingCore.Sync')
|
||||
local global = global['ExpGamingInfo.Rockets']
|
||||
|
||||
Sync.add_update('rockets',function()
|
||||
local _return = {}
|
||||
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-global.first)/satellites) end
|
||||
_return.total = satellites
|
||||
_return.first = Sync.tick_format(global.first)
|
||||
_return.last = Sync.tick_format(global.last-global._last)
|
||||
_return.time = Sync.tick_format(time)
|
||||
_return.fastest = Sync.tick_format(global.fastest)
|
||||
_return.milestones = {}
|
||||
for milestone,next_time in pairs(global.milestones) do
|
||||
_return.milestones[milestone] = Sync.tick_format(next_time)
|
||||
end
|
||||
return _return
|
||||
end)
|
||||
106
old/modules/DONE/Guis/Science/control.lua
Normal file
106
old/modules/DONE/Guis/Science/control.lua
Normal file
@@ -0,0 +1,106 @@
|
||||
--- Adds a science count gui to the game that shows total made and per minute
|
||||
-- @module ExpGamingInfo.Science
|
||||
-- @author Cooldude2606
|
||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||
-- @alias ThisModule
|
||||
|
||||
-- Module Require
|
||||
local Gui = require('ExpGamingCore.Gui')
|
||||
local Game = require('FactorioStdLib.Game')
|
||||
|
||||
-- Local Variables
|
||||
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'
|
||||
}
|
||||
|
||||
-- Module Define
|
||||
local module_verbose = false
|
||||
local ThisModule = {
|
||||
on_init=function()
|
||||
if loaded_modules['ExpGamingCore.Sync^4.0.0'] then require(module_path..'/src/sync',{science_packs=science_packs}) end
|
||||
end
|
||||
}
|
||||
|
||||
-- Global Define
|
||||
local global = {
|
||||
_base={
|
||||
update=0,
|
||||
_update=0,
|
||||
made={0,0,0,0,0,0,0},
|
||||
_made={0,0,0,0,0,0,0}
|
||||
}
|
||||
}
|
||||
Global.register(global,function(tbl) global = tbl end)
|
||||
|
||||
-- Function Define
|
||||
ThisModule.Gui = Gui.left{
|
||||
name='science',
|
||||
caption='item/lab',
|
||||
tooltip={'ExpGamingInfo-Science.tooltip'},
|
||||
draw=function(self,frame)
|
||||
local player = Game.get_player(frame.player_index)
|
||||
if not global[player.force.name] then
|
||||
verbose('Added Science Global for: '..player.force.name)
|
||||
global[player.force.name] = table.deepcopy(global._base)
|
||||
end
|
||||
local force_data = global[player.force.name]
|
||||
frame.caption = {'ExpGamingInfo-Science.name'}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'ExpGamingInfo-Science.total'},
|
||||
style='caption_label'
|
||||
}
|
||||
local totals = frame.add{
|
||||
type='flow',
|
||||
direction='vertical'
|
||||
}
|
||||
frame.add{
|
||||
type='label',
|
||||
caption={'ExpGamingInfo-Science.time'},
|
||||
style='caption_label'
|
||||
}
|
||||
local times = frame.add{
|
||||
type='flow',
|
||||
direction='vertical'
|
||||
}
|
||||
if force_data.update < game.tick-100 then
|
||||
force_data._update = force_data.update
|
||||
force_data._made = table.deepcopy(force_data.made)
|
||||
for i,name in pairs(science_packs) do
|
||||
force_data.made[i] = player.force.item_production_statistics.get_input_count(name)
|
||||
end
|
||||
force_data.update = game.tick
|
||||
end
|
||||
for i,name in pairs(science_packs) do
|
||||
local made = force_data.made[i]
|
||||
if made > 0 then
|
||||
totals.add{
|
||||
type='label',
|
||||
caption={'ExpGamingInfo-Science.format',{'ExpGamingInfo-Science.'..name},made}
|
||||
}
|
||||
local _made = string.format('%.2f',(made-force_data._made[i])/((force_data.update-force_data._update)/(3600*game.speed)))
|
||||
times.add{
|
||||
type='label',
|
||||
caption={'ExpGamingInfo-Science.format',{'ExpGamingInfo-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 {'ExpGamingInfo-Science.none'} end
|
||||
end
|
||||
}
|
||||
|
||||
-- Event Define
|
||||
Event.add(defines.events.on_research_finished,function(event) Gui.left.update('science') end)
|
||||
|
||||
-- Module Return
|
||||
-- when called will toggle the gui for that player, if no player it will update the gui
|
||||
return setmetatable(ThisModule,{_call=function(self,...) self.Gui(...) end})
|
||||
14
old/modules/DONE/Guis/Science/locale/de.cfg
Normal file
14
old/modules/DONE/Guis/Science/locale/de.cfg
Normal file
@@ -0,0 +1,14 @@
|
||||
[ExpGamingInfo-Science]
|
||||
name=Wissenschaftsinfo
|
||||
tooltip=Detailliste über Wissenschaftspakete
|
||||
total=Gemachte Pakete:
|
||||
time=Pakete pro Minute:
|
||||
format=__1__: __2__
|
||||
science-pack-1=Rot
|
||||
science-pack-2=Grün
|
||||
science-pack-3=Blau
|
||||
military-science-pack=Militär
|
||||
production-science-pack=Produktion
|
||||
high-tech-science-pack=Hochtechnologie
|
||||
space-science-pack=Weltraum
|
||||
none=Es wurden noch keine Wissenschaftspakete gemacht.
|
||||
14
old/modules/DONE/Guis/Science/locale/en.cfg
Normal file
14
old/modules/DONE/Guis/Science/locale/en.cfg
Normal file
@@ -0,0 +1,14 @@
|
||||
[ExpGamingInfo-Science]
|
||||
name=Science Info
|
||||
tooltip=List of details about science packs.
|
||||
total=Packs Made:
|
||||
time=Packs Per Minute:
|
||||
format=__1__: __2__
|
||||
science-pack-1=Red
|
||||
science-pack-2=Green
|
||||
science-pack-3=Blue
|
||||
military-science-pack=Military
|
||||
production-science-pack=Production
|
||||
high-tech-science-pack=High Tech
|
||||
space-science-pack=Space
|
||||
none=No science packs have been made yet.
|
||||
14
old/modules/DONE/Guis/Science/locale/fr.cfg
Normal file
14
old/modules/DONE/Guis/Science/locale/fr.cfg
Normal file
@@ -0,0 +1,14 @@
|
||||
[ExpGamingInfo-Science]
|
||||
name=Science Info
|
||||
tooltip=List of details about science packs.
|
||||
total=Packs Made:
|
||||
time=Packs Per Minute:
|
||||
format=__1__: __2__
|
||||
science-pack-1=Red
|
||||
science-pack-2=Green
|
||||
science-pack-3=Blue
|
||||
military-science-pack=Military
|
||||
production-science-pack=Production
|
||||
high-tech-science-pack=High Tech
|
||||
space-science-pack=Space
|
||||
none=No science packs have been made yet.
|
||||
14
old/modules/DONE/Guis/Science/locale/nl.cfg
Normal file
14
old/modules/DONE/Guis/Science/locale/nl.cfg
Normal file
@@ -0,0 +1,14 @@
|
||||
[ExpGamingInfo-Science]
|
||||
name=Wetenschap info
|
||||
tooltip=Lijst met details over de wetenschaps pakketten.
|
||||
total=Pakketten gemaakt:
|
||||
time=Pakketten per minuut:
|
||||
format=__1__: __2__
|
||||
science-pack-1=Rood
|
||||
science-pack-2=Groen
|
||||
science-pack-3=Blauw
|
||||
military-science-pack=Militair
|
||||
production-science-pack=Productie
|
||||
high-tech-science-pack=High Tech
|
||||
space-science-pack=Ruimte
|
||||
none=Er zijn nog geen wetenschaps pakketten gemaakt.
|
||||
14
old/modules/DONE/Guis/Science/locale/sv-Se.cfg
Normal file
14
old/modules/DONE/Guis/Science/locale/sv-Se.cfg
Normal file
@@ -0,0 +1,14 @@
|
||||
[ExpGamingInfo-Science]
|
||||
name=Vetenskapsinformation
|
||||
tooltip=Detaljerad lista över vetenskapspaket.
|
||||
total=Paket gjorda:
|
||||
time=Paket per minut:
|
||||
format=__1__: __2__
|
||||
science-pack-1=Röda
|
||||
science-pack-2=Gröna
|
||||
science-pack-3=Blåa
|
||||
military-science-pack=Militära
|
||||
production-science-pack=Produktion
|
||||
high-tech-science-pack=Högteknologiska
|
||||
space-science-pack=Rymd
|
||||
none=Inga vetenskapspaket har blivit gjorda ännu.
|
||||
24
old/modules/DONE/Guis/Science/softmod.json
Normal file
24
old/modules/DONE/Guis/Science/softmod.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "ExpGamingInfo.Science",
|
||||
"version": "4.0.0",
|
||||
"description": "Adds a science count gui to the game that shows toatal made and per minute",
|
||||
"location": "FSM_ARCHIVE",
|
||||
"keywords": [
|
||||
"Gui",
|
||||
"Info",
|
||||
"ExpGaming",
|
||||
"Science",
|
||||
"Production"
|
||||
],
|
||||
"author": "<blank>",
|
||||
"contact": "<blank>",
|
||||
"license": "<blank>",
|
||||
"dependencies": {
|
||||
"ExpGamingCore.Gui": "^4.0.0",
|
||||
"FactorioStdLib.Game": "^0.8.0",
|
||||
"ExpGamingCore.Sync": "?^4.0.0",
|
||||
"ExpGamingCore.Sync^4.0.0": "?*"
|
||||
},
|
||||
"submodules": {},
|
||||
"collection": "ExpGamingInfo@4.0.0"
|
||||
}
|
||||
19
old/modules/DONE/Guis/Science/src/sync.lua
Normal file
19
old/modules/DONE/Guis/Science/src/sync.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
local Sync = require('ExpGamingCore.Sync')
|
||||
local data = global['ExpGamingInfo.Science']
|
||||
local science_packs = science_packs
|
||||
|
||||
Sync.add_update('science',function()
|
||||
local _return = {}
|
||||
for force_name,global in pairs(data) do
|
||||
if force_name ~= '_base' then
|
||||
_return[force_name] = {totals={},times={}}
|
||||
for i,name in pairs(science_packs) do
|
||||
local made = global.made[i]
|
||||
_return[force_name].totals[name] = made
|
||||
local _made = string.format('%.2f',(made-global._made[i])/((global.update-global._update)/(3600*game.speed)))
|
||||
_return[force_name].times[name] = _made
|
||||
end
|
||||
end
|
||||
end
|
||||
return _return
|
||||
end)
|
||||
207
old/modules/DONE/Guis/Tasklist/control.lua
Normal file
207
old/modules/DONE/Guis/Tasklist/control.lua
Normal file
@@ -0,0 +1,207 @@
|
||||
--- Adds a task list gui which acts like a bulletin board for the current tasks
|
||||
-- @module ExpGamingInfo.Tasklist
|
||||
-- @author Cooldude2606
|
||||
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
|
||||
-- @alias ThisModule
|
||||
|
||||
-- Module Require
|
||||
local Gui = require('ExpGamingCore.Gui')
|
||||
local Role = require('ExpGamingCore.Role')
|
||||
local Game = require('FactorioStdLib.Game')
|
||||
|
||||
-- Module Define
|
||||
local module_verbose = false
|
||||
local ThisModule = {}
|
||||
|
||||
-- Global Define
|
||||
local global = {
|
||||
tasks={},
|
||||
_edit={},
|
||||
_base={
|
||||
_edit=false,
|
||||
_tasks={},
|
||||
_editing={}
|
||||
}
|
||||
}
|
||||
Global.register(global,function(tbl) global = tbl end)
|
||||
|
||||
-- Function Define
|
||||
local edit = Gui.inputs{
|
||||
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(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{
|
||||
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{
|
||||
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)
|
||||
player = Game.get_player(player)
|
||||
local data = global._edit[player.index]
|
||||
if not data then return global.tasks end
|
||||
local editing = false
|
||||
for _,v in pairs(data._editing) do
|
||||
if v == true then
|
||||
editing = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if data._edit and not editing 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 editing 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 editing then return data._tasks
|
||||
else return global.tasks
|
||||
end
|
||||
end
|
||||
|
||||
ThisModule.Gui = Gui.left{
|
||||
name='tasklist',
|
||||
caption='utility/not_enough_repair_packs_icon',
|
||||
tooltip={'ExpGamingInfo-Tasklist.tooltip'},
|
||||
draw=function(self,frame)
|
||||
frame.caption = ''
|
||||
local title = frame.add{
|
||||
type='flow',
|
||||
direction='horizontal'
|
||||
}
|
||||
title.add{
|
||||
type='label',
|
||||
caption={'ExpGamingInfo-Tasklist.name'},
|
||||
style='caption_label'
|
||||
}
|
||||
local player = Game.get_player(frame.player_index)
|
||||
local allowed = Role.allowed(player,'edit-tasklist')
|
||||
if allowed then
|
||||
if not global._edit[player.index] then global._edit[player.index] = table.deepcopy(global._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 allowed then
|
||||
_edit(button_flow)
|
||||
if global._edit[player.index]._editing[i] then
|
||||
local element = remove(button_flow)
|
||||
element.style.height = 30
|
||||
element.style.width = 30
|
||||
local _element = add(button_flow)
|
||||
_element.style.height = 30
|
||||
_element.style.width = 30
|
||||
end
|
||||
end
|
||||
end
|
||||
if allowed then
|
||||
local flow = title.add{
|
||||
name=#_tasks(player),
|
||||
type='flow',
|
||||
direction='horizontal'
|
||||
}
|
||||
local button_flow = flow.add{
|
||||
type='flow',
|
||||
direction='horizontal'
|
||||
}
|
||||
local element = add(button_flow)
|
||||
element.style.height = 20
|
||||
element.style.width = 20
|
||||
end
|
||||
if #_tasks(player) == 0 and not allowed then frame.style.visible = false end
|
||||
end,
|
||||
can_open=function(player)
|
||||
if Role.allowed(player,'edit-tasklist') or #global.tasks > 0 then return true
|
||||
else return {'ExpGamingInfo-Tasklist.none'} end
|
||||
end,
|
||||
open_on_join=true
|
||||
}
|
||||
|
||||
-- Module return
|
||||
-- when called it will toggle the gui for that player, if no player then it will update the gui
|
||||
return setmetatable(ThisModule,{__call=function(self,...) self.Gui(...) end})
|
||||
4
old/modules/DONE/Guis/Tasklist/locale/de.cfg
Normal file
4
old/modules/DONE/Guis/Tasklist/locale/de.cfg
Normal file
@@ -0,0 +1,4 @@
|
||||
[ExpGamingInfo-Tasklist]
|
||||
name=Taskliste
|
||||
tooltip=Welche Aufgaben müssen rund um die Fabrik erledigt werden?
|
||||
none=Es sind aktuell keine Tasks erfasst, frage einen Member um einen hinzuzufügen.
|
||||
4
old/modules/DONE/Guis/Tasklist/locale/en.cfg
Normal file
4
old/modules/DONE/Guis/Tasklist/locale/en.cfg
Normal file
@@ -0,0 +1,4 @@
|
||||
[ExpGamingInfo-Tasklist]
|
||||
name=Task List
|
||||
tooltip=Jobs that needs to be completed all around the factory.
|
||||
none=There are currently no tasks. Ask a Member in-game or through Discord to add tasks.
|
||||
4
old/modules/DONE/Guis/Tasklist/locale/fr.cfg
Normal file
4
old/modules/DONE/Guis/Tasklist/locale/fr.cfg
Normal file
@@ -0,0 +1,4 @@
|
||||
[ExpGamingInfo-Tasklist]
|
||||
name=Task List
|
||||
tooltip=What jobs need to be done round the factory.
|
||||
none=There are no tasks to do right now, ask a member to add some.
|
||||
4
old/modules/DONE/Guis/Tasklist/locale/nl.cfg
Normal file
4
old/modules/DONE/Guis/Tasklist/locale/nl.cfg
Normal file
@@ -0,0 +1,4 @@
|
||||
[ExpGamingInfo-Tasklist]
|
||||
name=Taaklijst
|
||||
tooltip=Wat voor werk er rondom de fabriek gedaan moet worden
|
||||
none=Er zijn momenteel geen taken. Vraag een Member om taken toe te voegen.
|
||||
4
old/modules/DONE/Guis/Tasklist/locale/sv-SE.cfg
Normal file
4
old/modules/DONE/Guis/Tasklist/locale/sv-SE.cfg
Normal file
@@ -0,0 +1,4 @@
|
||||
[ExpGamingInfo-Tasklist]
|
||||
name=Uppgiftslista
|
||||
tooltip=Jobb som behövs slutföras överallt i fabriken
|
||||
none=Det finns för närvarande inga uppgifter. Fråga en medlem i spelet eller via Discord för att lägga till nya uppgifter.
|
||||
22
old/modules/DONE/Guis/Tasklist/softmod.json
Normal file
22
old/modules/DONE/Guis/Tasklist/softmod.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "ExpGamingInfo.Tasklist",
|
||||
"version": "4.0.0",
|
||||
"description": "Adds a task list gui which acts like a bulletin board for the current tasks",
|
||||
"location": "FSM_ARCHIVE",
|
||||
"keywords": [
|
||||
"Gui",
|
||||
"Info",
|
||||
"ExpGaming",
|
||||
"Tasks"
|
||||
],
|
||||
"author": "<blank>",
|
||||
"contact": "<blank>",
|
||||
"license": "<blank>",
|
||||
"dependencies": {
|
||||
"ExpGamingCore.Gui": "^4.0.0",
|
||||
"ExpGamingCore.Role": "^4.0.0",
|
||||
"FactorioStdLib.Game": "^0.8.0"
|
||||
},
|
||||
"submodules": {},
|
||||
"collection": "ExpGamingInfo@4.0.0"
|
||||
}
|
||||
Reference in New Issue
Block a user