13 IEntity owner = editableEntity.GetOwner();
18 if (!characterDamageManager)
21 if (characterDamageManager.GetState() ==
EDamageState.DESTROYED)
24 HitZone bloodHitzone = characterDamageManager.GetBloodHitZone();
29 float bloodLevelLoseDeath = bloodHitzone.GetDamageStateThreshold(
ECharacterBloodState.DESTROYED);
30 float bloodLevelContiousness = bloodHitzone.GetDamageStateThreshold(
ECharacterBloodState.UNCONSCIOUS);
31 float bloodLevel = Math.InverseLerp(bloodLevelLoseDeath, 1, bloodHitzone.GetHealthScaled());
34 bloodLevel = Math.Clamp(bloodLevel, 0, 1);
37 return SCR_BaseEditorAttributeVar.CreateVector(Vector(Math.Round(bloodLevel * 100), bloodLevelContiousness, characterDamageManager.GetPermitUnconsciousness()));
39 override void WriteVariable(Managed item,
SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager,
int playerID)
45 IEntity owner = editableEntity.GetOwner();
50 if (!characterDamageManager)
53 if (characterDamageManager.GetState() ==
EDamageState.DESTROYED)
56 HitZone bloodHitzone = characterDamageManager.GetBloodHitZone();
60 if (!characterDamageManager.IsDamageHandlingEnabled())
64 float bloodLevelLoseDeath = bloodHitzone.GetDamageStateThreshold(
ECharacterBloodState.DESTROYED);
65 float bloodLevel = Math.Lerp(bloodLevelLoseDeath, 1, var.GetFloat() * 0.01);
66 bloodLevel = Math.Clamp(bloodLevel, 0, 1);
67 bloodHitzone.SetHealthScaled(bloodLevel);