Social Feature with Event Broadcasting #149

Parent #68Owner #361Flags readSource hellcore/hellcore.db

Aliases: Social Feature with Event Broadcasting

2 verbs · 34 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
wave hug frown smile laughany none nonerxd#14915
_do_socialthis none thisrxd#149122

Properties

PropertyDefinerFlagsOwnerValue
warehouse#68r#29<clear>
help_msg#68rc#361<clear>
feature_verbs#68r#29{}
feature_ok#68r#29<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#361<clear>
health_max#5rc#361<clear>
min_skill#5rc#361<clear>
skill#5rc#361<clear>
recipe_for#5rc#361<clear>
carried_msg#5rc#361<clear>
aliases#1rc#361{"Social Feature with Event Broadcasting"}
description#1rc#361<clear>
object_size#1r#29{0, 0}
hidden_verbs#1rc#361<clear>
phelp_msg#1rc#361<clear>
weight#1rc#361<clear>
owner_verbs#1rc#361<clear>
plural_name#1rc#361<clear>
client_image#1rc#361<clear>
listening#1rc#361<clear>

Ancestry

Ancestors (nearest first): #68 Generic Feature Object#5 generic thing#1 root

Children: none

Call graph

calls n149_0 #149:wave n44_0 #44:match n149_0->n44_0 n107_43 #107:tell n149_0->n107_43 n149_1 #149:_do_social n149_0->n149_1 n20_34 #20:pronoun_sub n149_1->n20_34

Source

wave hug frown smile laugh

Spec any none noneFlags rxdOwner #361Definer #149

Referenced by

none

Source

1if (!valid(dobj))
2dobj = $mu:match(dobjstr, player.location:contents());
3endif
4if (dobj == #-2)
5player:tell(verb, " who?");
6return;
7elseif (dobj == #-3)
8player:tell("There is no one named \"", dobjstr, "\" here.");
9return;
10endif
11if (((0 && (verb == "hug")) && is_a(dobj, $player)) && (dobj != player))
12#270304.hug_log[dobj] = `#270304.hug_log[dobj] ! E_RANGE => 0' + 1;
13endif
14social = $actions.social.(verb);
15this:_do_social(player, dobj, social);

_do_social

Spec this none thisFlags rxdOwner #361Definer #149

Referenced by

Source

1":_do_social(OBJ source, OBJ target, OBJ social_action | STR social_action_name);";
2"Use #-1 as target if there is no target, i.e. if you just want to perform an undirected action (\"You smile.\");  Note that this doesn't always work, as some social verbs are transitive only.";
3{actor, target, social} = args;
4if (typeof(social) == STR)
5social = $actions.social.(social);
6endif
7where = actor.location;
8if (`where:forbid_social(actor, target, social.name) ! ANY')
9return;
10endif
11if ((!valid(target)) && social.transitive_only)
12actor:tell("You have to do that to someone in particular.");
13return;
14endif
15msgs = [];
16tangible = social.is_tangible;
17audible = social.is_audible;
18verb = social.name;
19prep = social.preposition;
20if (prep)
21prep = " " + prep;
22endif
23if (((verb[$] == "s") || (verb[$ - 1..$] == "sh")) || (verb[$ - 1..$] == "ch"))
24suffix = "es";
25else
26suffix = "s";
27endif
28"who can see?";
29witnesses = {};
30vague_witnesses = {};
31everyone = where:occupants($creature);
32for c in (everyone)
33dark = where:darkness(0, c);
34if ((dark in {1, 0, -1}) || (c:can_see_in_dark() && (dark > 0)))
35witnesses = {@witnesses, c};
36elseif (dark in {2, -2})
37vague_witnesses = {@vague_witnesses, c};
38endif
39endfor
40"if actor can't see, he may pick the wrong person.";
41hopefully_target = target;
42to_self = target == actor;
43if (valid(target) && (!to_self))
44if ((!(actor in witnesses)) && ($skills.senses:check(actor, -3 * where:darkness(0, actor)) < 0))
45potentials = setremove(everyone, actor);
46if (!potentials)
47actor:tell("No one seems to be here...");
48return;
49endif
50target = potentials[random($)];
51elseif (!((target == where) || (target.location in {where, actor})))
52actor:tell(target:dnamec(), " isn't here.");
53return;
54endif
55endif
56"get messages";
57if (valid(target))
58"transitive";
59msgs["self"] = social.tsocial_self_msg;
60msgs["others"] = social.tsocial_others_msg;
61msgs["target"] = social.tsocial_target_msg;
62else
63"intransitive";
64msg = social.social_msg;
65msgs["others"] = msg;
66self_msg = strsub(msg, "%DN", "You");
67self_msg = strsub(self_msg, "%N", "You");
68self_msg = strsub(self_msg, "%p", "your");
69msgs["self"] = self_msg;
70endif
71for msgtype in (keys(msgs))
72msg = msgs[msgtype];
73msg = strsub(msg, "[verb]", verb);
74msg = strsub(msg, "[prep]", prep);
75msgs[msgtype] = msg;
76endfor
77for c in (where.contents)
78if (!(has_property(c, "listening") && c.listening))
79continue;
80endif
81eff_actor = actor;
82eff_target = target;
83if ((c in witnesses) || (!is_a(c, $creature)))
84"ok, this person can see.";
85elseif (c == actor)
86eff_target = hopefully_target;
87elseif ((c == target) && (((c in vague_witnesses) || audible) || tangible))
88eff_actor = $someone;
89elseif (audible || (c in vague_witnesses))
90eff_actor = $someone;
91eff_target = $someone_else;
92else
93continue;
94endif
95if (c == actor)
96msg = msgs["self"];
97elseif (c == target)
98msg = msgs["target"];
99else
100msg = msgs["others"];
101endif
102msg = strsub(msg, "[suffix]", (c == actor) ? "" | suffix);
103if (valid(eff_target))
104if (to_self)
105msg = strsub(msg, "[dobj]", (c == actor) ? "yourself" | eff_actor.pr);
106else
107msg = strsub(msg, "[dobj]", eff_target:dname());
108endif
109endif
110msg = $su:ps(msg, eff_actor);
111if (((eff_actor == $someone) && (length(msg) >= 7)) && (msg[1..7] == "someone"))
112msg[1..7] = "Someone";
113endif
114c:tell(msg);
115endfor
116if (valid(target) && has_callable_verb(target, "receive_social_" + verb))
117target:("receive_social_" + verb)(actor);
118endif
119where:broadcast_event(1, social, actor, {target});
120if (is_a(social.noise, $noise))
121where:make_noise(social.noise, actor, {target});
122endif