Master Clock #1140

Parent Owner Flags Source rpg_march_2006/clock.txt

Aliases: master, clock

19 verbs · 25 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
healthis none this#114028
cyclethis none this#114016
collectthis none this#114014
flushnone none nonerxd#114011
restore_ATTsthis none this#114024
check_schedulethis none this#114027
cycle3(obsolete)this none this#114057
resurrect(obsolete)this none this#114011
add_deaththis none this#114021
remove_deaththis none this#11407
check_cyclesthis none this#114032
new_directionthis none this#114052
old_directionthis none this#114026
old_healthis none this#114021
not_checkpointthis none this#11401
susacleanthis none this#114019
cycle(old)this none this#114011
rebirththis none this#114051
cycle2(obsolete)this none this#114023

Properties

PropertyDefinerFlagsOwnerValue
recycler#1140rc#6565
burning#1140not readable (E_PERM)
depots#1140rc{#175}
going#1140rc{}
last_cycle#1140rc1141685372
last_cycle2#1140rc1141686249
resurrection_task#1140r1734019461
resurrection_queue#1140r{{#52484, 1141082078}, {#26608, 1141684100}, {#26388, 1141145668}, {#5632, 1141684074}, {#53798, 1141671684}, {#4981, 1141684119}, {#51765, 1141684079}, {#7057, 1141686031}, {#52165, 1141684096}}
resurrection_queue_pos#1140r10
monster_orphans#1140rc{}
storm_task#1140r1396710213
old_pcs#1140not readable (E_PERM)
old_dolls#1140not readable (E_PERM)
new_direction_msg#1140not readable (E_PERM)
old_direction_msg#1140not readable (E_PERM)
archive_interval#1140r604800
db_feature#1140rc#2470
clean_susa#1140r0
cycle_task#1140rc1222405917
next_rebirth#1140r1079617055
next_heal#1140r1141687594
next_att_check#1140r1141686849
key#1140not readable (E_PERM)
aliases#1140{"master", "clock"}
object_size#1140{33393, 1141286558}

Ancestry

Ancestors (nearest first): none

Children: none

Call graph

calls n1140_1 #1140:cycle n1140_0 #1140:heal n1140_1->n1140_0 n1140_5 #1140:check_schedule n1140_4 #1140:restore_ATTs n1140_5->n1140_4 n1140_6 #1140:cycle3(obsolete) n1140_14 #1140:not_checkpoint n1140_6->n1140_14 n1140_15 #1140:susaclean n1140_6->n1140_15 n1140_16 #1140:cycle(old) n1140_16->n1140_1 n1140_16->n1140_0 n1140_17 #1140:rebirth n1140_17->n1140_14 n1140_17->n1140_15 n1140_18 #1140:cycle2(obsolete) n1140_18->n1140_4

Source

heal

Spec this none thisDefiner #1140

Referenced by

Source

