1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-06-30 22:14:58 +03:00

Merge pull request #89 from zedlopez/concealment

Concealment
This commit is contained in:
Graham Nelson 2023-06-02 07:56:55 +01:00 committed by GitHub
commit 89fbb6c6ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 179 additions and 50 deletions

View file

@ -347,6 +347,26 @@ account.
rfalse;
];
@h Having Evident Content
This is true when something has at least one unconcealed thing in it.
It's false when something is truly empty or when all the things in
it are concealed or undescribed, and is used to ensure that output
is consistent in both those cases. The player shouldn't count for
these purposes, but since the player is undescribed, they're excluded
anyway.
=
[ ObviouslyOccupied o x;
if (~~((o ofclass K5_container) || (o ofclass K6_supporter))) rfalse;
if (o has container && o hasnt open && o hasnt transparent) rfalse; ! opaque closed container's status can never be obvious
x = child(o);
while (x) {
if ((x hasnt concealed) && (~~TestConcealment(o, x))) rtrue;
x = sibling(x);
}
rfalse;
];
@h Coalesce Marked List.
The return value is the new first entry in the raw list.
@ -588,21 +608,16 @@ by Inform. But this seems to be sound.
=
[ ListEqual o1 o2;
if ((o1.plural == 0) || (o2.plural == 0)) rfalse;
if (child(o1) ~= 0 && WillRecurs(o1) ~= 0) rfalse;
if (child(o2) ~= 0 && WillRecurs(o2) ~= 0) rfalse;
if (c_style & (FULLINV_BIT + PARTINV_BIT) ~= 0) {
if ((o1 hasnt worn && o2 has worn) || (o2 hasnt worn && o1 has worn)) rfalse;
if ((o1 hasnt light && o2 has light) || (o2 hasnt light && o1 has light)) rfalse;
if (o1 has container) {
if (o2 hasnt container) rfalse;
if ((o1 has open && o2 hasnt open) || (o2 has open && o1 hasnt open))
rfalse;
}
else if (o2 has container)
rfalse;
}
return Identical(o1, o2);
if (o1.KD_Count ~= o2.KD_Count) rfalse;
if ((o1.plural == 0) || (o2.plural == 0)) rfalse;
if (ObviouslyOccupied(o1) && WillRecurs(o1)) rfalse;
if (ObviouslyOccupied(o2) && WillRecurs(o2)) rfalse;
if (c_style & (FULLINV_BIT + PARTINV_BIT) ~= 0) {
if ((o1 hasnt worn && o2 has worn) || (o2 hasnt worn && o1 has worn)) rfalse;
if ((o1 hasnt light && o2 has light) || (o2 hasnt light && o1 has light)) rfalse;
if ((o1 has open && o2 hasnt open) || (o2 has open && o1 hasnt open)) rfalse;
}
return Identical(o1, o2);
];
[ WillRecurs o;

View file

@ -1,10 +1,10 @@
Bar
Welcome
An Interactive Fiction
Release 1 / Serial number 150512 / Inform 7 build 6M22 (I6/v6.33 lib 6/12N) SD
Release 1 / Serial number 160428 / Inform 7 v10.2.0 / D
Bar
You can see a counter (on which is a glass jar) and an obvious item here.
You can see a counter (on which is a glass jar (empty)) and an obvious item here.
> > Bar
(Testing.)
@ -17,7 +17,7 @@
>[3] look
Bar
You can see a counter (on which is a glass jar) and an obvious item here.
You can see a counter (on which is a glass jar (empty)) and an obvious item here.
>[4] take all
obvious item: Taken.

View file

@ -65,8 +65,9 @@ Carry out taking inventory (this is the print empty inventory rule):
Carry out taking inventory (this is the print standard inventory rule):
say "[We] [are] carrying:[line break]" (A);
list the contents of the player, with newlines, indented, including contents,
giving inventory information, with extra indentation.
now all things enclosed by the player are unmarked for listing;
now all things held by the player are marked for listing;
list the contents of the player, with newlines, indented, giving inventory information, with extra indentation, listing marked items only, not listing concealed items, including contents.
@ Report.
@ -1183,22 +1184,22 @@ Carry out examining (this is the examine directions rule):
Carry out examining (this is the examine containers rule):
if the noun is a container:
if the noun is open or the noun is transparent:
if something described which is not scenery is in the noun and something which
is not the player is in the noun:
say "In [the noun] " (A);
list the contents of the noun, as a sentence, tersely, not listing
concealed items, prefacing with is/are;
say ".";
now examine text printed is true;
otherwise if examine text printed is false:
if the player is in the noun:
make no decision;
say "[The noun] [are] empty." (B);
now examine text printed is true;
if the noun is closed and the noun is opaque, make no decision;
if something described which is not scenery is in the noun and something which
is not the player is in the noun and the noun is not falsely-unoccupied:
say "In [the noun] " (A);
list the contents of the noun, as a sentence, tersely, not listing
concealed items, prefacing with is/are;
say ".";
now examine text printed is true;
otherwise if examine text printed is false:
if the player is in the noun:
make no decision;
say "[The noun] [are] empty." (B);
now examine text printed is true;
Carry out examining (this is the examine supporters rule):
if the noun is a supporter:
if the noun is a supporter and the noun is not falsely-unoccupied:
if something described which is not scenery is on the noun and something which is
not the player is on the noun:
say "On [the noun] " (A);
@ -1657,7 +1658,7 @@ Carry out an actor opening (this is the standard opening rule):
Report an actor opening (this is the reveal any newly visible interior rule):
if the actor is the player and
the noun is an opaque container and
the first thing held by the noun is not nothing and
the noun is obviously-occupied and
the noun does not enclose the actor:
if the action is not silent:
if the actor is the player:

View file

@ -65,9 +65,60 @@ supplemented by details:
=
Printing room description details of something (documented at act_details) is an activity.
The printing room description details activity is accessible to Inter as "PRINTING_ROOM_DESC_DETAILS_ACT".
For printing room description details of a container (called the box) when the box is falsely-unoccupied (this is the falsely-unoccupied container room description details rule):
say text of list writer internal rule response (A); [ " (" ]
if the box is lit and the location is unlit begin;
if the box is closed, say text of list writer internal rule response (J); [ "closed, empty[if serial comma option is active],[end if] and providing light" ]
else say text of list writer internal rule response (I); [ "empty and providing light" ]
else;
if the box is closed, say text of list writer internal rule response (E); [ "closed" ]
else say text of list writer internal rule response (F); [ "empty" ]
end if;
say text of list writer internal rule response (B); [ ")" ]
Printing inventory details of something (documented at act_idetails) is an activity.
The printing inventory details activity is accessible to Inter as "PRINTING_INVENTORY_DETAILS_ACT".
To say the deceitfully empty inventory details of (box - a container):
let inventory text printed be false;
if the box is lit begin;
if the box is worn, say text of list writer internal rule response (K); [ "providing light and being worn" ]
else say text of list writer internal rule response (D); [ "providing light" ]
now inventory text printed is true;
else if the box is worn;
say text of list writer internal rule response (L); [ "being worn" ]
now inventory text printed is true;
end if;
if the box is openable begin;
if inventory text printed is true begin;
if the serial comma option is active, say ",";
say text of list writer internal rule response (C); [ "and" ]
end if;
if the box is open begin;
say text of list writer internal rule response (N); [ "open but empty" ]
else; [ it's closed ]
if the box is locked, say text of list writer internal rule response (P); [ "closed and locked" ]
else say text of list writer internal rule response (O); [ "closed" ]
now inventory text printed is true;
end if;
else; [ it's not openable ]
if the box is transparent begin;
if inventory text printed is true, say text of list writer internal rule response (C); [ "and" ]
say text of list writer internal rule response (F); [ "empty" ]
now inventory text printed is true; [ not relevant unless code is added ]
end if;
end if;
For printing inventory details of a container (called the box) when the box is falsely-unoccupied (this is the falsely-unoccupied container inventory details rule):
let the tag be "[the deceitfully empty inventory details of box]";
if tag is not empty begin;
say text of list writer internal rule response (A); [ "(" ]
say tag;
say text of list writer internal rule response (B); [ ")" ]
end if;
@ Names of things are often formed up into lists, in which they are sometimes
grouped together:
@ -79,6 +130,7 @@ The standard contents listing rule is defined by Inter as "STANDARD_CONTENTS_LIS
Grouping together something (documented at act_gt) is an activity.
The grouping together activity is accessible to Inter as "GROUPING_TOGETHER_ACT".
@ And such lists of names are formed up in turn into room descriptions.
Something which is visible in a room can either have a paragraph of its own
or can be relegated to the list of "nondescript" items at the end.
@ -511,6 +563,7 @@ For printing the locale description (this is the interesting locale paragraphs r
For printing the locale description (this is the you-can-also-see rule):
let the domain be the parameter-object;
let the mentionable count be 0;
if the domain is a thing and the domain holds the player and the domain is falsely-unoccupied, continue the activity;
repeat with item running through things:
now the item is not marked for listing;
repeat through the Table of Locale Priorities:
@ -711,22 +764,32 @@ For printing a locale paragraph about a supporter (called the tabletop)
Definition: a thing (called the item) is locale-supportable if the item is not
scenery and the item is not mentioned and the item is not undescribed.
For printing a locale paragraph about a thing (called the item)
For printing a locale paragraph about a thing (called the platform)
(this is the describe what's on scenery supporters in room descriptions rule):
if the item is scenery and the item does not enclose the player:
if a locale-supportable thing is on the item:
set pronouns from the item;
repeat with possibility running through things on the item:
now the possibility is marked for listing;
if the possibility is mentioned:
now the possibility is not marked for listing;
increase the locale paragraph count by 1;
say "On [the item] " (A);
list the contents of the item, as a sentence, including contents,
giving brief inventory information, tersely, not listing
concealed items, prefacing with is/are, listing marked items only;
say ".[paragraph break]";
continue the activity.
if the platform is not a scenery supporter that does not enclose the player, continue the activity;
let print a paragraph be false;
let item be the first thing held by the platform;
while item is not nothing begin;
if the item is not scenery and the item is described and the platform does not conceal the item begin;
if the item is mentioned begin;
now the item is not marked for listing;
else;
now the item is marked for listing;
now print a paragraph is true;
end if;
end if;
now the item is the next thing held after the item;
end while;
if print a paragraph is true begin;
set pronouns from the platform;
increase the locale paragraph count by 1;
say "On [the platform] " (A);
list the contents of the platform, as a sentence, including contents,
giving brief inventory information, tersely, not listing
concealed items, prefacing with is/are, listing marked items only;
say ".[paragraph break]";
end if;
continue the activity
For printing a locale paragraph about a thing (called the item)
(this is the describe what's on mentioned supporters in room descriptions rule):

View file

@ -92,6 +92,54 @@ The verb to conceal (he conceals, they conceal, he concealed, it is concealed,
he is concealing) means the concealment relation.
Definition: Something is concealed rather than unconcealed if the holder of it conceals it.
@ If a supporter or container has something on/in it, but all the contents are concealed or
undescribed, default behavior should be the same to what it would be if it were empty. The
following adjectives assist the maintenance of the deceit.
Something is obviously-occupied if it has at least one obvious (neither concealed nor
undescribed) thing in it, but closed opaque containers the player is outside of aren't
obviously-occupied because their status isn't obvious. The player is undescribed and so
the player's own presence in an enterable supporter or container doesn't count toward it
being considered occupied. The opposite of obviously-occupied is possibly-unoccupied.
Something is possibly-unoccupied if it's truly empty, or the only things in it are concealed
or undescribed (or both), or it's a closed opaque container the player is outside of.
Something is falsely-unoccupied if it's not a closed opaque continer the player is outside
of and it's not truly empty but everything in it is concealed or undescribed. Note that
falsely-unoccupied is not the opposite of obviously-occupied. Possibly-occupied is the
opposite of obviously-occupied; falsely-occupied is something different.
None of this considers visibility per se and they behave the same way in light or
darkness. The presumption is that if the game is evaluating whether the player can perceive
the contents of a thing, it has already been determined that they can perceive that
thing.
These tests only consider what's directly contained or supported. If there's an obvious
thing its contents can't make it any less obvious; if something is undescribed or
concealed, it's assumed that the game shouldn't be calling attention to their contents.
These adjectives are not defined for people. Things directly held by the player are always
perceptible by the player. Things possessed by other people aren't mentioned by default
in room descriptions or when searching or examining them, but only through whatever rules
an author adds to do so, so the details are left to the author.
=
Definition: a container is obviously-occupied rather than possibly-unoccupied if
I6 routine "ObviouslyOccupied" says so (it contains at least one obvious thing).
Definition: a supporter is obviously-occupied rather than possibly-unoccupied if
I6 routine "ObviouslyOccupied" says so (it supports at least one obvious thing).
Definition: a container (called c) is falsely-unoccupied:
if the first thing held by it is nothing, no;
if it is closed and it is opaque and it does not enclose the player, no;
decide on whether or not it is possibly-unoccupied;
Definition: a supporter is falsely-unoccupied:
if the first thing held by it is nothing, no;
if the first thing held by it is the player and the next thing held after the player is nothing, no;
decide on whether or not it is possibly-unoccupied;
@ A final sort of pseudo-containment: does the entire world contain
something, or not? (For things destroyed during play, or not yet created, the
answer would be no.)

View file

@ -259,6 +259,8 @@ When the story compiles the list of nondescript items, it adds tags such as "(op
Rule for printing room description details: stop.
The "(empty)" tag can appear when something is <i>not</i> truly empty if everything within is concealed or undescribed.
And we can suppress the "(open)" and "(on which is...)" sorts of tags with the "omit the contents in listing" phrase, as in
Rule for printing the name of the bottle while not inserting or removing: