Documentation
¶
Index ¶
- func AddHandler(handler func(*state), cmd ...string)
- func Commands(s *state)
- func Drop(s *state)
- func Dump(s *state)
- func Examine(s *state)
- func Get(s *state)
- func Inventory(s *state)
- func Look(s *state)
- func Move(s *state)
- func NewState(t has.Thing, input string) *state
- func Parse(t has.Thing, input string) string
- func Put(s *state)
- func Quit(s *state)
- func Read(s *state)
- func Say(s *state)
- func Sneeze(s *state)
- func Take(s *state)
- func Version(s *state)
- func Who(s *state)
- Bugs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddHandler ¶
func AddHandler(handler func(*state), cmd ...string)
AddHandler adds the given commands for the specified handler. The commands will automatically be uppercased. Each command and it's aliases should register it's handler in it's init function. For example:
func init() { AddHandler(Look, "L", "LOOK") }
In this example the LOOK command and it's alias 'L' register the Look function as their handler. If a handler is added for an existing command or alias the original handler will be replaced.
func Commands ¶
func Commands(s *state)
BUG(diddymus): Terminal with is hardcoded to be 80 characters wide
func Drop ¶
func Drop(s *state)
func Dump ¶
func Dump(s *state)
func Examine ¶
func Examine(s *state)
func Get ¶
func Get(s *state)
func Inventory ¶
func Inventory(s *state)
func Look ¶
func Look(s *state)
func NewState ¶
NewState returns a *state initialised with the passed Thing and input. If the passed Thing is locatable the containing Inventory is added to the lock list, but the lock is not taken at this point.
func Parse ¶
Parse initiates processing of the input string for the specified Thing. The input string is expected to be either input from a player or possibly a scripted command. The actual command processed will be returned. For example GET or DROP.
func Put ¶
func Put(s *state)
func Quit ¶
func Quit(s *state)
The Quit command acts as a hook for processing - such as cleanup - to be done when a player quits the game.
func Read ¶
func Read(s *state)
func Say ¶
func Say(s *state)
func Sneeze ¶
func Sneeze(s *state)
func Take ¶
func Take(s *state)
func Version ¶
func Version(s *state)
func Who ¶
func Who(s *state)
Types ¶
This section is empty.
Notes ¶
Bugs ¶
Terminal with is hardcoded to be 80 characters wide
If you examine another player you can see their inventory items. For now we just skip the inventory listing if we are examining a player.
Should this be moved into handler.go?
We don't treat observer differently to observers - should we?