1":heal() -> Decrement damage monitors on all dolls.";
2"We set .inj directly here (in defiance of possible lifelinks) because it's faster and it doesn't happen frequently enough to get our knickers in a twist over it.  - THX";
3if ((rpg = $local.rpg):is_grandmaster(caller_perms()))
4  if (rpg.active_players)
5    {c_u, last_cycle, rpg_doll} = {$command_utils, this.last_cycle, rpg.doll};
6    factor = random(50) - 1;
7    for doll in (rpg.dolls)
8      rpg:s_i_f_i_n();
9      if ((parent(doll) == rpg_doll) && (doll.last_action < last_cycle))
10        {inj, ins, fat, end, wil} = {doll.inj, doll.ins, doll.fat, doll.end, doll.wil};
11        if (!doll.deathless)
12          doll.inj = `max(0, inj - end) ! E_TYPE => 0';
13          doll.inj || clear_property(doll, "inj");
14        endif
15        doll.ins = `max(0, (ins - ((ins + factor) / 50)) - wil) ! E_TYPE => 0';
16        doll.ins || clear_property(doll, "ins");
17        doll.fat = `max(0, (fat - ((fat + (2 * factor)) / 50)) - (((wil + end) + end) / 2)) ! E_TYPE => 0';
18        doll.fat || clear_property(doll, "fat");
19      endif
20    endfor
21  else
22    return;
23  endif
24else
25  return E_PERM;
26endif
27"Profane 17-AUG-97 809PDT -- new 1.8 version";
28"THX (#105941) - Sun Apr 12, 1998 - Made this a bit speedier in CPU usage.";

cycle

Spec this none thisDefiner #1140

Referenced by

Source

1":cycle() => Run the universal RPG healing task.";
2"New paradigm: don't use a suspended background task. Have #49444:rest call this.";
3if ((time() < this.next_heal) || $code_utils:task_valid(this.cycle_task))
4  return E_NONE;
5elseif (caller_perms() == (rpg = $local.rpg).owner)
6  if (rpg.gm_lag < rpg.idle_threshold)
7    fork x (5)
8      this.next_heal = time() + 2222;
9      this:heal();
10      this.last_cycle = time();
11    endfork
12    this.cycle_task = x;
13  endif
14else
15  return E_PERM;
16endif

collect

Spec this none thisDefiner #1140

Referenced by

none

Source

1":collect(OBJ parent) => loops through kids of PARENT and adds those in $nowhere to the .going list. One can then recycle all these kids via :flush";
2if (caller_perms() == this.owner)
3  {from} = args;
4  rpg = $local.rpg;
5  for thing in ($object_utils:descendants(from))
6    where = thing.location;
7    if (where == $nowhere)
8      player:tell(thing.name, "(", thing, ") at ", where, " _not_ added to list.");
9    elseif (($room in rpg:parents(where)) && (!(where in this.depots)))
10      this.going = {@this.going, thing};
11      player:tell(thing.name, "(", thing, ") in ", where.name, "(", where, ") added to hit list.");
12    endif
13  endfor
14endif

flush

Spec none none noneFlags rxdDefiner #1140

Referenced by

none

Source

1":flush() -> recycle everything in this.going, which is set via :collect";
2if (caller_perms() == this.owner)
3  rpg = $local.rpg;
4  return;
5  for thing in (this.going)
6    player:tell(thing.name, "(", thing, ") is being recycled.");
7    rpg.recycler:_recycle(thing);
8  endfor
9  this.going = {};
10endif
11"THX (#105941) - Sat Mar 24, 2001 - disabled.  what the heck was this supposed to do?";

restore_ATTs

Spec this none thisDefiner #1140

Referenced by

Source

1":restore_ATTs(OBJ monster that triggered execution) -> Return temporarily modified atts on dolls to their original value.";
2{monster} = args;
3(rpg = $local.rpg):secure();
4past_day = time() - (40 * rpg.idle_threshold);
5active_players = 0;
6for doll in (setremove(rpg.dolls, `monster.doll ! E_PROPNF => $nothing'))
7  if (doll.last_action > past_day)
8    rpg:s_i_n();
9    try
10      doll:check_schedule();
11      if (is_player(doll.character))
12        active_players = active_players + 1;
13      endif
14    except (ANY)
15      "Doll got recycled during suspend. Oh well.";
16    endtry
17  endif
18endfor
19rpg.active_players = active_players;
20"Isagi 30-SEP-94 4:07P Added";
21"Irin Sat Sep 28 14:26:40 1996 PDT -- Changed att_schedule to doll:check_schedule.";
22"THX 18-Jun-1997  -- Hacked to check only dolls that have done anything in the past 24 hours.";
23"THX 21-Sept-1997  -- Added a counter to determine how many players are active and store that value in rpg.active_players.";
24"THX (#105941) - Sun Apr 15, 2001 - Changed this to be triggered (via :check_schedule) by a monster moving through a secure exit.  Removed that monster from the schedule checking so it doesn't look too \"busy\".";

check_schedule

Spec this none thisDefiner #1140

Referenced by

none

Source

1":check_schedule() -- run the universal RPG stat-restoring cycle.";
2if ((time() < this.next_att_check) || $login.checkpoint_in_progress)
3  return E_NONE;
4elseif (caller_perms() == (rpg = $local.rpg).owner)
5  this.next_att_check = (time() + 600) + rpg.gm_lag;
6  if (rpg.gm_lag < rpg.idle_threshold)
7    this:restore_ATTs(@args);
8    this.last_cycle2 = time();
9  endif
10  "archiver = rpg.archiver;";
11  "if (archiver.last_doll_archive + this.archive_interval < time())";
12  "  archiver.last_doll_archive = time();";
13  "  \"... :doll_archive will set this, too, but we ...\";";
14  "  \"... don't want this verb calling it more than...\";";
15  "  \"... once while it's still running            ...\";";
16  "  fork (rpg.gm_lag)";
17  "    archiver:doll_archive();";
18  "  endfork";
19  "endif";
20else
21  return E_PERM;
22endif
23"Isagi 30-SEP-94 4:43P Added  This scheduler (hopefully) runs every ten minutes";
24"THX1138 20-Jun-1997 --  Added a call to .gm_lag to back this task off a bit if G_M is really lagged.  Every 10 minutes is desirable, but not essential.";
25"Mooshie (#106469) - Sat Oct 30, 1999 - Added a hook for the doll archival task. Seemed an appropriate place.";
26"THX (#105941) - Sun Apr 15, 2001 - Changed this to be triggered instead of cycling eternally.";
27"Profane (#30788) - Wed Jun 13, 2001 - NBCi go boom, we not have new archive site yet, no doll archive for joo. suck it up.";

cycle3(obsolete)

Spec this none thisDefiner #1140

Referenced by

none

Source

1":cycle3() => Continuously check this.death_queue for monsters to resurrect.";
2if ((caller != this) && (!caller_perms().wizard))
3  return E_PERM;
4elseif ($code_utils:task_valid(this.resurrection_task))
5  return E_NACC;
6endif
7this.resurrection_task = task_id();
8cemetery = (rpg = $local.rpg).cemetery;
9while (this.resurrection_queue)
10  ".resurrection_queue structure: LIST of {OBJ beastie, NUM time it died}";
11  suspend(this.resurrection_interval);
12  pos = ((p = this.resurrection_queue_pos) > length(this.resurrection_queue)) ? 1 | p;
13  try
14    {beast, time} = this.resurrection_queue[pos];
15  except (E_RANGE)
16    "Means we have a blank resurrection queue";
17    break;
18  endtry
19  if ((((!rpg:is_monster(beast)) || (beast.location != cemetery)) || (typeof(`gestate = beast.gestate ! E_PROPNF, E_PERM') != NUM)) || (gestate < 0))
20    "What the heck is it doin in the queue?";
21    this.resurrection_queue = listdelete(this.resurrection_queue, pos);
22  elseif (this:not_checkpoint() && (time() >= (time + gestate)))
23    "Bring it back to life.";
24    fork (4 + rpg.gm_lag)
25      if (!beast.alive)
26        try
27          beast:birth();
28        except x (ANY)
29          "Notify the beast's owner";
30          $mail_agent:send_message(this, {beast.owner}, {"Error birthing " + $string_utils:nn(beast), {#4044}}, ($string_utils:from_value(x, 1, 5) + " ") + tostr(beast));
31        endtry
32      endif
33    endfork
34    this.resurrection_queue = listdelete(this.resurrection_queue, pos);
35    this.monster_orphans = setadd(this.monster_orphans, beast);
36    if (this.clean_susa)
37      this:susaclean();
38      this.clean_susa = 0;
39    endif
40    "If all is well the cemetery's :exitfunc will remove the beast from the orphans list.";
41  elseif ((!this.clean_susa) && (!this:not_checkpoint()))
42    this.clean_susa = 1;
43  elseif (time() >= ((time + gestate) - this.resurrection_interval))
44    "... do nothing this critter will be born next pass ... ";
45  else
46    this.resurrection_queue_pos = pos + 1;
47  endif
48  this.resurrection_interval = (60 + min(rpg.idle_threshold, 3 * rpg.gm_lag)) - (length(this.resurrection_queue) * (!this.clean_susa));
49endwhile
50"StarDancer -  7:17 15-Aug-1996 EDT - changed test from beast.alive to testing if the critter's in the cemetery.";
51"Profane 20-AUG-96 0920PDT -- orphan stuff.";
52"THX 16-Apr-1997 --  Changed $object_utils:is(beast, $local.rpg.monster) to rpg:is_monster(beast) and shaved off a few ticks.";
53"THX 21-Jun-1997 --  Added a dynamic to the .resurrection_interval; the code can now add up to two additional minutes to the interval if G_M is really lagged.";
54"Profane 8-AUG-97 2110PDT -- check .alive inside the forked birth task";
55"Profane (#30788) - Mon Oct  6 17:49:28 1997 PDT - Added mail message in case of error in birthing.";
56"THX 11-Dec-1997  -- Added a conditional that lets the queue hang back if the critter it's looking at will be birthed next pass through.";
57"THX (#105941) - Tue Nov  9, 1999 - Don't birth during checkpoint.  Clean Susa before resuming.";

resurrect(obsolete)

Spec this none thisDefiner #1140

Referenced by

none

Source

1":resurrect() -- start the monster resurrection cycle.";
2if (!(caller_perms() in $local.rpg.grand_masters))
3  return E_PERM;
4elseif ($code_utils:task_valid(id = this.resurrection_task))
5  kill_task(id);
6else
7  fork (5)
8    this:cycle3();
9  endfork
10  return 1;
11endif

add_death

Spec this none thisDefiner #1140

Referenced by

none

Source

1":add_death(OBJ dead beast, [NUM time it died]) -- Add beast to queue for ressurection, time of death defaults to now.";
2(rpg = $local.rpg):secure();
3this.resurrection_queue = (typeof(this.resurrection_queue) == ERR) ? {} | this.resurrection_queue;
4if ((!valid(beast = args[1])) || (!rpg:is_monster(beast)))
5  ret = E_NACC;
6elseif ((typeof(gestate = beast.gestate) != NUM) || (gestate < 0))
7  ret = E_RANGE;
8elseif (ret = $list_utils:iassoc(beast, this.resurrection_queue, 1))
9else
10  time = (length(args) > 2) ? (typeof(args[2]) == NUM) ? args[2] | time() | time();
11  pos = this.resurrection_queue_pos;
12  ret = length(this.resurrection_queue = listinsert(this.resurrection_queue, {beast, time}, pos));
13  this.resurrection_queue_pos = pos + 1;
14endif
15"if ((!$code_utils:task_valid(this.resurrection_task)) && this.resurrection_queue)";
16"  force_input(this.owner, \";$local.rpg.clock:resurrect()\");";
17"this:resurrect();";
18"endif";
19return ret;
20"THX (#105941) - Thu Mar 12, 1998 - Added a force_input so that G_M takes 'possession' of the queue checking.";
21"THX (#105941) - Sun Apr 15, 2001 - Removed the resurrect cycle restart code.  Now triggered by cemetery enterfunc instead.";

remove_death

Spec this none thisDefiner #1140

Referenced by

none

Source

1":remove_death(OBJ dead beast) -- remove beast from resurrection queue";
2$local.rpg:secure();
3if (pos = $list_utils:iassoc(beast = args[1], this.resurrection_queue, 1))
4  return length(this.resurrection_queue = listdelete(this.resurrection_queue, pos));
5else
6  return E_NONE;
7endif

check_cycles

Spec this none thisDefiner #1140

Referenced by

none

Source

1":check_cycles() -> called by ~vacuum:cycle, checks other continous forked RPG tasks and starts them up if they're dead.";
2$local.rpg:secure();
3tasks = queued_tasks();
4c1 = c2 = mtask = ltask = ctask = 1;
5for item in (tasks)
6  if ((item[7] == "cycle") && (item[6] == this))
7    "c1 = 0;";
8    "elseif ((item[7] == \"cycle2\") && (item[6] == this))";
9    "  c2 = 0;";
10    "elseif ((item[7] == \"my_suspend\") && (item[6] == #94427))";
11    "  mtask = 0;";
12  elseif ((item[7] == "my_suspend") && (item[6] == #48923))
13    ltask = 0;
14    "elseif ((item[7] == \"cycle\") && (item[6] == $local.rpg.vacuum))";
15    "  \"ctask = 0;\";";
16  endif
17endfor
18"c1 ? this:cycle() | \"\";";
19"Restart main healing cycle task";
20"c2 ? this:cycle2() | \"\";";
21"Restart att restoration cycle";
22"mtask ? #94427:pump() | \"\";";
23"Restart magnetic object heart";
24ltask ? #48923:pump() | "";
25"Restart light source heart";
26"ctask ? $local.rpg.vacuum:cycle() | \"\";";
27"Restart object cleanup/recyling cycle";
28"((!$code_utils:task_valid(this.resurrection_task)) && this.resurrection_queue) ? this:cycle3() | \"\";";
29"Restart monster ressurection cycle, if there are any monsters to be resurrected.";
30"Profane 5-AUG-96 1547PDT -- Added";
31"Profane (#30788) - Wed Mar 18, 1998 - simplify security";
32"THX (#105941) - Sun Apr 15, 2001 - Commented out cycle(), cycle2(), cycle3(), and vacuum:cycle() tasks that are now on triggers.";

new_direction

Spec this none thisDefiner #1140

Referenced by

none

Source

1if (!(rpg = $local.rpg):is_grandmaster(caller_perms()))
2  return E_PERM;
3else
4  "Save all player's dolls, move their equipment away, and give them new dolls.";
5  rpg.doll.paralyzed = 1;
6  pcs = rpg.pcs;
7  dolls = rpg.dolls;
8  this.old_pcs = this.old_dolls = {};
9  for i in [1..length(rpg.pcs)]
10    if (is_player(rpg.pcs[i]))
11      this.old_pcs = listappend(this.old_pcs, rpg.pcs[i]);
12      this.old_dolls = listappend(this.old_dolls, rpg.dolls[i]);
13      pcs = setremove(pcs, rpg.pcs[i]);
14      dolls = setremove(dolls, rpg.dolls[i]);
15    endif
16    rpg:time_stop(rpg:gm_lag());
17  endfor
18  if (length($set_utils:union(this.old_pcs, pcs)) != length(rpg.pcs))
19    return E_NACC;
20  endif
21  "OK, at this point PCS contains all monsters, and DOLLS contains all monster dolls. OLD_PCS and OLD_DOLLS contain the same, only for players.";
22  "Time to move the equipment (to the doll, for simplicity).";
23  for i in [1..length(this.old_pcs)]
24    dude = this.old_pcs[i];
25    doll = this.old_dolls[i];
26    claimed = doll:claimed_objects();
27    carried = rpg.user_utils.quinn:class_list(dude.contents, rpg.thing);
28    for item in ({@claimed, @carried})
29      `item:moveto(doll) ! ANY';
30      "if (item.location != doll)";
31      "  return E_INVIND;";
32      "endif";
33      rpg:time_stop(rpg:gm_lag());
34    endfor
35  endfor
36  "OK items now stowed. Issue new dolls.";
37  "First redo rpg.pcs and rpg.dolls";
38  rpg.pcs = pcs;
39  rpg.dolls = dolls;
40  for dude in (this.old_pcs)
41    rpg:def_pc(dude);
42    rpg:time_stop(rpg:gm_lag());
43  endfor
44  $mail_agent:send_message(this.owner, {rpg.news, #21259}, "LambdaMOO RPG Takes a New Direction", this.new_direction_msg);
45  q = queued_tasks();
46  for item in (q)
47    if (q[6] == rpg.vacuum)
48      kill_task(q[1]);
49    endif
50  endfor
51  rpg.doll.paralyzed = 0;
52endif

old_direction

Spec this none thisDefiner #1140

Referenced by

none

Source

1if (!(rpg = $local.rpg):is_grandmaster(caller_perms()))
2  return E_PERM;
3else
4  "put it all back..";
5  rpg.doll.paralyzed = 1;
6  for i in [1..length(rpg.pcs)]
7    who = rpg.pcs[i];
8    if (j = who in this.old_pcs)
9      old_doll = rpg.dolls[i];
10      doll = this.old_dolls[j];
11      rpg.pcs[i] = doll;
12      for item in (doll.contents)
13        `item:moveto(who) ! ANY';
14        rpg:time_stop(rpg:gm_lag());
15      endfor
16      old_doll.character = #-1;
17      `rpg.recycler:_recycle(old_doll) ! ANY';
18    endif
19  endfor
20  $mail_agent:send_message(this.owner, {rpg.news, #21259}, "LambdaMOO RPG Takes an Old Direction", this.old_direction_msg);
21  q = queued_tasks();
22  if (!(i = rpg.vacuum in $list_utils:slice(q, 6)))
23    rpg.vacuum:cycle();
24  endif
25  rpg.doll.paralyzed = 0;
26endif

old_heal

Spec this none thisDefiner #1140

Referenced by

none

Source

1":heal() -> Decrement damage monitors on all dolls.";
2if ((rpg = $local.rpg):is_grandmaster(caller_perms()))
3  if (!rpg.active_players)
4    return;
5  endif
6  factor = random(50) - 1;
7  for doll in (rpg.dolls)
8    $command_utils:suspend_if_needed(2 * rpg:gm_lag());
9    if ((parent(doll) == rpg.doll) && (doll.last_action < this.last_cycle))
10      {inj, ins, fat, end, wil} = {doll.inj, doll.ins, doll.fat, doll.end, doll.wil};
11      if (!doll.deathless)
12        doll.inj = `max(0, inj - end) ! E_TYPE => 0';
13      endif
14      doll.ins = `max(0, (ins - ((ins + factor) / 50)) - wil) ! E_TYPE => 0';
15      doll.fat = `max(0, (fat - ((fat + (2 * factor)) / 50)) - (((wil + end) + end) / 2)) ! E_TYPE => 0';
16    endif
17  endfor
18else
19  return E_PERM;
20endif
21"Profane 17-AUG-97 809PDT -- new 1.8 version";

not_checkpoint

Spec this none thisDefiner #1140

Referenced by

Source

1return !$login.checkpoint_in_progress;

susaclean

Spec this none thisDefiner #1140

Referenced by

Source

1"Copied from THX's GM FO (#98965):@susa by THX (#105941) Tue Nov  9 11:20:28 1999 PST";
2rpg = $local.rpg;
3{susa, bad, trash} = {rpg.object_db.obj_money[1].owner, {}, $garbage};
4for t in (susa.owned_objects)
5  rpg:s_i_f_i_n();
6  if (((!valid(t)) || (!valid(parent(t)))) || (parent(t) == trash))
7    bad = {@bad, t};
8  endif
9endfor
10quiet = caller == this;
11if (bad)
12  quiet || player:tell("The following bad objects were found in ", susa.name, "'s owned_objects: ", $string_utils:nn(bad));
13  for t in (bad)
14    susa:cleanup(t);
15  endfor
16else
17  quiet || player:tell("No invalid or $garbage items were found on ", susa.name, "'s owned_objects list.");
18endif
19quiet ? $byte_quota_utils:summarize_one_user(susa) | $byte_quota_utils:do_summary(susa);

cycle(old)

Spec this none thisDefiner #1140

Referenced by

none

Source

1":cycle() => Run the universal RPG healing task.";
2if (caller_perms() == (rpg = $local.rpg).owner)
3  next = 1800 + random(900);
4  fork (next)
5    this:cycle();
6    if (rpg.gm_lag < rpg.idle_threshold)
7      this:heal();
8      this.last_cycle = time();
9    endif
10  endfork
11endif

rebirth

Spec this none thisDefiner #1140

Referenced by

none

Source

1if ((time() < this.next_rebirth) || (!this.resurrection_queue))
2  return E_NONE;
3endif
4cemetery = (rpg = $local.rpg).cemetery;
5if (caller != cemetery)
6  return E_PERM;
7elseif ($code_utils:task_valid(this.resurrection_task) && $code_utils:owns_task(this.resurrection_task, rpg.owner))
8  return E_NACC;
9elseif ($list_utils:iassoc("read_lines_escape", queued_tasks(), 7))
10  return E_QUOTA;
11endif
12this.resurrection_task = task_id();
13".resurrection_queue structure: LIST of {OBJ beastie, NUM time it died}";
14pos = ((p = this.resurrection_queue_pos) > length(this.resurrection_queue)) ? 1 | p;
15try
16  {beast, time} = this.resurrection_queue[pos];
17except (E_RANGE)
18  "Means we have a blank resurrection queue";
19endtry
20this.next_rebirth = (this.next_rebirth + (60 + min(rpg.idle_threshold, 3 * rpg.gm_lag))) - (length(this.resurrection_queue) * (!this.clean_susa));
21if ((((!rpg.object_db:is_monster(beast)) || (beast.location != cemetery)) || (typeof(`gestate = beast.gestate ! E_PROPNF, E_PERM') != NUM)) || (gestate < 0))
22  "What the heck is it doin in the queue?";
23  this.resurrection_queue = listdelete(this.resurrection_queue, pos);
24elseif (this:not_checkpoint() && (time() >= (time + gestate)))
25  "Bring it back to life.";
26  fork (3 + rpg.gm_lag)
27    if (!beast.alive)
28      try
29        force_input(this.owner, tostr("quietbirth ", beast));
30      except x (ANY)
31        "Notify the beast's owner";
32        $mail_agent:send_message(this, {beast.owner}, {"Error birthing " + $string_utils:nn(beast), {rpg.object_db.bugs}}, ($string_utils:from_value(x, 1, 5) + " ") + tostr(beast));
33      endtry
34    endif
35  endfork
36  this.resurrection_queue = listdelete(this.resurrection_queue, pos);
37  this.monster_orphans = setadd(this.monster_orphans, beast);
38  if (this.clean_susa)
39    this:susaclean();
40    this.clean_susa = 0;
41  endif
42  "If all is well the cemetery's :exitfunc will remove the beast from the orphans list.";
43elseif ((!this.clean_susa) && (!this:not_checkpoint()))
44  this.clean_susa = 1;
45elseif (this.next_rebirth >= (time + gestate))
46  "... do nothing this critter will be born next pass ... ";
47else
48  this.resurrection_queue_pos = pos + 1;
49endif
50"THX (#105941) - Sun Apr 15, 2001 - Moved essential code from this:cycle3() and altered it to trigger from cemetery's enterfunc.   G_M force_inputs the birth call so player's won't get the TBs.";
51"THX (#105941) - Wed Apr 18, 2001 - Put a $code_utils:owns_task() in there too.  Doesn't take many ticks and doesn't run often.";

cycle2(obsolete)

Spec this none thisDefiner #1140

Referenced by

none

Source

1":cycle2() -- run the universal RPG stat-restoring cycle.";
2if (caller_perms() == (rpg = $local.rpg).owner)
3  fork (600 + rpg.gm_lag)
4    this:cycle2();
5    if (rpg.gm_lag < rpg.idle_threshold)
6      this:restore_ATTs();
7      this.last_cycle2 = time();
8    endif
9    archiver = rpg.archiver;
10    if ((archiver.last_doll_archive + this.archive_interval) < time())
11      archiver.last_doll_archive = time();
12      "... :doll_archive will set this, too, but we ...";
13      "... don't want this verb calling it more than...";
14      "... once while it's still running            ...";
15      fork (0)
16        archiver:doll_archive();
17      endfork
18    endif
19  endfork
20endif
21"Isagi 30-SEP-94 4:43P Added  This scheduler (hopefully) runs every ten minutes";
22"THX1138 20-Jun-1997 --  Added a call to :gm_lag() to back this task off a bit if G_M is really lagged.  Every 10 minutes is desirable, but not essential.";
23"Mooshie (#106469) - Sat Oct 30, 1999 - Added a hook for the doll archival task. Seemed an appropriate place.";