Section 17 - Thermal Detonator
The thermal detonator is a thing. The detonator can be armed or disarmed. It is disarmed. The detonator has a number called countdown. The countdown of the detonator is three. The description is "A standard fusion-based explosive device. Once armed, has a three-second fuse and a 6m blast radius."
Understand "detonator" as thermal detonator.
Understand "arm [detonator]" as arming.
Arming is an action applying to one carried thing.
To arm is a verb.
Check arming:
if the noun is armed, say "[The noun] is already armed." instead.
Carry out arming:
now the noun is armed.
Report arming:
say "[The actor] [arm] [the noun]."
Understand "disarm [detonator]" as disarming.
Disarming is an action applying to one carried thing.
To disarm is a verb.
Check disarming:
if the noun is disarmed, say "[The noun] is not armed." instead.
Carry out disarming:
now the noun is disarmed;
now the countdown of the noun is 3.
Report disarming:
say "[The actor] [disarm] [the noun]."
Every turn when the detonator is armed:
let the count be the countdown of the detonator;
let the place be the location of the detonator;
if the player is in the place begin;
if the count is 3, say "The detonator whines softly.";
if the count is 2, say "The detonator whines softly.";
if the count is 1, say "The detonator whines loudly.";
if the count is 0, say "The detonator explodes!";
end if;
if the player is not in the place begin;
if the count is 0, say "You hear an explosion.";
end if;
if the count is 0 begin;
let targets be the list of things who are in the place;
now the detonator is disarmed;
now the detonator is nowhere;
repeat with target running through targets begin;
if the target is a person, now the target is dead;
if the target is not a person, now the target is broken;
if the target is not a person, now the target is unfixable;
end repeat;
if the place is the Cornice begin;
now the place is collapsed;
end if;
end if;
now the countdown of the detonator is the countdown of the detonator - 1.