Moved more stuff to done

This commit is contained in:
Cooldude2606
2019-05-29 22:19:35 +01:00
parent 98f6266ad1
commit 53f9c51c0e
23 changed files with 0 additions and 0 deletions

View 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})

View 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.

View 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.

View 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.

View 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.

View 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.

View 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"
}

View 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)