Documentation
¶
Index ¶
- func AddHandler(handler func(*state), cmd ...string)
- func Cleanup(s *state)
- func Close(s *state)
- 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 Junk(s *state)
- func Look(s *state)
- func Move(s *state)
- func Open(s *state)
- func Parse(t has.Thing, input string) string
- func Poof(s *state)
- func Put(s *state)
- func Quit(s *state)
- func Read(s *state)
- func Reset(s *state)
- func Say(s *state)
- func Script(t has.Thing, input string) string
- 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 Cleanup ¶ added in v0.0.5
func Cleanup(s *state)
func Close ¶ added in v0.0.4
func Close(s *state)
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 Junk ¶ added in v0.0.5
func Junk(s *state)
func Look ¶
func Look(s *state)
func Open ¶ added in v0.0.4
func Open(s *state)
func Parse ¶
Parse initiates processing of the input string for the specified Thing. The input string is expected to be input from a player. The actual command processed will be returned. For example GET or DROP.
Parse runs with state.scripting set to false, disallowing scripting specific commands from being executed by players directly.
When sync handles a command the command may determine it needs to hold additional locks. In this case sync will return false and should be called again. This repeats until the list of locks is complete, the command processed and sync returns true.
func Poof ¶ added in v0.0.4
func Poof(s *state)
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 Reset ¶ added in v0.0.5
func Reset(s *state)
func Say ¶
func Say(s *state)
func Script ¶ added in v0.0.4
Script processes the input string the same as Parse. However Script runs with the state.scripting flag set to true, permitting scripting specific commands to be executed.
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?