Parts
MenuAdventures.Parts
— ModuleMenuAdventures.Parts
A sub-module that allows things to be part of other things.
julia> using MenuAdventures
julia> using MenuAdventures.Testing
julia> using MenuAdventures.Parts
julia> import MenuAdventures: ever_possible
julia> @universe struct Universe <: AbstractUniverse
end;
julia> @noun struct Room <: AbstractRoom
already_lit::Bool = true
end;
julia> @noun struct Person <: Noun
end;
julia> @noun struct StickyThing <: Noun
end;
julia> ever_possible(::Take, ::Reachable, ::StickyThing) = true;
julia> ever_possible(::Attach, ::Inventory, ::StickyThing) = true;
julia> cd(joinpath(pkgdir(MenuAdventures), "test", "Parts")) do
check_choices() do interface
you = Person(
"Brandon",
grammatical_person = second_person,
indefinite_article = "",
)
room = Room("room")
universe = Universe(you, interface = interface)
universe[room, you] = Containing()
universe[room, StickyThing("sticky thing")] = Containing()
universe
end
end
true
MenuAdventures.Parts.Attach
— TypeAttach()
Attach
something from your Inventory
to something else Reachable
.
An Action
. By default, ever_possible(::Attach, ::Reachable, _) = true
, that is, you can attach something sticky to anything.
MenuAdventures.Parts.Incorporating
— Type