Class engine.generator.interface.GameTargeting
Handles default targeting interface & display
Methods
engine.generator.interface.GameTargeting:init ()
Initializes targeting
engine.generator.interface.GameTargeting:targetOnTick ()
Maintain the current target each tick Make sure the target still exists
engine.generator.interface.GameTargeting:targetDisplayTooltip (dx, dy, force, nb_keyframes)
Display the tooltip, if any
engine.generator.interface.GameTargeting:tooltipDisplayAtMap (x, y, text, extra, force, nb_keyframes)
Forces the tooltip to pop with the given text
engine.generator.interface.GameTargeting:targetMode (v, msg, co, typ)
Enter/leave targeting mode
This is the "meat" of this interface, do not expect to understand it easily, it mixes some nasty stuff
This require the Game to have both a "key" field (this is the default) and a "normal_key" field
It will switch over to a special keyhandler and then restore the "normal_key" one
engine.generator.interface.GameTargeting:targetSetupKey ()
This setups the default keybindings for targeting
engine.generator.interface.GameTargeting:targetMouse (button, mx, my, xrel, yrel, event)
Handle mouse event for targeting
engine.generator.interface.GameTargeting:targetGetForPlayer (typ)
Player requests a target This method should be called by your Player:getTarget() method, it will handle everything
engine.generator.interface.GameTargeting:targetSetForPlayer (target)
Player wants to set its target This method should be called by your Player:setTarget() method, it will handle everything
Methods
- engine.generator.interface.GameTargeting:init ()
- Initializes targeting
- engine.generator.interface.GameTargeting:targetOnTick ()
- Maintain the current target each tick Make sure the target still exists
- engine.generator.interface.GameTargeting:targetDisplayTooltip (dx, dy, force, nb_keyframes)
-
Display the tooltip, if any
Parameters:
- dx
- dy
- force
- nb_keyframes Tooltip is displayed over all else
- engine.generator.interface.GameTargeting:tooltipDisplayAtMap (x, y, text, extra, force, nb_keyframes)
-
Forces the tooltip to pop with the given text
Parameters:
- x
- y
- text
- extra
- force
- nb_keyframes
- engine.generator.interface.GameTargeting:targetMode (v, msg, co, typ)
-
Enter/leave targeting mode
This is the "meat" of this interface, do not expect to understand it easily, it mixes some nasty stuff
This require the Game to have both a "key" field (this is the default) and a "normal_key" field
It will switch over to a special keyhandler and then restore the "normal_key" oneParameters:
- v
- msg
- co
- typ
- engine.generator.interface.GameTargeting:targetSetupKey ()
- This setups the default keybindings for targeting
- engine.generator.interface.GameTargeting:targetMouse (button, mx, my, xrel, yrel, event)
-
Handle mouse event for targeting
Parameters:
- button
- mx
- my
- xrel
- yrel
- event
Returns:
-
true if the event was handled
- engine.generator.interface.GameTargeting:targetGetForPlayer (typ)
-
Player requests a target
This method should be called by your Player:getTarget() method, it will handle everything
Parameters:
- typ the targeting parameters
- engine.generator.interface.GameTargeting:targetSetForPlayer (target)
-
Player wants to set its target
This method should be called by your Player:setTarget() method, it will handle everything
Parameters:
- target