ReikaKalseki / Reika_FactorioMods_Issues

The issue tracker for all of my Factorio mods - EndgameCombat, NauvisDay, Geothermal, Oreverhaul, and the rest.
5 stars 1 forks source link

Error loading modded ammo crates - Endgame Combat 1.152.1 #398

Open Aerospacesmith opened 1 year ago

Aerospacesmith commented 1 year ago

Error loading with Endgame Combat 1.152.1 & modded ammo types - similar to Issue #387

Loading Error: Error while loading recipe prototype "osmium-rounds-magazine-crate" (recipe): Key "icon" not found in property tree at ROOT.recipe.osmium-rounds-magazine-crate.icons[0]

Mods affected: Clowns-Processing (1.3.16)

Relevant part of Clown's code:

osmiumbullet=table.deepcopy(data.raw.ammo["uranium-rounds-magazine"])
osmiumbullet.name="osmium-rounds-magazine"
if osmiumbullet.ammo_type.action and osmiumbullet.ammo_type.action.action_delivery then
  osmiumbullet.ammo_type.action.action_delivery.target_effects[2].damage = {amount = 20, type = "physical"}
  osmiumbullet.ammo_type.action.action_delivery.target_effects[3] = {type = "damage",damage = { amount = 6, type = "explosion"}}
else
  table.insert(osmiumbullet.ammo_type.action,{action_delivery={target_effects={{damage = {amount = 20, type = "physical"}},{type = "damage", damage = { amount = 6, type = "explosion"}}}}})
end
osmiumbullet.order = "a[basic-clips]-d[osmium-rounds-magazine]"
osmiumbullet.icon = nil
osmiumbullet.icons = {
  {icon = "__Clowns-Processing__/graphics/icons/osmium-rounds-magazine.png", icon_size = 64, icon_mipmaps = 4--[[, tint = {95,56,75}]]}
}
if not osmiumbullet.pictures then
  osmiumbullet.pictures = {layers={}}
else
    osmiumbullet.pictures.layers[1].filename = "__Clowns-Processing__/graphics/icons/osmium-rounds-magazine.png"
end
data:extend({osmiumbullet})
Aerospacesmith commented 1 year ago

An update. This appears to happen when an icon entry exists but is set to nil, and a separate icons table entry is added.

I've made it work in my game by changing Clown's code to entirely delete the icon table entry, not just set it to nil. However there should still be code here to check if icon is nil, but icons exists and has data.