Internals

MenuAdventures.NOUN_FIELDSConstant
const 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.

source
MenuAdventures.ever_possibleMethod
MenuAdventures.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 that noun has a mutable closed::Bool field.
  • ever_possible(::Unlock, ::Reachable, noun) requires that noun has a key::Noun field and a mutable locked::Bool field.
source
MenuAdventures.look_aroundMethod
MenuAdventures.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.

source
MenuAdventures.mention_statusMethod
mention_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.

source
MenuAdventures.possible_nowMethod
MenuAdventures.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.

source
MenuAdventures.possible_nowMethod
possible_now(universe, action)

Whether it is possible to conduct an action. Defaults to true; you can set to false for some actions without arguments.

source
MenuAdventures.print_sentenceFunction
MenuAdventures.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 Answers.

source