Skip to main content
Verticopolis engineGitHub

GameplayEvent

Enum GameplayEvent 

Source
pub enum GameplayEvent {
    TowerFounded {
        mode: GameMode,
    },
    FacilityPlaced {
        kind: Kind,
        floor: i64,
        count: i64,
    },
    FacilityRemoved {
        kind: Kind,
        method: RemovalMethod,
    },
    PricingChanged {
        kind: Kind,
    },
    CapacityChanged {
        kind: Kind,
    },
    StarReached {
        star: i64,
    },
    FireStarted,
    FireGutted {
        rooms: i64,
    },
    BombDetonated {
        rooms: i64,
    },
    BombFound,
    EmergencyResolved {
        kind: EmergencyKind,
        decision: EmergencyDecision,
        source: EmergencySource,
    },
    MilestoneReached {
        id: &'static str,
    },
}
Expand description

One gameplay event. CATALOG_JSON holds the full meaning of each, under its name.

Variants§

§

TowerFounded

tower_founded: a new game started. A load never emits it.

Fields

§mode: GameMode

The game’s mode.

§

FacilityPlaced

facility_placed: a build was placed and charged.

Fields

§kind: Kind

The kind placed.

§floor: i64

The top floor it reaches.

§count: i64

How many of kind it placed (more than one for a floor run).

§

FacilityRemoved

facility_removed: a player sold or bulldozed a room or a shaft.

Fields

§kind: Kind

The kind removed.

§method: RemovalMethod

How it was removed.

§

PricingChanged

pricing_changed: a price moved, once per command.

Fields

§kind: Kind

The kind repriced.

§

CapacityChanged

capacity_changed: an elevator’s cars or span changed.

Fields

§kind: Kind

The shaft’s kind.

§

StarReached

star_reached: the rating rose to star (6 is TOWER), one event per star gained.

Fields

§star: i64

The new rating.

§

FireStarted

fire_started: a room caught fire. A fire spreading is the same fire.

§

FireGutted

fire_gutted: a fire burned rooms down to empty shells.

Fields

§rooms: i64

How many rooms, at least 1.

§

BombDetonated

bomb_detonated: a bomb went off before Security found it.

Fields

§rooms: i64

How many rooms the blast destroyed.

§

BombFound

bomb_found: Security found the bomb in time.

§

EmergencyResolved

emergency_resolved: an offer was answered.

Fields

§kind: EmergencyKind

Which offer.

§decision: EmergencyDecision

What took effect.

§source: EmergencySource

Who answered.

§

MilestoneReached

milestone_reached: the tower reached a milestone. A load never emits it.

Fields

§id: &'static str

The milestone’s id, stable across versions.

Implementations§

Source§

impl GameplayEvent

Source

pub fn name(&self) -> &'static str

The event’s name in the catalog, such as facility_placed.

Source

pub fn payload(&self) -> Value

The event’s payload fields as a JSON object.

Source

pub fn to_json(&self) -> Value

The event as { "name": ..., "payload": {...} }, the shape CATALOG_JSON describes.

Trait Implementations§

Source§

impl Clone for GameplayEvent

Source§

fn clone(&self) -> GameplayEvent

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GameplayEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for GameplayEvent

Source§

fn eq(&self, other: &GameplayEvent) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for GameplayEvent

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.