Internals
MenuAdventures.NOUN_FIELDS
MenuAdventures.argument_domains
MenuAdventures.blocking
MenuAdventures.ever_possible
MenuAdventures.find_in_domain
MenuAdventures.indefinite
MenuAdventures.interrogative
MenuAdventures.is_shining
MenuAdventures.is_transparent
MenuAdventures.is_vehicle
MenuAdventures.look_around
MenuAdventures.mention_status
MenuAdventures.opposite
MenuAdventures.possible_now
MenuAdventures.possible_now
MenuAdventures.print_sentence
MenuAdventures.NOUN_FIELDS
— Constantconst NOUN_FIELDS = [
:(name::String),
:(grammatical_person::GrammaticalPerson = third_person),
:(indefinite_article::String = "a"),
:(plural::Bool = false),
:(description = (_, __) -> "")
]
A list of expressions, the fields added by the @noun
macro.
You can add new noun fields by push!
ing to this list. Because the expressions will be escaped, you might want to interpolate in everything except for the field name. Be careful; obviously changing NOUN_FIELDS
will change the behavior of the @noun
macro.
MenuAdventures.argument_domains
— FunctionMenuAdventures.blocking
— FunctionMenuAdventures.blocking(domain, parent_thing, relationship, thing)
parent_thing
is blocked from accessing thing
via the relationship
.
By default, Reachable
parent_thing
s block thing
s they are Containing
if they are closed. By default, Visible
parent_thing
s block thing
s they are Containing
if they are closed and not MenuAdventures.is_transparent
.
MenuAdventures.ever_possible
— MethodMenuAdventures.ever_possible(action::Action, domain::Domain, noun::Noun)
Whether it is abstractly possible to apply an Action
to a Noun
from a particular Domain
.
For whether it is concretely possible for the player in at a certain moment, see possible_now
. Most possibilities default to false
, with some exceptions, documented in specific actions.
Certain possibilities come with required fields:
ever_possible(::Open, ::Reachable, noun
requires thatnoun
has a mutableclosed::Bool
field.ever_possible(::Unlock, ::Reachable, noun)
requires thatnoun
has akey::Noun
field and a mutablelocked::Bool
field.
MenuAdventures.find_in_domain
— FunctionMenuAdventures.find_in_domain(universe, sentence, domain; lit = true)
Return a vector of Answer
s for all things around the player in a certain Domain
.
MenuAdventures.indefinite
— MethodMenuAdventures.indefinite(domain) = "something"
Placeholder for an object from the Domain
.
For example, the indefinite for ExitDirections
is "some way".
MenuAdventures.interrogative
— MethodMenuAdventures.interrogative(domain) = "what"
Ask for an object from the Domain
.
For example, the interrogative for ExitDirections
is "which way".
MenuAdventures.is_shining
— Methodis_shining(::Noun) = false
Whether something provides light.
MenuAdventures.is_transparent
— MethodMenuAdventures.is_transparent(thing::Noun) = false
Whether you can see through a thing
into its contents.
MenuAdventures.is_vehicle
— MethodMenuAdventures.is_vehicle(::Noun) = false
Whether something is a vehicle.
MenuAdventures.look_around
— MethodMenuAdventures.look_around(universe, domain, blocking_thing, blocked_relationship)
Look around a lit location.
You can overload look_around
for a Noun
subtype. Use Core.invoke
to avoid replicating the look_around
machinery.
MenuAdventures.mention_status
— Methodmention_status(io, action, thing)
Print the status of thing
corresponding to action
into io
.
For example, for the OpenOrClose
action, will display whether thing
is open or closed. Called for all action subtypes when mentioning a thing. Defaults to doing nothing
.
MenuAdventures.opposite
— FunctionMenuAdventures.opposite(direction::Direction)
The opposite of a Direction
.
MenuAdventures.possible_now
— MethodMenuAdventures.possible_now(universe, sentence, domain, thing)
Whether it is currently possible to apply sentence.action
to a thing
in a domain
.
See ever_possible
for a more abstract possibilities. sentence
will contain already chosen arguments, should you wish to access them.
MenuAdventures.possible_now
— Methodpossible_now(universe, action)
Whether it is possible to conduct an action. Defaults to true
; you can set to false
for some actions without arguments.
MenuAdventures.print_sentence
— FunctionMenuAdventures.print_sentence(io, action::Action, argument_answers::Answer...)
Print a sentence to io
.
This allows for inserting connectives like with
. Arguments will be passed as Answer
s.