Class SimWorld

Namespace
SurvivorsMaker.Simulation
Assembly
SurvivorsMaker.Simulation.dll

All state of one running wave. Systems read and write it; presentation only reads it. Lists keep a stable order: new items are appended, removal keeps the order of the rest.

public sealed class SimWorld
Inheritance
SimWorld
Inherited Members

Constructors

SimWorld()

public SimWorld()

Fields

ActualMovingTicks

public int ActualMovingTicks

Field Value

int

ActualStationaryTicks

public int ActualStationaryTicks

Field Value

int

Arena

public ArenaRect Arena

Field Value

ArenaRect

ArenaDef

The arena definition, for CommonGroups.

public ArenaDef ArenaDef

Field Value

ArenaDef

BehaviourSpawns

Spawns asked for by enemy attacks this tick; admitted after all enemies acted.

public readonly List<SpawnRequest> BehaviourSpawns

Field Value

List<SpawnRequest>

Combat

Hit/damage rules shared by systems. Set by the tick loop at start.

public ICombat Combat

Field Value

ICombat

CombatWallet

public StatWallet CombatWallet

Field Value

StatWallet

DeathSpawns

Spawns asked for by deaths this tick; admitted after dead enemies are removed.

public readonly List<SpawnRequest> DeathSpawns

Field Value

List<SpawnRequest>

Difficulty

public int Difficulty

Field Value

int

Enemies

public readonly List<Enemy> Enemies

Field Value

List<Enemy>

EnemyProjectiles

public readonly List<Projectile> EnemyProjectiles

Field Value

List<Projectile>

Events

Events of the current tick only; cleared at the start of each tick.

public readonly List<SimEvent> Events

Field Value

List<SimEvent>

FriendlyProjectiles

public readonly List<Projectile> FriendlyProjectiles

Field Value

List<Projectile>

HasExtendedTriggers

public bool HasExtendedTriggers

Field Value

bool

HitHealCooldownTicks

public int HitHealCooldownTicks

Field Value

int

HitSource

The weapon definition behind the HitEnemy(SimWorld, Enemy, int, bool, int, Vec2, float) call in progress, or null. Set by the weapon system around each hit, so wrappers (e.g. balance meters) can attribute damage.

public WeaponDef HitSource

Field Value

WeaponDef

HordesFired

Horde events of the wave that already fired (indexes into Wave.Hordes).

public readonly List<int> HordesFired

Field Value

List<int>

MinimumGrowthExperience

public float MinimumGrowthExperience

Field Value

float

MovingTicks

public int MovingTicks

Field Value

int

OwnedEntityCounts

public readonly Dictionary<string, int> OwnedEntityCounts

Field Value

Dictionary<string, int>

PickupRules

Replace through WaveSimulation's pickup-rules constructor overload.

public PickupRules PickupRules

Field Value

PickupRules

Pickups

public readonly List<Pickup> Pickups

Field Value

List<Pickup>

Player

The first (and today the only) player. Same object as Players[0].

public readonly PlayerState Player

Field Value

PlayerState

Players

Every player in the wave, Player first. Single-player games have one entry; systems that operate on additional players iterate this list instead of using Player.

public readonly List<PlayerState> Players

Field Value

List<PlayerState>

PlaytestInvulnerable

Development-only damage bypass; false keeps the ordinary combat path.

public bool PlaytestInvulnerable

Field Value

bool

Pools

Object reuse for projectiles, enemies and statuses. Set by the tick loop from Pools.

public ISimPools Pools

Field Value

ISimPools

Progress

public readonly WaveProgress Progress

Field Value

WaveProgress

Random

public SimRandom Random

Field Value

SimRandom

Schedule

Active spawn groups, filled by Begin(SimWorld) in authoring order.

public readonly List<ScheduledGroup> Schedule

Field Value

List<ScheduledGroup>

Settings

public SimSettings Settings

Field Value

SimSettings

Spatial

Enemy lookups by area. Set by the tick loop from Spatial; rebuilt after enemies move and spawns are admitted.

public ISpatialIndex Spatial

Field Value

ISpatialIndex

StationaryTicks

public int StationaryTicks

Field Value

int

Stats

