Mjolnir #214
Aliases: Mjolnir, weatherstick
14 verbs · 39 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
heartbeat | this none this | rxd | #214 | 4 |
debug | this none this | rxd | #214 | 1 |
change_random_pressure | this none this | rxd | #214 | 24 |
average_pressures | this none this | rxd | #214 | 8 |
inspect | this none none | rxd | #214 | 8 |
average_pressure | this none this | rxd | #214 | 10 |
update_wind_room | this none this | rxd | #214 | 5 |
drift_clouds | this none this | rxd | #214 | 54 |
rooms | this none this | rxd | #214 | 1 |
simulate | this none this | rxd | #214 | 23 |
reset_pressure | this none this | rxd | #214 | 4 |
broadcast_to | this none this | rxd | #214 | 0 |
disperse_clouds | this none this | rxd | #214 | 15 |
create_cloud | this none this | rxd | #214 | 5 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
heart | #214 | rc | #361 | 20 |
last_heartbeat | #214 | rc | #361 | 1311761101 |
last_average | #214 | rc | #361 | 1218494990 |
wind_room | #214 | rc | #361 | #169565 |
last_wind_room | #214 | rc | #361 | 1218494931 |
last_drift_clouds | #214 | rc | #361 | 1218494902 |
cloud_check | #214 | rc | #361 | 4 |
last_reset_pressure | #214 | rc | #361 | 1218410609 |
disperse_chance | #214 | rc | #361 | 20 |
handed | #5 | rc | #361 | <clear> |
wield_msg | #5 | rc | #361 | <clear> |
unwield_msg | #5 | rc | #361 | <clear> |
size | #5 | rc | #361 | <clear> |
look_place_msg | #5 | rc | #361 | <clear> |
value | #5 | rc | #361 | <clear> |
get_msg | #5 | rc | #361 | <clear> |
drop_msg | #5 | rc | #361 | <clear> |
get_fail_msg | #5 | rc | #361 | <clear> |
junk_ok | #5 | rc | #361 | <clear> |
floats | #5 | rc | #361 | <clear> |
long_name_msg | #5 | rc | #361 | <clear> |
article | #5 | rc | #361 | "" |
setup_list | #5 | rc | #361 | <clear> |
health | #5 | rc | #361 | <clear> |
health_max | #5 | rc | #361 | <clear> |
min_skill | #5 | rc | #361 | <clear> |
skill | #5 | rc | #361 | <clear> |
recipe_for | #5 | rc | #361 | <clear> |
carried_msg | #5 | rc | #361 | <clear> |
aliases | #1 | rc | #361 | {"Mjolnir", "weatherstick"} |
description | #1 | rc | #361 | "A small metal figurine of Thor." |
object_size | #1 | r | #29 | {9463, 1298434115} |
hidden_verbs | #1 | rc | #361 | <clear> |
phelp_msg | #1 | rc | #361 | <clear> |
weight | #1 | rc | #361 | 100 |
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): #5 generic thing → #1 root
Children: none
Call graph
Source
heartbeat
Referenced by
none
Source
1return; 2fork (0) 3this:simulate(); 4endfork
debug
Referenced by
- #214:change_random_pressure line 24:
this:debug - #214:average_pressures line 1:
this:debug - #214:average_pressures line 8:
this:debug - #214:update_wind_room line 5:
this:debug - #214:drift_clouds line 1:
this:debug - #214:simulate line 1:
this:debug - #214:reset_pressure line 1:
this:debug - #214:disperse_clouds line 1:
this:debug - #214:create_cloud line 5:
this:debug
Source
1#38143:announce(this, tostr(@args), 1);
change_random_pressure
Referenced by
- #214:simulate line 2:
this:change_random_pressure
Source
1"Change a random sky room's pressure."; 2rooms = this:rooms(); 3rooms = $lu:randomly_permute(rooms); 4rooms = rooms[1..min($, 3 + random(3))]; 5log = {}; 6for room in (rooms) 7if (!is_a(room, $skyroom)) 8continue; 9endif 10change = random(9); 11change = change - 5; 12if (change == 0) 13continue; 14endif 15room.pressure = room.pressure + change; 16log = listappend(log, tostr($su:nn(room), ":", change)); 17localrooms = room:_room_map_list(3, 3); 18pressures = $lu:map_property(localrooms, "pressure"); 19if ((room.pressure < (max(@pressures) - this.cloud_check)) || (room.pressure > (min(@pressures) + this.cloud_check))) 20this:create_cloud(room); 21this:average_pressure(room); 22endif 23endfor 24this:debug($su:from_list(log, ", "));
average_pressures
Referenced by
- #214:simulate line 11:
this:average_pressures
Source
1this:debug("averaging pressures start"); 2rooms = this:rooms(); 3rooms = $lu:randomly_permute(rooms); 4for room in (rooms) 5this:average_pressure(room); 6$cu:sin(); 7endfor 8this:debug("averaging pressures stop");
inspect
Referenced by
none
Source
1rooms = #24855.contents; 2pressures = $lu:map_property(rooms, "pressure"); 3average = $math_utils:average(pressures); 4player:tell("Average pressure is ", average); 5player:tell("Last averaging of pressure was ", $time:duration(time() - this.last_average), " ago"); 6player:tell("Last drifting of clouds was ", $time:duration(time() - this.last_drift_clouds), " ago"); 7player:tell("Last update of wind room was ", $time:duration(time() - this.last_wind_room), " ago"); 8player:tell("The current wind room is ", $su:nn(this.wind_room));
average_pressure
Referenced by
- #214:change_random_pressure line 21:
this:average_pressure - #214:average_pressures line 5:
this:average_pressure
Source
1{room} = args; 2if (!is_a(room, $skyroom)) 3raise(E_INVARG); 4endif 5rooms = room:_room_map_list(3, 3); 6pressures = $lu:map_property(rooms, "pressure"); 7average = $math_utils:average(@pressures); 8for room in (rooms) 9room.pressure = average; 10endfor
update_wind_room
Referenced by
- #214:simulate line 17:
this:update_wind_room
Source
1rooms = #24855.contents; 2rooms = $lu:sort_prop(rooms, "pressure"); 3this.wind_room = rooms ? rooms[1] | #-1; 4$cu:sin(3); 5this:debug("New wind room ", $su:nn(this.wind_room), " = ", this.wind_room.pressure);
drift_clouds
Referenced by
- #214:simulate line 22:
this:drift_clouds
Source
1this:debug("drifting clouds"); 2clouds = $ou:leaves($aweather); 3drifted = {}; 4for cloud in (clouds) 5$cu:sin(1); 6if (!is_a(cloud, $aweather)) 7continue; 8elseif (cloud.f) 9continue; 10elseif (!is_a(cloud.location, #79017)) 11continue; 12elseif (!cloud.drifts) 13continue; 14elseif (cloud.location == this.wind_room) 15continue; 16elseif (random(100) < 80) 17continue; 18elseif (!is_a(hop = cloud.location:next_hop_to(this.wind_room), $exit)) 19continue; 20elseif (((!is_a(hop.otherside, $exit)) || (!is_a(hop.otherside.location, $skyroom))) || (hop.otherside.location in drifted)) 21continue; 22endif 23drifting = random(cloud.accumulation); 24if (cloud.dispersable) 25left = cloud.accumulation - drifting; 26oldlocation = cloud.location; 27cloud.accumulation = drifting; 28if (m = cloud:drift_msg()) 29cloud.location:announce_all($su:ps(m, cloud, hop, hop.otherside.location)); 30endif 31if (m = cloud:odrift_msg()) 32hop.otherside.location:announce_all($su:ps(m, cloud, hop.otherside, cloud.location)); 33endif 34cloudparent = parent(cloud); 35cloud:moveto(hop.otherside.location); 36if (left) 37newcloud = $rpg:spawn(cloudparent); 38newcloud.accumulation = left; 39newcloud:moveto(oldlocation); 40endif 41else 42newcloud = $rpg:spawn(parent(cloud)); 43newcloud.accumulation = drifting; 44if (m = cloud:drift_msg()) 45cloud.location:announce_all($su:ps(m, cloud, hop, hop.otherside.location)); 46endif 47if (m = cloud:odrift_msg()) 48hop.otherside.location:announce_all($su:ps(m, cloud, hop.otherside, cloud.location)); 49endif 50newcloud.dispersable = 1; 51newcloud:moveto(hop.otherside.location); 52endif 53drifted = setadd(drifted, hop.otherside.location); 54endfor
rooms
Referenced by
- #214:change_random_pressure line 2:
this:rooms - #214:average_pressures line 2:
this:rooms - #214:reset_pressure line 2:
this:rooms
Source
1return #24855.contents;
simulate
Referenced by
- #214:heartbeat line 3:
this:simulate
Source
1this:debug("simulate"); 2this:change_random_pressure(); 3"Reset pressures every 24 hours."; 4if (this.last_reset_pressure < (time() - 86400)) 5this.last_reset_pressure = time(); 6this:reset_pressure(); 7endif 8"Average pressure every 10 minutes."; 9if (this.last_average < (time() - 600)) 10this.last_average = time(); 11this:average_pressures(); 12this:disperse_clouds(); 13endif 14"Update wind room every 5 minutes."; 15if (this.last_wind_room < (time() - 300)) 16this.last_wind_room = time(); 17this:update_wind_room(); 18endif 19"Drift clouds every 4 minutes."; 20if (this.last_drift_clouds < (time() - 240)) 21this.last_drift_clouds = time(); 22this:drift_clouds(); 23endif
reset_pressure
Referenced by
- #214:simulate line 6:
this:reset_pressure
Source
1this:debug("resetting pressures"); 2for room in (this:rooms()) 3room.pressure = 1000; 4endfor
broadcast_to
Referenced by
none
Source
No program (verb defined but unprogrammed).
disperse_clouds
Referenced by
- #214:simulate line 12:
this:disperse_clouds
Source
1this:debug("dispersing clouds"); 2clouds = $ou:leaves($aweather); 3for cloud in (clouds) 4$cu:sin(1); 5if (!is_a(cloud, $aweather)) 6continue; 7elseif (cloud.f) 8continue; 9elseif (!is_a(cloud.location, #79017)) 10continue; 11elseif (random(100) >= this.disperse_chance) 12continue; 13endif 14cloud:decrease_accumulation(random(cloud.accumulation)); 15endfor
create_cloud
Referenced by
- #214:change_random_pressure line 20:
this:create_cloud
Source
1room = args[1]; 2generic = (is_a(room.generic_cloud, $aweather) && room.generic_cloud.f) ? room.generic_cloud | $cloud; 3cloud = $rpg:spawn(generic); 4cloud:moveto(room); 5this:debug("created ", $su:nn(cloud), " in ", $su:nn(room));