generic furniture #137

Parent #255Owner #361Flags read, fertileSource hellcore/hellcore.db

Aliases: generic furniture

23 verbs · 64 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
rise standnone out of/from inside/from thisrxd#1372
integrated_objectsthis none thisrxd#1377
look_place_msgthis none thisrxd#1372
recline lie laynone on top of/on/onto/upon thisrxd#13711
free_seatsthis none thisrxd#1378
sitnone on top of/on/onto/upon thisrxd#1375
do_sitthis none thisrxd#13729
do_standthis none thisrxd#13713
do_reclinethis none thisrxd#13734
sittersthis none thisrxd#1373
reclinersthis none thisrxd#1373
validate_occupantsthis none thisrxd#13712
look_selfthis none thisrxd#13711
old_users_msgthis none thisrxd#13755
forbid_action_movethis none thisrxd#13727
users_msgthis none thisrxd#13769
usersthis none thisrxd#1371
tree_tagthis none thisrxd#1372
junkthis none nonerxd#1371
resetthis none thisrxd#1377
remove_userthis none thisrxd#1379
cant_takethis none thisrxd#1373
_sitthis none thisrxd#13721

Properties

PropertyDefinerFlagsOwnerValue
seats#137rc#3611
sitting#137rc#361{}
reclining#137rc#361{}
sit_msg#137rc#361"You %<sit> on %dt."
osit_msg#137rc#361"%DN %<sits> on %dt."
sit_from_reclining_msg#137rc#361"You %<sit> up on %dt."
osit_from_reclining_msg#137rc#361"%DN %<sits> up on %dt."
rise_msg#137rc#361"You %<stand> up from %dt."
orise_msg#137rc#361"%DN %<stands> up from %dt."
look_sitting_and_reclining_msg#137rc#361"%sitters %sv sitting and $recliners %rv reclining on %dt."
look_sitting_msg#137rc#361"%sitters %sv sitting on %dt."
recline_full_msg#137rc#361"There's no room to recline on %dt!"
already_sitting_msg#137rc#361"You're already sitting on %dt."
already_reclining_msg#137rc#361"You're already reclining on %dt."
recline_from_sitting_msg#137rc#361"You %<recline> on %dt."
orecline_from_sitting_msg#137rc#361"%DN %<reclines> on %dt."
recline_msg#137rc#361"You %<recline> on %dt."
orecline_msg#137rc#361"%DN %<reclines> on %dt."
look_reclining_msg#137rc#361"%recliners %rv reclining on %dt."
sitting_doing_msg#137rc#361"%DN is %<sitting> on %dt %doing."
reclining_doing_msg#137rc#361"%DN is %<reclining> on %dt %doing."
help_msg#137rc#361
list of 19{"This object can be used to create a VR element that allows players to sit down or recline. It could be used for standard furniture, like a couch or a chair, or used more generally to as the base for anything that allows someone to sit or lie on it (tables, pillows, whatever).", "Properties:", " .seats -- the number of people who can sit on this thing (reclining takes up two seats)", "Messages:", " There are a slew of them for various situations, see @messages $furniture", "Verbs:", " sit on this -- queues a sit action for player with this as the target", " recline on this -- queues a recline action for player with this as the target", " stand from this -- queues a stand action for the player with this as the target", "", "Tutorial:", "@create $furniture named \"loveseat\"", "#loveseat.seats = 2;", "@describe loveseat as \"A tattered plaid loveseat.\"", "@look_place_msg loveseat is \"You see a tattered %t here.\"", "drop loveseat", "sit on loveseat", "recline on loveseat", "stand form loveseat"}
rise_failed_msg#137rc#361"You aren't sitting or reclining on %dt."
sit_full_msg#137rc#361"%DT is too crowded for you to sit on."
is_cover#137rc#3611
break_msg#255rc#361<clear>
repair_difficulty#255rc#361<clear>
junk_on_break#255rc#361<clear>
rename_on_break#255rc#361<clear>
smashable#255rc#361<clear>
repairable#255rc#361<clear>
armor#255rc#361<clear>
held_break_msg#255rc#361<clear>
oheld_break_msg#255rc#361<clear>
handed#5rc#361<clear>
wield_msg#5rc#361<clear>
unwield_msg#5rc#361<clear>
size#5rc#361<clear>
look_place_msg#5rc#361<clear>
value#5rc#361<clear>
get_msg#5rc#361<clear>
drop_msg#5rc#361<clear>
get_fail_msg#5rc#361<clear>
junk_ok#5rc#361<clear>
floats#5rc#361<clear>
long_name_msg#5rc#361<clear>
article#5rc#361<clear>
setup_list#5rc#361<clear>
health#5rc#36150
health_max#5rc#36150
min_skill#5rc#361<clear>
skill#5rc#361<clear>
recipe_for#5rc#361<clear>
carried_msg#5rc#361<clear>
aliases#1rc#361{"generic furniture"}
description#1rc#361"Nothing special, but it looks like you could sit on it."
object_size#1r#29{20382, 1298433815}
hidden_verbs#1rc#361{"hold", "stow", "give", "@setup", "appraise", "throw", "junk"}
phelp_msg#1rc#361<clear>
weight#1rc#36110000
owner_verbs#1rc#361<clear>
plural_name#1rc#361<clear>
client_image#1rc#361<clear>
listening#1rc#361<clear>

