mirror of
https://github.com/Xevion/project-cybersyn.git
synced 2025-12-06 03:16:05 -06:00
migrate game.item_prototypes for 2.0
This commit is contained in:
@@ -14,7 +14,7 @@ local DEFINES_LOW_POWER = defines.entity_status.low_power
|
|||||||
---@param map_data MapData
|
---@param map_data MapData
|
||||||
---@param item_name string
|
---@param item_name string
|
||||||
function get_stack_size(map_data, item_name)
|
function get_stack_size(map_data, item_name)
|
||||||
return game.item_prototypes[item_name].stack_size
|
return prototypes.item[item_name].stack_size
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param item_order table<string, int>
|
---@param item_order table<string, int>
|
||||||
@@ -756,7 +756,7 @@ function set_comb2(map_data, station)
|
|||||||
local signals = {}
|
local signals = {}
|
||||||
for item_name, count in pairs(deliveries) do
|
for item_name, count in pairs(deliveries) do
|
||||||
local i = #signals + 1
|
local i = #signals + 1
|
||||||
local is_fluid = game.item_prototypes[item_name] == nil--NOTE: this is expensive
|
local is_fluid = prototypes.item[item_name] == nil--NOTE: this is expensive
|
||||||
signals[i] = {index = i, signal = {type = is_fluid and "fluid" or "item", name = item_name}, count = sign*count}
|
signals[i] = {index = i, signal = {type = is_fluid and "fluid" or "item", name = item_name}, count = sign*count}
|
||||||
end
|
end
|
||||||
set_combinator_output(map_data, station.entity_comb2, signals)
|
set_combinator_output(map_data, station.entity_comb2, signals)
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ local function init_items(manager)
|
|||||||
manager.item_order = item_order
|
manager.item_order = item_order
|
||||||
local i = 1
|
local i = 1
|
||||||
|
|
||||||
for _, protos in pairs{game.item_prototypes, game.fluid_prototypes} do
|
for _, protos in pairs{prototypes.item, game.fluid_prototypes} do
|
||||||
--- @type (LuaItemPrototype|LuaFluidPrototype)[]
|
--- @type (LuaItemPrototype|LuaFluidPrototype)[]
|
||||||
local all_items = {}
|
local all_items = {}
|
||||||
for _, proto in pairs(protos) do
|
for _, proto in pairs(protos) do
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ function set_refueler_combs(map_data, refueler, train)
|
|||||||
else
|
else
|
||||||
name = a.name
|
name = a.name
|
||||||
end
|
end
|
||||||
if game.item_prototypes[name] then
|
if prototypes.item[name] then
|
||||||
wagon_signals[1] = {index = 1, signal = {type = "item", name = a.name}, count = 1}
|
wagon_signals[1] = {index = 1, signal = {type = "item", name = a.name}, count = 1}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user