Table of Contents

Class QueueUnitMovementCommand

Namespace
StarterKit.Commands
Assembly
StarterKit.dll

StarterKit command: Queue unit movement along a path. Uses time-based EU4-style movement (units take X days per province). For multiplayer sync - all clients queue the same movement orders. Note: Uses BaseCommand instead of SimpleCommand for custom List serialization.

[Command("queue_movement", Description = "Queue unit movement along a path", Examples = new string[] { "queue_movement 1 5,6,7,10" })]
public class QueueUnitMovementCommand : BaseCommand, ICommand
Inheritance
object
QueueUnitMovementCommand
Implements
Inherited Members

Properties

CountryId

Country that owns the unit (for validation).

public ushort CountryId { get; set; }

Property Value

ushort

MovementDays

Days to move between each province (unit speed).

public int MovementDays { get; set; }

Property Value

int

Path

Full path including start province and all waypoints. Index 0 = current province, Index 1 = first destination, etc.

public List<ushort> Path { get; set; }

Property Value

List<ushort>

UnitId

public ushort UnitId { get; set; }

Property Value

ushort

Methods

Deserialize(BinaryReader)

Deserialize command data from binary reader Used for save/load and command replay Must reconstruct identical command state

public override void Deserialize(BinaryReader reader)

Parameters

reader BinaryReader

Binary reader to deserialize from

Execute(GameState)

Execute the command and modify game state Should emit appropriate events for other systems to react Must be deterministic for multiplayer compatibility

public override void Execute(GameState gameState)

Parameters

gameState GameState

Game state to modify

Serialize(BinaryWriter)

Serialize command data to binary writer Used for save/load and command logging Must be deterministic - same command = same bytes

public override void Serialize(BinaryWriter writer)

Parameters

writer BinaryWriter

Binary writer to serialize to

Undo(GameState)

Undo the command - restore previous state Required for replay systems and error recovery

public override void Undo(GameState gameState)

Parameters

gameState GameState

Game state to restore

Validate(GameState)

Validate that this command can be executed in the current game state. Should be fast and have no side effects.

public override bool Validate(GameState gameState)

Parameters

gameState GameState

Current game state for validation

Returns

bool

True if command can be executed