Skip to content

Commit

Permalink
Mtn: insert equipment directly at armor
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerkiz committed Oct 27, 2024
1 parent c979d61 commit a24c948
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 17 additions & 1 deletion maps/mountain_fortress_v3/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1973,8 +1973,24 @@ function Public.equip_players(starting_items, recreate)
Modifiers.update_player_modifiers(player)
if not recreate then
starting_items = starting_items or this.starting_items
if this.starting_items['modular-armor'] then
player.insert({ name = 'modular-armor', count = 1 })
end

for item, item_data in pairs(this.starting_items) do
player.insert({ name = item, count = item_data.count })
if item ~= 'modular-armor' then
local equip = prototypes.equipment[item]
if equip then
local p_armor = player.get_inventory(defines.inventory.character_armor)
if p_armor and p_armor.valid and p_armor[1] and p_armor[1].grid then
for _ = 1, item_data.count do
p_armor[1].grid.put({ name = item })
end
end
else
player.insert({ name = item, count = item_data.count })
end
end
end
end
Public.show_all_gui(player)
Expand Down
2 changes: 1 addition & 1 deletion utils/commands/misc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ function Public.insert_all_items(player)

this.players[player.index] = true

local p_armor = player.get_inventory(5)[1].grid
local p_armor = player.get_inventory(defines.inventory.character_armor)[1].grid
if p_armor and p_armor.valid then
p_armor.put({ name = 'fission-reactor-equipment', quality = quality })
p_armor.put({ name = 'fission-reactor-equipment', quality = quality })
Expand Down

0 comments on commit a24c948

Please sign in to comment.