Mjolnir #214

Parent #5Owner #361Flags readSource hellcore/hellcore.db

Aliases: Mjolnir, weatherstick

14 verbs · 39 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
heartbeatthis none thisrxd#2144
debugthis none thisrxd#2141
change_random_pressurethis none thisrxd#21424
average_pressuresthis none thisrxd#2148
inspectthis none nonerxd#2148
average_pressurethis none thisrxd#21410
update_wind_roomthis none thisrxd#2145
drift_cloudsthis none thisrxd#21454
roomsthis none thisrxd#2141
simulatethis none thisrxd#21423
reset_pressurethis none thisrxd#2144
broadcast_tothis none thisrxd#2140
disperse_cloudsthis none thisrxd#21415
create_cloudthis none thisrxd#2145

Properties

PropertyDefinerFlagsOwnerValue
heart#214rc#36120
last_heartbeat#214rc#3611311761101
last_average#214rc#3611218494990
wind_room#214rc#361#169565
last_wind_room#214rc#3611218494931
last_drift_clouds#214rc#3611218494902
cloud_check#214rc#3614
last_reset_pressure#214rc#3611218410609
disperse_chance#214rc#36120
handed#5rc#361<clear>
wield_msg#5rc#361<clear>
unwield_msg#5rc#361<clear>
size#5rc#361<clear>
look_place_msg#5rc#361<clear>
value#5rc#361<clear>
get_msg#5rc#361<clear>
drop_msg#5rc#361<clear>
get_fail_msg#5rc#361<clear>
junk_ok#5rc#361<clear>
floats#5rc#361<clear>
long_name_msg#5rc#361<clear>
article#5rc#361""
setup_list#5rc#361<clear>
health#5rc#361<clear>
health_max#5rc#361<clear>
min_skill#5rc#361<clear>
skill#5rc#361<clear>
recipe_for#5rc#361<clear>
carried_msg#5rc#361<clear>
aliases#1rc#361{"Mjolnir", "weatherstick"}
description#1rc#361"A small metal figurine of Thor."
object_size#1r#29{9463, 1298434115}
hidden_verbs#1rc#361<clear>
phelp_msg#1rc#361<clear>
weight#1rc#361100
owner_verbs#1rc#361<clear>
plural_name#1rc#361<clear>
client_image#1rc#361<clear>
listening#1rc#361<clear>

Ancestry

Ancestors (nearest first): #5 generic thing#1 root

Children: none

Call graph

calls n214_0 #214:heartbeat n214_9 #214:simulate n214_0->n214_9 n214_2 #214:change_random_pressure n214_9->n214_2 n214_1 #214:debug n214_9->n214_1 n214_3 #214:average_pressures n214_9->n214_3 n214_6 #214:update_wind_room n214_9->n214_6 n214_7 #214:drift_clouds n214_9->n214_7 n214_10 #214:reset_pressure n214_9->n214_10 n214_12 #214:disperse_clouds n214_9->n214_12 n214_8 #214:rooms n214_2->n214_8 n47_25 #47:randomly_permute n214_2->n47_25 n20_59 #20:name_and_number n214_2->n20_59 n214_13 #214:create_cloud n214_2->n214_13 n214_5 #214:average_pressure n214_2->n214_5 n214_2->n214_1 n20_5 #20:from_list n214_2->n20_5 n214_13->n20_59 n214_13->n214_1 n103_1 #103:spawn n214_13->n103_1 n18_39 #18:mean n214_5->n18_39 n214_3->n214_8 n214_3->n47_25 n214_3->n214_5 n214_3->n214_1 n48_8 #48:suspend_if_needed n214_3->n48_8 n214_4 #214:inspect n214_4->n20_59 n214_4->n18_39 n107_43 #107:tell n214_4->n107_43 n112_7 #112:duration n214_4->n112_7 n214_6->n20_59 n214_6->n214_1 n214_6->n48_8 n47_43 #47:sort_prop n214_6->n47_43 n214_7->n214_1 n214_7->n48_8 n45_23 #45:leaves n214_7->n45_23 n20_34 #20:pronoun_sub n214_7->n20_34 n214_7->n103_1 n214_10->n214_8 n214_10->n214_1 n214_12->n214_1 n214_12->n48_8 n214_12->n45_23

Source

heartbeat

Spec this none thisFlags rxdOwner #361Definer #214

Referenced by

none

Source

1return;
2fork (0)
3this:simulate();
4endfork

debug

Spec this none thisFlags rxdOwner #361Definer #214

Referenced by

Source

1#38143:announce(this, tostr(@args), 1);

change_random_pressure

Spec this none thisFlags rxdOwner #361Definer #214

Referenced by

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

Spec this none thisFlags rxdOwner #361Definer #214

Referenced by

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

Spec this none noneFlags rxdOwner #361Definer #214

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

Spec this none thisFlags rxdOwner #361Definer #214

Referenced by

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

Spec this none thisFlags rxdOwner #361Definer #214

Referenced by

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

Spec this none thisFlags rxdOwner #361Definer #214

Referenced by

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

Spec this none thisFlags rxdOwner #361Definer #214

Referenced by

Source

1return #24855.contents;

simulate

Spec this none thisFlags rxdOwner #361Definer #214

Referenced by

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

Spec this none thisFlags rxdOwner #361Definer #214

Referenced by

Source

1this:debug("resetting pressures");
2for room in (this:rooms())
3room.pressure = 1000;
4endfor

broadcast_to

Spec this none thisFlags rxdOwner #361Definer #214

Referenced by

none

Source

No program (verb defined but unprogrammed).

disperse_clouds

Spec this none thisFlags rxdOwner #361Definer #214

Referenced by

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

Spec this none thisFlags rxdOwner #361Definer #214

Referenced by

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));