Cold Biters


Adds a nest of Cold Aliens and Worms! These aliens will cause cold damage, and may launch a cold cloud over your factory. Defeated aliens will drop artifacts that can be further processed into weapons and armors. With Alien-biomes, nests will only spawn in cold areas.

5 months ago
0.17 - 1.1
46361

b Loot Table Code

1 year, 11 months ago
(updated 1 year, 11 months ago)

Hi, I am the author of Schall Alien Loot. I tried to add compatible to your mod, so your new aliens will also give loots,
I find a problem in your code, that will gives wrong results though.
In cold_weapons.lua lines 705-713, you have used:

local Medium_Loot = {{ item = "cb_alien_cold_gland", probability = MEDIUM_LOOT_PROBABILITY, count_min = 1, count_max = 5 }}
data.raw["unit-spawner"]["cb-cold-spawner"].loot = Medium_Loot

The property loot is table though. Assignments like the above will only set the POINTER to it, not the VALUE. Therefore, you will set "cb-cold-spawner", "behemoth-cold-worm-turret", "leviathan-cold-worm-turret" to have pointed to "share" exactly the same TABLE. E.g., by adding a coal to "cb-cold-spawner" loot table, the "behemoth-cold-worm-turret" will be affected too.

The correct way should be using `table.insert' instead of direct assignment. So lines 705-713 should be something like below:

local Medium_Loot = { item = "cb_alien_cold_gland", probability = MEDIUM_LOOT_PROBABILITY, count_min = 1, count_max = 5 }
table.insert(data.raw["unit-spawner"]["cb-cold-spawner"].loot, Medium_Loot)

Other lines should be adjusted similarly.

Such a change would be compatible to not only my mod, but also any mods dealing with loot tables as well.

1 year, 11 months ago

Wow! Thanks! I Will change that

New response