bug with reflection fixed (#19127)

* bug with reflection fixed

* check for pockets added
This commit is contained in:
kalane15
2023-08-15 08:07:54 +03:00
committed by GitHub
parent cabc834e84
commit 68f312834a

View File

@@ -174,8 +174,10 @@ public abstract class SharedReflectSystem : EntitySystem
if (!TryComp(args.Equipee, out ReflectComponent? reflection))
return;
reflection.Enabled = true;
if (args.Slot == "pocket1" || args.Slot == "pocket2")
return;
reflection.Enabled = comp.Enabled;
// reflection probability should be: (1 - old probability) * newly-equipped item probability + old probability
// example: if entity has .25 reflection and newly-equipped item has .7, entity should have (1 - .25) * .7 + .25 = .775
reflection.ReflectProb += (1 - reflection.ReflectProb) * comp.ReflectProb;