The activeItem table contains bindings which provide functionality for the ActiveItem and for the item's 'owner' (a ToolUser entity currently holding the item).
Returns the entity id of the owner entity.
Returns the damage team of the owner entity.
Returns the world aim position of the owner entity.
Returns the power multiplier of the owner entity.
Returns the current fire mode of the item, which can be "none", "primary" or "alt". Single-handed items held in the off hand will receive right click as "primary" rather than "alt".
Returns the name of the hand that the item is currently held in, which can be "primary" or "alt".
Takes an input position (defaults to [0, 0]) relative to the item and returns a position relative to the owner entity.
Returns a table containing the `float` aim angle and `int` facing direction that would be used for the item to aim at the specified target position with the specified vertical offset. This takes into account the position of the shoulder, distance of the hand from the body, and a lot of other complex factors and should be used to control aimable weapons or tools based on the owner's aim position.
Similar to activeItem.aimAngleAndDirection but only returns the aim angle that would be calculated with the entity's current facing direction. Necessary if, for example, an item needs to aim behind the owner.
Sets whether the owner is visually holding the item.
Sets the arm image frame that the item should use when held behind the player, or clears it to the default rotation arm frame if no frame is specified.
Sets the arm image frame that the item should use when held in front of the player, or clears it to the default rotation arm frame if no frame is specified.
Sets whether the item should be visually held with both hands. Does not alter the functional handedness requirement of the item.
Sets whether the item is in a recoil state, which will translate both the item and the arm holding it slightly toward the back of the character.
Sets whether the item should be visually rendered outside the owner's hand. Items outside of the hand will be rendered in front of the arm when held in front and behind the arm when held behind.
Sets the angle to which the owner's arm holding the item should be rotated.
Sets the item's requested facing direction, which controls the owner's facing. Positive direction values will face right while negative values will face left. If the owner holds two items which request opposing facing directions, the direction requested by the item in the primary hand will take precedence.
Sets a list of active damage sources with coordinates relative to the owner's position or clears them if unspecified.
Sets a list of active damage sources with coordinates relative to the item's hand position or clears them if unspecified.
Sets a list of active shield polygons with coordinates relative to the owner's position or clears them if unspecified.
Sets a list of active shield polygons with coordinates relative to the item's hand position or clears them if unspecified.
Sets a list of active physics force regions with coordinates relative to the owner's position or clears them if unspecified.
Sets a list of active physics force regions with coordinates relative to the item's hand position or clears them if unspecified.
Sets the item's overriding cursor image or clears it if unspecified.
Sets a parameter to be used by the item's scripted animator.
Sets the inventory icon of the item.
String` parameter, <code>Json value)
Sets an instance value (parameter) of the item.
String functionName, [
LuaValue args ...])
Attempts to call the specified function name with the specified argument values in the context of an ActiveItem held in the opposing hand and synchronously returns the result if successful.
Json config, [
Triggers an interact action on the owner as if they had initiated an interaction and the result had returned the specified interaction type and configuration. Can be used to e.g. open GUI windows normally triggered by player interaction with entities.
Triggers the owner to perform the specified emote.
If the owner is a player, sets that player's camera to be centered on the position of the specified entity, or recenters the camera on the player's position if no entity id is specified.
Portal - Basics - JSON - Lua - Assets - Guides
Tables - Hooks - Tips & Tricks - Libraries - All Pages