Salet character
The character object is available as salet.character
.
It controls the character's inventory. On loading the game, Salet creates a new Character
object automatically and erases the old values.
On saving the game, Salet saves every value in salet.character
that can be serialized (turned into text).
CoffeeScript properties
inventory
An array of units - character inventory. Better not call it directly, there are methods for that.
CoffeeScript methods
take
Adds a new unit to the character inventory (at the end)
Argument: a unit, SaletUnit
class
drop
Removes from the inventory a unit with given name. Returns true
if the deletion was successfull; false
if the unit is not found.
Argument: name of the unit (<unit>.name
), string. Mandatory argument.
has
Returns true
if the character inventory has a unit with this name; false
if it's not found.
Argument: name of the unit (<unit>.name
), string. Mandatory argument.
inv
Calls an inv
action of the given unit. An action can be a function or a string.
Argument: name of the unit (<unit>.name
), string. Mandatory argument.
listinv
Returns a link in the form of <a href="{unit.name}">{unit.display}</a>
. The link text is a display
property. When clicked on it, Salet will call the inv
action of this unit.
Argument: name of the unit (<unit>.name
), string. Mandatory argument.