Module ...

Handles default targeting interface & display

Functions

_M:init () Initializes targeting
_M:targetDisplayTooltip (dx, dy) Display the tooltip, if any
_M:targetGetForPlayer (typ) Player requests a target This method should be called by your Player:getTarget() method, it will handle everything
_M: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
_M:targetMouse (button, mx, my, xrel, yrel, event) Handle mouse event for targeting
_M:targetOnTick () Maintain the current target each tick Make sure the target still exists
_M:targetSetForPlayer (target) Player wants to set its target This method should be called by your Player:setTarget() method, it will handle everything
_M:targetSetupKey () This setups the default keybindings for targeting


Functions

_M:init ()
Initializes targeting
_M:targetDisplayTooltip (dx, dy)
Display the tooltip, if any

Parameters

  • dx:
  • dy:
_M: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
_M: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

Parameters

  • v:
  • msg:
  • co:
  • typ:
_M:targetMouse (button, mx, my, xrel, yrel, event)
Handle mouse event for targeting

Parameters

  • button:
  • mx:
  • my:
  • xrel:
  • yrel:
  • event:

Return value:

true if the event was handled
_M:targetOnTick ()
Maintain the current target each tick Make sure the target still exists
_M:targetSetForPlayer (target)
Player wants to set its target This method should be called by your Player:setTarget() method, it will handle everything

Parameters

  • target:
_M:targetSetupKey ()
This setups the default keybindings for targeting

Valid XHTML 1.0!