mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-31 04:51:40 +09:00
Fixed a few bugs in science info
This commit is contained in:
@@ -20,7 +20,7 @@ local science_packs = {
|
|||||||
|
|
||||||
local function _global(reset)
|
local function _global(reset)
|
||||||
global.addons = not reset and global.addons or {}
|
global.addons = not reset and global.addons or {}
|
||||||
global.addons.science = not reset and global.addons.science or {update=0,_update,made={0,0,0,0,0,0,0},_made={0,0,0,0,0,0,0}}
|
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
|
return global.addons.science
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -31,6 +31,10 @@ Gui.left.add{
|
|||||||
draw=function(frame)
|
draw=function(frame)
|
||||||
local data = _global()
|
local data = _global()
|
||||||
local player = Game.get_player(frame.player_index)
|
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.caption = {'science.name'}
|
||||||
frame.add{
|
frame.add{
|
||||||
type='label',
|
type='label',
|
||||||
@@ -44,15 +48,15 @@ Gui.left.add{
|
|||||||
frame.add{
|
frame.add{
|
||||||
type='label',
|
type='label',
|
||||||
caption={'science.time'},
|
caption={'science.time'},
|
||||||
style='caption_lable'
|
style='caption_label'
|
||||||
}
|
}
|
||||||
local times = frame.add{
|
local times = frame.add{
|
||||||
type='flow',
|
type='flow',
|
||||||
direction='vertical'
|
direction='vertical'
|
||||||
}
|
}
|
||||||
if data.update < game.time-100 then
|
if data.update < game.tick-100 then
|
||||||
data._update = data.update
|
data._update = data.update
|
||||||
data._made = data.made
|
data._made = table.deepcopy(data.made)
|
||||||
for i,name in pairs(science_packs) do
|
for i,name in pairs(science_packs) do
|
||||||
data.made[i] = player.force.item_production_statistics.get_input_count(name)
|
data.made[i] = player.force.item_production_statistics.get_input_count(name)
|
||||||
end
|
end
|
||||||
@@ -72,7 +76,11 @@ Gui.left.add{
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
Event.register(defines.events.on_research_finished, function(event) Gui.left.update('science') end)
|
Event.register(defines.events.on_research_finished,function(event) Gui.left.update('science') end)
|
||||||
@@ -42,17 +42,20 @@ local ranks = Ranking._ranks(true)
|
|||||||
groups['Root']:edit('allow',false,{
|
groups['Root']:edit('allow',false,{
|
||||||
['player-list']=true,
|
['player-list']=true,
|
||||||
['readme']=true,
|
['readme']=true,
|
||||||
['rockets']=true
|
['rockets']=true,
|
||||||
|
['science']=true
|
||||||
})
|
})
|
||||||
groups['Admin']:edit('allow',false,{
|
groups['Admin']:edit('allow',false,{
|
||||||
['player-list']=true,
|
['player-list']=true,
|
||||||
['readme']=true,
|
['readme']=true,
|
||||||
['rockets']=true
|
['rockets']=true,
|
||||||
|
['science']=true
|
||||||
})
|
})
|
||||||
groups['User']:edit('allow',false,{
|
groups['User']:edit('allow',false,{
|
||||||
['player-list']=true,
|
['player-list']=true,
|
||||||
['readme']=true,
|
['readme']=true,
|
||||||
['rockets']=true
|
['rockets']=true,
|
||||||
|
['science']=true
|
||||||
})
|
})
|
||||||
groups['Jail']:edit('allow',false,{
|
groups['Jail']:edit('allow',false,{
|
||||||
|
|
||||||
|
|||||||
@@ -11,3 +11,4 @@ military-science-pack=Military
|
|||||||
production-science-pack=Production
|
production-science-pack=Production
|
||||||
high-tech-science-pack=High Tech
|
high-tech-science-pack=High Tech
|
||||||
space-science-pack=Space
|
space-science-pack=Space
|
||||||
|
none=No science packs have been made yet.
|
||||||
Reference in New Issue
Block a user