by_player flag on bump and delay flag on move

This commit is contained in:
2026-08-16 01:17:30 -05:00
parent 1fa47f6418
commit d9408a9012
15 changed files with 139 additions and 81 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ lantern = """
fn init(me) {
say("A warm light\\nflickers here.");
}
fn bump(me, _dir) {
fn bump(me, _dir, _by_player) {
say("The lantern\\nglows steadily.");
}
"""
+14 -8
View File
@@ -54,15 +54,17 @@ fn tick(me, dt) {
me.delay(0.5);
}
// Fires when a solid (the player, an object, or a pushed crate) presses into this
// object; dir is the direction the bump came from.
fn bump(me, dir) {
log(`mover bumped from ${dir}`);
// object; dir is the direction the bump came from, by_player whether the bumper
// was the player.
fn bump(me, dir, by_player) {
log(`mover bumped from ${dir} by player ${by_player}`);
say("Ow!");
}
"""
muffin = """
fn bump(me, _dir) {
fn bump(me, _dir, by_player) {
if !by_player { return; }
scroll([
"You find a small muffin on the ground, your favorite kind.",
"It smells of cinnamon and warm mornings.",
@@ -81,7 +83,8 @@ fn ignore() {
"""
noticeboard = """
fn bump(me, _dir) {
fn bump(me, _dir, by_player) {
if !by_player { return; }
scroll([
" TOWN NOTICE BOARD",
" ",
@@ -114,7 +117,8 @@ fn bump(me, _dir) {
"""
bookshelf = """
fn bump(me, _dir) {
fn bump(me, _dir, by_player) {
if !by_player { return; }
scroll([
" THE BOOKSHELF",
" ",
@@ -133,13 +137,15 @@ fn bump(me, _dir) {
"""
fireplace = """
fn bump(me, _dir) {
fn bump(me, _dir, by_player) {
if !by_player { return; }
say("The fire crackles warmly.\\nYou feel at ease.");
}
"""
chest = """
fn bump(me, _dir) {
fn bump(me, _dir, by_player) {
if !by_player { return; }
scroll([
" THE CHEST",
" ",