Counterfeit Monkey — 237 of 292

Emily Short

Release 6

Section 12 - Power Cord

[This section incorporates the power cord but also the rest of the socketry, etc. It would also have been reasonable to define this stuff in the Generator Room section, but it felt easier to keep all the relevant parts together in one place.

Plugging things into other things is one of those maddening verbs that needs a lot of implementation just to cover the standard idiomatic ways of talking about it. We want the player to feel there's enough depth here that they can unplug bits individually, but "PLUG IN DAIS" should also just work, given the presence of the power cord.

Another complication comes from the destructibility of objects; if the player gels or anagrams the power cord while it's plugged in, it should automatically unplug, or some weird results may appear when it's reconstructed.]

Test cord with "test chord / get cord / test plugging".

Test plugging with "look / x socket / x wall socket / x dais / x dais socket / get wall socket / get dais socket / plug cord into wall socket / plug plug into dais socket / unplug dais / unplug wall socket / plug wall socket into dais / unplug cord / plug cord into dais / take plug / unplug cord / plug in dais / test gun-ownership / shoot cord with gun / look / shoot crow with gun / x cord / unplug cord / plug in dais" in the Workshop.

Test gun-ownership with "load gun" holding the anagramming gun and the bullets.

A ranking rule when the power cord is mentionable:

increase the description-rank of the power cord by 10;

increase the description-rank of the programmable dais by 12.

Definition: a power cord is deeply dull if 1 is 2.

A dangerous destruction rule for the power cord:

while a massive plug (called target plug) is plugged into something (called the other):

now the target plug is not plugged into the other.

Rule for writing a topic sentence about the power cord:

say "[A power cord] snakes across the ground";

if a massive plug is plugged into the dais socket and a massive plug is plugged into the wall socket:

say ", connecting [the dais socket] to [the wall socket]. ";

otherwise if a massive plug is plugged into the dais socket:

say ", plugged into [the dais socket] and with the other end dangling free. ";

otherwise if a massive plug is plugged into the wall socket:

say ", one end plugged into [the wall socket] but the other unattached. ";

otherwise:

say ". Neither end is currently plugged into anything. ";

say run paragraph on.

The description of the power cord is "This is the heaviest-duty cabling I've ever seen in my life: thick as a snake, covered in yellow sheathing, with a [random massive plug] at each end."

The massive plug is a kind of thing. The description of a massive plug is "There are [unless the player wears the Britishizing goggles]two flat parallel prongs and one round grounding prong[otherwise]two flat horizontal prongs and one flat vertical prong[end if]. The prongs look extraordinarily sturdy and determined." Understand "prong" or "prongs" as a massive plug.

Two massive plugs are part of the power cord.

A power socket is a kind of thing. The description of a power socket is usually "[if something is plugged into the item described]A power socket, with one end of the power cord currently plugged in[otherwise]A power socket suitable for plugging a cord into[end if]."

A power socket called a wall socket is fixed in place in the Workshop. "A specialized wall socket is built into the east wall, clearly not part of the ordinary power system for the Bureau."

A power socket called a dais socket is part of the programmable dais.

After printing the name of the dais socket while examining:

say "[if something is plugged into the dais socket and there is a free massive plug] (with power cord attached, though the cord connects to nothing)[otherwise if something is plugged into the dais socket] (from which a power cord runs to the wall)[otherwise] (with no cord currently plugged in)[end if]"

Attachment relates one massive plug to one power socket. The verb to be plugged into implies the attachment relation.

Sanity-check an actor inserting the power cord into a power socket:

if a free massive plug (called target plug) is part of the power cord:

try the actor plugging the target plug into the second noun instead.

Sanity-check inserting a massive plug into a power socket:

try the actor plugging the noun into the second noun instead.

Sanity-check taking a massive plug:

if the noun is plugged into something (called the target):

try unplugging the noun from the target instead;

otherwise:

try taking the power cord instead.

Understand "unplug [a massive plug] from [a power socket]" as unplugging it from. Understand "unplug [something] from [something]" as unplugging it from. Unplugging it from is an action applying to two things. Understand "unplug [something]" as unplugging it from.

Rule for supplying a missing second noun when unplugging something from:

if the noun is a massive plug:

if the noun is plugged into something (called target socket):

now the second noun is the target socket;

otherwise:

say "[The noun] is not plugged in anyhow." instead;

otherwise if the noun is a power socket:

if something (called target plug) is plugged into the noun:

now the second noun is the noun;

now the noun is the target plug;

otherwise:

say "Nothing is plugged into [the noun] anyway." instead;

