Module Miniature

Represnts a miniature of a unit.

Expects the table "spawnSetup" to be set to initialize the miniature.

See also:

Usage:

    someMini.setTable('spawnSetup', {
      -- Data table.
      name = '...',
    
      -- Whether to be considered a unit leader. Omit if not a leader.
      leader: {
        color = 'Red',
        rank  = 'Corps',
      },
    })
    

Functions

showFloatingNumber (args) Shows a floating number above the miniature's head.
hideFloatingNumber () Hides any visible floating number above the miniature's head.
toggleThreats () Toggle threats-mode for the unit leader.
isPartOfUnit (args) Returns whether the `guid` of the provided table is part of the unit.
toggleSilouhettes () Toggle silouhettes showing up for the miniature.
connectTo (minis) Associate this model with another minis.
getUnitLeader () Returns the miniature for this unit that is the unit leader.
getOwner () Returns the owner of the mini.

Fields

IS_TARGETABLE Used by the targeting sub-system to determine what models are targetable.
IS_UNIT_LEADER Used by various sub-systems to determine what models represent unit leaders.
_SELECTED_BY_COLOR Whether this unit is currently selected by a player (color).

Local Functions

_initializeAsLeader () Initialize as a Unit Leader.
_onSelect (player) Select button (i.e.
_initializeAsFollower () Initialize as a "Follower" (not a Unit Leader).
_disableSelectable () Disables the ability to select this model.
_selectUnit (color) Toggles selection of the unit.
_destroyAttachment (checkGuid) Destroys any attachments that the provided guid.
_getLeaderSetup () Returns the `_PERSIST.SETUP` value for the leader of this unit.


Functions

showFloatingNumber (args)
Shows a floating number above the miniature's head.

Parameters:

  • args Table: `number` and `color` to show.
hideFloatingNumber ()
Hides any visible floating number above the miniature's head.
toggleThreats ()
Toggle threats-mode for the unit leader.

Usage:

    unitLeaderMini.call('toggleThreats')
isPartOfUnit (args)
Returns whether the `guid` of the provided table is part of the unit.

Parameters:

  • args A table with a 'guid' property.

Returns:

    True if the mini is part of the unit.

Usage:

    unitLeaderMini.call('isPartOfUnit', {
      guid: 'abc123',
    })
toggleSilouhettes ()
Toggle silouhettes showing up for the miniature.

If this unit is a unit leader, then this automatically calls the `toggleSilouhettes` method for all miniatures attached to the unit.

Usage:

    unitLeaderMini.call('toggleSilouhettes')
connectTo (minis)
Associate this model with another minis.

Parameters:

  • minis A list of other model objects.

    If you are a unit leader, this method associates itself with miniatures that are considered "part" of your unit (including things like counterparts).

    If you are a non-leader, this method links to your unit leader.

Usage:

    unitLeaderMini.call('connectTo', {mini1, mini2, mini3})
getUnitLeader ()
Returns the miniature for this unit that is the unit leader.

Returns:

    Miniature
getOwner ()
Returns the owner of the mini.

Returns:

    Color, such as "Red" or "Blue".

Fields

IS_TARGETABLE
Used by the targeting sub-system to determine what models are targetable.

Defaults to true.

IS_UNIT_LEADER
Used by various sub-systems to determine what models represent unit leaders.

Defaults to false.

_SELECTED_BY_COLOR
Whether this unit is currently selected by a player (color).

This value should always be `nil` for a non-leader miniature.

Local Functions

_initializeAsLeader ()
Initialize as a Unit Leader.

Assigns @see Miniature:IS_UNIT_LEADER and sets up UI.

_onSelect (player)
Select button (i.e. the base) is clicked.

Parameters:

  • player Player that selected the miniature.

See also:

_initializeAsFollower ()
Initialize as a "Follower" (not a Unit Leader).
_disableSelectable ()
Disables the ability to select this model.
_selectUnit (color)
Toggles selection of the unit.

Parameters:

  • color Player color.
_destroyAttachment (checkGuid)
Destroys any attachments that the provided guid.

Parameters:

  • checkGuid GUID to search for.

Usage:

    _destroyAttachment(rangeFinderGuid)
_getLeaderSetup ()
Returns the `_PERSIST.SETUP` value for the leader of this unit.

Returns:

    table {color, rank}

Usage:

    local setup = _getLeaderSetup()
    print(setup.color, setup.rank)
generated by LDoc 1.4.6 Last updated 2020-05-19 00:07:14