add_gems -> alter_gems
This commit is contained in:
+6
-6
@@ -67,11 +67,11 @@ fn bump(me, state, id) {
|
||||
Called when the **player walks onto** this object and the object is a *grab* thing (gems, hearts —
|
||||
`solid + grab`). Unlike `bump`, the player ends up on the object's cell; the hook typically adjusts a
|
||||
player stat and removes the object. It fires followed by an immediate resolve, so any `die()` /
|
||||
`add_gems()` / `alter_health()` applies before the player's move returns.
|
||||
`alter_gems()` / `alter_health()` applies before the player's move returns.
|
||||
|
||||
```rhai
|
||||
fn grab(me, state) {
|
||||
add_gems(1);
|
||||
alter_gems(1);
|
||||
die();
|
||||
}
|
||||
```
|
||||
@@ -276,7 +276,7 @@ engine after the batch. The *subject* of a write is implicit and varies by funct
|
||||
| `send(target_id, fn_name [, arg])` | any object | 0 | Call a handler function on another object; optional string/number arg. |
|
||||
| `delay(secs)` | self | — | Insert an explicit pause; integer and float overloads. Adjacent delays merge. |
|
||||
| `now()` | self | — | Move the **most recently enqueued** action to the front of the queue. |
|
||||
| `add_gems(n)` | player | 0 | Change the player's gem count (clamped at 0). |
|
||||
| `alter_gems(n)` | player | 0 | Change the player's gem count (clamped at 0). |
|
||||
| `alter_health(dh)` | player | 0 | Change the player's health (clamped to `[0, max_health]`). |
|
||||
| `set_key(color, present)` | player | 0 | Give/take a key color (`"blue"`, `"green"`, `"cyan"`, `"red"`, `"purple"`, `"orange"`, `"yellow"`, `"white"`). Unknown name logs and is ignored. |
|
||||
| `die()` | self | 0 | Remove the calling object from the board. |
|
||||
@@ -397,11 +397,11 @@ they are shape problems.
|
||||
### Inconsistency — naming and conventions
|
||||
|
||||
- **No consistent verb convention.** Setters by name (`set_tile`, `set_tag`, `set_fg`, `set_bg`,
|
||||
`set_color`, `set_key`), delta verbs (`add_gems`, `alter_health`), and bare verbs (`move`, `die`,
|
||||
`set_color`, `set_key`), delta verbs (`alter_gems`, `alter_health`), and bare verbs (`move`, `die`,
|
||||
`teleport`, `push`, `shift`, `scroll`, `say`, `log`) all coexist. Worse, the two "change by a
|
||||
delta" operations use *different* verbs: `add_gems` vs `alter_health`.
|
||||
delta" operations use *different* verbs: `alter_gems` vs `alter_health`.
|
||||
- **The implicit subject of a write is unpredictable.** `set_tile`/`set_fg`/`say`/`die` act on
|
||||
**self**; `add_gems`/`alter_health`/`set_key` act on the **player**; `set_tag`/`send` act on an
|
||||
**self**; `alter_gems`/`alter_health`/`set_key` act on the **player**; `set_tag`/`send` act on an
|
||||
**arbitrary target**; `push`/`shift`/`teleport` act on **cells**. The `set_*` prefix in particular
|
||||
means three different subjects.
|
||||
- **Reads are methods/getters on handles, but writes are free functions.** `me.blocked(dir)` reads,
|
||||
|
||||
Reference in New Issue
Block a user