Indestructible Biter Nests & Worms


Biter Nests and Worms have OVER 9000!!! Health, and cannot be damaged or destroyed. (note: works for all 8 damage types present in vanilla (physical, impact, fire, acid, poison, explosion, laser, electric). Mods which add additional damage types are not covered yet

Tweaks
9 months ago
1.1
43
Combat Enemies

g doesntwork.txt

9 months ago

If you want to add resistances against all damage types, try this:

local invincible = {}
for damage_type in pairs(data.raw["damage-type"]) do
  -- invincible[#invincible] = {type = damage_type, percent = 100}
  invincible[#invincible + 1] = {type = damage_type, percent = 100}
end

invincible[#invincible] = x will assign x to the last element of invincible. As the table is never extended, the last element is always the same and would take on the values of each of the damage types (when the loop is finished, invincible will only have the value of the last element). Assigning values to #invincible + 1, on the other hand, will extend the table by one element before assigning a value to the last element.

9 months ago
(updated 9 months ago)
local invincible = {}
for damage_type in pairs(data.raw["damage-type"]) do
   table.insert(invincible, {type = damage_type, percent = 100})
end

This should do the trick.

New response