"A dump of #1140 on Sun Dec 17 13:52:58 1995 PST @create $root_class named Master Clock:master,clock @prop #1140."recycler" #6565 rc @prop #1140."burning" {} c @prop #1140."depots" {} rc ;;#1140.("depots") = {#175} @prop #1140."going" {} rc @prop #1140."last_cycle" 819235641 rc @prop #1140."last_cycle2" 819237026 rc @prop #1140."resurrection_task" 627452446 r @prop #1140."resurrection_interval" 60 rc @prop #1140."resurrection_queue" {} r ;;#1140.("resurrection_queue") = {{#15458, 819232205}, {#53798, 819230691}} @prop #1140."resurrection_queue_pos" 2 r ;;#1140.("key") = 0 ;;#1140.("aliases") = {"master", "clock"} ;;#1140.("object_size") = {7316, 819192265} @verb #1140:"heal" this none this @program #1140:heal ":heal() -> Decrement damage monitors on all dolls."; addb = $local.rpg; if (!addb:is_grandmaster(caller_perms())) return E_PERM; endif for doll in (addb.dolls) if ((ticks_left() < 500) || (seconds_left() < 2)) suspend(0); endif if (doll.last_action < this.last_cycle) if (typeof(inj = doll.inj) != NUM) doll.inj = 0; elseif (inj != 0) doll.inj = max(inj - doll.end, 0); endif if (typeof(ins = doll.ins) != NUM) doll.ins = 0; elseif (ins != 0) doll.ins = max((ins - (((ins + random(50)) - 1) / 50)) - doll.wil, 0); endif if (typeof(fat = doll.fat) != NUM) doll.fat = 0; elseif (doll.fat != 0) doll.fat = max((fat - (((fat + random(100)) - 1) / 50)) - (((doll.wil + doll.end) + doll.end) / 2), 0); endif endif endfor "Quinn 26-SEP-93 1051: Added fatigue healing."; "Profane 28-MAR-95 1715EST -- Add bit to reset non-numeric values."; . @verb #1140:"cycle" none none none rxd @program #1140:cycle if (caller_perms() == #2693) next = 1800 + random(900); fork (next) this:cycle(); this:heal(); this.last_cycle = time(); endfork endif . @verb #1140:"collect" none none none rxd @program #1140:collect if (caller_perms() == this.owner) from = args[1]; for thing in ($object_utils:descendants(from)) where = thing.location; if (where < #0) player:tell(thing.name, "(", thing, ") at ", where, " _not_ added to list."); elseif (($room in $object_utils:ancestors(where)) && (!(where in this.depots))) this.going = {@this.going, thing}; player:tell(thing.name, "(", thing, ") in ", where.name, "(", where, ") added to hit list."); endif endfor endif . @verb #1140:"flush" none none none rxd @program #1140:flush if (caller_perms() == this.owner) for thing in (this.going) player:tell(thing.name, "(", thing, ") is being recycled."); this.recycler:_recycle(thing); endfor this.going = {}; endif . @verb #1140:"heal(old)" this none this @program #1140:heal(old) if (caller_perms() == this.owner) for doll in (#46.dolls) #46:time_stop(); if (doll.last_action < this.last_cycle) if (doll.inj != 0) doll.inj = max(doll.inj - doll.end, 0); endif if (doll.ins != 0) doll.ins = max((doll.ins - (((doll.ins + random(50)) - 1) / 50)) - doll.wil, 0); endif endif endfor endif . @verb #1140:"restore_ATTs" this none this rx @program #1140:restore_ATTs ":restore_ATTs() -> Return temporarily modified atts on dolls to their original value."; addb = $local.rpg; if (!addb:is_grandmaster(caller_perms())) return E_PERM; endif activity = 0; for doll in (addb.dolls) if ((ticks_left() < 500) || (seconds_left() < 2)) suspend(0); endif if (length(doll.misc_notes)) activity = activity + doll:do_att_schedule(); endif endfor return {activity}; "Isagi 30-SEP-94 4:07P Added"; . @verb #1140:"cycle2" none none none rxd @program #1140:cycle2 if (caller_perms() == #2693) next = 10 * 60; fork (next) this:cycle2(); this:restore_ATTs(); this.last_cycle2 = time(); endfork endif "Isagi 30-SEP-94 4:43P Added This scheduler (hopefully) runs every ten minutes"; . @verb #1140:"cycle3" this none this @program #1140:cycle3 ":cycle3() => Continuously check this.death_queue for monsters to ressurect."; if ((caller != this) && (!caller_perms().wizard)) return E_PERM; elseif ($code_utils:task_valid(this.resurrection_task)) return E_NACC; endif this.resurrection_task = task_id(); while (this.resurrection_queue) ".resurrection_queue structure: LIST of {OBJ beastie, NUM time it died}"; suspend(this.resurrection_interval); pos = ((p = this.resurrection_queue_pos) > length(this.resurrection_queue)) ? 1 | p; beast = this.resurrection_queue[pos][1]; if ((((!$object_utils:isa(beast, $local.rpg.monster)) || beast.alive) || (typeof(gestate = beast.gestate) != NUM)) || (gestate < 0)) "What the heck is it doin in the queue?"; this.resurrection_queue = listdelete(this.resurrection_queue, pos); elseif (time() >= (this.resurrection_queue[pos][2] + gestate)) "Bring it back to life."; fork (0) beast:birth(); endfork this.resurrection_queue = listdelete(this.resurrection_queue, pos); else this.resurrection_queue_pos = pos + 1; endif endwhile . @verb #1140:"resurrect" this none this @program #1140:resurrect ":ressurrect() -- start the monster ressurrection cycle."; if (!(caller_perms() in $local.rpg.grand_masters)) return E_PERM; elseif ($code_utils:task_valid(id = this.resurrection_task)) kill_task(id); else fork (0) this:cycle3(); endfork return 1; endif . @verb #1140:"add_death" this none this @program #1140:add_death ":add_death(OBJ dead beast, [NUM time it died]) -- Add beast to queue for ressurection, time of death defaults to now."; if (!$local.rpg:trusted(caller_perms())) ret = E_PERM; elseif ((!valid(beast = args[1])) || (!$object_utils:isa(beast, $local.rpg.monster))) ret = E_NACC; elseif ((typeof(gestate = beast.gestate) != NUM) || (gestate < 0)) ret = E_RANGE; elseif (ret = $list_utils:iassoc(beast, this.resurrection_queue, 1)) else time = (length(args) > 2) ? (typeof(args[2]) == NUM) ? args[2] | time() | time(); pos = this.resurrection_queue_pos; ret = length(this.resurrection_queue = listinsert(this.resurrection_queue, {beast, time}, pos)); this.resurrection_queue_pos = pos + 1; endif if ((!$code_utils:task_valid(this.resurrection_task)) && this.resurrection_queu e) this:resurrect(); endif return ret; . @verb #1140:"remove_death" this none this @program #1140:remove_death ":remove_death(OBJ dead beast) -- remove beast from resurrection queue"; if (!$local.rpg:trusted(caller_perms())) return E_PERM; elseif (!(pos = $list_utils:iassoc(beast = args[1], this.resurrection_queue, 1))) return E_NONE; else return length(this.resurrection_queue = listdelete(this.resurrection_queue, pos)); endif . "***finished***