Table of Contents

Class AIShelterSettings

Namespace
FishMMO.Server.Implementation.World.SceneServer.AI
Assembly
FishMMO.Server.dll

Whether, and in what, an archetype's NPCs go and stand out of the weather.

[Serializable]
public class AIShelterSettings
Inheritance
AIShelterSettings
Inherited Members

Remarks

Off by default, deliberately (Q15). Every existing archetype in the project gets this struct at its defaults, and at its defaults it does nothing at all. Weather arrives across a whole region at once, so a default of "on" would have every NPC on the continent abandon its post the first time a front came through — patrols leaving their routes, merchants leaving their stalls, and quest targets nowhere to be found. Sheltering is something an archetype opts into because it makes sense for that creature.

It reads the same weather the player's exposure does. A WeatherReading taken at the NPC's own position, so an NPC already under a canopy has nothing to walk away from and an NPC in the open does — from the same numbers that are soaking the player standing next to it.

Fields

CheckInterval

[Tooltip("Seconds between asking the question. Weather moves slowly; this need not be quick.")]
[Min(0.5)]
public float CheckInterval

Field Value

float

Enabled

[Tooltip("Whether this archetype's NPCs go and stand out of the weather at all. Off by default: weather covers whole regions, and every NPC in one leaving its post at once is rarely what anybody wanted.")]
public bool Enabled

Field Value

bool

MinimumExposure

[Tooltip("How exposed the NPC has to be before it bothers. At 0.5 an NPC already half under cover stays where it is.")]
[Range(0, 1)]
public float MinimumExposure

Field Value

float

MinimumSeverity

[Tooltip("How hard it has to be coming down. 0 means any trace of the chosen kinds counts.")]
[Range(0, 1)]
public float MinimumSeverity

Field Value

float

MinimumShelterStrength

[Tooltip("How well a volume has to shelter before it counts as shelter. A thin canopy is not a roof.")]
[Range(0, 1)]
public float MinimumShelterStrength

Field Value

float

SearchRadius

[Tooltip("How far from home the NPC will go looking for cover.")]
[Min(1)]
public float SearchRadius

Field Value

float

ShelterFrom

[Tooltip("The kinds of weather worth walking away from.")]
public WeatherKindMask ShelterFrom

Field Value

WeatherKindMask

ShelterState

[Tooltip("The state entered to walk to cover. Without one the NPC has no way to get there and the whole setting stays inert.")]
public SeekShelterState ShelterState

Field Value

SeekShelterState

Methods

SeverityOf(in WeatherReading)

How hard the chosen kinds are coming down here, 0..1: the worst of them.

public float SeverityOf(in WeatherReading weather)

Parameters

weather WeatherReading

Returns

float

WantsShelter(in WeatherReading)

Whether an NPC standing in this weather should be looking for cover.

public bool WantsShelter(in WeatherReading weather)

Parameters

weather WeatherReading

Returns

bool

Remarks

Pure, and the reason it is: sheltering has to be decided the same way whether it is asked on a tick, in a test, or by a tool showing a designer what an archetype will do — and every input is in the sample.

Severity is read from the kinds actually chosen, not from one fixed channel. An archetype that shelters from lightning and nothing else must not be driven out by heavy rain it does not care about, and would be if this measured precipitation regardless.

WouldStay(in WeatherReading)

Whether an NPC that is already sheltering should stay put.

public bool WouldStay(in WeatherReading weather)

Parameters

weather WeatherReading

Returns

bool

Remarks

A lower bar than WantsShelter(in WeatherReading) on purpose. With one threshold, weather hovering on it would send an NPC out of the doorway and back in again for as long as it held there — the same flicker the exposure states use two thresholds to avoid, except this one is a creature visibly pacing in and out of a barn.