pub enum CommandPayload {
Move {
entity_id: u64,
target_coord: Coord,
},
Spawn {
coord: Coord,
field_values: Vec<(FieldId, f32)>,
},
Despawn {
entity_id: u64,
},
SetField {
coord: Coord,
field_id: FieldId,
value: f32,
},
Custom {
type_id: u32,
data: Vec<u8>,
},
SetParameter {
key: ParameterKey,
value: f64,
},
SetParameterBatch {
params: Vec<(ParameterKey, f64)>,
},
}Expand description
All command payloads.
WorldEvent variants affect per-cell state; GlobalParameter variants
affect simulation-wide scalar parameters.
§Examples
use murk_core::{CommandPayload, FieldId, ParameterKey};
// Set a single field value at a coordinate.
let coord: murk_core::Coord = vec![3i32, 7].into();
let payload = CommandPayload::SetField {
coord,
field_id: FieldId(0),
value: 42.0,
};
// Batch-set multiple global parameters atomically.
let batch = CommandPayload::SetParameterBatch {
params: vec![(ParameterKey(0), 1.0), (ParameterKey(1), 0.5)],
};
assert!(matches!(payload, CommandPayload::SetField { .. }));
assert!(matches!(batch, CommandPayload::SetParameterBatch { .. }));Variants§
Move
Move an entity to a target coordinate.
Rejected if entity_id is unknown or target_coord is out of bounds.
Spawn
Spawn a new entity at a coordinate with initial field values.
Fields
Despawn
Remove an entity. Associated field values are cleared at the next tick.
SetField
Set a single field value at a coordinate. Primarily for Sparse fields.
Fields
Custom
Extension point for domain-specific commands.
SetParameter
Set a single global parameter. Takes effect at the next tick boundary.
SetParameterBatch
Batch-set multiple parameters atomically.
Fields
§
params: Vec<(ParameterKey, f64)>The parameters to set.
Trait Implementations§
Source§impl Clone for CommandPayload
impl Clone for CommandPayload
Source§fn clone(&self) -> CommandPayload
fn clone(&self) -> CommandPayload
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CommandPayload
impl Debug for CommandPayload
Source§impl PartialEq for CommandPayload
impl PartialEq for CommandPayload
impl StructuralPartialEq for CommandPayload
Auto Trait Implementations§
impl Freeze for CommandPayload
impl RefUnwindSafe for CommandPayload
impl Send for CommandPayload
impl Sync for CommandPayload
impl Unpin for CommandPayload
impl UnwindSafe for CommandPayload
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more