Ancestry

Ancestors (nearest first): #255 generic smashable thing#5 generic thing#1 root

Children: none

Call graph

calls n137_2 #137:look_place_msg n137_11 #137:validate_occupants n137_2->n137_11 n1_43 #1:look_place_msg n137_2->n1_43 n137_3 #137:recline n107_43 #107:tell n137_3->n107_43 n1_31 #1:dname n137_3->n1_31 n92_2 #92:queue_action n137_3->n92_2 n137_5 #137:sit n137_5->n107_43 n137_22 #137:_sit n137_5->n137_22 n137_22->n1_31 n137_6 #137:do_sit n1_39 #1:dnamec n137_6->n1_39 n137_4 #137:free_seats n137_6->n137_4 n20_34 #20:pronoun_sub n137_6->n20_34 n137_7 #137:do_stand n137_7->n20_34 n137_8 #137:do_recline n137_8->n137_4 n137_8->n20_34 n137_12 #137:look_self n137_12->n137_11 n137_12->n107_43 n5_4 #5:description n137_12->n5_4 n137_15 #137:users_msg n137_12->n137_15 n1_11 #1:tell_lines n137_12->n1_11 n103_36 #103:damage_to_desc n137_12->n103_36 n137_15->n1_31 n137_9 #137:sitters n137_15->n137_9 n137_10 #137:recliners n137_15->n137_10 n20_9 #20:trim n137_15->n20_9 n20_15 #20:capitalize n137_15->n20_15 n20_6 #20:english_list n137_15->n20_6 n137_13 #137:old_users_msg n137_13->n20_34 n137_13->n137_9 n137_13->n137_10 n19_1 #19:intersection n137_13->n19_1 n137_13->n20_9 n137_14 #137:forbid_action_move n137_14->n137_9 n137_14->n137_10 n45_5 #45:isa n137_14->n45_5 n137_16 #137:users n137_14->n137_16 n137_17 #137:tree_tag n5_18 #5:tree_tag n137_17->n5_18 n137_18 #137:junk n137_18->n107_43 n5_9 #5:iname n137_18->n5_9 n137_19 #137:reset n137_19->n137_7

Source

rise stand

Spec none out of/from inside/from thisFlags rxdOwner #361Definer #137

Referenced by

none

Source

1target = valid(dobj) ? dobj | player;
2target:queue_action($actions.stand, {this}, 1, (verb + " ") + argstr);

integrated_objects

Spec this none thisFlags rxdOwner #361Definer #137

Referenced by

none

Source

