Skip to main content

Inventoryitem Classified

Based on game build 722832 | Last updated: 2026-04-17

Overview

inventoryitem_classified is a hidden prefab entity used to store and replicate network state for inventory items without requiring full entity synchronization. It attaches to a parent inventory item entity and synchronizes properties like image, perishability, recharge, and deploy data via net variables. This structure is primarily internal to the game's networking system but exposes serialization and deserialization methods on the entity instance for state management.

Usage example

-- Typically spawned internally by the inventoryitem component during replication
local classified = SpawnPrefab("inventoryitem_classified")
classified.entity:SetParent(parent_inst.entity)

-- Server-side: Update percent used state
classified:SerializePercentUsed(0.5)

-- Client-side: Access replicated data via parent replica
local parent = classified.entity:GetParent()
if parent and parent.replica.inventoryitem then
local data = parent.replica.inventoryitem.classified
-- Data is synchronized via net variables on the classified entity
end

Dependencies & tags

External dependencies:

  • TheWorld -- checks ismastersim to determine server/client logic branch
  • FRAMES -- global constant used for recharge tick timing
  • DEPLOYMODE / DEPLOYSPACING -- enums for deployable state defaults
  • net_hash, net_bool, net_float, net_byte, net_smallbyte, net_tinybyte -- network variable constructors
  • Prefab, CreateEntity -- prefab registration and entity creation

Components used:

  • inventoryitem (replica) -- accessed via parent.replica.inventoryitem to check wetness and acid sizzling state

Tags:

  • CLASSIFIED -- added to the entity to mark it as a classified data container

Properties

PropertyTypeDefault ValueDescription
imagenet_hash0Hash of the inventory item image asset.
atlasnet_hash0Hash of the inventory item atlas asset.
cangoincontainernet_booltrueWhether the item can be placed in containers.
canonlygoinpocketnet_boolfalseWhether the item can only be placed in player pockets.
canonlygoinpocketorpocketcontainersnet_boolfalseWhether the item is restricted to pockets or pocket containers.
src_pos.isvalidnet_boolfalseIndicates if the source position coordinates are valid.
src_pos.xnet_float0X coordinate of the source position.
src_pos.znet_float0Z coordinate of the source position.
percentusednet_byte255Encoded percentage of item durability or charge used.
perishnet_smallbyte63Encoded perishability state.
rechargenet_byte255Encoded recharge state.
rechargetimenet_float-2Time required to recharge; -2 indicates nil/default.
deploymodenet_tinybyteDEPLOYMODE.NONEDeployment mode enum value.
deployspacingnet_tinybyteDEPLOYSPACING.DEFAULTDeployment spacing enum value.
deployrestrictedtagnet_hash0Tag required for deployment target.
usegridplacernet_boolfalseWhether to use grid placement logic.
attackrangenet_float-99Weapon attack range override.
walkspeedmultnet_byte1Equippable walk speed multiplier.
equiprestrictedtagnet_hash0Tag required for equipping.
moisturenet_float0Current moisture level of the item.
islockedinslotnet_boolfalseWhether the item is locked in its inventory slot.

Main functions

OnEntityReplicated()

  • Description: Initializes the parent link and attaches classified data to the parent's replica component. Assigns OnRemoveEntity handler. Client-side only — only assigned when !TheWorld.ismastersim.
  • Parameters: inst -- entity instance being replicated
  • Returns: None
  • Error states: None

OnRemoveEntity()

  • Description: Cleans up the parent reference when the classified entity is removed. Client-side only — assigned as a handler within OnEntityReplicated on client.
  • Parameters: inst -- entity instance being removed
  • Returns: None
  • Error states: None

SerializePercentUsed(percent)

  • Description: Encodes and sets the percentused net variable. Clamps values between 0 and 100. Server-side only — only assigned when TheWorld.ismastersim.
  • Parameters: percent -- number representing usage (0 to 1).
  • Returns: None
  • Error states: None

DeserializePercentUsed()

  • Description: Decodes the percentused net variable and pushes a change event to the parent. Client-side only — only assigned when !TheWorld.ismastersim.
  • Parameters: None
  • Returns: None
  • Error states: None

SerializePerish(percent)

  • Description: Encodes and sets the perish net variable. Clamps values between 0 and 62. Server-side only — only assigned when TheWorld.ismastersim.
  • Parameters: percent -- number representing perish progress (0 to 1).
  • Returns: None
  • Error states: None

ForcePerishDirty()

  • Description: Forces a local and network dirty update on the perish variable to trigger refreshes. Server-side only — only assigned when TheWorld.ismastersim.
  • Parameters: None
  • Returns: None
  • Error states: None

DeserializePerish()

  • Description: Decodes the perish net variable and pushes a change event to the parent. Client-side only — only assigned when !TheWorld.ismastersim.
  • Parameters: None
  • Returns: None
  • Error states: None

SerializeRecharge(percent, overtime)

  • Description: Encodes and sets the recharge net variable. Handles overtime flag for clamping. Server-side only — only assigned when TheWorld.ismastersim.
  • Parameters:
    • percent -- number representing charge (0 to 1)
    • overtime -- boolean indicating if overtime logic applies
  • Returns: None
  • Error states: None

DeserializeRecharge()

  • Description: Decodes the recharge net variable, triggers dirty check, and pushes a change event to the parent. Client-side only — only assigned when !TheWorld.ismastersim.
  • Parameters: None
  • Returns: None
  • Error states: None

SerializeRechargeTime(t)

  • Description: Encodes and sets the rechargetime net variable. Handles nil and infinite values. Server-side only — only assigned when TheWorld.ismastersim.
  • Parameters: t -- number representing time in seconds.
  • Returns: None
  • Error states: None

DeserializeRechargeTime()

  • Description: Decodes the rechargetime net variable, triggers dirty check, and pushes a change event to the parent. Client-side only — only assigned when !TheWorld.ismastersim.
  • Parameters: None
  • Returns: None
  • Error states: None

Events & listeners

  • Listens to (on classified entity): imagedirty, percentuseddirty, perishdirty, rechargedirty, rechargetimedirty
  • Listens to (on parent entity): inventoryitem_stacksizedirty, iswetdirty, isacidsizzlingdirty
  • Pushes (to parent entity): imagechange, percentusedchange, perishchange, rechargechange, rechargetimechange, wetnesschange, acidsizzlingchange
  • Pushes (to TheWorld): stackitemdirty