public StatBuild Stats

Field Value

StatBuild

Systems

The systems running this world, so one system can call another (e.g. spawning → InitEnemy).

public SimSystems Systems

Field Value

SimSystems

Telegraphs

public readonly List<Telegraph> Telegraphs

Field Value

List<Telegraph>

TempBuffs

public readonly List<TempBuff> TempBuffs

Field Value

List<TempBuff>

TriggerHandlers

Handlers for TriggerAction.Custom, from WaveRequest.TriggerHandlers (set at wave start).

public IReadOnlyDictionary<string, ITriggerHandler> TriggerHandlers

Field Value

IReadOnlyDictionary<string, ITriggerHandler>

Triggers

Triggers of this wave in WaveRequest order (filled by the trigger system's Begin).

public readonly List<TriggerState> Triggers

Field Value

List<TriggerState>

Wave

public WaveDef Wave

Field Value

WaveDef

WaveNumber

public int WaveNumber

Field Value

int

WavesSinceFirst

public int WavesSinceFirst

Field Value

int

Weapons

public readonly List<WeaponState> Weapons

Field Value

List<WeaponState>

Properties

Behaviours

Behaviour registries, from Behaviours.

public SimBehaviours Behaviours { get; }

Property Value

SimBehaviours

CurrencyIncome

public long CurrencyIncome { get; }

Property Value

long

Occupancy

Enemies + telegraphs, the count limited by MaxAlive.

public int Occupancy { get; }

Property Value

int

Tick

public int Tick { get; }

Property Value

int

Methods

CanSpawnForPlaytest(EnemyDef)

Validates the registered spawn behaviours before a playtest command mutates the world.

public bool CanSpawnForPlaytest(EnemyDef definition)

Parameters

definition EnemyDef

Returns

bool

Emit(SimEventKind, Vec2, int, int, float, int, bool)

public void Emit(SimEventKind kind, Vec2 position, int sourceId = 0, int targetId = 0, float amount = 0, int slot = -1, bool crit = false)

Parameters

kind SimEventKind
position Vec2
sourceId int
targetId int
amount float
slot int
crit bool

EmitCustom(string, Vec2, float, int, int, int)

Emits a Custom event that views, sounds and modules can react to.

public void EmitCustom(string id, Vec2 position, float amount = 0, int sourceId = 0, int targetId = 0, int slot = -1)

Parameters

id string
position Vec2
amount float
sourceId int
targetId int
slot int

GrantLevelsForPlaytest(int)

Applies level health growth and emits the same LevelUp events, without advancing combat time.

public bool GrantLevelsForPlaytest(int levels)

Parameters

levels int

Returns

bool

NewId()

One id sequence for enemies, telegraphs, projectiles and pickups.

public int NewId()

Returns

int

NewSpawnOrder()

public int NewSpawnOrder()

Returns

int

SetOwnedEntityCount(string, int)

Updates one named owned-entity source count and signals source invalidation.

public void SetOwnedEntityCount(string kind, int count)

Parameters

kind string
count int

SignalStatSourcesChanged()

Invalidates cached external stat-source evaluation after gameplay source state changes.

public void SignalStatSourcesChanged()

SpawnForPlaytest(EnemyDef, int)

Spawns an evenly spaced ring at the configured safe distance, bypassing capacity/telegraphs.

public bool SpawnForPlaytest(EnemyDef definition, int count)

Parameters

definition EnemyDef
count int

Returns

bool

SpawnPickup(string, Vec2, int)

Appends a registered pickup with a fresh world id. Invalid ids throw before mutation.

public Pickup SpawnPickup(string behaviourId, Vec2 position, int value = 0)

Parameters

behaviourId string
position Vec2
value int

Returns

Pickup

Stat(string)

public int Stat(string id)

Parameters

id string

Returns

int

TryCreditCurrency(int)

Credits the world currency wallet atomically; failure leaves wallet state unchanged.

public bool TryCreditCurrency(int amount)

Parameters

amount int

Returns

bool

TryDebitCurrency(int)

Debits the world currency wallet atomically; failure leaves wallet state unchanged.

public bool TryDebitCurrency(int amount)

Parameters

amount int

Returns

bool