mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-30 20:41:41 +09:00
Add joinable legacy code
This commit is contained in:
@@ -96,9 +96,12 @@ end
|
||||
-- @tparam string item_name the name of the item that you want the data about
|
||||
-- @treturn table contains total made, used and net
|
||||
function Production.get_production_total(force, item_name)
|
||||
local stats = force.item_production_statistics
|
||||
local made = stats.get_input_count(item_name) or 0
|
||||
local used = stats.get_output_count(item_name) or 0
|
||||
local made, used = 0, 0
|
||||
for _, surface in pairs(game.surfaces) do
|
||||
local stats = force.get_item_production_statistics(surface)
|
||||
made = made + stats.get_input_count(item_name)
|
||||
used = used + stats.get_output_count(item_name)
|
||||
end
|
||||
|
||||
return {
|
||||
made=made,
|
||||
@@ -114,9 +117,12 @@ end
|
||||
-- @tparam defines.flow_precision_index precision the precision that you want the data given to
|
||||
-- @treturn table contains made, used and net
|
||||
function Production.get_production(force, item_name, precision)
|
||||
local stats = force.item_production_statistics.get_flow_count
|
||||
local made = stats{name=item_name, input=true, precision_index=precision} or 0
|
||||
local used = stats{name=item_name, input=false, precision_index=precision} or 0
|
||||
local made, used = 0, 0
|
||||
for _, surface in pairs(game.surfaces) do
|
||||
local stats = force.get_item_production_statistics(surface).get_flow_count
|
||||
made = made + stats{name=item_name, category="input", precision_index=precision}
|
||||
used = used + stats{name=item_name, category="output", precision_index=precision}
|
||||
end
|
||||
|
||||
return {
|
||||
made=made,
|
||||
|
||||
Reference in New Issue
Block a user