26 lines
590 B
Plaintext
26 lines
590 B
Plaintext
|
|
// 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.
|
||
|
|
fn grab() {
|
||
|
|
let colors = [
|
||
|
|
"red",
|
||
|
|
"orange",
|
||
|
|
"yellow",
|
||
|
|
"green",
|
||
|
|
"blue",
|
||
|
|
"cyan",
|
||
|
|
"purple",
|
||
|
|
"white"
|
||
|
|
];
|
||
|
|
|
||
|
|
for c in colors {
|
||
|
|
if Me.has_tag(`BUILTIN_key_${c}`) {
|
||
|
|
set_key(c, true);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
die();
|
||
|
|
}
|