Class WildlifePlanner
- Namespace
- FishMMO.Server.Implementation.World.SceneServer.Spawner
- Assembly
- FishMMO.Server.dll
Plans a world scene's wildlife spawners when it is cut: big overlapping areas over the open country, each with the species its biomes support, plus a group at each den point of interest and some cave mouths. The cut writes the plan into the scene as ObjectSpawners (WildlifeSpawnerCut), which the spawn-table bake carries to the server like any other. At spawn time the runtime keeps each species on its own ground and its herd together (SpawnerRuntime).
public static class WildlifePlanner
- Inheritance
-
WildlifePlanner
- Inherited Members
Remarks
Never in a settlement (by habitat or by a settlement point of interest), at sea, or inside a keep-out.
Methods
InsideKeepOut(IReadOnlyList<Vector3>, Vector3)
True when point is inside any of the circles (x, radius, z) on the ground plane.
public static bool InsideKeepOut(IReadOnlyList<Vector3> circles, Vector3 point)
Parameters
circlesIReadOnlyList<Vector3>pointVector3
Returns
KeepOutsFor(IReadOnlyList<Vector3>, Vector3, Vector3)
The settlement circles (x, radius, z) that reach into a box centred on center.
public static List<Vector3> KeepOutsFor(IReadOnlyList<Vector3> circles, Vector3 center, Vector3 size)
Parameters
circlesIReadOnlyList<Vector3>centerVector3sizeVector3
Returns
- List<Vector3>
Lives(WildlifeTemplate, BiomeHabitat)
Whether a species lives on ground of habitat: one of its habitats, and never a settlement or the sea.
public static bool Lives(WildlifeTemplate t, BiomeHabitat habitat)
Parameters
tWildlifeTemplatehabitatBiomeHabitat
Returns
PackSettings(bool)
A wildlife spawner's pack: on, so a herd flees together and a pack hunts together.
public static NPCPackSettings PackSettings(bool hunts)
Parameters
huntsbool
Returns
Plan(string, Rect, GroundSampler, IReadOnlyList<PointOfInterestRecord>, Func<float, float, bool>, IReadOnlyList<SceneCaveLifeSpot>, IReadOnlyList<Species>, WildlifeCatalogue)
The plan for one scene: big overlapping areas over the open country, each holding the species whose ground covers enough of it (weighted by how much, and by their density), then small single-species areas at dens and cave mouths. Dens come first so the cap never starves them. Pure and deterministic (seeded by the scene's name), so it is tested on its own; the cut writes it into the scene as ObjectSpawners.
public static List<WildlifeArea> Plan(string sceneName, Rect area, WildlifePlanner.GroundSampler ground, IReadOnlyList<PointOfInterestRecord> pois, Func<float, float, bool> keptOut, IReadOnlyList<SceneCaveLifeSpot> caves, IReadOnlyList<WildlifePlanner.Species> species, WildlifeCatalogue limits)
Parameters
sceneNamestringareaRectgroundWildlifePlanner.GroundSamplerpoisIReadOnlyList<PointOfInterestRecord>keptOutFunc<float, float, bool>cavesIReadOnlyList<SceneCaveLifeSpot>speciesIReadOnlyList<WildlifePlanner.Species>limitsWildlifeCatalogue
Returns
Spawnables(WildlifeArea)
The spawner's entries for an area: one per species, its chance the species' weight.
public static List<SpawnableSettings> Spawnables(WildlifeArea area)
Parameters
areaWildlifeArea
Returns
StableHash(string)
FNV-1a of the scene name: the same placement every load, on every machine.
public static int StableHash(string text)
Parameters
textstring
Returns
Suitable(WildlifeTemplate, float, float, GroundSampler, Func<float, float, bool>, List<Vector3>, out float)
Whether a point is ground the species lives on, away from towns, the sea and keep-outs.
public static bool Suitable(WildlifeTemplate t, float x, float z, WildlifePlanner.GroundSampler ground, Func<float, float, bool> keptOut, List<Vector3> settlements, out float altitude)
Parameters
tWildlifeTemplatexfloatzfloatgroundWildlifePlanner.GroundSamplerkeptOutFunc<float, float, bool>settlementsList<Vector3>altitudefloat
Returns
ToDefinition(WildlifeArea)
Turns an area into a spawner definition (the baked shape the runtime reads): its species as weighted entries, a pack per species (the runtime keys wildlife packs by species), respawn times from each species.
public static SpawnerDefinition ToDefinition(WildlifeArea area)
Parameters
areaWildlifeArea