-
Notifications
You must be signed in to change notification settings - Fork 0
[Lib] WeaponPreview
This library allows for easily adding icons to the board for weapon attacks. This was originally created by Lemonymous here and then I updated it to support adding images in skill build events/hooks via the executeWithState fn, adding two click weapon support, and multi-icon grouping and tooltips.
Any issues or concerns? Join the Redacted Rice Discord and @Das Keifer
-
weaponPreview
- AddAnimation
- AddColor
- AddDamage
- AddDelay
- AddDesc
- AddEmitter
- AddFlashing
- AddFunction
- AddImage
- AddSimpleColor
- ClearMarks
- ExecuteWithState
- GetQueuedSkillEffectMarker
- GetQueuedFinalEffectMarker
- GetSkillEffectMarker
- GetFinalEffectMarker
- GetGroupData
- GetTargetAreaMarker
- GetSecondTargetAreaMarker
- IsQueuedSkillEffectMarker
- IsQueuedFinalEffectMarker
- IsSkillEffectMarker
- IsFinalEffectMarker
- IsTargetAreaMarker
- IsSecondTargetAreaMarker
- RegisterGroup
- ResetQueuedSkillEffectTimer
- ResetQueuedFinalEffectTimer
- ResetSkillEffectTimer
- ResetFinalEffectTimer
- ResetTargetAreaTimer
- ResetSecondTargetAreaTimer
- SetLooping
- Constants
- events
A library with methods that can be used in non-queued skills' GetTargetArea and GetSkillEffect methods; and in queued skills' GetSkillEffect method.
The methods adds preview marks on the in-game board when activating the skills. Since they only adds to the preview, the effects they display will not alter the board state when the skill is used. This can be useful to for example add back lost information due to having coded parts of the skill within scripts, which won't display by default.
It can also be used to add animations, emitters or other cool effects to the attack preview.
When using several methods (like two animations) for the same skill, it is possible to run them on top of each other, or to run them in sequence, depending on how you set it up.
The library also comes with a set of functions and events that can be used to get information about the current state of which unit is marking the board and with what weapon.
The collection of all marks added during a GetTargetArea or GetSkillEffect
Calling any of the methods starting with Add- adds a mark to the preview
marks can have a length. Most marks has a length of zero (0). The total length of the preview will be the smallest length needed to contain all mark's lengths. If all marks starts at the same time, the total length will be the largest length of any mark.
Methods that can add length:
| method |
|---|
| AddDelay |
| AddAnimation |
marks can have a duration. If not specified, it is infinite. The duration is what specifies how long the mark will be displayed from when it starts playing. duration does not change length.
delay can be added to the preview to space out when the next mark added will begin playing. This will also space out marks so the total length of the preview will increase.
Methods that can add delay:
| method |
|---|
| AddDelay |
| AddAnimation |
By default the preview will be looping. This can be disabled with SetLooping(false). Animations with the animation field Loop set to true will loop for the entire preview regardless however.
-
voidweaponPreview:AddAnimation(point, animation, delay, groupId, description)
| Argument name | Type | Description |
|---|---|---|
point |
Point | The location on the board to add the animation |
animation |
string | The name of the animation in the ANIMS table |
delay |
number | (Optional) Pass ANIM_DELAY to add a delay equal to the duration of this animation |
groupId |
string | (Optional) Group Id so if there is more than one in the group, the multi icon will show instead |
description |
string | (Optional) Description to display in the tool tip |
Adds a mark to the preview, playing an animation on a point on the board. Most animations should work out of the box.
If the animation's field Loop is equal to true, the animation will play for the entire preview.
The duration and length of this mark is defined by the total length of the animation in the ANIMS table.
If ANIM_DELAY is passed as Argument #3, then a delay will be added before the next mark
Example:
local point = Point(0, 0)
local anim = "FireBack"
weaponPreview:AddAnimation(point, anim)
-
voidweaponPreview:AddColor(point, gl_color, duration)
| Argument name | Type | Description |
|---|---|---|
point |
Point | The location on the board to display the color |
gl_color |
GL_Color | The color to display |
duration |
number | (Optional) The duration to display the color. Defaults to infinite
|
Adds a mark to the preview, displaying a color on a point on the board.
Example:
local point = Point(0, 0)
local color = GL_Color(255, 255, 255, 255)
weaponPreview:AddColor(point, anim)
-
voidweaponPreview:AddDamage(spaceDamage, duration)
| Argument name | Type | Description |
|---|---|---|
spaceDamage |
SpaceDamage | The SpaceDamage object to display |
duration |
number | (Optional) The duration to display the SpaceDamage object. Defaults to infinite
|
Adds a mark to the preview, displaying a SpaceDamage object on the board.
Example:
local point = Point(0, 0)
local damage = 2
local spaceDamage = SpaceDamage(point, damage)
weaponPreview:AddDamage(spaceDamage)
-
voidweaponPreview:AddDelay(delay)
| Argument name | Type | Description |
|---|---|---|
delay |
number | The delay to wait before displaying the next mark |
Adds a mark to the preview, adding a delay before the next mark, and has a length of the same amount.
Example:
local delayInSeconds = 1
weaponPreview:AddDelay(delayInSeconds)
-
voidweaponPreview:AddDesc(point, desc, isDeadly, duration)
| Argument name | Type | Description |
|---|---|---|
point |
Point | The location on the board to display the tile description |
desc |
string | The description to display for the tile |
isDeadly |
boolean | (Optional) Whether to mark the tile as deadly or not. Defaults to true
|
duration |
number | (Optional) The duration to display the description object. Defaults to infinite
|
Adds a mark to the preview, displaying a description for the specified tile.
Example:
local point = Point(0, 0)
local description = "This is a dangerous tile"
weaponPreview:AddDesc(point, description)
-
voidweaponPreview:AddEmitter(point, emitter, duration)
| Argument name | Type | Description |
|---|---|---|
point |
Point | The location on the board to display the emitter |
emitter |
string | The internal name for the emitter |
duration |
number | (Optional) The duration to display the emitter. Defaults to infinite
|
Adds a mark to the preview, playing an emitter on a point on the board.
Example:
local point = Point(0, 0)
local emitter = "Emitter_tiles_grass"
weaponPreview:AddEmitter(point, emitter)
-
voidweaponPreview:AddFlashing(point, flash, duration)
| Argument name | Type | Description |
|---|---|---|
point |
Point | The location on the board to cause to flash |
flash |
boolean | (Optional) Whether to cause the grid icons on a tile to start flashing or not. Defaults to true
|
duration |
number | (Optional) The duration to play the flashing. Defaults to infinite
|
Adds a mark to the preview, causing grid icons of buildings to flash on a point on the board.
Example:
local point = Point(0, 0)
weaponPreview:AddFlashing(point)
-
voidweaponPreview:AddFunction(function fn, number duration, ...)
| Argument name | Type | Description |
|---|---|---|
fn |
function | The function to execute during the preview |
duration |
number | (Optional) The duration for which this function mark is active. Defaults to infinite
|
... |
any | (Optional) Additional arguments to pass to the function when it's called |
Adds a mark to the preview, allowing custom Lua code to be executed as part of the preview. The function receives the additional arguments provided after duration. This is useful for custom preview logic that doesn't fit into the standard mark types.
Example:
-- Add a custom function that runs during the preview
local function customPreview(pawn, weapon, ...)
-- Custom preview logic here
LOG("Running custom preview for " .. pawn:GetMechName())
end
weaponPreview:AddFunction(customPreview, 1.0, Pawn, "MyWeapon")
-
voidweaponPreview:AddImage(point, path, gl_color, duration)
| Argument name | Type | Description |
|---|---|---|
point |
Point | The location on the board to display the image |
path |
string | The path to the image to display |
gl_color |
GL_Color | The color tint added to the image |
duration |
number | (Optional) The duration to display the image. Defaults to infinite
|
Adds a mark to the preview, displaying an image on a point on the board.
Example:
local point = Point(0, 0)
local path = "img/combat/tile_icon/tile_rock.png"
local gl_color = GL_Color(255, 255, 255, 255)
weaponPreview:AddImage(point, path, gl_color)
-
voidweaponPreview:AddSimpleColor(point, gl_color, duration)
| Argument name | Type | Description |
|---|---|---|
point |
Point | The location on the board to display the color |
gl_color |
GL_Color | The color to display |
duration |
number | (Optional) The duration to display the color. Defaults to infinite
|
Adds a mark to the preview, displaying a color on a point on the board. Simple colors can not stack.
Example:
local point = Point(0, 0)
local gl_color = GL_Color(255, 255, 255, 255)
weaponPreview:AddSimpleColor(point, gl_color)
-
voidweaponPreview:ClearMarks()
Clears all marks added to the preview. Added for brevity.
Example:
weaponPreview:ClearMarks()
-
voidweaponPreview:ExecuteWithState(number state, function fn)
Temporarily sets the preview state to the specified state, executes the provided function, then restores the previous state. This is useful when you need to run code within a specific preview state context without permanently changing the global state. Most notably for doing things like adding weapon previews in skill build hooks
| Variable name | Type | Description |
|---|---|---|
| state | number | The preview state to temporarily set (e.g., STATE_SKILL_EFFECT, STATE_FINAL_EFFECT) |
| fn | function | The function to execute while the specified state is active |
Example:
-- Execute some code while temporarily in STATE_NONE
weaponPreview:ExecuteWithState(weaponPreview.STATE_NONE, function()
-- This code runs with preview state set to STATE_NONE
doSomething()
end)
-- State is automatically restored after the function completes
-
number,string,numberweaponPreview:GetQueuedSkillEffectMarker()
Returns 3 variables describing the queued weapon currently marking the board. A queued weapon will mark the board when a unit that is queueing a weapon is highlighted, and there is no armed weapon marking the board with GetSkillEffect. If there's currently no queued weapon marking the board, this function will return -1, "", -1.
| Variable name | Type | Description |
|---|---|---|
| pawnId | number | The id of the pawn marking the board |
| weapon | string | The queued weapon marking the board |
| weaponIndex | number | The weapon index of the weapon marking the board |
| Weapon Index | Description |
|---|---|
| -1 | No Weapon |
| 0 | Move |
| 1 | Primary Weapon |
| 2 | Secondary Weapon |
| 50 | Repair Skill |
Example:
LOGF("Pawn with id %q, with weapon %s in weapon index %s is currently marking the board", weaponPreview:GetQueuedSkillEffectMarker())
-
number,string,numberweaponPreview:GetQueuedFinalEffectMarker()
See GetQueuedSkillEffectMarker. This is the same thing but for Queued Final Effects (queued second clicks)
-
number,string,numberweaponPreview:GetSkillEffectMarker()
Returns 3 variables describing the armed weapon currently marking the board with its GetSkillEffect. An armed weapon will mark the board with its GetSkillEffect when it's armed and highlighting a valid tile as defined by its GetTargetArea. If there's no armed weapon currently marking the board with its GetSkillEffect, this function will return -1, "", -1.
| Variable name | Type | Description |
|---|---|---|
| pawnId | number | The id of the pawn marking the board |
| weapon | string | The armed weapon marking the board |
| weaponIndex | number | The weapon index of the weapon marking the board |
| Weapon Index | Description |
|---|---|
| -1 | No Weapon |
| 0 | Move |
| 1 | Primary Weapon |
| 2 | Secondary Weapon |
| 50 | Repair Skill |
Example:
LOGF("Pawn with id %q, with weapon %s in weapon index %s is currently marking the board", weaponPreview:GetSkillEffectMarker())
-
number,string,numberweaponPreview:GetFinalEffectMarker()
Returns 3 variables describing the armed weapon currently marking the board with its GetFinalEffect. An armed weapon will mark the board with its GetFinalEffect when it's a two-click weapon and highlighting a valid tile as defined by its GetSecondTargetArea. If there's no armed weapon currently marking the board with its GetFinalEffect, this function will return -1, "", -1.
| Variable name | Type | Description |
|---|---|---|
| pawnId | number | The id of the pawn marking the board |
| weapon | string | The armed weapon marking the board |
| weaponIndex | number | The weapon index of the weapon marking the board |
| Weapon Index | Description |
|---|---|
| -1 | No Weapon |
| 0 | Move |
| 1 | Primary Weapon |
| 2 | Secondary Weapon |
| 50 | Repair Skill |
Example:
LOGF("Pawn with id %q, with weapon %s in weapon index %s is currently marking the board", weaponPreview:GetFinalEffectMarker())
-
table|nil—weaponPreview:GetGroupData(groupId)
Returns the internal group registration table (offset, multiIcon, multiIconMarkData, groupMultiIconKey) or nil if not registered.
See registerGroup for more details on returned table fields
-
number,string,numberweaponPreview:GetTargetAreaMarker()
Returns 3 variables describing the armed weapon currently marking the board with its GetTargetArea. An armed weapon will continuously mark the board with its GetTargetArea whenever it's armed. If there's no armed weapon currently marking the board, this function will return -1, "", -1.
| Variable name | Type | Description |
|---|---|---|
| pawnId | number | The id of the pawn marking the board |
| weapon | string | The armed weapon marking the board |
| weaponIndex | number | The weapon index of the weapon marking the board |
| Weapon Index | Description |
|---|---|
| -1 | No Weapon |
| 0 | Move |
| 1 | Primary Weapon |
| 2 | Secondary Weapon |
| 50 | Repair Skill |
Example:
LOGF("Pawn with id %q, with weapon %s in weapon index %s is currently marking the board", weaponPreview:GetTargetAreaMarker())
-
number,string,numberweaponPreview:GetSecondTargetAreaMarker()
Returns 3 variables describing the armed weapon currently marking the board with its GetSecondTargetArea. An armed weapon will mark the board with its GetSecondTargetArea when it's a two-click weapon and the first target has been selected. If there's no armed weapon currently marking the board with its GetSecondTargetArea, this function will return -1, "", -1.
| Variable name | Type | Description |
|---|---|---|
| pawnId | number | The id of the pawn marking the board |
| weapon | string | The armed weapon marking the board |
| weaponIndex | number | The weapon index of the weapon marking the board |
| Weapon Index | Description |
|---|---|
| -1 | No Weapon |
| 0 | Move |
| 1 | Primary Weapon |
| 2 | Secondary Weapon |
| 50 | Repair Skill |
Example:
LOGF("Pawn with id %q, with weapon %s in weapon index %s is currently marking the board", weaponPreview:GetSecondTargetAreaMarker())
-
booleanweaponPreview:IsQueuedSkillEffectMarker()
Returns true if there is currently a queued weapon marking the board; otherwise false. A queued weapon will mark the board when a unit that is queueing a weapon is highlighted, and there is no armed weapon marking the board with GetSkillEffect.
Example:
LOGF("A queued weapon is currently marking the board: %s", weaponPreview:IsQueuedSkillEffectMarker())
-
booleanweaponPreview:IsQueuedFinalEffectMarker()
Returns true if there is currently a queued final effect weapon marking the board; otherwise false. A queued final effect weapon will mark the board when a unit that is queueing a two click weapon is highlighted, and there is no armed weapon marking the board with GetSkillEffect.
Example:
LOGF("A queued two click weapon is currently marking the board: %s", weaponPreview:IsQueuedFinalEffectMarker())
-
booleanweaponPreview:IsSkillEffectMarker()
Returns true if there's currently an armed weapon marking the board with its GetSkillEffect; otherwise false. An armed weapon will mark the board with its GetSkillEffect when it's armed and highlighting a valid tile as defined by its GetTargetArea.
Example:
LOGF("An armed weapon is currently marking the board with 'GetSkillEffect': %s", weaponPreview:IsSkillEffectMarker())
-
booleanweaponPreview:IsFinalEffectMarker()
Returns true if there's currently an armed weapon marking the board with its GetFinalEffect; otherwise false. An armed weapon will mark the board with its GetFinalEffect when it's a two-click weapon and highlighting a valid tile as defined by its GetSecondTargetArea.
Example:
LOGF("An armed weapon is currently marking the board with 'GetFinalEffect': %s", weaponPreview:IsFinalEffectMarker())
-
booleanweaponPreview:IsTargetAreaMarker()
Returns true if there's currently an armed weapon marking the board with its GetTargetArea; otherwise false. An armed weapon will continuously mark the board with its GetTargetArea whenever it's armed.
Example:
LOGF("An armed weapon is currently marking the board with 'GetTargetArea': %s", weaponPreview:IsTargetAreaMarker())
-
booleanweaponPreview:IsSecondTargetAreaMarker()
Returns true if there's currently an armed weapon marking the board with its GetSecondTargetArea; otherwise false. An armed weapon will mark the board with its GetSecondTargetArea when it's a two-click weapon and the first target has been selected.
Example:
LOGF("An armed weapon is currently marking the board with 'GetSecondTargetArea': %s", weaponPreview:IsSecondTargetAreaMarker())
-
void—weaponPreview:RegisterGroup(groupId, offset, multiIcon, multiIconMarkData)
| Argument | Type | Description |
|---|---|---|
groupId |
string | Unique group name (e.g. mod id + purpose) |
offset |
Point | PosX/PosY applied to all animations in this group |
multiIcon |
string | (optional) ANIMS key for consolidated multi-icon; defaults to library DEFAULT_MULTI_ICON
|
multiIconMarkData |
table | (optional) {duration, delay, loop} for multi-icon mark |
Registers a group of icons which are functionally or logically related that when multiple should be shown instead a multi-icon will be displayed and will combine the individual tooltips of the icons for the multi-icon.
Call once during mod load() before previewing grouped animations. Safe to call only once per groupId (subsequent calls are ignored).
Example:
WeaponPreview:RegisterGroup("more_plus_levelup_skills", Point(-25, 11))
-
voidweaponPreview:ResetQueuedSkillEffectTimer()
Resets the timer used to keep track of which mark to play during a preview of a queued weapon's GetQueuedSkillEffect.
Example:
weaponPreview:ResetQueuedSkillEffectTimer()
-
voidweaponPreview:ResetQueuedFinalEffectTimer()
Resets the timer used to keep track of which mark to play during a preview of a queued weapon's GetQueuedFinalEffect.
Example:
weaponPreview:ResetQueuedFinalEffectTimer()
-
voidweaponPreview:ResetSkillEffectTimer()
Resets the timer used to keep track of which mark to play during a preview of an armed weapon's GetSkillEffect. Can for instance be used in the beginning of GetSkillEffect to force a preview to always start from the beginning when targetting a new tile.
Example:
weaponPreview:ResetSkillEffectTimer()
-
voidweaponPreview:ResetFinalEffectTimer()
Resets the timer used to keep track of which mark to play during a preview of an armed weapon's GetFinalEffect. Can for instance be used in the beginning of GetFinalEffect to force a preview to always start from the beginning when targetting the second tile of a two-click weapon.
Example:
weaponPreview:ResetFinalEffectTimer()
-
voidweaponPreview:ResetTargetAreaTimer()
Resets the timer used to keep track of which mark to play during a preview of an armed weapon's GetTargetArea.
Example:
weaponPreview:ResetTargetAreaTimer()
-
voidweaponPreview:ResetSecondTargetAreaTimer()
Resets the timer used to keep track of which mark to play during a preview of an armed weapon's GetSecondTargetArea. Can be used to force the second target area preview to restart from the beginning.
Example:
weaponPreview:ResetSecondTargetAreaTimer()
-
voidweaponPreview:SetLooping(loop)
| Argument name | Type | Description |
|---|---|---|
loop |
boolean | Whether to enable or disable looping. Defaults to true
|
Disables looping if false. Otherwise enables looping.
Example:
weaponPreview:SetLooping(false)
The following constants represent different preview states and can be used with ExecuteWithState.
-
numberweaponPreview.STATE_NONE
Represents the idle state when no weapon preview is currently active. This is the default state when no weapon is selected or being previewed.
Example:
-- Check if we're in the idle state
if currentState == weaponPreview.STATE_NONE then
-- No preview active
end
-
numberweaponPreview.STATE_SKILL_EFFECT
Represents the state when a weapon's GetSkillEffect is being previewed. This state is active when a weapon is armed and hovering over a valid target tile.
Example:
-- Execute code in skill effect preview context
weaponPreview:ExecuteWithState(weaponPreview.STATE_SKILL_EFFECT, function()
-- This runs during skill effect preview
end)
-
number—weaponPreview.STATE_TARGET_AREA
Active while an armed weapon continuously previews GetTargetArea.
-
numberweaponPreview.STATE_QUEUED_SKILL
Represents the state when a queued weapon's skill effect is being previewed. This state is active when hovering over a unit that has a weapon queued for the next turn, and no armed weapon is currently active.
Example:
-- Check if we're previewing a queued skill
if currentState == weaponPreview.STATE_QUEUED_SKILL then
-- Queued weapon preview is active
end
-
number—weaponPreview.STATE_QUEUED_FINAL_EFFECT
Active while previewing a queued pawn's GetFinalEffect (two-click weapons).
-
numberweaponPreview.STATE_FINAL_EFFECT
Represents the state when a two-click weapon's GetFinalEffect is being previewed. This state is active when a two-click weapon is armed and hovering over a valid second target tile
Example:
-- Execute code in final effect preview context
weaponPreview:ExecuteWithState(weaponPreview.STATE_FINAL_EFFECT, function()
-- This runs during final effect preview of two-click weapons
end)
-
numberweaponPreview.STATE_SECOND_TARGET_AREA
Represents the state when a two-click weapon's GetSecondTargetArea is being previewed. This state is active when a two-click weapon is armed after the first click and displaying the available second target locations.
Example:
-- Execute code in second target area preview context
weaponPreview:ExecuteWithState(weaponPreview.STATE_SECOND_TARGET_AREA, function()
-- This runs during second target area preview
end)
The following events can be subscribed to, in order to be informed when the current marker changes.
Documentation on how to use events: Event System
-
string—weaponPreview.DEFAULT_MULTI_ICON("weaponPreview_icon_multihit")
Default animation key used when consolidating multiple grouped icons on one tile. Groups may override via RegisterGroup's multiIcon argument.
-
voidonQueuedSkillEffectHidden:subscribe(eventHandler)
| Argument name | Type | Description |
|---|---|---|
pawnId |
number | The id of the pawn queueing the weapon |
weapon |
string | The weapon being queued |
weaponIndex |
number | The weapon index of the weapon being queued |
Dispatched when a queued weapon stops marking the board. A queued weapon will mark the board when a unit that is queueing a weapon is highlighted, and there is no armed weapon marking the board with GetSkillEffect.
Example:
local handler = function(pawnId, weapon, weaponIndex)
LOGF(
"Pawn with pawnId %s stopped marking with "..
"its queued weapon %q with weapon index %s",
pawnId,
weapon,
weaponIndex
)
end
weaponPreview.events.onQueuedSkillEffectHidden:subscribe(handler)
-
voidonQueuedSkillEffectShown:subscribe(eventHandler)
| Argument name | Type | Description |
|---|---|---|
pawnId |
number | The id of the pawn queueing the weapon |
weapon |
string | The weapon being queued |
weaponIndex |
number | The weapon index of the weapon being queued |
Dispatched when a queued weapon begins marking the board. A queued weapon will mark the board when a unit that is queueing a weapon is highlighted, and there is no armed weapon marking the board with GetSkillEffect.
Example:
local handler = function(pawnId, weapon, weaponIndex)
LOGF(
"Pawn with pawnId %s started marking with "..
"its queued weapon %q with weapon index %s",
pawnId,
weapon,
weaponIndex
)
end
weaponPreview.events.onQueuedSkillEffectShown:subscribe(handler)
-
voidonQueuedFinalEffectHidden:subscribe(eventHandler)
| Argument name | Type | Description |
|---|---|---|
pawnId |
number | The id of the pawn queueing the weapon |
weapon |
string | The weapon being queued |
weaponIndex |
number | The weapon index of the weapon being queued |
Dispatched when a queued weapon stops marking the board. A queued weapon will mark the board when a unit that is queueing a two click weapon is highlighted, and there is no armed weapon marking the board with GetSkillEffect.
Example:
local handler = function(pawnId, weapon, weaponIndex)
LOGF(
"Pawn with pawnId %s stopped marking with "..
"its queued two click weapon %q with weapon index %s",
pawnId,
weapon,
weaponIndex
)
end
weaponPreview.events.onQueuedFinalEffectHidden:subscribe(handler)
-
voidonQueuedFinalEffectShown:subscribe(eventHandler)
| Argument name | Type | Description |
|---|---|---|
pawnId |
number | The id of the pawn queueing the weapon |
weapon |
string | The weapon being queued |
weaponIndex |
number | The weapon index of the weapon being queued |
Dispatched when a queued two click weapon begins marking the board. A queued two click weapon will mark the board when a unit that is queueing a weapon is highlighted, and there is no armed weapon marking the board with GetSkillEffect.
Example:
local handler = function(pawnId, weapon, weaponIndex)
LOGF(
"Pawn with pawnId %s started marking with "..
"its queued two click weapon %q with weapon index %s",
pawnId,
weapon,
weaponIndex
)
end
weaponPreview.events.onQueuedFinalEffectShown:subscribe(handler)
-
voidonSkillEffectHidden:subscribe(eventHandler)
| Argument name | Type | Description |
|---|---|---|
pawnId |
number | The id of the pawn arming the weapon |
weapon |
string | The weapon being armed |
weaponIndex |
number | The weapon index of the weapon being armed |
Dispatched when an armed weapon stops marking the board with its GetSkillEffect. An armed weapon will mark the board with its GetSkillEffect when it's armed and highlighting a valid tile as defined by its GetTargetArea.
Example:
local handler = function(pawnId, weapon, weaponIndex)
LOGF(
"Pawn with pawnId %s stopped marking with "..
"GetSkillEffect with its armed weapon %q "..
"with weapon index %s",
pawnId,
weapon,
weaponIndex
)
end
weaponPreview.events.onSkillEffectHidden:subscribe(handler)
-
voidonSkillEffectShown:subscribe(eventHandler)
| Argument name | Type | Description |
|---|---|---|
pawnId |
number | The id of the pawn arming the weapon |
weapon |
string | The weapon being armed |
weaponIndex |
number | The weapon index of the weapon being armed |
Dispatched when an armed weapon begins marking the board with its GetSkillEffect. An armed weapon will mark the board with its GetSkillEffect when it's armed and highlighting a valid tile as defined by its GetTargetArea.
Example:
local handler = function(pawnId, weapon, weaponIndex)
LOGF(
"Pawn with pawnId %s started marking with "..
"GetSkillEffect with its armed weapon %q "..
"with weapon index %s",
pawnId,
weapon,
weaponIndex
)
end
weaponPreview.events.onSkillEffectShown:subscribe(handler)
-
voidonFinalEffectHidden:subscribe(eventHandler)
| Argument name | Type | Description |
|---|---|---|
pawnId |
number | The id of the pawn arming the weapon |
weapon |
string | The weapon being armed |
weaponIndex |
number | The weapon index of the weapon being armed |
Dispatched when an armed weapon stops marking the board with its GetFinalEffect. An armed weapon will mark the board with its GetFinalEffect when it's a two-click weapon and highlighting a valid tile as defined by its GetSecondTargetArea.
Example:
local handler = function(pawnId, weapon, weaponIndex)
LOGF(
"Pawn with pawnId %s stopped marking with "..
"GetFinalEffect with its armed weapon %q "..
"with weapon index %s",
pawnId,
weapon,
weaponIndex
)
end
weaponPreview.events.onFinalEffectHidden:subscribe(handler)
-
voidonFinalEffectShown:subscribe(eventHandler)
| Argument name | Type | Description |
|---|---|---|
pawnId |
number | The id of the pawn arming the weapon |
weapon |
string | The weapon being armed |
weaponIndex |
number | The weapon index of the weapon being armed |
Dispatched when an armed weapon begins marking the board with its GetFinalEffect. An armed weapon will mark the board with its GetFinalEffect when it's a two-click weapon and highlighting a valid tile as defined by its GetSecondTargetArea.
Example:
local handler = function(pawnId, weapon, weaponIndex)
LOGF(
"Pawn with pawnId %s started marking with "..
"GetFinalEffect with its armed weapon %q "..
"with weapon index %s",
pawnId,
weapon,
weaponIndex
)
end
weaponPreview.events.onFinalEffectShown:subscribe(handler)
-
voidonTargetAreaHidden:subscribe(eventHandler)
| Argument name | Type | Description |
|---|---|---|
pawnId |
number | The id of the pawn arming the weapon |
weapon |
string | The weapon being armed |
weaponIndex |
number | The weapon index of the weapon being armed |
Dispatched when an armed weapon stops marking the board with its GetTargetArea. An armed weapon will continuously mark the board with its GetTargetArea whenever it's armed.
Example:
local handler = function(pawnId, weapon, weaponIndex)
LOGF(
"Pawn with pawnId %s stopped marking with "..
"GetTargetArea with its armed weapon %q "..
"with weapon index %s",
pawnId,
weapon,
weaponIndex
)
end
weaponPreview.events.onTargetAreaHidden:subscribe(handler)
-
voidonTargetAreaShown:subscribe(eventHandler)
| Argument name | Type | Description |
|---|---|---|
pawnId |
number | The id of the pawn arming the weapon |
weapon |
string | The weapon being armed |
weaponIndex |
number | The weapon index of the weapon being armed |
Dispatched when an armed weapon starts marking the board with its GetTargetArea. An armed weapon will continuously mark the board with its GetTargetArea whenever it's armed.
Example:
local handler = function(pawnId, weapon, weaponIndex)
LOGF(
"Pawn with pawnId %s started marking with "..
"GetTargetArea with its armed weapon %q "..
"with weapon index %s",
pawnId,
weapon,
weaponIndex
)
end
weaponPreview.events.onTargetAreaShown:subscribe(handler)
-
voidonSecondTargetAreaHidden:subscribe(eventHandler)
| Argument name | Type | Description |
|---|---|---|
pawnId |
number | The id of the pawn arming the weapon |
weapon |
string | The weapon being armed |
weaponIndex |
number | The weapon index of the weapon being armed |
Dispatched when an armed weapon stops marking the board with its GetSecondTargetArea. An armed weapon will mark the board with its GetSecondTargetArea when it's a two-click weapon and the first target has been selected.
Example:
local handler = function(pawnId, weapon, weaponIndex)
LOGF(
"Pawn with pawnId %s stopped marking with "..
"GetSecondTargetArea with its armed weapon %q "..
"with weapon index %s",
pawnId,
weapon,
weaponIndex
)
end
weaponPreview.events.onSecondTargetAreaHidden:subscribe(handler)
-
voidonSecondTargetAreaShown:subscribe(eventHandler)
| Argument name | Type | Description |
|---|---|---|
pawnId |
number | The id of the pawn arming the weapon |
weapon |
string | The weapon being armed |
weaponIndex |
number | The weapon index of the weapon being armed |
Dispatched when an armed weapon starts marking the board with its GetSecondTargetArea. An armed weapon will mark the board with its GetSecondTargetArea when it's a two-click weapon and the first target has been selected.
Example:
local handler = function(pawnId, weapon, weaponIndex)
LOGF(
"Pawn with pawnId %s started marking with "..
"GetSecondTargetArea with its armed weapon %q "..
"with weapon index %s",
pawnId,
weapon,
weaponIndex
)
end
weaponPreview.events.onSecondTargetAreaShown:subscribe(handler)