generic invasion #306

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

Aliases: generic invasion, invasion

11 verbs · 34 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
setupthis none thisrxd#30632
is_activethis none thisrxd#3067
msgthis none thisrxd#30610
heartbeatthis none thisrxd#30644
on_spawnthis none thisrxd#3061
recyclethis none thisrxd#3061
endthis none thisrxd#3066
setup_spawnthis none thisrxd#3068
look_selfthis none thisrxd#3064
hear_deaththis none thisrxd#3068
entombthis none thisrxd#3062

Properties

PropertyDefinerFlagsOwnerValue
start_rooms#306rc#361{#101198, #147166}
dest_rooms#306rc#361{#4908}
spawns#306rc#361{#326148, #326148, #326148, #326148, #326148, #326148}
invaders#306rc#361{}
start#306rc#361#-1
dest#306rc#361#-1
leader_type#306rc#361#138
leader#306rc#361#-1
leader_spews_msg#306rc#361{"Get 'em boys!", "RIOT!"}
fnn_start_msg#306rc#361{"FNN choppers have sighted a large group of %spawns in %area1, headed directly for %area2!"}
fnn_reached_msg#306rc#361{"FNN's eye in the sky has live footage of the invasion of %area2 by %spawns!"}
fnn#306rc#361#221210
heart#306r#3610
last_heartbeat#306r#3610
enemy_species#306rc#361{#10989, #6}
aggression_chance#306rc#36140
duration#306rc#3612400
start_time#306r#3610
arrived#306r#3610
fnn_end_msg#306rc#361{"FNN's eye in the sky brings you up close with the aftermath of the invasion of %area2."}
help_msg#306rc#361
list of 23{"Create an $invasion and @chmod it +f. Set up these properties:", "", " start_rooms : A list of possible start locations.", "", " end_rooms : A list of possible destinations. After the invasion reaches one of these, the party will just wander from there.", "", " spawns : A list of unique NPCs and/or +f spawnable generic NPCs.", "", "Add your invasion to an area's .invasions list or manually call $rpg:spawn(invasion) to set one off.", "", "Optional properties:", "", " enemy_species: This list is set on any monster spawns.", "", " aggression_chance: As above.", "", " fnn_start_msg: Broadcast on FNN TV when the invasion starts.", "", " fnn_reached_msg: Broadcast on FNN TV when the invasion reaches the target.", "", " leader_spews_msg: The leader of the invasion will spout these quotes during the invasion. (The leader is the first creature in .spawns)", "", ""}
last_announce_time#306r#3610
fnn_continue_msg#306rc#361{"The rampage of %spawns in %area2 continues unabated!", "FCPD have yet to put a stop to the %spawns invasion."}
job#306rc#361#517205
aliases#1rc#361{"generic invasion", "invasion"}
description#1rc#361<clear>
object_size#1r#29{9005, 1298434119}
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): #1 root

Children: none

Call graph

calls n306_0 #306:setup n150_0 #150:register n306_0->n150_0 n306_7 #306:setup_spawn n306_0->n306_7 n306_2 #306:msg n306_0->n306_2 n20_81 #20:msg n306_2->n20_81 n306_3 #306:heartbeat n306_3->n306_2 n306_3->n20_81 n150_2 #150:unregister n306_3->n150_2 n306_6 #306:end n306_3->n306_6 n306_6->n306_2 n57_1 #57:_recycle n306_6->n57_1 n306_4 #306:on_spawn n306_4->n306_0 n306_5 #306:recycle n306_5->n150_2 n306_8 #306:look_self n107_43 #107:tell n306_8->n107_43 n112_7 #112:duration n306_8->n112_7 n20_1 #20:left n306_8->n20_1 n306_10 #306:entomb n306_10->n150_2

Source

setup

Spec this none thisFlags rxdOwner #361Definer #306

Referenced by

Source

1if (gamevalid(this.start) || this.f)
2return;
3endif
4this.heart = 0;
5$heart:register(this);
6start = this.start_rooms[random($)];
7this.start = start;
8dest = this.dest_rooms[random($)];
9this.dest = dest;
10invaders = {};
11leader = #-1;
12for x in (this.spawns)
13suspend(1);
14if (x.f)
15inv = x:_spawn();
16else
17inv = x;
18endif
19inv:moveto(start);
20this:setup_spawn(inv);
21invaders = {@invaders, inv};
22if (!valid(leader))
23if (is_a(inv, this.leader_type))
24leader = inv;
25endif
26endif
27endfor
28this.leader = leader;
29this.invaders = invaders;
30this.start_time = time();
31this.fnn:report(this:msg(this.fnn_start_msg));
32$nets.gamenet:announce(this, ("Spawning in " + this.start:area():dname()) + "!");

