Class engine.Object
Object
Tables
engine.Object.stackmo
Returns a map object that represents how many are in the stack
Methods
engine.Object:resolve (t, last, on_entity)
Resolves the object This will call the entities resolver and then add to the game entities list
engine.Object:loaded ()
Loaded, we add ourself back to the game
engine.Object:canAct ()
Can this object act at all Most object will want to answer false, only recharging and stuff needs them
engine.Object:setupMinimapInfo (mo, map)
Setup minimap color for this entity You may overload this method to customize your minimap
engine.Object:act ()
Do something when its your turn For objects this mostly is to recharge them By default, does nothing at all
engine.Object:getDisplayColor ()
Gets the color in which to display the object in lists
engine.Object:getName (t)
Gets the full name of the object
engine.Object:getDesc ()
Gets the full desc of the object
engine.Object:wornInven ()
Returns the inventory type an object is worn on
engine.Object:enoughEnergy (val)
Do we have enough energy
engine.Object:useEnergy (val)
Use some energy
engine.Object:stackable ()
Stackable, can it stack at all ?
engine.Object:canStack (o)
Can it stacks with others of its kind ?
engine.Object:stack (o, force, num)
Adds an object to the stack
engine.Object:unstack (num)
Removes one or more objects from a stack of objects
engine.Object:forAllStack (fct)
Applies a function to all items of the stack
stops after fct(so, i) returns true
engine.Object:getNumber ()
Returns the number of objects available Always one for non stacking objects
engine.Object:getTypeOrder ()
Sorting by type function By default, sort by type name
engine.Object:getSubtypeOrder ()
Sorting by type function By default, sort by subtype name
engine.Object:getRequirementDesc (who)
Describe requirements
engine.Object:getEntityKind ()
Return the kind of the entity
Tables
Methods
- engine.Object:resolve (t, last, on_entity)
-
Resolves the object
This will call the entities resolver and then add to the game entities list
Parameters:
- t
- last
- on_entity
- engine.Object:loaded ()
- Loaded, we add ourself back to the game
- engine.Object:canAct ()
- Can this object act at all Most object will want to answer false, only recharging and stuff needs them
- engine.Object:setupMinimapInfo (mo, map)
-
Setup minimap color for this entity
You may overload this method to customize your minimap
Parameters:
- mo
- map
- engine.Object:act ()
- Do something when its your turn For objects this mostly is to recharge them By default, does nothing at all
- engine.Object:getDisplayColor ()
- Gets the color in which to display the object in lists
- engine.Object:getName (t)
-
Gets the full name of the object
Parameters:
- t
- engine.Object:getDesc ()
- Gets the full desc of the object
- engine.Object:wornInven ()
- Returns the inventory type an object is worn on
- engine.Object:enoughEnergy (val)
-
Do we have enough energy
Parameters:
- val
- engine.Object:useEnergy (val)
-
Use some energy
Parameters:
- val
- engine.Object:stackable ()
- Stackable, can it stack at all ?
- engine.Object:canStack (o)
-
Can it stacks with others of its kind ?
Parameters:
- o
- engine.Object:stack (o, force, num)
-
Adds an object to the stack
Parameters:
- o = object to stack onto self
- force boolean to stack unstackable objects
- num = maximum number of stacked objects to move
Returns:
-
false if stacking failed
Or
- true if stacking worked
- boolean if all of the stack was moved
- engine.Object:unstack (num)
-
Removes one or more objects from a stack of objects
Parameters:
- num = maximum number to remove
Returns:
-
self or new object, true if last item was removed (self is not deleted) or false if more on the stack
- engine.Object:forAllStack (fct)
-
Applies a function to all items of the stack
stops after fct(so, i) returns trueParameters:
- fct
- engine.Object:getNumber ()
- Returns the number of objects available Always one for non stacking objects
- engine.Object:getTypeOrder ()
- Sorting by type function By default, sort by type name
- engine.Object:getSubtypeOrder ()
- Sorting by type function By default, sort by subtype name
- engine.Object:getRequirementDesc (who)
-
Describe requirements
Parameters:
- who
- engine.Object:getEntityKind ()
- Return the kind of the entity