generic furniture #137
Aliases: generic furniture
23 verbs · 64 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
rise stand | none out of/from inside/from this | rxd | #137 | 2 |
integrated_objects | this none this | rxd | #137 | 7 |
look_place_msg | this none this | rxd | #137 | 2 |
recline lie lay | none on top of/on/onto/upon this | rxd | #137 | 11 |
free_seats | this none this | rxd | #137 | 8 |
sit | none on top of/on/onto/upon this | rxd | #137 | 5 |
do_sit | this none this | rxd | #137 | 29 |
do_stand | this none this | rxd | #137 | 13 |
do_recline | this none this | rxd | #137 | 34 |
sitters | this none this | rxd | #137 | 3 |
recliners | this none this | rxd | #137 | 3 |
validate_occupants | this none this | rxd | #137 | 12 |
look_self | this none this | rxd | #137 | 11 |
old_users_msg | this none this | rxd | #137 | 55 |
forbid_action_move | this none this | rxd | #137 | 27 |
users_msg | this none this | rxd | #137 | 69 |
users | this none this | rxd | #137 | 1 |
tree_tag | this none this | rxd | #137 | 2 |
junk | this none none | rxd | #137 | 1 |
reset | this none this | rxd | #137 | 7 |
remove_user | this none this | rxd | #137 | 9 |
cant_take | this none this | rxd | #137 | 3 |
_sit | this none this | rxd | #137 | 21 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
seats | #137 | rc | #361 | 1 |
sitting | #137 | rc | #361 | {} |
reclining | #137 | rc | #361 | {} |
sit_msg | #137 | rc | #361 | "You %<sit> on %dt." |
osit_msg | #137 | rc | #361 | "%DN %<sits> on %dt." |
sit_from_reclining_msg | #137 | rc | #361 | "You %<sit> up on %dt." |
osit_from_reclining_msg | #137 | rc | #361 | "%DN %<sits> up on %dt." |
rise_msg | #137 | rc | #361 | "You %<stand> up from %dt." |
orise_msg | #137 | rc | #361 | "%DN %<stands> up from %dt." |
look_sitting_and_reclining_msg | #137 | rc | #361 | "%sitters %sv sitting and $recliners %rv reclining on %dt." |
look_sitting_msg | #137 | rc | #361 | "%sitters %sv sitting on %dt." |
recline_full_msg | #137 | rc | #361 | "There's no room to recline on %dt!" |
already_sitting_msg | #137 | rc | #361 | "You're already sitting on %dt." |
already_reclining_msg | #137 | rc | #361 | "You're already reclining on %dt." |
recline_from_sitting_msg | #137 | rc | #361 | "You %<recline> on %dt." |
orecline_from_sitting_msg | #137 | rc | #361 | "%DN %<reclines> on %dt." |
recline_msg | #137 | rc | #361 | "You %<recline> on %dt." |
orecline_msg | #137 | rc | #361 | "%DN %<reclines> on %dt." |
look_reclining_msg | #137 | rc | #361 | "%recliners %rv reclining on %dt." |
sitting_doing_msg | #137 | rc | #361 | "%DN is %<sitting> on %dt %doing." |
reclining_doing_msg | #137 | rc | #361 | "%DN is %<reclining> on %dt %doing." |
help_msg | #137 | rc | #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 | #137 | rc | #361 | "You aren't sitting or reclining on %dt." |
sit_full_msg | #137 | rc | #361 | "%DT is too crowded for you to sit on." |
is_cover | #137 | rc | #361 | 1 |
break_msg | #255 | rc | #361 | <clear> |
repair_difficulty | #255 | rc | #361 | <clear> |
junk_on_break | #255 | rc | #361 | <clear> |
rename_on_break | #255 | rc | #361 | <clear> |
smashable | #255 | rc | #361 | <clear> |
repairable | #255 | rc | #361 | <clear> |
armor | #255 | rc | #361 | <clear> |
held_break_msg | #255 | rc | #361 | <clear> |
oheld_break_msg | #255 | rc | #361 | <clear> |
handed | #5 | rc | #361 | <clear> |
wield_msg | #5 | rc | #361 | <clear> |
unwield_msg | #5 | rc | #361 | <clear> |
size | #5 | rc | #361 | <clear> |
look_place_msg | #5 | rc | #361 | <clear> |
value | #5 | rc | #361 | <clear> |
get_msg | #5 | rc | #361 | <clear> |
drop_msg | #5 | rc | #361 | <clear> |
get_fail_msg | #5 | rc | #361 | <clear> |
junk_ok | #5 | rc | #361 | <clear> |
floats | #5 | rc | #361 | <clear> |
long_name_msg | #5 | rc | #361 | <clear> |
article | #5 | rc | #361 | <clear> |
setup_list | #5 | rc | #361 | <clear> |
health | #5 | rc | #361 | 50 |
health_max | #5 | rc | #361 | 50 |
min_skill | #5 | rc | #361 | <clear> |
skill | #5 | rc | #361 | <clear> |
recipe_for | #5 | rc | #361 | <clear> |
carried_msg | #5 | rc | #361 | <clear> |
aliases | #1 | rc | #361 | {"generic furniture"} |
description | #1 | rc | #361 | "Nothing special, but it looks like you could sit on it." |
object_size | #1 | r | #29 | {20382, 1298433815} |
hidden_verbs | #1 | rc | #361 | {"hold", "stow", "give", "@setup", "appraise", "throw", "junk"} |
phelp_msg | #1 | rc | #361 | <clear> |
weight | #1 | rc | #361 | 10000 |
owner_verbs | #1 | rc | #361 | <clear> |
plural_name | #1 | rc | #361 | <clear> |
client_image | #1 | rc | #361 | <clear> |
listening | #1 | rc | #361 | <clear> |
Ancestry
Ancestors (nearest first): #255 generic smashable thing → #5 generic thing → #1 root
Children: none
Call graph
Source
rise stand
Referenced by
none
Source
1target = valid(dobj) ? dobj | player; 2target:queue_action($actions.stand, {this}, 1, (verb + " ") + argstr);
integrated_objects
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
Referenced by
none
Source
1this:validate_occupants(); 2return pass(@args);
recline lie lay
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
Referenced by
- #137:do_sit line 12:
this:free_seats - #137:do_recline line 4:
this:free_seats
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
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
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
Referenced by
- #137:reset line 3:
this:do_stand
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
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
Referenced by
- #137:old_users_msg line 3:
this:sitters - #137:forbid_action_move line 10:
this:sitters - #137:users_msg line 5:
this:sitters
Source
1":sitters() => {@this.sitting}"; 2"Returns a list of everyone stiing on the furniture"; 3return this.sitting;
recliners
Referenced by
- #137:old_users_msg line 4:
this:recliners - #137:forbid_action_move line 10:
this:recliners - #137:users_msg line 6:
this:recliners
Source
1":recliners() => {@this.recliners}"; 2"Returns a list of people reclining on the furniture."; 3return this.reclining;
validate_occupants
Referenced by
- #137:look_place_msg line 1:
this:validate_occupants - #137:look_self line 2:
this:validate_occupants
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
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
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
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
Referenced by
- #137:look_self line 4:
this:users_msg - #137:look_self line 6:
this:users_msg
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
Referenced by
- #137:forbid_action_move line 16:
this:users - #137:forbid_action_move line 22:
this:users
Source
1return {@this.sitting, @this.reclining};
tree_tag
Referenced by
none
Source
1s = pass(@args); 2return ((((s + $ansi.cyan) + "s") + tostr(this.seats)) + " / c") + $ansi.reset;
junk
Referenced by
none
Source
1player:tell("You can't just throw away ", this:iname(), ".");
reset
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
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
Referenced by
none
Source
1if (this.sitting || this.reclining) 2return "someone's sitting on it"; 3endif
_sit
Referenced by
- #137:sit line 5:
this:_sit
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");