Class PlantSim
Inheritance
System.Object
PlantSim
Assembly: Eco.Simulation.dll
Syntax
public class PlantSim : Object
Constructors
PlantSim()
Declaration
Fields
PlantCellCache
Declaration
public PlantCache PlantCellCache
Field Value
Properties
All
Declaration
public IEnumerable<Plant> All { get; }
Property Value
Type |
Description |
System.Collections.Generic.IEnumerable<Plant> |
|
NumPlants
Declaration
public int NumPlants { get; }
Property Value
Type |
Description |
System.Int32 |
|
NutrientLayers
Declaration
public Dictionary<string, AccumulatingPuller> NutrientLayers { get; }
Property Value
Methods
AllFertileSpaces(WorldArea)
Declaration
public IEnumerable<Vector3i> AllFertileSpaces(WorldArea worldRange)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<Vector3i> |
|
AnyPlantsWithinRange(WrappedWorldPosition3i, Single, Predicate<Plant>)
Declaration
public bool AnyPlantsWithinRange(WrappedWorldPosition3i pos, float radius, Predicate<Plant> predicate)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Clear()
Declaration
DestroyPlant(Plant, DeathType, Boolean, Object)
Declaration
public void DestroyPlant(Plant plant, DeathType deathType, bool addToPuller = true, object killer = null)
Parameters
Type |
Name |
Description |
Plant |
plant |
|
DeathType |
deathType |
|
System.Boolean |
addToPuller |
|
System.Object |
killer |
|
EnumerableOfArea(WorldArea, PlantSpecies)
Use this as low-memory allocation option for iterating over plants in area. Internally it will use a lock and pooled list to get plants and release the pooled list in the end of iteration.
Can be used with linq methods, like Sum, but HyperLinq is prefered since it won't create allocations.
Declaration
public PlantsInAreaEnumerable EnumerableOfArea(WorldArea area, PlantSpecies species = null)
Parameters
Returns
Fertile(Vector2i)
Declaration
public bool Fertile(Vector2i pos)
Parameters
Returns
Type |
Description |
System.Boolean |
|
FertileSpaces(WorldArea, Boolean)
Declaration
public IEnumerable<Vector3i> FertileSpaces(WorldArea worldArea, bool underwater = false)
Parameters
Type |
Name |
Description |
WorldArea |
worldArea |
|
System.Boolean |
underwater |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<Vector3i> |
|
ForEachPlant(Action<Plant>)
Declaration
public void ForEachPlant(Action<Plant> action)
Parameters
Type |
Name |
Description |
System.Action<Plant> |
action |
|
GetPlant(Vector3i)
Declaration
public Plant GetPlant(Vector3i position)
Parameters
Returns
GetPlant(WorldPosition3i)
Declaration
public Plant GetPlant(WorldPosition3i position)
Parameters
Returns
GetPlant(WrappedWorldPosition3i)
Declaration
public Plant GetPlant(WrappedWorldPosition3i position)
Parameters
Returns
KillPlant(Plant, DeathType, Boolean)
Turn the plant into a gross dead version. Leave the block and the plant entry.
Declaration
public void KillPlant(Plant plant, DeathType deathType, bool addToPuller = true)
Parameters
Type |
Name |
Description |
Plant |
plant |
|
DeathType |
deathType |
|
System.Boolean |
addToPuller |
|
MarkAllDirty()
Declaration
public void MarkAllDirty()
OnPlantBlockDestroyed(Plant)
Declaration
public void OnPlantBlockDestroyed(Plant plant)
Parameters
Type |
Name |
Description |
Plant |
plant |
|
PlantsInBounds(Vector2, Vector2)
Enumerates plants in bounds specified by center point and extents.
Declaration
public PlantsInAreaEnumerable PlantsInBounds(Vector2 center, Vector2 extents)
Parameters
Returns
PlantsWithinRange(Vector2, Single, Predicate<Plant>)
Declaration
public IEnumerable<Plant> PlantsWithinRange(Vector2 pos, float radius, Predicate<Plant> predicate)
Parameters
Type |
Name |
Description |
Vector2 |
pos |
|
System.Single |
radius |
|
System.Predicate<Plant> |
predicate |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<Plant> |
|
PlantsWithinRange(Vector3, Single, Predicate<Plant>)
Declaration
public IEnumerable<Plant> PlantsWithinRange(Vector3 pos, float radius, Predicate<Plant> predicate)
Parameters
Type |
Name |
Description |
System.Numerics.Vector3 |
pos |
|
System.Single |
radius |
|
System.Predicate<Plant> |
predicate |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<Plant> |
|
SpawnPlant(PlantSpecies, WorldPosition3i, Boolean)
Declaration
public Plant SpawnPlant(PlantSpecies species, WorldPosition3i pos, bool addToPuller = true)
Parameters
Returns
Tick()
Declaration
TotalFertility(WorldArea, Boolean)
Calculates total fertility over worldArea
. Either for ground or underwater
blocks.
Declaration
public float TotalFertility(WorldArea worldArea, bool underwater)
Parameters
Type |
Name |
Description |
WorldArea |
worldArea |
|
System.Boolean |
underwater |
|
Returns
Type |
Description |
System.Single |
|
UpRootPlant(Plant)
Declaration
public void UpRootPlant(Plant plant)
Parameters
Type |
Name |
Description |
Plant |
plant |
|