keys 1
This commit is contained in:
@@ -79,6 +79,12 @@ pub(crate) enum Action {
|
||||
/// Add `n` to the player's gem count (negative subtracts; the count is
|
||||
/// clamped at 0). Zero time cost. Applied to `GameState::player_gems`.
|
||||
AddGems(i64),
|
||||
/// Give (`true`) or take (`false`) the named key color from the player.
|
||||
///
|
||||
/// Color must be one of `"blue"`, `"green"`, `"cyan"`, `"red"`, `"purple"`,
|
||||
/// `"orange"`, `"yellow"`, `"white"`. An unrecognized name is logged and
|
||||
/// ignored. Zero time cost. Applied to `GameState::player_keys`.
|
||||
SetKey(String, bool),
|
||||
/// Remove the source object from the board. Zero time cost. Used by grab
|
||||
/// things (e.g. gems) to despawn themselves from their `grab()` hook.
|
||||
Die,
|
||||
@@ -191,6 +197,11 @@ pub(crate) fn action_to_map(action: &Action) -> rhai::Map {
|
||||
m.insert("type".into(), ds("AddGems"));
|
||||
m.insert("n".into(), Dynamic::from(*n));
|
||||
}
|
||||
Action::SetKey(color, present) => {
|
||||
m.insert("type".into(), ds("SetKey"));
|
||||
m.insert("color".into(), Dynamic::from(color.clone()));
|
||||
m.insert("present".into(), Dynamic::from(*present));
|
||||
}
|
||||
Action::Die => {
|
||||
m.insert("type".into(), ds("Die"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user