-
Notifications
You must be signed in to change notification settings - Fork 0
HazardInfo
This is the data container which contains the information for a singular hazard. KAI NPCs can store any arbitrary number of these when given to them. This data does nothing on its' own, it's up to the NPCs themselves to decide what to do with this information, like if they should run away from the biggest threat on the list.
The Vector3 position that is the origin of the hazard. If this is meant to be empty, don't forget to pass its' value as (Double.NaN, Double.NaN, Double.NaN).
The actor that is the origin of the hazard, if any. Like in the case of direct actor hazards (Necessary) or attack hazards (Where origin is the will-be attacker).
The range of the hazard. By default, NPCs will remove the entry from their Hazards array if the Origin or Position are further than this distance.
What type of hazard is this ?
The hazard has no type in particular, for non-specific hazards I suggest instead using the below type.
This is a miscellaneous hazard, AKA it doesn't fall under any of the predefined types.
This is an environmental hazard, useful to discern if the hazard in question is say, a crushing polyobject that's closing in, a crushing floor, etc. For these hazard types you should use the Position vector to specify their origin.
An actor is a hazard itself, e.g a boss that emits a hazard of this type when activating a harmful defensive forcefield. For this type you can just use the Origin pointer, and have it point to the source of the hazard of course, and just use that as the source of the danger.
The hazard is not exactly an actor itself, but rather an attack originating from an actor, like a Cyberdemon that is about to, or is currently firing, in which case, the hazard zone would warp to wherever he is aiming. For this type, you should use the Origin pointer as the source of the hazard (The attacker), while the Position vector is where the attack will actually go (And where the NPC should stay away from if you want them to run).
How big of a threat is this hazard ? This is similar to the threat levels.
- HAZARD_HARMLESS: The hazard is harmless.
- HAZARD_VERYLOW: The hazard isn't super dangerous (e.g a very weak damaging floor ?).
- HAZARD_LOW: The hazard is weak (e.g a trap that only does 4-6 damage per hit)
- HAZARD_MEDIUM: This is an average hazard (e.g a sector doing ~10 damage to monsters, a relatively weak crusher, etc)
- HAZARD_LARGE: This is a major hazard (e.g a very damaging crusher, a large pit with fall damage enabled, very harmfull floors (20+ damage), etc)
- HAZARD_HUGE: This is a huge hazard.
- HAZARD_APOLLYON: This hazard should be avoided at all costs.
Attributes that inform how the hazard is supposed to work, these generally have to be obeyed by the NPC itself that has a reference to the HazardInfo.
- HAZ_NOSIGHT: This hazard should be avoided even if it's out of sight. Meaning that when NPCs are checking if they should avoid it, they can skip any potential sight checks.
In addition to the actual hazard data, HazardInfo includes a few static functions that can be called from anywhere.
- Source: The actor that is the origin of the hazard zone.
- Range: The range of the hazard zone (Both the range in which the HazardInfo is given to eligible actor, and the value of its' Range variable.)
- Type: The type of the hazard.
- HazLevel: How big the danger is.
- Flags: The hazards' attributes.
Creates a HazardInfo with the specified parameters. And emits it to every KAI NPC around Source using a blockmap iterator.
- Haz1, Haz2: The 2 HazardInfo classes to compare.
Checks if Haz1 and Haz2 have the exact same data. Incredibly useful and practically necessary for when passing hazards to NPCs (Especially if doing so constantly), so that the emitter will not keep giving NPCs duplicate HazardInfo entries.
Returns true if both HazardInfo entries have the same data.
- Home
- Features
- Classes
- Functions
- Guides