1":integrated_objects() => { all objects this object integrates into its description when looked at }";
2"This verb returns a list of every object that this object will integrate into its own description when someone looks at it.";
3integrated = {};
4for x in ({@this.sitting, @this.reclining})
5integrated = setadd(integrated, x);
6endfor
7return setadd(integrated, this);

look_place_msg

Spec this none thisFlags rxdOwner #361Definer #137

Referenced by

none

Source

1this:validate_occupants();
2return pass(@args);

recline lie lay

Spec none on top of/on/onto/upon thisFlags rxdOwner #361Definer #137

Referenced by

none

Source

1if (this.location != player.location)
2player:tell("You need to set ", this:dname(), " down before you can lay on it.");
3return;
4endif
5for x in (setremove({@this.location:occupants($furniture), this.location}, this))
6if ((player in x.reclining) || (player in x.sitting))
7player:tell("You're already on ", x:dname(), ", you'll have to get up if you want to recline on ", this:dname(), ".");
8return;
9endif
10endfor
11player:queue_action($actions.recline, {this}, 1, (verb + " ") + argstr);

free_seats

Spec this none thisFlags rxdOwner #361Definer #137

Referenced by

Source

1":free_seats() => INT number_of_free_seats";
2"This verb returns the number of currently available seats";
3if (this.health < 1)
4return 0;
5endif
6free = this.seats - length(this.sitting);
7free = free - (2 * length(this.reclining));
8return max(0, free);

sit

Spec none on top of/on/onto/upon thisFlags rxdOwner #361Definer #137

Referenced by

none

Source

1if (player in player.location.covering)
2player:tell("You're already taking cover; stand up if you want to sit down somewhere.");
3return;
4endif
5this:_sit(player);

do_sit

Spec this none thisFlags rxdOwner #361Definer #137

Referenced by

none

Source

1":do_sit(OBJ who) => Announce messages, update internal state";
2"This verb does the state transition on the furniture and makes announcements to the who and the room about what happened.";
3who = args[1];
4if (valid(seat = who:sitting_on()) && (seat != this))
5who:tell("You're already sitting on ", seat:dname(), ".");
6return 1;
7elseif (valid(seat = who:reclining_on()) && (seat != this))
8who:tell("You're already reclining on ", seat:dname(), ".");
9return 1;
10elseif (!this.health)
11who:tell(this:dnamec(), " is smashed to pieces.  You don't feel like sitting on a pile of junk.");
12elseif (this:free_seats() < 1)
13who:tell($string_utils:pronoun_sub(this.sit_full_msg));
14return 1;
15elseif (who in this.sitting)
16who:tell($string_utils:pronoun_sub(this.already_sitting_msg));
17return 1;
18elseif (who in this.reclining)
19this.sitting = {@this.sitting, who};
20this.reclining = setremove(this.reclining, who);
21who.posture = "sitting";
22who:tell($string_utils:pronoun_sub(this.sit_from_reclining_msg));
23who.location:announce($string_utils:pronoun_sub(this.osit_from_reclining_msg));
24else
25this.sitting = {@this.sitting, who};
26who.posture = "sitting";
27who.location:announce($string_utils:pronoun_sub(this.osit_msg));
28who:tell($string_utils:pronoun_sub(this.sit_msg));
29endif

do_stand

Spec this none thisFlags rxdOwner #361Definer #137

Referenced by

Source

1":do_stand() => Announce messages and adjust internal state";
2"This verb does the real work of standing from the furniture in question.  It is a callback verb which should be called only from the processing of events which have already been placed on the event queue by the 'stand' verb.";
3who = args[1];
4if (!((who in this.sitting) || (who in this.reclining)))
5who:tell($string_utils:pronoun_sub(this.rise_failed_msg));
6else
7this.sitting = setremove(this.sitting, who);
8this.reclining = setremove(this.reclining, who);
9if (is_player(who))
10who:tell($string_utils:pronoun_sub(this.rise_msg));
11who.location:announce($string_utils:pronoun_sub(this.orise_msg));
12endif
13endif

do_recline

Spec this none thisFlags rxdOwner #361Definer #137

