drop #270
Aliases: drop
5 verbs · 19 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
_start | this none this | rxd | #270 | 82 |
_finish | this none this | rxd | #270 | 90 |
put | this none this | rxd | #270 | 8 |
doing_msg | this none this | rxd | #270 | 21 |
_abort | this none this | rxd | #270 | 34 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
help_msg | #93 | rc | #361 | <clear> |
duration | #93 | rc | #361 | <clear> |
preemptible | #93 | rc | #361 | <clear> |
unstoppable | #93 | rc | #361 | <clear> |
dodge_mod | #93 | rc | #361 | <clear> |
doing_msg | #93 | rc | #361 | <clear> |
doing_to_msg | #93 | rc | #361 | <clear> |
oabort_msg | #93 | rc | #361 | <clear> |
can_parry | #93 | rc | #361 | <clear> |
aliases | #1 | rc | #361 | {"drop"} |
description | #1 | rc | #361 | <clear> |
object_size | #1 | r | #29 | {0, 0} |
hidden_verbs | #1 | rc | #361 | <clear> |
phelp_msg | #1 | rc | #361 | <clear> |
weight | #1 | rc | #361 | <clear> |
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): #93 Generic Action → #1 root
Children: none
Call graph
Source
_start
Referenced by
none
Source
1"$actions.drop:_start(OBJ who, LIST callback) => "; 2" This is the entry point for a queued drop action. The callback args "; 3" are as follows: "; 4" { LIST what, OBJ container, LIST dropped } "; 5" -- what is the list of things we'd eventually like to drop or put "; 6" -- container is the container we'd like to drop or put the object in "; 7" -- dropped is the list of things we've already dropped in this session"; 8who = args[1]; 9callback = args[2]; 10"Remove any invalid drops."; 11what = $lu:list_is_a((typeof(callback[1]) == LIST) ? callback[1] | {callback[1]}, #1); 12container = (length(callback) > 1) ? callback[2] | #-1; 13dropped = (length(callback) > 2) ? callback[3] | {}; 14first_drop = dropped ? 0 | 1; 15total_weight = 0; 16dropping = {}; 17for item in (what) 18"Here we exclude anything the container or room won't accept, as well "; 19" as wristpads, which people don't want to lose "; 20if ((!is_a(item, $wristpad)) && (item.location in {who, who.location})) 21if (container:acceptable(item)) 22dropping = setadd(dropping, item); 23elseif (is_a(item, $thing)) 24who:tell(item:dnamec(), " won't fit in ", container:dname(), "."); 25endif 26endif 27endfor 28if (!dropping) 29"If they can drop anything in the list, tell them so and exit with "; 30"E_INVARG, which will halt the execution of this action altogether. "; 31"Note that 'what' may be empty, in case whatever was queued was recycled "; 32"before we got here. "; 33if (what) 34if ($api.container:is_on(container)) 35who:tell("You can't seem to get ", what[1]:dname(), " into ", container:dname(), "."); 36else 37who:tell("You can't drop ", what[1]:dname(), " here."); 38endif 39endif 40return E_INVARG; 41endif 42if (valid(container) && (container.location == who)) 43pronoun = who.pp; 44else 45pronoun = "the"; 46endif 47"If this is the first item we're dropping, we need to print messages to "; 48" the room to let people know what's happening. From there on out "; 49" we will only print a message periodically, or when they're finished. "; 50if (first_drop) 51names = $su:message_db(dropping, "iname"); 52namestrs = {}; 53for x in (names) 54if (len = length(x[1]) > 1) 55namestrs = setadd(namestrs, x[1][1]:pname(len)); 56else 57namestrs = setadd(namestrs, x[2]); 58endif 59endfor 60if (length(namestrs) > 1) 61things = "things"; 62else 63things = namestrs[1]; 64endif 65if (length(dropping) > 3) 66if ($api.container:is_on(container)) 67who:aat(((((((who:dnamec() + " starts putting ") + things) + " in ") + pronoun) + " ") + container:name()) + "."); 68else 69who:aat(((who:dnamec() + " starts dropping ") + things) + "."); 70endif 71elseif (length(dropping) > 1) 72if (is_a(container, $container)) 73who:aat(((((((who:dnamec() + " starts putting ") + $su:english_list(namestrs)) + " into ") + pronoun) + " ") + container:name()) + "."); 74else 75who:aat(((who:dnamec() + " starts dropping ") + $su:english_list(namestrs)) + "."); 76endif 77endif 78endif 79"Note that we are passing a possibly revised copy of the callback args to "; 80":_finish, so that it need not reprocess anything. "; 81who.location:broadcast_event(1, $actions.put, who, {dropping[1], container}); 82return {this:duration(), {dropping, container, dropped}};
_finish
Referenced by
none
Source
1"$actions.drop:_finish(OBJ who, LIST callback, LIST from_start) => "; 2" This is the second phase of a get action, in which the player actually "; 3" finished dropping the object (or putting it in a container). "; 4" The callback args look like this: "; 5" { LIST what, OBJ container, LIST pick } "; 6" -- what is the list of objects we wanted to pick up "; 7" -- container is the container we want to put something in (or the room)"; 8" -- dropped is the list of objects we've already dropped in this session"; 9"Since this is the finish phase, we basically ignore the callback args in "; 10" favor of the args we were passed from the :_start phase. The from_start "; 11" list looks just like the callback args, but has already been pruned of "; 12" objects we can't work with. "; 13who = args[1]; 14callback = args[2]; 15from_start = args[3]; 16what = callback[1]; 17dropping = $lu:remove_if_not($rpg, "valid", from_start[1]); 18dropped = $lu:remove_if_not($rpg, "valid", (length(callback) > 2) ? callback[3] | {}); 19container = callback[2]; 20if (dropping) 21target = dropping[1]; 22dropping = listdelete(dropping, 1); 23put = this:put(who, target, container); 24if (typeof(put == ERR)) 25return E_NONE; 26endif 27dropped = setadd(dropped, target); 28finalnames = $su:message_db(dropped, "iname"); 29finalnamestrs = {}; 30for x in (finalnames) 31finalnamestrs = setadd(finalnamestrs, ((len = length(x[1])) > 1) ? x[1][1]:pname() | x[2]); 32endfor 33if (length(finalnamestrs) > 1) 34things = "stuff"; 35else 36things = finalnamestrs[1]; 37endif 38elseif (dropped) 39target = dropped[$]; 40else 41target = #-1; 42endif 43if (valid(container) && (container.location == who)) 44pronoun = who.pp; 45else 46pronoun = "the"; 47endif 48if (dropping) 49if (!(length(dropping) % 5)) 50if (length(finalnamestrs) > 1) 51if ($api.container:is_on(container)) 52who.location:announce_all_but({who}, ((((((((("You notice " + who:dnamec()) + " stowing ") + target:iname()) + " as ") + who.ps) + " continues putting things into ") + pronoun) + " ") + container:name()) + "."); 53else 54who.location:announce_all_but({who}, ((((("You notice " + who:dnamec()) + " dropping ") + target:iname()) + " as ") + who.ps) + " continues to unload."); 55endif 56else 57if ($api.container:is_on(container)) 58who.location:announce_all_but({who}, ((((((who:dnamec() + " continues putting ") + dropping[1]:pname()) + " into ") + pronoun) + " ") + container:name()) + "."); 59else 60who.location:announce_all_but({who}, ((who:dnamec() + " continues dropping ") + dropping[1]:pname()) + "."); 61endif 62endif 63endif 64who:queue_action(this, {dropping, container, dropped}, 0, (this.name + " ") + dropping[1]:name()); 65else 66if (length(dropped) > 3) 67if ($api.container:is_on(container)) 68who:aat(((((((who:dnamec() + " stops putting ") + things) + " in ") + pronoun) + " ") + container:name()) + "."); 69else 70who:aat(((who:dnamec() + " finishes dropping ") + things) + "."); 71endif 72elseif (length(dropped) > 1) 73if ($api.container:is_on(container)) 74who:aat(((((((who:dnamec() + " finishes putting ") + $su:english_list(finalnamestrs)) + " in ") + pronoun) + " ") + container:name()) + "."); 75else 76who:aat(((who:dnamec() + " finishes dropping ") + $su:english_list(finalnamestrs)) + "."); 77endif 78else 79if ($api.container:is_on(container)) 80if (!(m = `container.put_msg ! E_PROPNF => 0')) 81m = ((("%DN puts %id into " + pronoun) + " ") + container.name) + "."; 82endif 83who:aat($su:ps(m, who, container, dropped[1], target, container)); 84elseif (valid(target)) 85if (m = `who.drop_msg ? who.drop_msg | (target.drop_msg ? target.drop_msg | who.location.drop_msg) ! ANY => 0') 86who:aat($su:ps(m, who, target, target)); 87endif 88endif 89endif 90endif
put
Referenced by
- #270:_finish line 23:
this:put
Source
1who = args[1]; 2what = args[2]; 3container = (length(args) > 2) ? args[3] | who.location; 4if ($api.container:is_on(container) && (m = container:cant_put_into(what, who))) 5who:tell("You can't get ", what:dname(), " into ", container:dname(), " because ", m, "."); 6return E_INVARG; 7endif 8who:_put(what, container);
doing_msg
Referenced by
none
Source
1who = args[1]; 2if (args[2]) 3callback = args[2]; 4what = callback[1]; 5container = (length(callback) > 1) ? callback[2] | #-1; 6if (length(what) > 1) 7if ($api.container:is_on(container)) 8return (("putting some things into " + who.pp) + " ") + container:name(); 9else 10return "dropping some things"; 11endif 12else 13if ($api.container:is_on(container)) 14return (((("putting " + what[1]:iname()) + " into ") + who.pp) + " ") + container:name(); 15else 16return "dropping " + what[1]:iname(); 17endif 18endif 19else 20return "dropping"; 21endif
_abort
Referenced by
none
Source
1who = args[1]; 2callback = args[2]; 3what = callback[1]; 4container = callback[2]; 5dropped = callback[3]; 6if (dropped) 7names = $su:message_db(dropped, "iname"); 8namestrs = {}; 9for x in (names) 10if (len = length(x[1]) > 1) 11namestrs = setadd(namestrs, x[1][1]:pname(len)); 12else 13namestrs = setadd(namestrs, x[2]); 14endif 15endfor 16if (length(namestrs) > 1) 17things = "stuff"; 18else 19things = namestrs[1]; 20endif 21if (length(dropped) > 3) 22if ($api.container:is_on(container)) 23who:aat(((((((who:dnamec() + " stops putting ") + things) + " in ") + who.pp) + " ") + container:name()) + "."); 24else 25who:aat(((who:dnamec() + " stops dropping ") + things) + "."); 26endif 27elseif (length(dropped) > 1) 28if ($api.container:is_on(container)) 29who:aat(((((((who:dnamec() + " managed to put ") + $su:english_list(namestrs)) + " into ") + who.pp) + " ") + container:name()) + "."); 30else 31who:aat(((who:dnamec() + " managed to drop ") + $su:english_list(namestrs)) + "."); 32endif 33endif 34endif