Water Purifier Mod not preventing damage from murky water, have to unequip/re-equip

f8isrippin

Refugee
Version
2.0
Platform
Windows
Every time I load up my game, I take damage from murky water but do not get sick. If I unequip the mod and re-equip the mod, or unequip and re-equip my helmet, it will start working normally again. It will then work for the rest of the session. If I leave and re-enter, the issue will still be present.
 
Reproduction Steps
Load into game where I have a water purifier mod equipped into my helmet. Drink murky water from a natural source, murky water bottle, or bucket-placed water node, which causes damage. Unequip the helmet or the mod and re-equip it. Drink the same water source, no damage is taken. Leave game and re-enter. Drink murky water source, which causes damage.
Link to Logs
https://pastebin.com/7z0G7h1H
Link to Screenshot/Video
https://youtu.be/q5cuA-VyX_4
I have this issue as well. I play with friends, and all friends have the same issue. We leave the water purifier on each of our helmets (sometimes 6 of us in session at once).
If we drink from a pond we take damage. Its like the water purifier doesnt exist.
Simply take the hat off even if keeping it in your hand, then drop it straight back on again and it will work for the rest of the session provided you dont log off and back on again at any point.
 
This bug is not only about Water Purifier.
It affects anything relying on buffs applied at onSelfEquipStart on dedicated server.
For example Nerd Outfit without intellect mastery 3.
For example Impact Bracing.
For example Nerd Boots, Rogue Boots, Miner Boots, Raider Boots
Probably Bandolier, a bit tricky to check though.

The relevant buff simply vanishes on relog, which can be tested by changing hidden="true" to hidden="false"

The whole idea with binary buff/nobuff is flawed.
For example if I switch Nerd Outfit Q4 to Nerd Outfit Q5, is onSelfEquipStart of Q5 called before onSelfEquipStop of Q4? If so the buff will be silently overwritten first and deleted later and the thing will stop working without intellect mastery 3.
But some other item might want exactly that order - onSelfEquipStart of the new one before onSelfEquipStop of the old one.
 
Last edited:
Investigated the issue under the debugger.

My guess is this:

The client on spawning does EntityBuffs.AddBuff in Equipment.Apply.
After that, in EntityAlive.switchModelView it reequips stuff, calling EntityBuffs.RemoveBuff, then EntityBuffs.AddBuff again.
EntityBuffs.RemoveBuff does not pass _instigatorId to server, so the server sends the event back, and the buff gets removed.
But EntityBuffs.AddBuff does pass _instigatorId to server, and server uses it to not send it back, so the buff does not get readded.
The passing back happens in NetPackageAddRemoveBuff.ProcessPackage.
 
Last edited:
Back
Top