Item proxy (self.item)¶
Bound on script tables as self.item. Only these members are available; unknown names are rejected.
Source: Utils/Lua/LuaItemApi.cs.
Properties¶
| Name | Lua type | Access | Notes |
|---|---|---|---|
Attacking |
boolean |
Read/write | Melee swing state. Non-melee items read false and ignore writes. |
AttackPosture |
boolean |
Read/write | Held-item body attack posture. Non-held items read false and ignore writes. |
CollisionsEnabled |
boolean |
Read/write | Whether melee or loaded held-item collisions are active. Unsupported hosts read false and ignore writes. |
CurClipSize |
integer |
Read/write | Current rounds in the clip. Reads 0 and ignores writes on items without a loaded held-item host. |
CurGlobalCenter |
Vector2 | Read-only | Current center in world pixels. Returns a Vector2 value copy, or (0, 0) when the item is absent. |
DamageModifier |
number |
Read/write | Damage multiplier, where 1 means unchanged. Reads 1 and ignores writes on unsupported hosts. |
DefaultAttackSpeedModifier |
number |
Read/write | Default attack-speed multiplier, where 1 means unchanged. Reads 1 and ignores writes on unsupported hosts. |
EnergyDrainPerSecond |
number |
Read/write | Player energy drain in points per second. Non-held items read 0 and ignore writes. |
FinishSwingOnCollide |
boolean |
Read/write | Whether the loaded held-item swing finishes on collision. Reads true and ignores writes on unsupported hosts. |
HidesBackArm |
boolean |
Read/write | Whether the held-item drawing hides the back arm. Reads false and ignores writes on unsupported hosts. |
HitsDeposits |
boolean |
Read/write | Whether loaded held-item collisions can strike deposits. Reads false and ignores writes on unsupported hosts. |
HUDAmmoDisplayOverrideString |
string or nil |
Read/write | Ammo HUD override text, or nil when unset or the item is absent. Assign nil to clear the override. |
IgnoreGroundCollisions |
boolean |
Read/write | Whether the loaded held item ignores ground collisions. Reads false and ignores writes on unsupported hosts. |
IsDead |
boolean |
Read/write | Whether the item is marked for removal. Reads false and ignores writes when the item is absent. |
IsLocallyEquipped |
boolean |
Read-only | Check whether this item is the local player's displayed equipped held item. True only for the local player's displayed loaded held item, including an active displacing quick slot. False for displaced hotbar, remote, holstered, world, unsupported, or absent items. This is an execution-context check, independent of host authority. |
MaxClipSize |
integer |
Read/write | Maximum rounds in the clip. Reads 0 and ignores writes on items without a loaded held-item host. |
Owner |
Player or EntityView or Creature or Item or Projectile or OwnerToken or nil |
Read/write | Allowlisted current owner. Getters return Player, EntityView, Item, Projectile, an opaque OwnerToken, or nil; living non-player owners become EntityView. Setters accept the listed proxy types, including Creature, or nil to clear the owner. Other values unwrap to nil. Writes are ignored when the item is absent. |
PickPower |
integer |
Read/write | Loaded held-item mining power. Reads 0 and ignores writes on unsupported hosts. |
PreventMovement |
boolean |
Read/write | Whether the held item prevents player movement. Non-held items read false and ignore writes. |
Rotation |
number |
Read/write | Item rotation in radians. Reads 0 and ignores writes when the item is absent. |
UseClientSideInputLogic |
boolean |
Read/write | Whether the loaded held item uses client-side input logic. Reads true and ignores writes on unsupported hosts. |
UsingCombatWalk |
boolean |
Read/write | Whether the held item uses the combat walk. Non-held items read false and ignore writes. |
UsingForcedWalk |
boolean |
Read/write | Whether the held item forces walking. Non-held items read false and ignore writes. |
Velocity |
Vector2 | Read/write | Velocity in pixels per simulation update. Returns a Vector2 value copy; assign the whole vector to change it. Reads (0, 0) and ignores writes when the item is absent. |
Width |
integer |
Read-only | Item width in pixels, or 0 when the item is absent. |
X |
number |
Read/write | Horizontal position in world pixels. Reads 0 and ignores writes when the item is absent. |
Y |
number |
Read/write | Vertical position in world pixels. Reads 0 and ignores writes when the item is absent. |
Methods¶
| Lua call | Arguments | Returns | Notes |
|---|---|---|---|
self.item:AddBoneTextureOverride(boneName, textureName) |
boneName: string — Authored bone name.textureName: string — Authored texture name. |
no return value | Override a loaded held-item bone texture. Unsupported hosts do nothing. |
self.item:AddMotionBlurTextureOverride(boneName, textureName) |
boneName: string — Authored bone name.textureName: string — Authored texture name. |
no return value | Override a loaded held-item motion-blur texture. Unsupported hosts do nothing. |
self.item:AdjustPlayerEnergy(adjustmentAmount) |
adjustmentAmount: number — Signed player-energy adjustment in points. |
no return value | Adjust equipped player energy, clamped to 0 through MaxEnergy. Requires an equipped player on a held-item host; non-held items do nothing. |
self.item:ApplyLocationalStatusEffectToCreature(creature, statusEffectTypeString, duration, intensity, hitLocation, stacks) |
creature: Player or EntityView or Creature or nil — Living Player, EntityView, or Creature. Nil does nothing; non-living values are ignored.statusEffectTypeString: string — Exact registered pack StatusEffectTypeString, or a case-insensitive built-in enum name or legacy alias.duration: number — Duration in milliseconds.intensity: number — Effect-specific intensity.hitLocation: Vector2 — Hit position in world pixels.stacks: boolean (optional); default false — Whether this status effect stacks. Defaults to false. |
no return value | Apply a named status effect at a living target world hit position. BLEED attaches at its hit location; other effects, including registered pack effects, apply normally and ignore the location. Invalid effect names, nil targets, non-living values, and unsupported item hosts do nothing. |
self.item:ApplyStatusEffectToCreature(creature, statusEffectTypeString, duration, intensity, stacks) |
creature: Player or EntityView or Creature or nil — Living Player, EntityView, or Creature. Nil does nothing; non-living values are ignored.statusEffectTypeString: string — Exact registered pack StatusEffectTypeString, or a case-insensitive built-in enum name or legacy alias.duration: number — Duration in milliseconds.intensity: number — Effect-specific intensity.stacks: boolean (optional); default false — Whether this status effect stacks. Defaults to false. |
no return value | Apply a named status effect to a living target. Invalid effect names, nil targets, non-living values, and unsupported item hosts do nothing. |
self.item:CleanUpSFXInstance(instance) |
instance: SoundEffectHandle or nil — SoundEffectHandle returned by a documented sound method; nil does nothing. |
no return value | Clean up a sound handle through a loaded held-item host. Nil, unsupported handles, and unsupported item hosts do nothing. |
self.item:ClearBoneTextureOverrides() |
None | no return value | Clear loaded held-item bone overrides. Unsupported hosts do nothing. |
self.item:ClearLastGlobalCollisionPoints() |
None | no return value | Clear recorded melee collision points from the last swing. Non-melee items do nothing. |
self.item:ClearMotionBlurTextureOverrides() |
None | no return value | Clear loaded held-item motion-blur overrides. Unsupported hosts do nothing. |
self.item:DamageTile(tileX, tileY, pickPower) |
tileX: integer — Horizontal tile index, not a pixel coordinate.tileY: integer — Vertical tile index, not a pixel coordinate.pickPower: integer — Mining power. |
no return value | Damage a map tile with the given mining power. Requires a loaded held-item host; unsupported hosts do nothing. |
self.item:DealDamage(target, piercePercent) |
target: Player or EntityView or Creature or nil — Living Player, EntityView, or Creature. Nil does nothing; non-living values are ignored.piercePercent: number — Armor-piercing fraction from 0 to 1. The current direct-damage pipeline ignores this argument. |
no return value | Deal loaded held-item damage to a living target. Nil, non-living owner values, and unsupported item hosts do nothing. |
self.item:DealDamage(target, position, damage, piercePercent) |
target: Player or EntityView or Creature or nil — Living Player, EntityView, or Creature. Nil does nothing; non-living values are ignored.position: Vector2 — Damage position in world pixels.damage: number — Damage in damage points.piercePercent: number — Armor-piercing fraction from 0 to 1. The current direct-damage pipeline ignores this argument. |
no return value | Deal loaded held-item damage to a living target. Nil, non-living owner values, and unsupported item hosts do nothing. |
self.item:DisableCollisions() |
None | no return value | Disable loaded held-item collisions. Other item hosts do nothing; use CollisionsEnabled for melee hosts. |
self.item:DisableTaggedMeleeCollisionPoint(tag) |
tag: string — Authored tag string. |
no return value | Disable loaded held-item melee collision points with the given tag. Unsupported hosts do nothing. |
self.item:DisturbNearbyChickens() |
None | no return value | Disturb nearby chickens through a loaded held-item host. Unsupported hosts do nothing. |
self.item:DrawGlow(x, y, r, g, b, scale) |
x: number — Horizontal pixel coordinate.y: number — Vertical pixel coordinate.r: number — Red channel from 0 to 255, clamped.g: number — Green channel from 0 to 255, clamped.b: number — Blue channel from 0 to 255, clamped.scale: number — Glow scale multiplier. |
no return value | Draw an additive circular glow in world pixels. Only works during drawEffect on a loaded held-item host with the glow texture loaded. Color channels are clamped to 0 through 255. |
self.item:DrawLaser(startX, startY, endX, endY, r, g, b, widthScale) |
startX: number — Start X position in world pixels.startY: number — Start Y position in world pixels.endX: number — End X position in world pixels.endY: number — End Y position in world pixels.r: number — Red channel from 0 to 255, clamped.g: number — Green channel from 0 to 255, clamped.b: number — Blue channel from 0 to 255, clamped.widthScale: number — Beam width multiplier. |
no return value | Draw a laser beam in world pixels. Only works during drawEffect on a loaded held-item host. Color channels are clamped to 0 through 255. |
self.item:EnableCollisions() |
None | no return value | Enable loaded held-item collisions. Other item hosts do nothing; use CollisionsEnabled for melee hosts. |
self.item:EnableTaggedMeleeCollisionPoint(tag) |
tag: string — Authored tag string. |
no return value | Enable loaded held-item melee collision points with the given tag. Unsupported hosts do nothing. |
self.item:EndLoopingSound(label) |
label: string — Authored sound or light label. |
no return value | End a named loop on a loaded held-item or loaded melee host. Other hosts do nothing. |
self.item:FireHitscan(startX, startY, dirX, dirY, maxRange, damage) |
startX: number — Start X position in world pixels.startY: number — Start Y position in world pixels.dirX: number — Horizontal ray direction component.dirY: number — Vertical ray direction component.maxRange: number — Maximum ray range in pixels.damage: number — Damage in damage points. |
Vector2 — Final world position as a Vector2 value copy. Unsupported hosts return the supplied start position. | Fire a loaded held-item hitscan and return its final world position. |
self.item:FireItem(itemType, speed, emitBoneName, emitBoneOffsetX, emitBoneOffsetY, spreadRadian, angleOffset) |
itemType: ItemTypeToken — Built-in ammo token returned by GetCurAmmoType; numeric enum IDs are not accepted by the Lua binder. Prefer the namespaced string overload for pack items.speed: number — Speed in pixels per simulation update.emitBoneName: string — Authored emission bone name.emitBoneOffsetX: number — Horizontal texture offset from the emission bone in pixels.emitBoneOffsetY: number — Vertical texture offset from the emission bone in pixels.spreadRadian: number (optional); default 0 — Charge fraction for fired arrows, normally 0 to 1. Despite its name, this argument does not set launch spread; other item types ignore it. Defaults to 0.angleOffset: number (optional); default 0 — Launch angle offset in radians. Defaults to 0. |
no return value | Fire an item from a held-item bone on the locally equipped player. Requires a loaded held-item host; unsupported or non-local hosts do nothing. |
self.item:FireItem(uniqueItemTypeID, speed, emitBoneName, emitBoneOffsetX, emitBoneOffsetY, spreadRadian, angleOffset) |
uniqueItemTypeID: string — Full registered item identity string.speed: number — Speed in pixels per simulation update.emitBoneName: string — Authored emission bone name.emitBoneOffsetX: number — Horizontal texture offset from the emission bone in pixels.emitBoneOffsetY: number — Vertical texture offset from the emission bone in pixels.spreadRadian: number (optional); default 0 — Charge fraction for fired arrows, normally 0 to 1. Despite its name, this argument does not set launch spread; other item types ignore it. Defaults to 0.angleOffset: number (optional); default 0 — Launch angle offset in radians. Defaults to 0. |
no return value | Fire an item from a held-item bone on the locally equipped player. Requires a loaded held-item host; unsupported or non-local hosts do nothing. |
self.item:FireProjectile(projectileTypeID, speed, emitX, emitY, velX, velY, accuracyModifier) |
projectileTypeID: integer — Registered numeric projectile type ID.speed: number — Speed in pixels per simulation update.emitX: number — Emission X position in world pixels.emitY: number — Emission Y position in world pixels.velX: number — Horizontal direction component, multiplied by speed.velY: number — Vertical direction component, multiplied by speed.accuracyModifier: number (optional); default 1 — Accepted for compatibility; the explicit-coordinate host overload does not use this argument. Defaults to 1. |
Projectile or nil — The inserted projectile, or nil for an unsupported item host, unavailable map, or unknown projectile type. Existing callers may ignore the return value. |
Fire a registered projectile at world coordinates in this local simulation. The projectile has completed its initialization callbacks and is inserted before return; callers may customize it before its first update. Creation and later changes are not automatically replicated. |
self.item:FireProjectile(projectileTypeID, speed, emitBoneName, emitBoneOffsetX, emitBoneOffsetY, accuracyModifier) |
projectileTypeID: integer — Registered numeric projectile type ID.speed: number — Speed in pixels per simulation update.emitBoneName: string — Authored emission bone name.emitBoneOffsetX: number — Horizontal texture offset from the emission bone in pixels.emitBoneOffsetY: number — Vertical texture offset from the emission bone in pixels.accuracyModifier: number (optional); default 1 — Accuracy multiplier; 1 leaves the authored accuracy unchanged. Defaults to 1. |
Projectile or nil — The inserted projectile, or nil for an unsupported item host, absent or non-local equipped player, unavailable player map, or unknown projectile type. Existing callers may ignore the return value. |
Fire a registered projectile from a held-item bone on the local equipped player. The projectile has completed its initialization callbacks and is inserted before return; callers may customize it before its first update. Creation and later changes are not automatically replicated. |
self.item:FireProjectile(uniqueProjectileTypeString, speed, emitX, emitY, velX, velY, accuracyModifier) |
uniqueProjectileTypeString: string — Full registered projectile identity string.speed: number — Speed in pixels per simulation update.emitX: number — Emission X position in world pixels.emitY: number — Emission Y position in world pixels.velX: number — Horizontal direction component, multiplied by speed.velY: number — Vertical direction component, multiplied by speed.accuracyModifier: number (optional); default 1 — Accepted for compatibility; the explicit-coordinate host overload does not use this argument. Defaults to 1. |
Projectile or nil — The inserted projectile, or nil for an unsupported item host, unavailable map, or empty or unknown projectile identity. Existing callers may ignore the return value. |
Fire a registered projectile at world coordinates in this local simulation. The projectile has completed its initialization callbacks and is inserted before return; callers may customize it before its first update. Creation and later changes are not automatically replicated. |
self.item:FireProjectile(uniqueProjectileTypeString, speed, emitBoneName, emitBoneOffsetX, emitBoneOffsetY, accuracyModifier) |
uniqueProjectileTypeString: string — Full registered projectile identity string.speed: number — Speed in pixels per simulation update.emitBoneName: string — Authored emission bone name.emitBoneOffsetX: number — Horizontal texture offset from the emission bone in pixels.emitBoneOffsetY: number — Vertical texture offset from the emission bone in pixels.accuracyModifier: number (optional); default 1 — Accuracy multiplier; 1 leaves the authored accuracy unchanged. Defaults to 1. |
Projectile or nil — The inserted projectile, or nil for an unsupported item host, absent or non-local equipped player, unavailable player map, or empty or unknown projectile identity. Existing callers may ignore the return value. |
Fire a registered projectile from a held-item bone on the local equipped player. The projectile has completed its initialization callbacks and is inserted before return; callers may customize it before its first update. Creation and later changes are not automatically replicated. |
self.item:FireSpell(emitPosition, emitDirectionVector, spellTypeString, canHitOwner) |
emitPosition: Vector2 — Emission position in world pixels.emitDirectionVector: Vector2 — Emission direction vector.spellTypeString: string — SpellType enum name.canHitOwner: boolean (optional); default false — Whether the spell can hit its owner. Defaults to false. |
no return value | Fire a named spell from the given world position and direction. Invalid spell names and unsupported item hosts do nothing. |
self.item:GetCurAmmoType() |
None | ItemTypeToken — Opaque built-in ammo enum userdata, or the NULL enum token on unsupported hosts. The bundled Lua bridge does not convert this return to a Lua integer. | Read the current built-in ammo enum value. Unsupported hosts return the NULL enum value. |
self.item:GetCurrentAnimationName() |
None | string or nil — Current animation name, or nil on unsupported hosts. |
Read the current animation name on a loaded held-item host. |
self.item:GetEquippedPlayer() |
None | Player or nil — Equipped Player proxy, or nil on unsupported hosts or when no player is equipped. |
Get the equipped player from a loaded held-item host. |
self.item:GetGlobalBonePosition(boneName, textureOffsetX, textureOffsetY) |
boneName: string — Authored bone name.textureOffsetX: integer (optional); default 0 — Horizontal texture offset from the bone in pixels. Defaults to 0.textureOffsetY: integer (optional); default 0 — Vertical texture offset from the bone in pixels. Defaults to 0. |
Vector2 — World position as a Vector2 value copy; (0, 0) on unsupported hosts. | Read a loaded held-item bone position in world pixels. |
self.item:GetNewParticleInstanceID() |
None | integer — Particle-instance integer, or 0 when the item is absent. |
Allocate an item particle-instance identifier for persistent effects. |
self.item:GetPlayerEnergy() |
None | number — Current player-energy points, or 0 on non-held item hosts. |
Read equipped player energy through a held-item host. Requires an equipped player. |
self.item:GetRandomGlobalCollisionPoint() |
None | MeleeCollisionPointView or nil — Read-only collision-point snapshot, or nil on unsupported hosts or when no point is available. |
Get a read-only snapshot of a loaded held-item collision point, including its bone name and pixel texture offsets. The result is not a world-position vector. |
self.item:GetTransitionAnimationName() |
None | string or nil — Destination animation name, or nil on unsupported hosts or when unavailable. |
Read the destination animation name on a loaded held-item host. |
self.item:HasTag(tag) |
tag: string — Authored tag string. |
boolean — False when the host is absent or does not support this operation. |
Check an authored item tag. |
self.item:HitscanHitLast() |
None | boolean — False when the host is absent or does not support this operation. |
Check whether the last loaded held-item hitscan hit something. |
self.item:HitscanHitLivingLast() |
None | boolean — False when the host is absent or does not support this operation. |
Check whether the last loaded held-item hitscan hit a living entity. |
self.item:IsCollisionsEnabled() |
None | boolean — False when the host is absent or does not support this operation. |
Check loaded held-item collisions. Use CollisionsEnabled for melee hosts. |
self.item:IsCurAmmoValid() |
None | boolean — False when the host is absent or does not support this operation. |
Check whether the loaded held item has valid current ammo. |
self.item:IsEnoughEnergyPerSecond(gameTime, ratePerSecond) |
gameTime: GameTime — Current callback GameTime; pass the update callback value.ratePerSecond: number — Player-energy rate in points per second. |
boolean — False when the host is absent or does not support this operation. |
Check whether the held item has enough player energy for this update at the specified per-second rate. Requires an equipped player. |
self.item:IsPowered() |
None | boolean — False when the host is absent or does not support this operation. |
Check whether the held item is powered. |
self.item:IsSoundPlaying(instance) |
instance: SoundEffectHandle or nil — SoundEffectHandle returned by a documented sound method; nil does nothing. |
boolean — False for nil or unsupported handles, an unsupported item host, or a failed sound operation. |
Check a sound handle through a loaded held-item or loaded melee host. |
self.item:IsTransitioning() |
None | boolean — False when the host is absent or does not support this operation. |
Check whether a loaded held-item animation is transitioning. |
self.item:LoadSoundEffect(label, path) |
label: string — Authored sound or light label.path: string — Content sound asset path. |
no return value | Load a named sound clip on a loaded held-item or loaded melee host. Other item hosts do nothing. |
self.item:MuzzleFlash(emitBoneName, emitBoneOffsetX, emitBoneOffsetY, spreadRadian, scaleX, scaleY) |
emitBoneName: string — Authored emission bone name.emitBoneOffsetX: number — Horizontal texture offset from the emission bone in pixels.emitBoneOffsetY: number — Vertical texture offset from the emission bone in pixels.spreadRadian: number (optional); default .5 — Flash angular spread in radians. Defaults to .5.scaleX: number (optional); default .5 — Horizontal scale multiplier. Defaults to .5.scaleY: number (optional); default .5 — Vertical scale multiplier. Defaults to .5. |
no return value | Emit a muzzle flash from a loaded held-item bone. Unsupported hosts do nothing. |
self.item:PauseSound(instance) |
instance: SoundEffectHandle or nil — SoundEffectHandle returned by a documented sound method; nil does nothing. |
boolean — False for nil or unsupported handles, an unsupported item host, or a failed sound operation. |
Pause a sound handle through a loaded held-item or loaded melee host. |
self.item:PerformActionNetworked(actionIndex) |
actionIndex: integer — Action selector passed to performAction on the networked path; its meaning is defined by the script. |
no return value | Send an authored action from the local player's displayed held item, including an active displacing quick slot, to the other instances. Does not invoke the local callback; HeldItem:performActionNetworked invokes it before sending. Displaced hotbar, remote, holstered, world, and unsupported item hosts do nothing. The host runs the received action and relays it to other clients, excluding its originating player; receivers require a matching held-item network ID. |
self.item:PlayAnimation(animationName, speed) |
animationName: string — Authored animation name.speed: number — Playback multiplier; 1 is normal speed. |
no return value | Start a held-item animation at the given playback multiplier. Non-held items do nothing. |
self.item:PlayHitSpriteFX(hitPosition) |
hitPosition: Vector2 — Hit position in world pixels. |
no return value | Play a loaded held-item hit effect at a world position. Unsupported hosts do nothing. |
self.item:PlayLoopingSoundEffect(label, volume, pitch) |
label: string — Authored sound or light label.volume: number (optional); default 1 — Volume multiplier from 0 to 1. Defaults to 1.pitch: number (optional); default 0 — Pitch adjustment from -1 to 1; 0 is unchanged. Defaults to 0. |
SoundEffectHandle or nil — Sound control handle, or nil when the host or clip is unavailable. |
Play a looping clip on a loaded held-item or loaded melee host and return its control handle. |
self.item:PlayParticleEffectOnce(particleEffectPath, emitPosition) |
particleEffectPath: string — Content particle asset path.emitPosition: Vector2 — Emission position in world pixels. |
no return value | Trigger a particle asset once at a world position. Does nothing when the item is absent. |
self.item:PlayParticleEffectPersistent(particleEffectPath, particleInstanceID, emitX, emitY) |
particleEffectPath: string — Content particle asset path.particleInstanceID: integer — Identifier returned by GetNewParticleInstanceID.emitX: number — Emission X position in world pixels.emitY: number — Emission Y position in world pixels. |
no return value | Update a persistent particle instance at a world position. Does nothing when the item is absent. |
self.item:PlayParticleEffectPersistent(particleEffectPath, particleInstanceID, emitPosition) |
particleEffectPath: string — Content particle asset path.particleInstanceID: integer — Identifier returned by GetNewParticleInstanceID.emitPosition: Vector2 — Emission position in world pixels. |
no return value | Update a persistent particle instance at a world position. Does nothing when the item is absent. |
self.item:PlayPositionalSoundFX(cueName) |
cueName: string — Authored audio cue name. |
no return value | Play an audio cue at the equipped player center. Empty cue names, unsupported hosts, and unequipped items do nothing. |
self.item:PlaySoundEffect(label, volume, pitch) |
label: string — Authored sound or light label.volume: number (optional); default 1 — Volume multiplier from 0 to 1. Defaults to 1.pitch: number (optional); default 0 — Pitch adjustment from -1 to 1; 0 is unchanged. Defaults to 0. |
SoundEffectHandle or nil — Sound control handle, or nil when unavailable. Loaded melee hosts play the sound but return nil. |
Play a named sound on a loaded held-item or loaded melee host. The melee host plays the clip but does not return a handle. |
self.item:ProjectTrajectory(emitBoneName, emitBoneOffsetX, emitBoneOffsetY, speed) |
emitBoneName: string — Authored emission bone name.emitBoneOffsetX: number — Horizontal texture offset from the emission bone in pixels.emitBoneOffsetY: number — Vertical texture offset from the emission bone in pixels.speed: number — Speed in pixels per simulation update. |
no return value | Draw a locally equipped loaded held-item trajectory preview from a bone. Unsupported and non-local hosts do nothing. |
self.item:ProjectTrajectory(emitBoneName, emitBoneOffsetX, emitBoneOffsetY, speed, bounds) |
emitBoneName: string — Authored emission bone name.emitBoneOffsetX: number — Horizontal texture offset from the emission bone in pixels.emitBoneOffsetY: number — Vertical texture offset from the emission bone in pixels.speed: number — Speed in pixels per simulation update.bounds: Rectangle — Rectangle userdata. Sandbox scripts have no constructor or producer for this value; its members remain opaque. Prefer the overload without bounds. |
no return value | Draw a locally equipped loaded held-item trajectory preview from a bone. Unsupported and non-local hosts do nothing. The bounds overload requires an engine Rectangle; use the overload without bounds in sandbox scripts. |
self.item:ReleasePersistentCue() |
None | no return value | Release the persistent audio cue through a loaded held-item host. Unsupported hosts do nothing. |
self.item:RemoveQuantity(amount) |
amount: integer — Positive number of stack units to remove, capped at the remaining amount. |
no return value | Remove units from this item stack on the host. Depletion marks the item dead. Does nothing on clients, for an absent or empty item, or for a nonpositive amount. |
self.item:ResumeSound(instance) |
instance: SoundEffectHandle or nil — SoundEffectHandle returned by a documented sound method; nil does nothing. |
boolean — False for nil or unsupported handles, an unsupported item host, or a failed sound operation. |
Resume a sound handle through a loaded held-item or loaded melee host. |
self.item:SetAnimationSpeed(speed, animationName) |
speed: number — Playback multiplier; 1 is normal speed.animationName: string or nil (optional); default nil — Authored animation name. Defaults to nil. |
no return value | Change loaded held-item playback speed. A supplied name must match the current non-transitioning animation; nil changes speed without the name check. Unsupported hosts do nothing. |
self.item:SetBoneOverlayTexture(boneName, textureName, alpha) |
boneName: string — Authored bone name.textureName: string — Authored texture name.alpha: number — Opacity fraction from 0 to 1. |
no return value | Set a loaded held-item bone overlay texture and opacity. Unsupported hosts do nothing. |
self.item:SetLoopingSound(label, playing, volume) |
label: string — Authored sound or light label.playing: boolean — True to keep the named loop active; false to stop it.volume: number (optional); default 1 — Volume multiplier from 0 to 1. Defaults to 1. |
no return value | Latch a named looping clip on or off on a loaded held-item or loaded melee host. The host retriggers latched loops and stops them on unequip or holster. Prefer this to retaining a sound handle. Other hosts do nothing. |
self.item:StartNamedAnimation(animationName) |
animationName: string — Authored animation name. |
no return value | Start a named hold animation without changing playback speed. Non-held items and hosts without a hold animation player do nothing. |
self.item:StopSound(instance) |
instance: SoundEffectHandle or nil — SoundEffectHandle returned by a documented sound method; nil does nothing. |
boolean — False for nil or unsupported handles, an unsupported item host, or a failed sound operation. |
Stop a sound handle through a loaded held-item or loaded melee host. |
self.item:TransitionToAnimation(animationName, transitionTime, playSpeed) |
animationName: string — Authored animation name.transitionTime: number — Transition duration in seconds.playSpeed: number (optional); default 1 — Playback multiplier; 1 is normal speed. Defaults to 1. |
no return value | Transition a held-item animation and set its playback multiplier. Non-held items do nothing. |
self.item:TriggerContinuousPFX(key, emitBoneName, emitOffsetX, emitOffsetY, rotation) |
key: string — Authored particle-effect key.emitBoneName: string — Authored emission bone name.emitOffsetX: number — Horizontal emission texture offset in pixels.emitOffsetY: number — Vertical emission texture offset in pixels.rotation: number (optional); default 0 — Effect rotation in radians. Defaults to 0. |
no return value | Trigger an authored continuous particle-effect key on a loaded held-item host. Unsupported hosts do nothing. |
self.item:TriggerLoopingSound(label, baseVolume) |
label: string — Authored sound or light label.baseVolume: number (optional); default 1 — Base volume multiplier from 0 to 1. Defaults to 1. |
no return value | Refresh a named loop on a loaded held-item or loaded melee host. Other hosts do nothing. |
self.item:TriggerOneShotPFX(key, emitBoneName, emitOffsetX, emitOffsetY, rotation) |
key: string — Authored particle-effect key.emitBoneName: string — Authored emission bone name.emitOffsetX: number — Horizontal emission texture offset in pixels.emitOffsetY: number — Vertical emission texture offset in pixels.rotation: number (optional); default 0 — Effect rotation in radians. Defaults to 0. |
no return value | Trigger an authored particle-effect key once on a loaded held-item host. Unsupported hosts do nothing. |
self.item:TriggerOneShotPFX(key, emitPoint, rotation) |
key: string — Authored particle-effect key.emitPoint: Vector2 — Emission position in world pixels.rotation: number (optional); default 0 — Effect rotation in radians. Defaults to 0. |
no return value | Trigger an authored particle-effect key once on a loaded held-item host. Unsupported hosts do nothing. |
self.item:TryEquipAmmo() |
None | no return value | Try to equip ammunition on a loaded held-item host. Unsupported hosts do nothing. |
self.item:UpdatePersistentCue(cueName) |
cueName: string — Authored audio cue name. |
no return value | Update a persistent audio cue through a loaded held-item host. Unsupported hosts do nothing. |
self.item:UpdateSFXPosition(instance, baseVolume) |
instance: SoundEffectHandle or nil — SoundEffectHandle returned by a documented sound method; nil does nothing.baseVolume: number — Base volume multiplier from 0 to 1. |
no return value | Update a sound handle position and base volume through a loaded held-item host. Nil, unsupported handles, and unsupported hosts do nothing. |
CLR declaration reference
These names identify the backing engine source declarations.
Boolean AttackingBoolean AttackPostureBoolean CollisionsEnabledint CurClipSizeVector2 CurGlobalCenterfloat DamageModifierfloat DefaultAttackSpeedModifierfloat EnergyDrainPerSecondBoolean FinishSwingOnCollideBoolean HidesBackArmBoolean HitsDepositsString HUDAmmoDisplayOverrideStringBoolean IgnoreGroundCollisionsBoolean IsDeadbool IsLocallyEquippedint MaxClipSizeobject Ownerint PickPowerBoolean PreventMovementfloat RotationBoolean UseClientSideInputLogicBoolean UsingCombatWalkBoolean UsingForcedWalkVector2 Velocityint Widthfloat Xfloat Yvoid AddBoneTextureOverride(String boneName, String textureName)void AddMotionBlurTextureOverride(String boneName, String textureName)void AdjustPlayerEnergy(float adjustmentAmount)void ApplyLocationalStatusEffectToCreature(object creature, String statusEffectTypeString, float duration, float intensity, Vector2 hitLocation, Boolean stacks = false)void ApplyStatusEffectToCreature(object creature, String statusEffectTypeString, float duration, float intensity, Boolean stacks = false)void CleanUpSFXInstance(object instance)void ClearBoneTextureOverrides()void ClearLastGlobalCollisionPoints()void ClearMotionBlurTextureOverrides()void DamageTile(int tileX, int tileY, int pickPower)void DealDamage(object target, float piercePercent)void DealDamage(object target, Vector2 position, float damage, float piercePercent)void DisableCollisions()void DisableTaggedMeleeCollisionPoint(String tag)void DisturbNearbyChickens()void DrawGlow(float x, float y, float r, float g, float b, float scale)void DrawLaser(float startX, float startY, float endX, float endY, float r, float g, float b, float widthScale)void EnableCollisions()void EnableTaggedMeleeCollisionPoint(String tag)void EndLoopingSound(String label)Vector2 FireHitscan(float startX, float startY, float dirX, float dirY, float maxRange, float damage)void FireItem(InventoryItemType itemType, float speed, String emitBoneName, float emitBoneOffsetX, float emitBoneOffsetY, float spreadRadian = 0, float angleOffset = 0)void FireItem(String uniqueItemTypeID, float speed, String emitBoneName, float emitBoneOffsetX, float emitBoneOffsetY, float spreadRadian = 0, float angleOffset = 0)LuaProjectileApi FireProjectile(int projectileTypeID, float speed, float emitX, float emitY, float velX, float velY, float accuracyModifier = 1)LuaProjectileApi FireProjectile(int projectileTypeID, float speed, String emitBoneName, float emitBoneOffsetX, float emitBoneOffsetY, float accuracyModifier = 1)LuaProjectileApi FireProjectile(String uniqueProjectileTypeString, float speed, float emitX, float emitY, float velX, float velY, float accuracyModifier = 1)LuaProjectileApi FireProjectile(String uniqueProjectileTypeString, float speed, String emitBoneName, float emitBoneOffsetX, float emitBoneOffsetY, float accuracyModifier = 1)void FireSpell(Vector2 emitPosition, Vector2 emitDirectionVector, String spellTypeString, Boolean canHitOwner = false)InventoryItemType GetCurAmmoType()String GetCurrentAnimationName()LuaPlayerApi GetEquippedPlayer()Vector2 GetGlobalBonePosition(String boneName, int textureOffsetX = 0, int textureOffsetY = 0)int GetNewParticleInstanceID()float GetPlayerEnergy()LuaMeleeCollisionPointView GetRandomGlobalCollisionPoint()String GetTransitionAnimationName()Boolean HasTag(String tag)Boolean HitscanHitLast()Boolean HitscanHitLivingLast()Boolean IsCollisionsEnabled()Boolean IsCurAmmoValid()Boolean IsEnoughEnergyPerSecond(GameTime gameTime, float ratePerSecond)Boolean IsPowered()Boolean IsSoundPlaying(object instance)Boolean IsTransitioning()void LoadSoundEffect(String label, String path)void MuzzleFlash(String emitBoneName, float emitBoneOffsetX, float emitBoneOffsetY, float spreadRadian = .5f, float scaleX = .5f, float scaleY = .5f)Boolean PauseSound(object instance)void PerformActionNetworked(int actionIndex)void PlayAnimation(String animationName, float speed)void PlayHitSpriteFX(Vector2 hitPosition)LuaSoundEffectHandle PlayLoopingSoundEffect(String label, float volume = 1, float pitch = 0)void PlayParticleEffectOnce(String particleEffectPath, Vector2 emitPosition)void PlayParticleEffectPersistent(String particleEffectPath, int particleInstanceID, float emitX, float emitY)void PlayParticleEffectPersistent(String particleEffectPath, int particleInstanceID, Vector2 emitPosition)void PlayPositionalSoundFX(String cueName)LuaSoundEffectHandle PlaySoundEffect(String label, float volume = 1, float pitch = 0)void ProjectTrajectory(String emitBoneName, float emitBoneOffsetX, float emitBoneOffsetY, float speed)void ProjectTrajectory(String emitBoneName, float emitBoneOffsetX, float emitBoneOffsetY, float speed, Rectangle bounds)void ReleasePersistentCue()void RemoveQuantity(int amount)Boolean ResumeSound(object instance)void SetAnimationSpeed(float speed, String animationName = null)void SetBoneOverlayTexture(String boneName, String textureName, float alpha)void SetLoopingSound(String label, Boolean playing, float volume = 1)void StartNamedAnimation(String animationName)Boolean StopSound(object instance)void TransitionToAnimation(String animationName, float transitionTime, float playSpeed = 1)void TriggerContinuousPFX(String key, String emitBoneName, float emitOffsetX, float emitOffsetY, float rotation = 0)void TriggerLoopingSound(String label, float baseVolume = 1)void TriggerOneShotPFX(String key, String emitBoneName, float emitOffsetX, float emitOffsetY, float rotation = 0)void TriggerOneShotPFX(String key, Vector2 emitPoint, float rotation = 0)void TryEquipAmmo()void UpdatePersistentCue(String cueName)void UpdateSFXPosition(object instance, float baseVolume)
Generated 2026-10-02T21:05:27.5090099Z · b8c9ae78 · 102 members.