1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-04-17 11:46:41 +02:00

port prototypes on game

This commit is contained in:
danielmartin0 2024-09-25 15:38:14 +01:00
parent 99255db065
commit f632d3136a
63 changed files with 1615 additions and 1615 deletions

View File

@ -439,7 +439,7 @@ local function on_player_joined_game()
['rock-huge'] = { 'uranium-ore' }
}
if game.item_prototypes['angels-ore1'] then
if prototypes.item['angels-ore1'] then
storage.entity_yield['tree-01'] = { 'angels-ore1', 'angels-ore2' }
storage.entity_yield['tree-02-red'] = { 'angels-ore5', 'angels-ore6' }
storage.entity_yield['tree-04'] = { 'coal' }
@ -448,7 +448,7 @@ local function on_player_joined_game()
game.map_settings.pollution.ageing = 0
end
if game.item_prototypes['thorium-ore'] then
if prototypes.item['thorium-ore'] then
storage.entity_yield['rock-big'] = { 'uranium-ore', 'thorium-ore' }
storage.entity_yield['rock-huge'] = { 'uranium-ore', 'thorium-ore' }
end

View File

@ -40,7 +40,7 @@ local function built_entity(event)
end
local function get_stack_size(name)
local proto = game.item_prototypes[name]
local proto = prototypes.item[name]
if not proto then
log('item prototype ' .. name .. ' not found')
return 1

View File

