Files
kiln/kiln-core/src/scripts/key.rhai
T

26 lines
592 B
Plaintext
Raw Normal View History

2026-06-23 20:07:53 -05:00
// Built-in script for the `gem` archetype (see kiln-core/src/builtin_scripts.rs).
//
// A gem is a grabbable collectible: walking onto it (or pushing it into the
// player) fires this `grab()` hook instead of blocking. We bump the player's gem
// count and remove ourselves from the board.
2026-07-07 23:55:27 -05:00
fn grab(me) {
2026-06-23 20:07:53 -05:00
let colors = [
"red",
"orange",
"yellow",
"green",
"blue",
"cyan",
"purple",
"white"
];
for c in colors {
2026-06-28 00:12:52 -05:00
if me.has_tag(`BUILTIN_key_${c}`) {
2026-06-23 20:07:53 -05:00
set_key(c, true);
}
}
die();
}