1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2024-12-26 22:56:43 +02:00

Mtn: insert equipment directly at armor

This commit is contained in:
Gerkiz 2024-10-27 10:02:11 +01:00
parent c979d61711
commit a24c948ee1
2 changed files with 18 additions and 2 deletions

View File

@ -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)

View File

@ -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 })