14 lines
454 B
Plaintext
14 lines
454 B
Plaintext
// Built-in script for the `gem` archetype (see kiln-core/src/builtin.rs).
|
|
//
|
|
// A gem is a collectible: it is solid, so walking into it fires this `bump()`
|
|
// hook. We bank the gem and `die()`, which clears the cell — so the move that
|
|
// bumped us completes and the player ends up standing where the gem was.
|
|
fn bump(me, dir, by_player) {
|
|
if by_player {
|
|
alter_gems(1);
|
|
die();
|
|
} else {
|
|
move(dir.opposite, false)
|
|
}
|
|
}
|