@ -1036,7 +1036,7 @@ local function on_chunk_generated(event)
end
local decorative_names = {}
for k, v in pairs(game.decorative_prototypes) do
for k, v in pairs(prototypes.decorative) do
if v.autoplace_specification then
decorative_names[#decorative_names + 1] = k
end

View File

@ -794,7 +794,7 @@ local function on_chunk_generated(event)
end
local decorative_names = {}
for k, v in pairs(game.decorative_prototypes) do
for k, v in pairs(prototypes.decorative) do
if v.autoplace_specification then
decorative_names[#decorative_names + 1] = k
end

View File

@ -158,7 +158,7 @@ function Public.loot_crate(surface, position, container_name, player_index)
local amount_multiplier = Constants.treasures[container_name].amount_multiplier
local base_amount = 16 * amount_multiplier
local difficulty_modifier = Public.get_difficulty_modifier(position)
local slots = game.entity_prototypes[container_name].get_inventory_size(defines.inventory.chest)
local slots = prototypes.entity[container_name].get_inventory_size(defines.inventory.chest)
local tech_bonus = Constants.treasures[container_name].tech_bonus
local description = Constants.treasures[container_name].description
@ -535,13 +535,13 @@ Public.mining_events = {
local tick = game.tick
local trees = {}
for k, prototype in pairs(game.entity_prototypes) do
for k, prototype in pairs(prototypes.entity) do
if prototype.type == 'tree' then
table.insert(trees, k)
end
end
table.shuffle_table(trees)
local tree = game.entity_prototypes[trees[1]].name
local tree = prototypes.entity[trees[1]].name
for c = 1, math_random(4, 96), 1 do
Esq.add_to_queue(tick + c * 5, surface, { name = tree, position = position, force = 'neutral' }, 64)

View File

@ -208,7 +208,7 @@ local function on_init()
cave_miner.buildings_raffle = {}
local types = { 'furnace', 'assembling-machine', 'reactor', 'artillery-turret', 'boiler', 'beacon', 'generator', 'storage-tank', 'roboport' }
for _, e in pairs(game.entity_prototypes) do
for _, e in pairs(prototypes.entity) do
for _, t in pairs(types) do
if e.type == t then
table.insert(cave_miner.buildings_raffle, e.name)

View File

@ -274,7 +274,7 @@ local function on_player_joined_game(event)
['rock-huge'] = { 'uranium-ore' }
}
if game.item_prototypes['angels-ore1'] then
if prototypes.item['angels-ore1'] then
storage.entity_yield['tree-01'] = { 'angels-ore1', 'angels-ore2' }
storage.entity_yield['tree-02-red'] = { 'angels-ore5', 'angels-ore6' }
storage.entity_yield['tree-04'] = { 'coal' }
@ -283,7 +283,7 @@ local function on_player_joined_game(event)
game.map_settings.pollution.ageing = 0
end
if game.item_prototypes['thorium-ore'] then
if prototypes.item['thorium-ore'] then
storage.entity_yield['rock-big'] = { 'uranium-ore', 'thorium-ore' }
storage.entity_yield['rock-huge'] = { 'uranium-ore', 'thorium-ore' }
end

View File

@ -395,7 +395,7 @@ local function on_player_joined_game(event)
['tree-05'] = { 'copper-ore', 'stone' }
}
if game.item_prototypes['angels-ore1'] then
if prototypes.item['angels-ore1'] then
storage.entity_yield['tree-01'] = { 'angels-ore1', 'angels-ore2' }
storage.entity_yield['tree-02-red'] = { 'angels-ore5', 'angels-ore6' }
storage.entity_yield['tree-04'] = { 'coal' }
@ -404,7 +404,7 @@ local function on_player_joined_game(event)
--game.map_settings.pollution.ageing = 0
end
if game.item_prototypes['thorium-ore'] then
if prototypes.item['thorium-ore'] then
storage.entity_yield['rock-big'] = { 'uranium-ore', 'thorium-ore' }
storage.entity_yield['rock-huge'] = { 'uranium-ore', 'thorium-ore' }
end

View File

@ -109,8 +109,8 @@ end
function Public.spawn_entities(surface, entities)
local objective = Chrono_table.get_table()
for _, entity in pairs(entities) do
if entity_functions[game.entity_prototypes[entity.name].type] then
entity_functions[game.entity_prototypes[entity.name].type](surface, entity)
if entity_functions[prototypes.entity[entity.name].type] then
entity_functions[prototypes.entity[entity.name].type](surface, entity)
else
if surface.can_place_entity(entity) then
local e = surface.create_entity(entity)

View File

@ -158,7 +158,7 @@ local function generate_spawn_area(this, surface)
end
local decorative_names = {}
for k, v in pairs(game.decorative_prototypes) do
for k, v in pairs(prototypes.decorative) do
if v.autoplace_specification then
decorative_names[#decorative_names + 1] = k
end

View File

@ -14,7 +14,7 @@ local random = math.random
local function on_chunk_charted(event)
local settings = DPT.get('settings')
local surface = game.get_surface(event.surface_index)
local deco = game.decorative_prototypes
local deco = prototypes.decorative
local position = event.position
if settings.chunks_charted[tostring(position.x) .. tostring(position.y)] then
return

View File

@ -132,7 +132,7 @@ local function on_chunk_generated(event)
if get_noise('oasis', entity.position, seed) <= oasis_start then
entity.destroy()
else
if game.item_prototypes[entity.name] then
if prototypes.item[entity.name] then
surface.create_entity(
{ name = entity.name, position = entity.position, amount = math_random(200, 300) + math.sqrt(entity.position.x ^ 2 + entity.position.y ^ 2) * 0.65 }
)
@ -278,7 +278,7 @@ local function deny_tile_building(surface, inventory, tiles, tile)
for _, t in pairs(tiles) do
if not save_tiles[t.old_tile.name] then
surface.set_tiles({ { name = t.old_tile.name, position = t.position } }, true)
if game.item_prototypes[tile.name] then
if prototypes.item[tile.name] then
inventory.insert({ name = tile.name, count = 1 })
else
if tile_to_item[tile.name] then

View File

@ -193,7 +193,7 @@ function Public.spawn_units(spawner)
end
function Public.get_item_tooltip(name)
return { 'expanse.stats_item_tooltip', game.item_prototypes[name].localised_name, Price_raffle.get_item_worth(name) }
return { 'expanse.stats_item_tooltip', prototypes.item[name].localised_name, Price_raffle.get_item_worth(name) }
end
function Public.invasion_numbers()

View File

@ -236,7 +236,7 @@ function Public.roll_item_stack(remaining_budget, blacklist, value_blacklist)
end
end
local stack_size = game.item_prototypes[item_name].stack_size * 32
local stack_size = prototypes.item[item_name].stack_size * 32
local item_count = 1

View File

@ -165,7 +165,7 @@ local function generate_spawn_area(surface)
end
local decorative_names = {}
for k, v in pairs(game.decorative_prototypes) do
for k, v in pairs(prototypes.decorative) do
if v.autoplace_specification then
decorative_names[#decorative_names + 1] = k
end
@ -293,7 +293,7 @@ local function enemy_territory(surface, left_top)
end
--if pos.x % 32 == 0 and pos.y % 32 == 0 then
-- local decorative_names = {}
-- for k,v in pairs(game.decorative_prototypes) do
-- for k,v in pairs(prototypes.decorative) do
-- if v.autoplace_specification then
-- decorative_names[#decorative_names+1] = k
-- end

View File

@ -1377,7 +1377,7 @@ local function on_chunk_generated(event)
end
local decorative_names = {}
for k, v in pairs(game.decorative_prototypes) do
for k, v in pairs(prototypes.decorative) do
if v.autoplace_specification then
decorative_names[#decorative_names + 1] = k
end
@ -1552,7 +1552,7 @@ local function on_chunk_generated(event)
surface.set_tiles(tiles, true)
local decorative_names = {}
for k, v in pairs(game.decorative_prototypes) do
for k, v in pairs(prototypes.decorative) do
if v.autoplace_specification then
decorative_names[#decorative_names + 1] = k
end

View File

@ -329,7 +329,7 @@ local generate_spawn_area_token =
end
local decorative_names = {}
for k, v in pairs(game.decorative_prototypes) do
for k, v in pairs(prototypes.decorative) do
if v.autoplace_specification then
decorative_names[#decorative_names + 1] = k
end

View File

@ -296,7 +296,7 @@ local function on_chunk_generated(event)
labyrinth(event)
local decorative_names = {}
for k, v in pairs(game.decorative_prototypes) do
for k, v in pairs(prototypes.decorative) do
if v.autoplace_specification then
decorative_names[#decorative_names + 1] = k
end

View File

@ -223,7 +223,7 @@ local function on_init()
surface.force_generate_chunk_requests()
--storage.tree_raffle = {}
--for _, e in pairs(game.entity_prototypes) do
--for _, e in pairs(prototypes.entity) do
-- if e.type == "tree" then
-- table.insert(storage.tree_raffle, e.name)
-- end
@ -238,7 +238,7 @@ local function on_init()
['red-desert-decal'] = true
}
storage.decorative_names = {}
for k, v in pairs(game.decorative_prototypes) do
for k, v in pairs(prototypes.decorative) do
if not blacklist[k] then
if v.autoplace_specification then
storage.decorative_names[#storage.decorative_names + 1] = k

View File

@ -695,7 +695,7 @@ function Public.draw_mothership(journey)
for k, item_name in pairs({ 'arithmetic-combinator', 'constant-combinator', 'decider-combinator', 'programmable-speaker', 'red-wire', 'green-wire', 'small-lamp', 'substation', 'pipe', 'gate', 'stone-wall', 'transport-belt' }) do
local chest = surface.create_entity({ name = 'infinity-chest', position = { -7 + k, Constants.mothership_radius - 3 }, force = 'player' })
chest.set_infinity_container_filter(1, {name = item_name, count = game.item_prototypes[item_name].stack_size})
chest.set_infinity_container_filter(1, { name = item_name, count = prototypes.item[item_name].stack_size })
protect(chest, false)
local loader = surface.create_entity({ name = 'express-loader', position = { -7 + k, Constants.mothership_radius - 4 }, force = 'player' })
protect(loader, true)
@ -1533,7 +1533,7 @@ function Public.world(journey)
local name = slot.name
local count = slot.count
local needs = (journey.mothership_cargo_space[name] or 0) - (journey.mothership_cargo[name] or 0)
if needs > 0 and count >= math.min(game.item_prototypes[name].stack_size, needs) then
if needs > 0 and count >= math.min(prototypes.item[name].stack_size, needs) then
if silo.launch_rocket() then
table.insert(journey.mothership_messages, { 'journey.message_rocket_launched', count, name, silo.position.x, silo.position.y })
end

View File

@ -332,7 +332,7 @@ Public.wasteland = {
if position then
local e = surface.create_entity({ name = name, position = position, force = 'neutral' })
if math_random(1, 4) == 1 then
local slots = game.entity_prototypes[e.name].get_inventory_size(defines.inventory.chest)
local slots = prototypes.entity[e.name].get_inventory_size(defines.inventory.chest)
local blacklist = LootRaffle.get_tech_blacklist(0.2)
local item_stacks = LootRaffle.roll(math_random(16, 64), slots, blacklist)
for _, item_stack in pairs(item_stacks) do
@ -741,7 +741,7 @@ Public.resupply_station = {
on_world_start = function (journey)
local pick = delivery_options[math.random(1, #delivery_options)]
journey.speedrun = { enabled = true, time = 0, item = pick }
journey.mothership_cargo_space[pick] = game.item_prototypes[pick].stack_size
journey.mothership_cargo_space[pick] = prototypes.item[pick].stack_size
end,
clear = function (journey)
journey.mothership_cargo_space[journey.speedrun.item] = nil

View File

@ -451,7 +451,7 @@ local function on_chunk_charted(event)
storage.chunks_charted[tostring(position.x) .. tostring(position.y)] = true
local decorative_names = {}
for k, v in pairs(game.decorative_prototypes) do
for k, v in pairs(prototypes.decorative) do
if v.autoplace_specification then
decorative_names[#decorative_names + 1] = k
end

View File

@ -337,8 +337,8 @@ local function process_mirror_surface(event)
end
for _, entity in pairs(entities) do
if entity_functions[game.entity_prototypes[entity.name].type] then
entity_functions[game.entity_prototypes[entity.name].type](surface, entity)
if entity_functions[prototypes.entity[entity.name].type] then
entity_functions[prototypes.entity[entity.name].type](surface, entity)
else
if surface.can_place_entity(entity) then
surface.create_entity(entity)

View File

@ -270,7 +270,7 @@ local function grow_cell(chunk_position, surface) -- luacheck: ignore
end
local tree_raffle = {}
for _, e in pairs(game.entity_prototypes) do
for _, e in pairs(prototypes.entity) do
if e.type == 'tree' then
table.insert(tree_raffle, e.name)
end
@ -293,7 +293,7 @@ local function grow_cell(chunk_position, surface) -- luacheck: ignore
'splitter',
'straight-rail'
}
for _, e in pairs(game.entity_prototypes) do
for _, e in pairs(prototypes.entity) do
for _, t in pairs(types) do
if e.type == t then
table.insert(allied_entity_raffle, e.name)
@ -586,7 +586,7 @@ local function grow_cell(chunk_position, surface) -- luacheck: ignore
surface.set_tiles(tiles, true)
local decorative_names = {}
for k, v in pairs(game.decorative_prototypes) do
for k, v in pairs(prototypes.decorative) do
if v.autoplace_specification then
decorative_names[#decorative_names + 1] = k
end

View File

@ -494,7 +494,7 @@ local function deny_building(event)
return
end
if not game.item_prototypes[entity.name] then
if not prototypes.item[entity.name] then
return
end
if not Functions.is_minefield_tile(entity.position, true) then

View File

@ -239,7 +239,7 @@ local function generate_north_chunk(area, surface)
end
local decorative_names = {}
for k, v in pairs(game.decorative_prototypes) do
for k, v in pairs(prototypes.decorative) do
if v.autoplace_specification then
decorative_names[#decorative_names + 1] = k
end

View File

@ -1012,8 +1012,8 @@ local function rock_chunk(surface, left_top)
end
for _, entity in pairs(entities) do
if entity_functions[game.entity_prototypes[entity.name].type] then
entity_functions[game.entity_prototypes[entity.name].type](surface, entity)
if entity_functions[prototypes.entity[entity.name].type] then
entity_functions[prototypes.entity[entity.name].type](surface, entity)
else
if surface.can_place_entity(entity) then
surface.create_entity(entity)

View File

@ -580,7 +580,7 @@ end
local function input_filtered(car_inv, chest, chest_inv, free_slots)
local request_stacks = {}
local prototypes = game.item_prototypes
local prototypes = prototypes.item
for slot_index = 1, 30, 1 do
local stack = chest.get_request_slot(slot_index)
if stack then

View File

@ -856,7 +856,7 @@ local function update_gui()
local btn
for item_name, item_count in pairs(items) do
local localized_name = game.item_prototypes[item_name].localised_name[1]
local localized_name = prototypes.item[item_name].localised_name[1]
if container.requested_item and tbl[container.requested_item] then
tbl[container.requested_item].number = item_count
else

View File

@ -67,7 +67,7 @@ local function add_random_loot_to_main_market(rarity)
return false
end
local types = game.item_prototypes
local types = prototypes.item
for k, v in pairs(main_market_items) do
if not v.static then

View File

@ -48,7 +48,7 @@ function Public.add_loot(surface, position, chest, collision)
local result = base_amount + budget + distance_mod
local c = game.entity_prototypes[chest]
local c = prototypes.entity[chest]
local slots = c.get_inventory_size(defines.inventory.chest)
local item_stacks = LootRaffle.roll(result, slots, blacklist)
@ -111,7 +111,7 @@ function Public.add_loot_rare(surface, position, chest, magic)
local result = base_amount + budget + distance_mod
local c = game.entity_prototypes[chest]
local c = prototypes.entity[chest]
local slots = c.get_inventory_size(defines.inventory.chest)
local item_stacks = LootRaffle.roll(result, slots, blacklist)

View File

@ -440,7 +440,7 @@ function Public.roll_item_stack(remaining_budget, blacklist)
end
end
local stack_size = game.item_prototypes[item_name].stack_size * 32
local stack_size = prototypes.item[item_name].stack_size * 32
local item_count = 1

View File

@ -95,7 +95,7 @@ local function ore_vein(player, entity)
local size = size_raffle[random(1, #size_raffle)]
local ore = this.raffle[random(1, #this.raffle)]
local icon
if game.entity_prototypes[ore] then
if prototypes.entity[ore] then
icon = '[img=entity/' .. ore .. ']'
else
icon = ' '

View File

@ -1350,7 +1350,7 @@ local function event_on_research_finished(event)
-- using a localised string means we have to write this out (recall that "" signals concatenation)
memory.force.print({ "", '>> ', { 'pirates.research_notification', research.localised_name } }, CoreData.colors.notify_force_light)
Server.to_discord_embed_raw({ '', '[' .. memory.name .. '] ', { 'pirates.research_notification', game.technology_prototypes[research.name].localised_name } }, true)
Server.to_discord_embed_raw({ '', '[' .. memory.name .. '] ', { 'pirates.research_notification', prototypes.technology[research.name].localised_name } }, true)
end
for _, e in ipairs(research.effects) do

View File

@ -201,7 +201,7 @@ function Public.create_cabin_surface()
filter = 'coal'
elseif splitter.type <= 6 then
priority = 'right'
filter = game.item_prototypes[CoreData.cost_items[splitter.type].name]
filter = prototypes.item[CoreData.cost_items[splitter.type].name]
elseif splitter.type == 7 then
priority = 'left'
elseif splitter.type == 8 then

View File

@ -343,7 +343,7 @@ local function on_init()
['capsule'] = true
}
for _, recipe in pairs(game.recipe_prototypes) do
for _, recipe in pairs(prototypes.recipe) do
if types_to_disable[recipe.subgroup.name] then
force.set_hand_crafting_disabled_for_recipe(recipe.name, true)
end

View File

@ -134,7 +134,7 @@ local function map_reset()
['gun'] = true,
['capsule'] = true
}
for _, recipe in pairs(game.recipe_prototypes) do
for _, recipe in pairs(prototypes.recipe) do
if types_to_disable[recipe.subgroup.name] then
force.set_hand_crafting_disabled_for_recipe(recipe.name, true)
end

View File

@ -143,7 +143,7 @@ local function on_chunk_generated(event)
end
local decorative_names = {}
for k, v in pairs(game.decorative_prototypes) do
for k, v in pairs(prototypes.decorative) do
if v.autoplace_specification then
decorative_names[#decorative_names + 1] = k
end

View File

@ -102,7 +102,7 @@ local function ore_vein(event)
local size = size_raffle[math_random(1, #size_raffle)]
local ore = this.rocks_yield_ore_veins.raffle[math_random(1, #this.rocks_yield_ore_veins.raffle)]
local icon
if game.entity_prototypes[ore] then
if prototypes.entity[ore] then
icon = '[img=entity/' .. ore .. ']'
else
icon = ' '

View File

@ -270,7 +270,7 @@ local function regenerate_decoratives_for_chunk(surface, position)
local chunk = get_chunk_position(position)
surface.destroy_decoratives({ area = { { chunk.x * 32, chunk.y * 32 }, { chunk.x * 32 + 32, chunk.y * 32 + 32 } } })
local decorative_names = {}
for k, v in pairs(game.decorative_prototypes) do
for k, v in pairs(prototypes.decorative) do
if v.autoplace_specification then
decorative_names[#decorative_names + 1] = k
end

View File

@ -187,7 +187,7 @@ local function regenerate_decoratives(surface, position)
end
surface.destroy_decoratives({ area = { { chunk.x * 32, chunk.y * 32 }, { chunk.x * 32 + 32, chunk.y * 32 + 32 } } })
local decorative_names = {}
for k, v in pairs(game.decorative_prototypes) do
for k, v in pairs(prototypes.decorative) do
if v.autoplace_specification then
decorative_names[#decorative_names + 1] = k
end

View File

@ -232,7 +232,7 @@ local function generate_north_chunk(area, surface)
end
local decorative_names = {}
for k, v in pairs(game.decorative_prototypes) do
for k, v in pairs(prototypes.decorative) do
if v.autoplace_specification then
decorative_names[#decorative_names + 1] = k
end

View File

@ -261,7 +261,7 @@ end
local function get_arena_layout_modifiers()
this.arena_layout_modifiers = {}
local proto = game.entity_prototypes
local proto = prototypes.entity
local tree_raffle = {}
for _, e in pairs(proto) do
@ -286,7 +286,7 @@ local function get_arena_layout_modifiers()
local tile_raffle = {}
for _, t in pairs(game.tile_prototypes) do
for _, t in pairs(prototypes.tile) do
if not tile_blacklist[t.name] then
insert(tile_raffle, t.name)
end

View File

@ -187,7 +187,7 @@ local function on_init()
['red-desert-decal'] = true
}
storage.decorative_names = {}
for k, v in pairs(game.decorative_prototypes) do
for k, v in pairs(prototypes.decorative) do
if not blacklist[k] then
if v.autoplace_specification then
storage.decorative_names[#storage.decorative_names + 1] = k
@ -204,7 +204,7 @@ local function on_init()
game.forces.shopping_chests.set_friend('player', true)
local tree_raffle = {}
for _, e in pairs(game.entity_prototypes) do
for _, e in pairs(prototypes.entity) do
if e.type == 'tree' then
table.insert(tree_raffle, e.name)
end
@ -213,7 +213,7 @@ local function on_init()
storage.tree_raffle = tree_raffle
local corpses_raffle = {}
for _, e in pairs(game.entity_prototypes) do
for _, e in pairs(prototypes.entity) do
if e.type == 'corpse' then
table.insert(corpses_raffle, e.name)
end

View File

@ -24,10 +24,10 @@ local function is_item_already_present_in_hotbar(player, item)
end
local function set_hotbar(player, item)
if not game.entity_prototypes[item] then
if not prototypes.entity[item] then
return
end
if not game.recipe_prototypes[item] then
if not prototypes.recipe[item] then
return
end
local slot_index = get_empty_hotbar_slot(player)

View File

@ -97,7 +97,7 @@ local function create_floaty_text(surface, position, name, count)
position.x,
position.y + this.floating_text_y_offsets[position.x .. '_' .. position.y]
},
text = { '', '-', count, ' ', game.item_prototypes[name].localised_name },
text = { '', '-', count, ' ', prototypes.item[name].localised_name },
color = { r = 255, g = 255, b = 255 }
}
)
@ -501,10 +501,10 @@ local function insert_item_into_chest(stack, chests, filtered_chests, name, floa
end
end
local item_prototypes = game.item_prototypes
local item_prototypes = prototypes.item
--Attempt to store in chests with same item subgroup.
local item_subgroup = game.item_prototypes[name].subgroup.name
local item_subgroup = prototypes.item[name].subgroup.name
if item_subgroup then
for chestnr, chest in pairs(filtered_chests.chest) do
if chest.request_slot_count and chest.request_slot_count > 0 then
@ -735,8 +735,8 @@ local function do_whitelist()
return
end
Task.delay(on_init_token, {})
local resources = game.entity_prototypes
local items = game.item_prototypes
local resources = prototypes.entity
local items = prototypes.item
this.whitelist = {}
for k, _ in pairs(resources) do
if resources[k] and resources[k].type == 'resource' and resources[k].mineable_properties then

View File

@ -29,8 +29,8 @@ local function compute_fullness(player)
local contents = inv.get_contents()
for item, count in pairs(contents) do
local stack_size = 1
if game.item_prototypes[item].stackable then
stack_size = game.item_prototypes[item].stack_size
if prototypes.item[item].stackable then
stack_size = prototypes.item[item].stack_size
end
num_stacks = num_stacks + count / stack_size

View File

@ -53,7 +53,7 @@ local function regenerate_decoratives(surface, position)
end
surface.destroy_decoratives({ area = { { chunk.x * 32, chunk.y * 32 }, { chunk.x * 32 + 32, chunk.y * 32 + 32 } } })
local decorative_names = {}
for k, v in pairs(game.decorative_prototypes) do
for k, v in pairs(prototypes.decorative) do
if v.autoplace_specification then
decorative_names[#decorative_names + 1] = k
end

View File

@ -15,7 +15,7 @@ function Public.get_crafting_machines_for_recipe(force_name, recipe)
local i = 1
for _, name in pairs(crafting_machines) do
if item_whitelist[name] or name == 'character' then
local crafting_categories = game.entity_prototypes[name].crafting_categories
local crafting_categories = prototypes.entity[name].crafting_categories
for category, _ in pairs(crafting_categories) do
if recipe_category == category then
result[i] = name
@ -32,7 +32,7 @@ local function set_crafting_machines()
storage.fjei.crafting_machines = {}
local list = storage.fjei.crafting_machines
local i = 1
for _, prototype in pairs(game.entity_prototypes) do
for _, prototype in pairs(prototypes.entity) do
if prototype.crafting_categories then
list[i] = prototype.name
i = i + 1
@ -93,7 +93,7 @@ end
local function set_item_list()
storage.fjei.item_list = {}
local item_list = storage.fjei.item_list
for recipe_name, recipe in pairs(game.recipe_prototypes) do
for recipe_name, recipe in pairs(prototypes.recipe) do
for key, product in pairs(recipe.products) do
add_item_list_product(item_list, product.name, recipe_name)
end
@ -132,8 +132,8 @@ local function set_sorted_item_list()
storage.fjei.sorted_item_list = {}
local sorted_item_list = storage.fjei.sorted_item_list
local item_list = storage.fjei.item_list
local item_prototypes = game.item_prototypes
local fluid_prototypes = game.fluid_prototypes
local item_prototypes = prototypes.item
local fluid_prototypes = prototypes.fluid
local sorted_items = {}
local i = 1
@ -186,13 +186,13 @@ local function add_recipe_to_whitelist(item_whitelist, recipe)
--Adding "place_result" in case the inventory item can turn into a differently named entity after placement on the map.
for key, product in pairs(recipe.products) do
local p = game.item_prototypes[product.name]
local p = prototypes.item[product.name]
if p and p.place_result then
item_whitelist[p.place_result.name] = true
end
end
for key, ingredient in pairs(recipe.ingredients) do
local p = game.item_prototypes[ingredient.name]
local p = prototypes.item[ingredient.name]
if p and p.place_result then
item_whitelist[p.place_result.name] = true
end
@ -207,7 +207,7 @@ function Public.add_research_to_whitelist(force, effects)
local items_have_been_added = false
for _, effect in pairs(effects) do
if effect.recipe then
add_recipe_to_whitelist(item_whitelist, game.recipe_prototypes[effect.recipe])
add_recipe_to_whitelist(item_whitelist, prototypes.recipe[effect.recipe])
items_have_been_added = true
end
end
@ -241,15 +241,15 @@ local function set_item_whitelists_for_all_forces()
end
local function get_localised_name(name)
local item = game.item_prototypes[name]
local item = prototypes.item[name]
if item then
return item.localised_name
end
local fluid = game.fluid_prototypes[name]
local fluid = prototypes.fluid[name]
if fluid then
return fluid.localised_name
end
local recipe = game.recipe_prototypes[name]
local recipe = prototypes.recipe[name]
if recipe then
return recipe.localised_name
end

View File

@ -68,15 +68,15 @@ local function get_formatted_amount(amount)
end
local function get_localised_name(name)
local item = game.item_prototypes[name]
local item = prototypes.item[name]
if item then
return item.localised_name
end
local fluid = game.fluid_prototypes[name]
local fluid = prototypes.fluid[name]
if fluid then
return fluid.localised_name
end
local recipe = game.recipe_prototypes[name]
local recipe = prototypes.recipe[name]
if recipe then
return recipe.localised_name
end
@ -84,16 +84,16 @@ local function get_localised_name(name)
end
local function get_sprite_type(name)
if game.item_prototypes[name] then
if prototypes.item[name] then
return 'item'
end
if game.fluid_prototypes[name] then
if prototypes.fluid[name] then
return 'fluid'
end
if game.entity_prototypes[name] then
if prototypes.entity[name] then
return 'entity'
end
if game.recipe_prototypes[name] then
if prototypes.recipe[name] then
return 'recipe'
end
return false
@ -321,7 +321,7 @@ local function draw_recipe_window_header(player, container, item_name, recipes,
end
local function draw_recipe(player, container, recipe_name)
local recipe = game.recipe_prototypes[recipe_name]
local recipe = prototypes.recipe[recipe_name]
local t = container.add({ type = 'table', column_count = 2 })
add_choose_elem_button(t, recipe.name, true)
@ -444,7 +444,7 @@ local function draw_recipe(player, container, recipe_name)
element.style.font = 'heading-2'
for key, machine in pairs(machines) do
local prototype = game.entity_prototypes[machine]
local prototype = prototypes.entity[machine]
if prototype then
add_choose_elem_button(t, machine)
end
@ -510,7 +510,7 @@ local function create_recipe_window(item_name, player, button, selected_recipe)
if not selected_recipe then
for key, recipe_name in pairs(recipes) do
if #Functions.get_crafting_machines_for_recipe(player.force.name, game.recipe_prototypes[recipe_name]) > 0 then
if #Functions.get_crafting_machines_for_recipe(player.force.name, prototypes.recipe[recipe_name]) > 0 then
selected_recipe = recipe_name
break
end
@ -559,7 +559,7 @@ local function create_recipe_window(item_name, player, button, selected_recipe)
end
local function add_to_history(item_name, player)
if not game.item_prototypes[item_name] and not game.fluid_prototypes[item_name] then
if not prototypes.item[item_name] and not prototypes.fluid[item_name] then
return
end

View File

@ -88,7 +88,7 @@ end
local function input_filtered(wagon_inventory, chest, chest_inventory, free_slots)
local request_stacks = {}
local prototypes = game.item_prototypes
local prototypes = prototypes.item
for slot_index = 1, 4, 1 do
local stack = chest.get_request_slot(slot_index)
if stack then

View File

@ -135,7 +135,7 @@ local function built_entity_robot(event)
end
local function item(item_name, item_count, inv, unit_number)
local item_stack = game.item_prototypes[item_name].stack_size
local item_stack = prototypes.item[item_name].stack_size
local diff = item_count - item_stack
if not this.inf_storage[unit_number] then
@ -639,7 +639,7 @@ local function gui_click(event)
end
elseif shift then
local count = storage[name]
local stack = game.item_prototypes[name].stack_size
local stack = prototypes.item[name].stack_size
if not count then
return
end

View File

@ -231,7 +231,7 @@ local function roll_item_stack(entity, wave)
end
end
local stack_size = game.item_prototypes[item_name].stack_size
local stack_size = prototypes.item[item_name].stack_size
local item_count = 1

View File

@ -98,9 +98,9 @@ local function item(item_name, item_count, player, storage)
local stack_size = this.stack_size[player.index]
local item_stack
if stack_size then
item_stack = game.item_prototypes[item_name].stack_size * stack_size
item_stack = prototypes.item[item_name].stack_size * stack_size
else
item_stack = game.item_prototypes[item_name].stack_size
item_stack = prototypes.item[item_name].stack_size
end
local diff = item_count - item_stack
@ -420,7 +420,7 @@ local function gui_click(event)
end
elseif shift then
local count = storage[name]
local stack = game.item_prototypes[name].stack_size
local stack = prototypes.item[name].stack_size
if not count then
return
end

View File

@ -27,7 +27,7 @@ local particles = {
local function get_chances()
local chances = {}
if game.entity_prototypes['angels-ore1'] then
if prototypes.entity['angels-ore1'] then
for i = 1, 6, 1 do
table.insert(chances, { 'angels-ore' .. i, 1 })
end

View File

@ -18,7 +18,7 @@ local size_raffle = {
local function get_chances()
local chances = {}
if game.entity_prototypes['angels-ore1'] then
if prototypes.entity['angels-ore1'] then
for i = 1, 6, 1 do
table.insert(chances, { 'angels-ore' .. i, 1 })
end
@ -45,7 +45,7 @@ local function set_raffle()
end
end
if game.entity_prototypes['angels-ore1'] then
if prototypes.entity['angels-ore1'] then
storage.rocks_yield_ore_veins.mixed_ores = { 'angels-ore1', 'angels-ore2', 'angels-ore3', 'angels-ore4', 'angels-ore5', 'angels-ore6', 'coal' }
return
end
@ -90,7 +90,7 @@ local function ore_vein(event)
local size = size_raffle[math_random(1, #size_raffle)]
local ore = storage.rocks_yield_ore_veins.raffle[math_random(1, #storage.rocks_yield_ore_veins.raffle)]
local icon
if game.entity_prototypes[ore] then
if prototypes.entity[ore] then
icon = '[img=entity/' .. ore .. ']'
else
icon = ' '

View File

@ -8,7 +8,7 @@ local stone_ratio = 0.25 --If math.random() is between diversity and this,
--Build a table of potential ores to pick from. Uranium is exempt from popping up randomly.
local function init()
storage.diverse_ores = {}
for k, v in pairs(game.entity_prototypes) do
for k, v in pairs(prototypes.entity) do
if v.type == 'resource' and v.resource_category == 'basic-solid' and v.mineable_properties.required_fluid == nil then
table.insert(storage.diverse_ores, v.name)
end

View File

@ -182,7 +182,7 @@ local function redraw_inventory(gui, source, target, caption, panel_type)
gui.clear()
local items_table = gui.add({ type = 'table', column_count = 11 })
local types = game.item_prototypes
local types = prototypes.item
local screen = source.gui.screen

View File

@ -53,7 +53,7 @@ local function roll_market()
local town_centers = townytable.town_centers
--Skip Towns that are too low in reserach for the current biter evolution.
local research_threshold = game.forces.enemy.evolution_factor * #game.technology_prototypes * 0.175
local research_threshold = game.forces.enemy.evolution_factor * #prototypes.technology * 0.175
for k, town_center in pairs(town_centers) do
if town_center.research_counter >= research_threshold then
@ -213,7 +213,7 @@ function Public.set_evolution()
return
end
local max_research_count = math_floor(#game.technology_prototypes * 0.30)
local max_research_count = math_floor(#prototypes.technology * 0.30)
local evo = 0
for _, town_center in pairs(townytable.town_centers) do

View File

@ -355,7 +355,7 @@ function Public.insert_all_items(player)
player.get_inventory(defines.inventory.character_armor).clear()
end
player.insert { name = 'power-armor-mk2', count = 1 }
Modifiers.update_single_modifier(player, 'character_inventory_slots_bonus', 'creative', #game.item_prototypes)
Modifiers.update_single_modifier(player, 'character_inventory_slots_bonus', 'creative', #prototypes.item)
Modifiers.update_single_modifier(player, 'character_mining_speed_modifier', 'creative', 150)
Modifiers.update_single_modifier(player, 'character_health_bonus', 'creative', 2000)
Modifiers.update_single_modifier(player, 'character_crafting_speed_modifier', 'creative', 150)
@ -382,7 +382,7 @@ function Public.insert_all_items(player)
p_armor.put({ name = 'battery-mk2-equipment' })
p_armor.put({ name = 'battery-mk2-equipment' })
end
local item = game.item_prototypes
local item = prototypes.item
local i = 0
for _k, _v in pairs(item) do
i = i + 1

View File

@ -458,7 +458,7 @@ function Public.roll_item_stack(remaining_budget, blacklist)
end
end
local stack_size = game.item_prototypes[item_name] and game.item_prototypes[item_name].stack_size and game.item_prototypes[item_name].stack_size
local stack_size = prototypes.item[item_name] and prototypes.item[item_name].stack_size and prototypes.item[item_name].stack_size
if not stack_size then stack_size = 1 end
local item_count = 1

View File

@ -70,7 +70,7 @@ end
local function on_init()
storage.watery_world_fishes = {}
for _, prototype in pairs(game.entity_prototypes) do
for _, prototype in pairs(prototypes.entity) do
if prototype.type == 'fish' then
table.insert(storage.watery_world_fishes, prototype.name)
end