Referenced by

none

Source

1":do_recline(OBJ who) => Announce messages and adjust internal state";
2"This verb is the callback for recline actions that have been placed on the event queue.  It should only be called in order to complete the processing of a recline action.";
3who = args[1];
4free_seats = this:free_seats();
5if (((free_seats == 0) && (this.sitting == {who})) && (this.reclining == {}))
6free_seats = 1;
7endif
8if (valid(seat = who:reclining_on()) && (seat != this))
9seatname = is_a(seat, $room) ? "the " + seat:floor_msg() | seat:dname();
10who:tell("You're already reclining on ", seatname, ".");
11return 1;
12elseif (valid(seat = who:sitting_on()) && (seat != this))
13seatname = is_a(seat, $room) ? "the " + seat:floor_msg() | seat:dname();
14who:tell("You're already sitting on ", seatname, ".");
15return 1;
16elseif (who in this.reclining)
17"is the who already reclining?";
18who:tell($string_utils:pronoun_sub(this.already_reclining_msg));
19return 1;
20elseif (free_seats <= 0)
21who:tell($string_utils:pronoun_sub(this.recline_full_msg));
22return 1;
23elseif (who in this.sitting)
24this.sitting = setremove(this.sitting, who);
25this.reclining = {@this.reclining, who};
26who.posture = "reclining";
27who:tell($string_utils:pronoun_sub(this.recline_from_sitting_msg));
28who.location:announce($string_utils:pronoun_sub(this.orecline_from_sitting_msg));
29else
30this.reclining = {@this.reclining, who};
31who.posture = "reclining";
32who.location:announce($string_utils:pronoun_sub(this.orecline_msg));
33who:tell($string_utils:pronoun_sub(this.recline_msg));
34endif

sitters

Spec this none thisFlags rxdOwner #361Definer #137

Referenced by

Source

1":sitters() => {@this.sitting}";
2"Returns a list of everyone stiing on the furniture";
3return this.sitting;

recliners

Spec this none thisFlags rxdOwner #361Definer #137

Referenced by

Source

1":recliners() => {@this.recliners}";
2"Returns a list of people reclining on the furniture.";
3return this.reclining;

validate_occupants

Spec this none thisFlags rxdOwner #361Definer #137

Referenced by

Source

1":validate_occupants() => 0";
2"This verb makes sure that the objects listed in the sitters and reliners list are actually in the same location as the furniture itself.";
3for x in (this.sitting)
4if (x.location != this.location)
5this.sitting = setremove(this.sitting, x);
6endif
7endfor
8for x in (this.reclining)
9if (x.location != this.location)
10this.reclining = setremove(this.reclining, x);
11endif
12endfor

look_self

Spec this none thisFlags rxdOwner #361Definer #137

Referenced by

none

Source

1":look_self() => Tells the player what this furniture looks like and who is using it";
2this:validate_occupants();
3if (typeof(desc = this:description()) == LIST)
4desc = {@desc, this:users_msg()};
5else
6desc = (desc + "  ") + this:users_msg();
7endif
8player:tell_lines(desc);
9if (this.health < this.health_max)
10player:tell("It's " + $rpg:damage_to_desc(this.health, this.health_max), ".");
11endif

old_users_msg

Spec this none thisFlags rxdOwner #361Definer #137

Referenced by

none

Source