is_active

Spec this none thisFlags rxdOwner #361Definer #306

Referenced by

none

Source

1inv = {};
2for x in (this.invaders)
3if (is_a(x, $creature) && (!x:is_dead()))
4inv = {@inv, x};
5endif
6endfor
7return inv;

msg

Spec this none thisFlags rxdOwner #361Definer #306

Referenced by

Source

1m = $su:msg(args[1]);
2if (this.invaders && is_a(this.invaders[$], $npc))
3m = strsub(m, "%spawns", this.invaders[$].name + "s");
4endif
5if (this.invaders && is_a(this.invaders[1], $npc))
6m = strsub(m, "%leader", this.invaders[1]:iname());
7endif
8m = strsub(m, "%area1", this.start:area():dname());
9m = strsub(m, "%area2", this.dest:area():dname());
10return m;

heartbeat

Spec this none thisFlags rxdOwner #361Definer #306

Referenced by

none

Source

1if (!this.invaders)
2$heart:unregister(this);
3return;
4endif
5if ((time() - this.start_time) > this.duration)
6return this:end();
7endif
8alive = {};
9for x in (this.invaders)
10if (is_a(x, $living) && ((parent(x) in this.spawns) || (x in this.spawns)))
11if (is_a(x:area(), $real_area))
12alive = {@alive, x};
13endif
14endif
15endfor
16this.invaders = alive;
17if (!alive)
18return this:end();
19endif
20if ((time() - this.start_time) > this.duration)
21return this:end();
22endif
23if ((is_a(this.leader, $living) && is_a(this.leader:area(), #1032)) && (m = this.leader_spews_msg))
24m = $su:msg(m);
25this.leader:say(m);
26endif
27if (!this.arrived)
28arrived = 0;
29for x in (alive)
30if ((x.location == this.dest) || (x.destination == #-1))
31arrived = 1;
32endif
33endfor
34if (arrived)
35this.arrived = 1;
36this.fnn:report(this:msg(this.fnn_reached_msg));
37endif
38else
39if ((time() - this.last_announce_time) > 300)
40this.last_announce_time = time();
41m = this:msg(this.fnn_continue_msg);
42this.fnn:report(m);
43endif
44endif

on_spawn

Spec this none thisFlags rxdOwner #361Definer #306

Referenced by

none

Source

1this:setup();

recycle

Spec this none thisFlags rxdOwner #361Definer #306

Referenced by

none

Source

1$heart:unregister(this);

end

Spec this none thisFlags rxdOwner #361Definer #306

Referenced by

Source

1this.fnn:report(this:msg(this.fnn_end_msg));
2for x in (this.invaders)
3is_a(x, $living) && x:die();
4yield;
5endfor
6$recycler:_recycle(this);

setup_spawn

Spec this none thisFlags rxdOwner #361Definer #306

Referenced by

Source

1who = args[1];
2who.destination = this.dest;
3who.death_listeners = setadd(who.death_listeners, this);
4if (is_a(who, $monster))
5who.enemy_species = this.enemy_species;
6who.aggression_chance = this.aggression_chance;
7who.areas = {this.start:area(), this.dest:area()};
8endif

look_self

Spec this none thisFlags rxdOwner #361Definer #306

Referenced by

none

Source

1player:tell($time:duration(this.duration - (time() - this.start_time)), " to go.");
2for x in (this.invaders)
3player:tell($su:left(x.name, -30), x.location.name);
4endfor

hear_death

Spec this none thisFlags rxdOwner #361Definer #306

Referenced by

none

Source

1who = args[1];
2killer = args[2];
3if (is_a(killer, $player))
4this.job:add_progress(killer);
5endif
6if (is_a(who, $creature))
7who.death_listeners = setremove(who.death_listeners, this);
8endif

entomb

Spec this none thisFlags rxdOwner #361Definer #306

Referenced by

none

Source

1"Copied from generic invasion (#80731):recycle by Gilmore (#98) Wed Jun  2 21:43:18 2010 CDT";
2$heart:unregister(this);