cmd

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2016 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

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 Move

func Move(s *state)

TODO: Move does not support vetoes yet.

func NewState

func NewState(t has.Thing, input string) *state

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

func Parse(t has.Thing, input string) string

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?

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL