2026-08-11 23:22:16 -05:00
|
|
|
// Built-in script for the `gem` archetype (see kiln-core/src/builtin.rs).
|
2026-06-21 18:27:45 -05:00
|
|
|
//
|
2026-08-11 23:22:16 -05:00
|
|
|
// 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.
|
2026-08-16 01:17:30 -05:00
|
|
|
fn bump(me, dir, by_player) {
|
|
|
|
|
if by_player {
|
|
|
|
|
alter_gems(1);
|
|
|
|
|
die();
|
|
|
|
|
} else {
|
|
|
|
|
move(dir.opposite, false)
|
|
|
|
|
}
|
2026-06-21 18:27:45 -05:00
|
|
|
}
|