Daveyx0 / PrimitiveMobs

34 stars 13 forks source link

[Bug] Weird damage-detection/item-drop code for Filch Lizards leads to infinite item dupe #307

Open SandwichHorror opened 3 years ago

SandwichHorror commented 3 years ago

This is not necessarily a gamebreaking bug, because it is due to a relatively obscure mod interaction that can be disabled, but it is a bizarre interaction nonetheless. When using the mod Rebirth of the Mobs, I decided to make filch lizards immune to cactus damage. They are, after all, desert creatures.

However, it seems that when the filch lizard brushed against a cactus, it still dropped the item even though it did not take any damage, and its health did not decrease.

If the filch lizard brushes against a cactus, detects """"damage"""", drops its item, and then picks it back up, there is a brief window of time where the item it picks up will be instantly dropped and duplicated. If this happens enough times in a row, it is possible for the Filch lizard to "generate" hundreds or thousands of the original item.

It's possible this issue could be with something on ROTM's end, but another solution could be revisiting the code that makes the Filch lizard drop its items, and maybe only allow it to drop its item if it actually suffers damage, or only if its health decreases (versus just experiencing a damageSource, even if that source event is cancelled).

SandwichHorror commented 3 years ago

2020-09-06_01 21 41