generic genius #155
Aliases: generic genius
19 verbs · 138 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
clear_queue | this none this | rxd | #155 | 16 |
cancel_current_action | this none this | rxd | #155 | 17 |
process_queue | this none this | rx | #155 | 75 |
plan_action | this none this | rxd | #155 | 8 |
_do_plan | this none this | rxd | #155 | 5 |
suggest_next_action | this none this | rxd | #155 | 12 |
heartbeat | this none this | rxd | #155 | 16 |
plan_loop | this none this | rxd | #155 | 1 |
die | this none this | rxd | #155 | 4 |
p_walkto | this none this | rxd | #155 | 65 |
hear_say_to | this none this | rxd | #155 | 2 |
tell_plan | this none this | rxd | #155 | 2 |
change_plan | this none this | rxd | #155 | 19 |
btell | this none this | rxd | #155 | 3 |
_wander | this none this | rxd | #155 | 4 |
p_defend | this none this | rxd | #155 | 38 |
next_plan | this none this | rxd | #155 | 2 |
page_send | this none this | rxd | #155 | 5 |
p_resthome | this none this | rxd | #155 | 3 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
plan_action | #155 | rc | #361 | {} |
plan_task | #155 | rc | #361 | 0 |
last_converse_time | #155 | rc | #361 | 0 |
plan_msg | #155 | rc | #361 | "" |
pwait | #155 | rc | #361 | 0 |
brainlisteners | #155 | rc | #361 | {} |
plan | #155 | rc | #361 | "" |
wristpad | #155 | rc | #361 | #-1 |
wields_weapons | #106 | rc | #361 | <clear> |
public_wander_only | #106 | rc | #361 | <clear> |
bravery | #106 | rc | #361 | <clear> |
enemies | #106 | rw | #361 | {} |
lastrooms | #106 | r | #361 | <clear> |
wander_chance | #106 | rc | #361 | <clear> |
last_greet_time | #106 | r | #361 | <clear> |
conversation | #106 | rc | #361 | {"doing,plan|NULL|tell_plan"} |
_conversation | #106 | r | #361 | {{{"doing", "plan"}, "NULL", "tell_plan"}} |
dunno_msg | #106 | rc | #361 | <clear> |
spawns_with | #106 | rc | #361 | <clear> |
accepted_gifts | #106 | rc | #361 | <clear> |
greet_msg | #106 | rc | #361 | <clear> |
wander_speed | #106 | rc | #361 | <clear> |
reacting_to | #106 | rc | #361 | <clear> |
lastaction | #106 | rw | #361 | <clear> |
comment_chance | #106 | rc | #361 | <clear> |
respawn_time | #106 | rc | #361 | <clear> |
death_time | #106 | rc | #361 | 1237677663 |
nemeses | #106 | rc | #361 | <clear> |
nemesis_lifetime | #106 | rc | #361 | <clear> |
junk_on_death | #106 | rc | #361 | <clear> |
say_fight_msg | #106 | rc | #361 | <clear> |
wander_last_try | #106 | rc | #361 | <clear> |
destination | #106 | rc | #361 | <clear> |
last_wander_time | #106 | rc | #361 | <clear> |
last_comment_time | #106 | rc | #361 | <clear> |
max_contents | #106 | rc | #361 | <clear> |
beg_health | #106 | rc | #361 | <clear> |
beg_chance | #106 | rc | #361 | <clear> |
beg_msg | #106 | rc | #361 | <clear> |
reload_guns | #106 | rc | #361 | <clear> |
clothing | #106 | rwc | #361 | <clear> |
wardrobe | #106 | rc | #361 | <clear> |
stay_home | #106 | rc | #361 | <clear> |
respawn_clothing | #106 | rc | #361 | <clear> |
walk_last_try | #106 | rc | #361 | <clear> |
ignore_next_say | #106 | rc | #361 | <clear> |
did_damage | #106 | rc | #361 | <clear> |
walk_speed | #106 | rc | #361 | <clear> |
here_for_something | #106 | rc | #361 | <clear> |
hands | #107 | rc | #361 | <clear> |
wielding | #107 | rc | #361 | <clear> |
health | #107 | rc | #361 | 0 |
unarmed_weapon | #107 | rc | #361 | <clear> |
size | #107 | rc | #361 | <clear> |
posture | #107 | rc | #361 | <clear> |
gender | #107 | rc | #361 | <clear> |
respawn | #107 | rc | #361 | <clear> |
corpse | #107 | rc | #361 | <clear> |
has_proper_name | #107 | rc | #361 | <clear> |
die_msg | #107 | rc | #361 | <clear> |
body_parts | #107 | rc | #361 | <clear> |
wearing | #107 | rc | #361 | <clear> |
armor | #107 | rc | #361 | <clear> |
last_swing_message | #107 | rc | #361 | <clear> |
health_max | #107 | rc | #361 | <clear> |
fighting | #107 | rc | #361 | {} |
last_dodge_time | #107 | rc | #361 | <clear> |
following | #107 | rc | #361 | <clear> |
icon | #107 | rc | #361 | <clear> |
say_msg | #107 | rc | #361 | <clear> |
say_to_msg | #107 | rc | #361 | <clear> |
afterlife | #107 | rc | #361 | <clear> |
get_msg | #107 | rc | #361 | <clear> |
drop_msg | #107 | rc | #361 | <clear> |
blood | #107 | rc | #361 | <clear> |
squeals | #107 | rc | #361 | <clear> |
prc | #107 | rc | #361 | <clear> |
ppc | #107 | rc | #361 | <clear> |
poc | #107 | rc | #361 | <clear> |
psc | #107 | rc | #361 | <clear> |
pr | #107 | rc | #361 | <clear> |
pp | #107 | rc | #361 | <clear> |
po | #107 | rc | #361 | <clear> |
ps | #107 | rc | #361 | <clear> |
pq | #107 | rc | #361 | <clear> |
pqc | #107 | rc | #361 | <clear> |
brief | #107 | rc | #361 | <clear> |
knockout | #107 | rc | #361 | <clear> |
knockout_msg | #107 | rc | #361 | <clear> |
body | #107 | rc | #361 | <clear> |
wake_msg | #107 | rc | #361 | <clear> |
owake_msg | #107 | rc | #361 | <clear> |
oknockout_msg | #107 | rc | #361 | <clear> |
friends | #107 | rc | #361 | <clear> |
home | #107 | rc | #361 | <clear> |
respawn_msg | #107 | rc | #361 | <clear> |
move_action | #107 | rc | #361 | <clear> |
heart | #107 | rc | #361 | -1 |
last_heartbeat | #107 | rc | #361 | <clear> |
dead | #107 | rc | #361 | 1237677663 |
_tohit_next | #107 | rc | #361 | <clear> |
last_words_msg | #107 | rc | #361 | <clear> |
attacked | #107 | rc | #361 | <clear> |
opens_doors | #107 | rc | #361 | 1 |
movable_by_explosion | #107 | rc | #361 | <clear> |
obscured | #107 | rc | #361 | <clear> |
obscured_desc_msg | #107 | rc | #361 | <clear> |
cooldowns | #107 | rc | #361 | <clear> |
combat_rounds | #107 | rc | #361 | <clear> |
encumbrance | #107 | rc | #361 | <clear> |
respawn_handler | #107 | rc | #361 | <clear> |
distant_form_msg | #107 | rc | #361 | <clear> |
block_msg | #107 | rc | #361 | <clear> |
attack_on_block | #107 | rc | #361 | <clear> |
last_stunned | #107 | rc | #361 | <clear> |
nude_descs | #107 | rc | #361 | <clear> |
skills | #107 | rc | #361 | <clear> |
explode_msg | #107 | rc | #361 | <clear> |
death_listeners | #107 | rc | #361 | <clear> |
queue | #92 | r | #361 | {} |
preemptible | #92 | r | #361 | <clear> |
executing | #92 | r | #361 | <clear> |
process_queue | #92 | r | #361 | <clear> |
help_msg | #92 | rc | #361 | <clear> |
last_action | #92 | r | #361 | <clear> |
article | #92 | rc | #361 | <clear> |
last_last_action | #92 | rc | #361 | <clear> |
action_count | #92 | rc | #361 | <clear> |
aliases | #1 | rc | #361 | {"generic genius"} |
description | #1 | rc | #361 | <clear> |
object_size | #1 | r | #29 | {18152, 1298433871} |
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): #106 generic NPC → #154 generic living creature → #107 generic creature → #92 generic actor → #1 root
Children: none
Call graph
Source
clear_queue
Referenced by
none
Source
1":clear_queue()"; 2"Kill all queued actions."; 3for x in ({@this.queue, this.executing}) 4if (length(x) > 5) 5if (task_valid(x[6])) 6kill_task(x[6]); 7endif 8endif 9endfor 10this.queue = {}; 11if (task_valid(this.process_queue) && (task_id() != this.process_queue)) 12kill_task(this.process_queue); 13endif 14if (this.executing) 15this.executing = {}; 16endif
cancel_current_action
Referenced by
none
Source
1":cancel_current_action([INT dontabort])"; 2"If we're currently executing an action, abort it and immediately start our next action."; 3if (this.executing) 4if (length(this.executing) > 5) 5"...Some AI thread was waiting for this action to finish. KILL IT."; 6kill_task(this.executing[6]); 7endif 8if ((!args) || (!args[1])) 9this.executing[1]:_abort(this, @this.executing[2..$]); 10endif 11this.executing = {}; 12if (task_valid(this.process_queue)) 13old_pq = this.process_queue; 14this:fork_process_queue(); 15kill_task(old_pq); 16endif 17endif
process_queue
Referenced by
none
Source
1"Copied from Gilmore (#98):process_queue by Satan (#2) Mon Jun 7 20:36:31 2004 PDT"; 2"Copied from generic actor (#716):process_queue by Satan (#2) Mon Jun 7 15:47:39 2004 PDT"; 3":process_queue()"; 4"Keep running actions until we don't have any to run."; 5player = this; 6next_action_delay = 0; 7if ((!this.queue) && (this.health > 0)) 8if (action = this:suggest_next_action()) 9this.queue = {action[1]}; 10next_action_delay = action[2]; 11endif 12endif 13while (this.queue) 14this.preemptible = 0; 15if (this.location == #742) 16this.queue = {}; 17endif 18if (this.queue) 19action = this.queue[1]; 20this.preemptible = action[1].preemptible; 21this.queue = listdelete(this.queue, 1); 22this.last_action = action; 23debugtext = $su:print(action[2..$]); 24"...sanity check..."; 25if (((!action[2]) || (typeof(action[2][1]) != OBJ)) || (!is_a(action[2][1], $garbage))) 26if (!this.location:check_forbid_action(this, @action)) 27"...nobody in here cancelled us..."; 28this.executing = {@action, @{$action, {}, 1, "", 0}[length(action) + 1..$]}; 29this:debug_tell("action", "start | ", $su:nn(action[1]), " ", debugtext); 30"...start the action..."; 31if (result = action[1]:_start(this, action[2])) 32duration = result[1]; 33pass_to_finish = result[2]; 34else 35duration = 0.0; 36pass_to_finish = 0; 37endif 38durint = $math_utils:gil_float_to_int(duration); 39suspend(durint); 40"...finish the action..."; 41this:debug_tell("action", "finish | ", $su:nn(action[1]), " ", debugtext); 42action[1]:_finish(this, action[2], pass_to_finish); 43this.executing = {}; 44if (length(action) > 4) 45"...wake up the waiting AI thread..."; 46resume(action[6], 1); 47endif 48else 49this:debug_tell("action", "forbid | ", $su:nn(action[1]), " ", debugtext); 50action[1]:_forbidden(this, @action[2..$]); 51if (length(action) > 4) 52resume(action[6], 0); 53endif 54endif 55endif 56endif 57this.preemptible = next_action_delay > 0; 58suspend(next_action_delay); 59this.preemptible = 0; 60if (!this.queue) 61"...no more queued actions, do we have an auto-action?..."; 62if (result = this:suggest_next_action()) 63action = result[1]; 64if (((action[1] in $rpg.repeatable_actions) || is_player(this)) || (action != this.last_action)) 65next_action_delay = result[2]; 66"...add our auto-action to the queue..."; 67this.queue = {action}; 68endif 69endif 70else 71next_action_delay = 0; 72endif 73endwhile 74"...the queue's empty! go away now..."; 75this.process_queue = 0;
plan_action
Referenced by
- #155:p_walkto line 45:
this:plan_action - #155:p_resthome line 2:
this:plan_action
Source
1if (this.plan_action || ((this.executing && (length(this.executing) > 5)) && task_valid(this.executing[6]))) 2this:btell("PLAN BURP"); 3kill_task(task_id()); 4else 5this.plan_action = {@args, @{$action, {}, 1, "", 0}[length(args) + 1..$], task_id()}; 6this:jumpstart(); 7return suspend($maxint); 8endif
_do_plan
Referenced by
- #155:suggest_next_action line 3:
this:_do_plan
Source
1if (this.plan_action) 2r = this.plan_action; 3this.plan_action = {}; 4return r; 5endif
suggest_next_action
Referenced by
- #155:process_queue line 8:
this:suggest_next_action - #155:process_queue line 62:
this:suggest_next_action
Source
1if (r = this:_fight()) 2return {r, 0}; 3elseif (r = this:_do_plan()) 4this.pwait = 1; 5return {r, 0}; 6elseif (this.pwait) 7return; 8else 9if (r = this:_wander()) 10return {r, this.wander_speed}; 11endif 12endif
heartbeat
Referenced by
none
Source
1pass(@args); 2if (!task_valid(this.plan_task)) 3if (this.pwait) 4this:btell("hmm, that's STRANGE. i thought i had something important to do, but it seems to have vanished."); 5this.pwait = 0; 6endif 7this.plan = ""; 8this.plan_task = 0; 9if (p = this:next_plan()) 10this:change_plan(@p); 11endif 12elseif ((!this.executing) && (!this.queue)) 13pt = this.plan_task; 14this.plan_task = 0; 15resume(pt); 16endif
plan_loop
Referenced by
none
Source
1this.plan_msg = "thinking";
die
Referenced by
none
Source
1if (task_valid(this.plan_task)) 2kill_task(this.plan_task); 3endif 4return pass(@args);
p_walkto
Referenced by
- #155:p_defend line 5:
this:p_walkto - #155:p_resthome line 1:
this:p_walkto
Source
1":p_walkto(OBJ dest, INT step delay[, STR reasoN, INT hurry])"; 2"Walk to the destination. If 'hurry', don't stop to chat."; 3{dest, delay, reason, ?hurry = 0} = args; 4this.pwait = 1; 5this.plan_msg = (("walking to " + dest.name) + " ") + reason; 6abort = 0; 7lastrooms = {}; 8if (is_a(dest, $room)) 9destwho = #-1; 10else 11destwho = dest; 12dest = destwho.location; 13endif 14while ((!abort) && (this.location != dest)) 15if (valid(destwho) && (destwho.location == this.location)) 16this:btell("oh, i ran into ", destwho.name, " on my way to ", dest.name, "!"); 17return 1; 18endif 19if (hurry && ((time() - this.last_converse_time) < 5)) 20this:say(("Sorry, I have to get going " + reason) + "."); 21this:btell("stupid talkers, wasting our precious time!"); 22suspend(1); 23else 24wait_on_converse = 0; 25while ((time() - this.last_converse_time) < 30) 26wait_on_converse = 1; 27this.plan_msg = ("walking to " + dest.name) + ", but I stopped to chat."; 28this:btell("waiting to finish talking"); 29suspend(5); 30endwhile 31if (wait_on_converse) 32this:say("Alright, I gotta get moving."); 33this.plan_msg = "walking to " + dest.name; 34endif 35endif 36if (this.location in lastrooms) 37this:btell("damn, i'm lost."); 38this:say("Damn. I'm lost."); 39suspend(5); 40abort = 1; 41elseif (valid(hop = this.location:next_hop_to(dest))) 42lastrooms = setadd(lastrooms, this.location); 43oldloc = this.location; 44this:btell("heading ", hop.name, " to get to ", dest.name, " (", reason, ")"); 45this:plan_action($actions.move, {hop}, 1, ""); 46suspend(delay); 47while (this.executing || this.queue) 48suspend(delay); 49endwhile 50if (this.location == oldloc) 51this:say("Damn! I'm stuck."); 52this:btell("i couldn't go ", hop.name, ", apparently."); 53abort = 1; 54endif 55else 56this:btell("damn. i don't know how to get to ", dest.name, " from ", this.location.name, "."); 57return 0; 58endif 59endwhile 60if (!abort) 61this:btell("hey, i made it to ", this.location.name, "!"); 62endif 63this.plan_msg = ""; 64this.pwait = 0; 65return this.location == dest;
hear_say_to
Referenced by
none
Source
1this.last_converse_time = time(); 2pass(@args);
tell_plan
Referenced by
none
Source
1who = args[1]; 2this:say(("I'm " + this.plan_msg) + ".", who);
change_plan
Referenced by
- #155:heartbeat line 10:
this:change_plan
Source
1if (task_valid(this.plan_task)) 2this:btell(("I'm giving up my " + this.plan_msg) + " plan."); 3kill_task(this.plan_task); 4this.plan_task = 0; 5endif 6if (newplan = args[1]) 7this:btell(((("New plan - " + newplan) + " (") + $su:from_value(args[2..$], 1, 5)) + ")"); 8fork task_id (0) 9try 10this:(newplan)(@args[2..$]); 11this.plan_task = 0; 12this.plan = ""; 13except e (ANY) 14$rpg:report_error(e); 15endtry 16endfork 17this.plan_task = task_id; 18this.plan = newplan; 19endif
btell
Referenced by
- #155:plan_action line 2:
this:btell - #155:heartbeat line 4:
this:btell - #155:p_walkto line 16:
this:btell - #155:p_walkto line 21:
this:btell - #155:p_walkto line 28:
this:btell - #155:p_walkto line 37:
this:btell - #155:p_walkto line 44:
this:btell - #155:p_walkto line 52:
this:btell - #155:p_walkto line 56:
this:btell - #155:p_walkto line 61:
this:btell - #155:change_plan line 2:
this:btell - #155:change_plan line 7:
this:btell - #155:_wander line 2:
this:btell - #155:p_defend line 2:
this:btell - #155:p_defend line 6:
this:btell - #155:p_defend line 12:
this:btell - #155:p_defend line 22:
this:btell - #155:p_defend line 29:
this:btell - #155:p_defend line 33:
this:btell
Source
1for x in (this.brainlisteners) 2x:tell($ansi.cyan, $ansi.bold_on, $su:nn(this), ": ", @args, $ansi.reset); 3endfor
_wander
Referenced by
- #155:suggest_next_action line 9:
this:_wander
Source
1if (r = pass(@args)) 2this:btell("hmm, i think i'll wander ", r[4]); 3endif 4return r;
p_defend
Referenced by
none
Source
1who = args[1]; 2this:btell("I've got to defend ", who.name, "!"); 3this.pwait = 1; 4if (who.location != this.location) 5if (!this:p_walkto(who, 1, "to defend " + who.name, 1)) 6this:btell("So much for defending ", who.name, "."); 7return this.pwait = 0; 8endif 9endif 10while ((foes = who.fighting) && (who.location == this.location)) 11foe = foes[1]; 12this:btell(foe.name, " is fighting ", who.name, ", and must therefore DIE."); 13this:start_fighting(foe); 14suspend(1); 15while ((foe.location == this.location) && (foe in who.fighting)) 16if (!(foe in this.fighting)) 17this:start_fighting(foe); 18endif 19suspend(5); 20endwhile 21if (who.location != this.location) 22this:btell("damn, ", who.name, " is gone!"); 23this.pwait = 0; 24return 0; 25endif 26endwhile 27this.pwait = 0; 28if (who:is_in_afterlife()) 29this:btell("shit! ", who.name, " died and we couldn't save ", who.po, "."); 30this:say("Why, God? WHY?"); 31return 0; 32else 33this:btell("we saved ", who.name, "!"); 34this:say("You okay?", who); 35this.last_converse_time = 0; 36this.pwait = 0; 37return 1; 38endif
next_plan
Referenced by
- #155:heartbeat line 9:
this:next_plan
Source
1"Return the next plan to be executed on a heartbeat, if we don't already have one."; 2return 0;
page_send
Referenced by
none
Source
1who = args[1]; 2msg = args[2]; 3fork (1) 4who:_receive(this, msg); 5endfork
p_resthome
Referenced by
none
Source
1if (this:p_walkto(this.home, 3, "to rest", 0)) 2this:plan_action($actions.recline, {this.location}, 1, ""); 3endif