otherwise if the noun incorporates a power socket (called target socket):

if something (called target plug) is plugged into the target socket:

now the second noun is the target socket;

now the noun is the target plug;

otherwise:

say "Nothing is plugged into [the noun] anyway." instead;

Sanity-check unplugging something which incorporates a power socket from something which incorporates a power socket:

try freeing the power cord instead.

Sanity-check unplugging something which is not a massive plug from something:

say "[The noun] [is-are] not a plug to start with." instead.

Sanity-check unplugging something from something which is not a power socket:

say "[The second noun] [is-are] not a socket." instead.

Sanity-check unplugging a free massive plug from something:

say "[The noun] [is-are] not plugged in anyway." instead.

Carry out unplugging something from something:

now the noun is not plugged into the second noun.

Report unplugging something from something:

say "[You] unplug [the noun] from [the second noun][if two free massive plugs are part of the power cord]. Both ends of the power cord are now free[otherwise]. The other plug is still attached to [the random power socket which is not the second noun][end if]."

Understand "unplug [the power cord]" as freeing. Freeing is an action applying to one thing.

Sanity-check freeing the power cord:

if the number of free massive plugs is 2:

say "The power cord is already detached." instead.

Carry out freeing:

repeat with item running through massive plugs which are plugged into a power socket:

if the item is plugged into a power socket (called target socket):

try unplugging the item from the target socket.

Understand "plug [a free massive plug] into [a power socket]" as plugging it into. Understand "plug [a massive plug] into [a power socket]" as plugging it into. Understand "plug [something] into [something]" as plugging it into.

Understand "plug in [a free massive plug] to [a power socket]" as plugging it into. Understand "plug in [a massive plug] to [a power socket]" as plugging it into. Understand "plug in [something] to [something]" as plugging it into.

Plugging it into is an action applying to two things.

Definition: a massive plug is free if it is not plugged into a power socket.

Sanity-check plugging something which is not a massive plug into a power socket:

if the noun is the power cord:

if a massive plug (called target plug) is free:

try plugging the target plug into the second noun instead;

otherwise:

say "The power cord is already fully plugged in." instead;

say "That's not what the best electrical safety engineers recommend." instead.

Sanity-check plugging a massive plug into something which is not a power socket:

say "Better look for a socket instead." instead.

Sanity-check plugging the power cord into something:

if the second noun is a power socket:

if a massive plug (called target plug) is free:

try plugging the target plug into the second noun instead;

otherwise:

say "The plugs are fully plugged in already." instead;

otherwise if the second noun incorporates a power socket (called target socket):

if a massive plug (called target plug) is free:

try plugging the target plug into the target socket instead;

otherwise:

say "The plugs are fully plugged in already." instead;

Carry out plugging a massive plug into a power socket:

if the power cord is not in the location:

silently try dropping the power cord;

now the noun is plugged into the second noun.

Report plugging a massive plug into a power socket:

say "[You] plug the power cord firmly into [the second noun][if a free massive plug is part of the power cord]. The other end remains free and not plugged into anything[otherwise]. Both ends of the power cord are now plugged in, so the dais is connected to the wall socket[end if]." instead.

Sanity-check going somewhere when the player carries the power cord:

if the number of free massive plugs is less than 2:

try dropping the power cord;

if the player carries the power cord:

stop the action.

Understand "plug [a power socket] into [a power socket]" as connecting it to. Understand "plug in [a power socket] in [a power socket]" as connecting it to. Connecting it to is an action applying to two things.

Sanity-check an actor connecting something to something:

if the actor does not carry the power cord:

if the actor can see the power cord:

try the actor taking the power cord;

if the actor does not carry the power cord:

if the actor is the player:

say "Some kind of power cord would be needed to bridge the gap.";

stop the action.

Carry out an actor connecting something to something:

unless something is plugged into the noun:

let the target plug be a random free massive plug;

try plugging the target plug into the noun;

if a massive plug (called next target plug) is free:

try plugging the next target plug into the second noun;

Understand "plug in [something]" as connecting.

Connecting is an action applying to one thing.

Sanity-check connecting something:

if the noun is a power socket:

make no decision;

if the noun is a massive plug:

make no decision;

if the noun incorporates a power socket:

make no decision;

if the noun incorporates a massive plug:

make no decision;

if the noun is a device:

say "[The noun] appear[s] to be adequately powered already." instead;

say "[The noun] feature[s] no dangling power cords or sockets." instead.

Carry out an actor connecting something:

try the actor connecting the dais socket to the wall socket.

[There's really no particular point to having the britishizing goggles change the compatibility of the plug. I just couldn't resist.]