1":users_msg(LIST exclude_list, OBJ looker) => STR description of who's using this";
2{?exclude_list = {}, ?looker = player} = args;
3sitters = this:sitters();
4recliners = this:recliners();
5looker_sitting = 0;
6looker_reclining = 0;
7if (looker in sitters)
8looker_sitting = 1;
9elseif (looker in recliners)
10looker_reclining = 1;
11endif
12for x in (exclude_list)
13sitters = setremove(sitters, x);
14recliners = setremove(recliners, x);
15endfor
16not_rendered = {@sitters, @recliners};
17text = "";
18for x in (not_rendered)
19if (!(x in exclude_list))
20if (msg = x:doing_msg())
21if (x in sitters)
22msg = $string_utils:substitute(this.sitting_doing_msg, {{"%doing", msg}});
23msg = $string_utils:pronoun_sub(msg, x, this);
24else
25msg = $string_utils:substitute(this.reclining_doing_msg, {{"%doing", msg}});
26msg = $string_utils:pronoun_sub(msg, x, this);
27endif
28not_rendered = setremove(not_rendered, x);
29text = (text + "  ") + msg;
30endif
31endif
32endfor
33if (length(snr = $set_utils:intersection(sitters, not_rendered)) > 1)
34sitter_verb = "are";
35else
36sitter_verb = "is";
37endif
38if (length(rnr = $set_utils:intersection(recliners, not_rendered)) > 1)
39recliner_verb = "are";
40else
41recliner_verb = "is";
42endif
43if (snr && rnr)
44msg = $string_utils:substitute(this.look_sitting_and_reclining_msg, {{"%sitters", $string_utils:title_list(snr)}, {"%recliners", $string_utils:title_list(rnr)}, {"%sv", sitter_verb}, {"%rv", recliner_verb}});
45text = (text + "  ") + $string_utils:pronoun_sub(msg);
46elseif (snr)
47msg = $string_utils:substitute(this.look_sitting_msg, {{"%sitters", $string_utils:title_list(snr)}, {"%sv", sitter_verb}});
48text = (text + "  ") + $string_utils:pronoun_sub(msg);
49elseif (rnr)
50msg = $string_utils:substitute(this.look_reclining_msg, {{"%recliners", $string_utils:title_list(rnr)}, {"%rv", recliner_verb}});
51text = (text + "  ") + $string_utils:pronoun_sub(msg);
52endif
53text = $string_utils:trim(text);
54text = $string_utils:pronoun_sub(text);
55return text;

forbid_action_move

Spec this none thisFlags rxdOwner #361Definer #137

Referenced by

none

Source

1":forbid_action(OBJ action, OBJ source, LIST callback_args)";
2"This verb makes sure not to let anyone move if they're sitting or reclining on the furniture";
3"It also prevents you from sitting or reclining on furniture other than the furniture you're already on.";
4action = args[2];
5source = args[1];
6callbacks = args[3];
7target = args[3][1];
8if ($ou:isa(action, $actions.move) && (typeof(callbacks[1]) == OBJ))
9"check to see if the source is using this furniture";
10if ((source in this:sitters()) || (source in this:recliners()))
11source:prequeue_action($actions.move, callbacks, 1, "go " + callbacks[1].direction, 1);
12source:prequeue_action($actions.stand, {this, source}, 1, "stand", 1);
13return 1;
14endif
15elseif ($ou:isa(action, $actions.sit))
16if ((source in this:users()) && (target != this))
17source:queue_action($actions.stand, {this, source}, 1, "");
18source:queue_action($actions.sit, callbacks, 1, "");
19return 1;
20endif
21elseif ($ou:isa(action, $actions.recline))
22if ((source in this:users()) && (target != this))
23source:queue_action($actions.stand, {this, source}, 1, "");
24source:queue_action($actions.recline, callbacks, 1, "");
25return 1;
26endif
27endif

users_msg

Spec this none thisFlags rxdOwner #361Definer #137

Referenced by

Source

