wraitii May 25 2019, 3:11 PM
- Differential Revision
- D1828: Health.js cleanup: add tests, add an "IsInjured" function, use GetHitpoints everywhere
- rP22297: Water GLSL shader improvements around reflections and whitespace fixes.
- Build Status
Buildable 7580 Build 12356: Post-Commit Build Jenkins
All callers to IsRepairable also check for IsInjured, hence isInjured may be checked inside isRepairable
this.hitpoints <= 0 || !this.IsInjured() = this.hitpoints <= 0 || !(this.hitpoints > 0 && this.hitpoints < this.maxHitpoints) = this.hitpoints <= 0 || (this.hitpoints <= 0 || this.hitpoints >= this.maxHitpoints) = this.hitpoints <= 0 || this.hitpoints >= this.maxHitpoints
IsUnhealable -> IsHealable? (one logical operation indirection less)
IsHealable = this.hitpoints < this.maxHitpoints && this.hitpoints > 0 && this.template.Unhealable != "true"
(also ordering the conditions so that the one that is most often false comes first, for performance, though probably negligible)
This looks like it might be a positive behavior change, removing an edge case where a guarded entity that just died was ordered to be taken care of (unless that entity has stopped to exist at the point this code is processed, but usually they stick around for some short time)