Class EntityBehaviorHealth
- Namespace
- Vintagestory.GameContent
- Assembly
- VSEssentials.dll
Adds health calculations to entity so that it can receive damage, die, get revived and get healed.
Uses the "health" code Open in GitHub
[DocumentAsJson]
[AddDocumentationProperty("minGenerationToAllowHealing", "If this is an animal, specifies the minimum generation required to be healed by player. Ignored if -1", "System.Int32", "Optional", "-1", true)]
public class EntityBehaviorHealth : EntityBehavior
- Inheritance
-
EntityBehaviorHealth
Examples
"behaviors": [
{
"code": "health",
"currenthealth": 15.0,
"maxhealth": 15.0
},
],
...
"attributes": {
"minGenerationToAllowHealing": 1
}
Fields
MaxHealth (Recommended) (Default: 20)
Max possible health points the entity can have. Can be affected by "maxhealthExtraPoints" character's trait
[DocumentAsJson("Recommended", "20", false)]
public float MaxHealth { get; set; }
Field Value
AutoRegenSaturationThreshold (Optional) (Default: 0.75)
Health regeneration speed will be slowed down when saturation is below this fraction of total saturation.
[DocumentAsJson("Optional", "0.75", false)]
protected virtual float AutoRegenSaturationThreshold { get; set; }
Field Value
CurrentHealth (Optional) (Default: MaxHealth)
The entity will have this much health points upon spawn if this is set in JSON. Otherwise, these are the health points of the entity
[DocumentAsJson("Optional", "MaxHealth", false)]
public float Health { get; set; }
Field Value
HurtAnimationCode (Optional) (Default: hurt)
This animation will be played if entity received more than 1hp damage. If set to 'null', animation wont be played.
[DocumentAsJson("Optional", "hurt", false)]
protected string? HurtAnimationCode
Field Value
ReceiveHailDamage (Optional) (Default: false)
Should entity receive hail damage. By default only players receive hail damage.
[DocumentAsJson("Optional", "false", false)]
protected virtual bool ReceiveHailDamage { get; set; }
Field Value
SaturationPerHealthPoint (Optional) (Default: 150)
How many saturation points will be consumed per health point restored.
[DocumentAsJson("Optional", "150", false)]
protected virtual float SaturationPerHealthPoint { get; set; }
Field Value
timeBetweenDoTTicksSec (Optional) (Default: 0.5)
The amount of time between each damage-over-time tick.
[DocumentAsJson("Optional", "0.5", false)]
protected float timeBetweenDoTTicksSec
Field Value
Properties
minGenerationToAllowHealing (Optional) (Default: -1)
If this is an animal, specifies the minimum generation required to be healed by player. Ignored if -1