1":users_msg([LIST exclude_list[, OBJ looker]]) => STR text description of who is using this and what they're doing";
2{?exclude_list = {}, ?looker = player} = args;
3text = "";
4msg_db = {};
5sitters = this:sitters();
6recliners = this:recliners();
7looker_sitting = 0;
8looker_reclining = 0;
9if (looker in sitters)
10looker_sitting = 1;
11elseif (looker in recliners)
12looker_reclining = 1;
13endif
14for x in (exclude_list)
15sitters = setremove(sitters, x);
16recliners = setremove(recliners, x);
17endfor
18users = {@sitters, @recliners};
19"build a message database for what everyone is doing";
20for x in (users)
21if ((x != looker) && ((x.posture == "sitting") && looker_sitting))
22if ((doing = x:doing_msg()) == looker:doing_msg())
23msg = (((x.posture + " on ") + this:dname()) + (doing ? " " + doing | "")) + " with you";
24else
25msg = ((x.posture + " on ") + this:dname()) + (doing ? " " + doing | "");
26endif
27elseif ((x != looker) && ((x.posture == "reclining") && looker_reclining))
28if ((doing = x:doing_msg()) == looker:doing_msg())
29msg = (((x.posture + " on ") + this:dname()) + (doing ? " " + doing | "")) + " with you";
30else
31msg = ((x.posture + " on ") + this:dname()) + (doing ? " " + doing | "");
32endif
33else
34msg = ((x.posture + " on ") + this:dname()) + ((doing = x:doing_msg()) ? " " + doing | "");
35endif
36if (msg_db)
37added = 0;
38for y in [1..length(msg_db)]
39if (msg_db[y][1] == msg)
40msg_db[y][2] = setadd(msg_db[y][2], x);
41added = 1;
42break;
43endif
44endfor
45if (!added)
46msg_db = setadd(msg_db, {msg, {x}});
47endif
48else
49msg_db = {{msg, {x}}};
50endif
51endfor
52"Now print all the messages";
53for x in (msg_db)
54if ((length(x[2]) > 1) || (x[2][1] == looker))
55verbstr = " are ";
56else
57verbstr = " is ";
58endif
59names = {};
60for y in (x[2])
61if (y == looker)
62names = setadd(names, "you");
63else
64names = setadd(names, y:name());
65endif
66endfor
67text = (text + "  ") + $su:capitalize((($su:english_list(names) + verbstr) + x[1]) + ".");
68endfor
69return $su:trim(text);

users

Spec this none thisFlags rxdOwner #361Definer #137

Referenced by

Source

1return {@this.sitting, @this.reclining};

tree_tag

Spec this none thisFlags rxdOwner #361Definer #137

Referenced by

none

Source

1s = pass(@args);
2return ((((s + $ansi.cyan) + "s") + tostr(this.seats)) + " / c") + $ansi.reset;

junk

Spec this none noneFlags rxdOwner #361Definer #137

Referenced by

none

Source

1player:tell("You can't just throw away ", this:iname(), ".");

reset

Spec this none thisFlags rxdOwner #361Definer #137

Referenced by

none

Source

1users = {@this.sitting, @this.reclining};
2for who in (users)
3this:do_stand(who);
4who.posture = "standing";
5endfor
6this.sitting = {};
7this.reclining = {};

remove_user

Spec this none thisFlags rxdOwner #361Definer #137

Referenced by

none

Source

1"Ensure that something is definitely not using this furniture in any way.";
2who = args[1];
3if (who in this.sitting)
4this.sitting = setremove(this.sitting, who);
5who.posture = "standing";
6elseif (who in this.reclining)
7this.reclining = setremove(this.reclining, who);
8who.posture = "standing";
9endif

cant_take

Spec this none thisFlags rxdOwner #361Definer #137

Referenced by

none

Source

1if (this.sitting || this.reclining)
2return "someone's sitting on it";
3endif

_sit

Spec this none thisFlags rxdOwner #361Definer #137

Referenced by

Source

1{who} = args;
2if (this.location != who.location)
3who:tell("You need to set ", this:dname(), " down before you can sit on it.");
4return 0;
5endif
6if (who in this.sitting)
7who:tell("You're already sitting on it.");
8return;
9endif
10for x in (setremove({@this.location:occupants($furniture), this.location}, this))
11if ((who in x.sitting) || (who in x.reclining))
12if (x == this.location)
13name = "the " + x:floor_msg();
14else
15name = x:dname();
16endif
17who:tell("You're on ", name, ", you'll have to get up if you want to sit on ", this:dname(), ".");
18return;
19endif
20endfor
21who:queue_action($actions.sit, {this}, 1, "sit");