Core Update 1.0.230 - Inventories, Nested Contexts & Templates, DataTables

Highlights for Version 1.0.230

Patch Notes Header

Welcome to our February 15th Patch Notes!

This patch is one of the largest feature releases we've had in quite a while and we are really looking forward to see what everyone will create with these new tools.

Make sure to watch the patch notes live stream hosted by Buckmonster on the Core Live Twitch channel at 9 AM PST.

Platform

  • New: Inventory and Items:

    • An Inventory in Core is a lightweight system used for tracking many items. Players can view and organize a list of items or resources they have collected. With these lists, players can discover whether they possess particular items (such as a key that opens a door), pay for trading, fulfill crafting requirements, maintain collections, and control other systems that require tracking what a player has acquired during the game. Read More
  • New: Nested Contexts:

    • You can now nest multiple contexts; however, the outermost context is usually the only one that takes effect. There are two exceptions in which the child context is respected within a different context. The first is a child client or server context inside a static context. The second is child client or server context inside a local context. In all other cases, the child context is treated as a folder. Read More
  • New: Nested Templates:

    • Nested Templates allow creators to include template instances inside other templates. Nested templates keep a link to their own template asset, while being part of another template asset. This allows for modular workflow when making a system that has many different subcomponents. This also allows teams of creators to use asynchronous collaboration when changing one aspect of a big and complex design. Read More
  • New: DataTables:

    • Creators can create Data Tables that contain data in tabular form that contains rows and columns. A data table is a list where each item is also a list. For example, a player's inventory that has items, and each item has a name, description, quantity, and icon. Read More
    • DataTables can also be opened and edited in external editors. This setting is separate from the external editor setting for scripting but if you want to use Visual Studio Code for it as well, we recommend using an extension to make handling CSV files easier.
  • New: Added a scene selection dropdown near top of hierarchy UI.

  • New: The social "Friends" and "Players In Game" sections can display two action buttons. One for adding as a friend, inviting to your party, or joining your friend's game.

  • New: A binding set object gets added to the hierarchy when a new set is created.

  • New: The "Empty project" framework was updated to support new default bindings.

  • New: Abilities now use binding set actions to activate.

  • New: All Weapons have been updated to support registering damage hit results.

  • New: Replaced "Event: Binding Pressed/Released" section with "Event: Input Action Pressed/Released" in the Script Generator.

  • New: Added new sections for chatHook and playerMovementHook to the Script Generator.

  • New: Added a "Open Script Helper" button in "Create Script" menu of toolbar in the editor.

  • New: Double clicking a binding set object will open the bindings manager.

  • New: The visibility of the in game voice chat widget can be toggled from the Game Settings object in the editor. We've also added a new API to do the same, see below.

  • New: Added eat animations to animated meshes (fox, raptor, whelp):

    • unarmed_eat
  • New: Added sleep animations to animated meshes (fox, raptor, whelp):

    • unarmed_sleep_begin
    • unarmed_sleep_cycle
    • unarmed_sleep_end
  • New: Added react_alert animations to animated meshes (fox, raptor, whelp):

    • unarmed_react_alert
  • New: Added react_alert animations to mecha animated mesh:

    • unarmed_fly_react_alert
  • Changed: For the UI parameter of an Asset Reference in the properties UI, the text now says "Missing Asset Reference" if it references asset that no longer exist instead of "Empty Asset Reference".

  • Changed: Core Content weapons have been updated to use Action Name property, instead of Action Binding. When importing a weapon from Core Content, it is necessary to add Shoot, Aim, and Reload in the Bindings Manager. This only applies to projects created prior to this update.

    • Abilities created prior to this update will show both Action Binding and Action Name. These abilities will continue to use Action Binding, though it is recommended that you change Action Binding to none and use Action Name instead.
  • Fixed: An issue where friend settings in the options menu did not save properly.

  • Fixed: An issue where social share links for game events produced broken urls.

  • Fixed: In the hierarchy ui the /hasMissingAssets command was not working in some cases.

  • Fixed: A crash when copying objects.

  • Fixed: An issue where instrument audio assets would cut out when many other events or objects are spawned.

  • Fixed: An issue where when binding for Core Behavior "Interact" contains more than three characters it would overlap the interaction label.

  • Fixed: An issue where the back button did not work in the "New Projects" section of the Create tab.

  • Fixed: Improper pivot placement on mushroom assets.

API

Ability

  • New: Add actionName property and deprecate actionBinding property:

    Property Name Return Type Description Tags
    actionBinding string This property is deprecated. Please use actionName instead, but note that actionBinding and actionName use different values. Which action binding will cause the Ability to activate. Possible values of the bindings are listed on the Ability binding page. Read-Only, Deprecated
    actionName string Which binding set action name will cause the Ability to activate. Read-Only

Debug

  • New: Add CoreDebug.ToString(object) that can be used to generated a detailed informational string about the current contents of, for example, an Inventory.

    Function Name Return Type Description Tags
    CoreDebug.ToString(value) string Returns a string representation of the given value. By default this will return the same result as Lua's built-in tostring() function, but some types may return additional information useful for debugging. The format of strings returned by this function is subject to change and should never be relied upon to return specific information. None

Item

Item is an interface which defines properties and functions for items in an Inventory or spawned in the world.

Properties

Property Name Return Type Description Tags
itemAssetId string Asset ID defining this Item's properties. Read-Only
itemTemplateId string Asset reference that is spawned as a child of an ItemObject when spawned in the world. May be nil. Read-Only
maximumStackCount integer The maximum number of items in one stack of this item. Zero or negative numbers indicate no limit. Read-Only
count integer The number of items this object represents. Read-Write

Functions

Function Name Return Type Description Tags
GetCustomProperties() table Returns a table containing the names and values of all custom properties on an Item. None
GetCustomProperty(string propertyName) value, boolean Returns the value of a specific custom property or nil if the Item does not possess the custom property. The second return value is true if the property is found or false if it is not. None
SetCustomProperty(string propertyName, value) boolean Sets the value of a custom property. The value must match the existing type of the property. Returns true if the property was successfully set. If the property could not be set, returns false or raises an error depending on the cause of the failure. None

ItemObject

ItemObject is a CoreObject which implements the Item interface. It represents an Item that has been spawned in the world.

Properties

Property Name Return Type Description Tags
itemAssetId string Asset ID defining this ItemObject's properties. Read-Only
itemTemplateId string Asset reference that is spawned as a child of the ItemObject when spawned in the world. This is inherited from the item asset's Item Template property. May be nil. Read-Only
maximumStackCount integer The maximum number of items in one stack of this item. This is inherited from the item asset's Maximum Stack Count property. Zero or negative numbers indicate no limit. Read-Only
count integer The number of items this object represents. Read-Write

Events

Event Name Return Type Description Tags
changedEvent Event<ItemObject> Fired when the count or a custom property value of an ItemObject has changed. None

Inventory

Properties

Property Name Return Type Description Tags
owner Player The Player who currently owns the inventory. May be nil. Change owners with Assign() or Unassign(). Read-Only
slotCount integer The number of unique inventory item stacks this inventory can hold. Zero or negative numbers indicate no limit. Read-Only
emptySlotCount integer The number of slots in the inventory that do not contain an inventory item stack. Read-Only
occupiedSlotCount integer The number of slots in the inventory that contain an inventory item stack. Read-Only

Functions

Function Name Return Type Description Tags
Assign(Player player) None Sets the owner property of the inventory to the specified player. When a networked inventory is assigned to a player, only that player's client will be able to access the inventory contents. None
Unassign() None Clears the owner property of the inventory. The given inventory will now be accessible to all clients. None
GetItem(integer slot) InventoryItem Returns the contents of the specified slot. Returns nil if the slot is empty. None
GetItems([table parameters]) Array<InventoryItem> Returns a list of all items in the inventory. Returns an empty list if the inventory is empty.
Supported parameters include:
itemAssetId (string): If specified, filters the results by the specified item asset reference. Useful for getting all inventory items of a specific type.
None
ClearItems() None Removes all items from the inventory. None
SortItems() None Reorganizes inventory items into sequential slots starting with slot 1. Does not perform any consolidation of item stacks of the same type. Use ConsolidateItems() first if this behavior is desired. None
ConsolidateItems() None Combines stacks of inventory items into as few slots as possible based on the maximumStackCount of each item. Slots may be emptied by this operation, but are otherwise not sorted or reorganized. None
CanResize(integer newSize) boolean Checks if there are enough slots for all current contents of the inventory if the inventory were to be resized. Returns true if the inventory can be resized to the new size or false if it cannot. None
Resize(integer newSize) boolean Changes the number of slots of the inventory. There must be enough slots to contain all of the items currently in the inventory or the operation will fail. This operation will move items into empty slots if necessary, but it will not consolidate item stacks, even if doing so would create sufficient space for the operation to succeed. Use ConsolidateItems() first if this behavior is desired. Returns true if the operation succeeded. Returns false and logs a warning if the operation failed. None
CanAddItem(string itemAssetId, [table parameters]) boolean Checks for room to add the specified item to this inventory. If the item can be added to the inventory, returns true. If the inventory is full or the item otherwise cannot be added, returns false. Supports the same parameters as AddItem(). None
AddItem(string itemAssetId, [table parameters]) boolean Attempts to add the specified item to this inventory. If the item was successfully added to the inventory, returns true. If the inventory was full or the item otherwise wasn't added, returns false.
Supported parameters include:
count (integer): Specifies the number of items to create and add to the inventory. Defaults to 1.
slot (integer): Attempts to create the item directly into the specified slot. If unspecified, the inventory will either look to stack this item with other items of the same itemAssetId, or will look to find the first empty slot.
customProperties (table): Applies initial property values to any dynamic properties on the item. Attempting to specify a property that does not exist will yield a warning. Attempting to specify a property that does exist and is not dynamic will raise an error. Providing a property value of the incorrect type will raise an error.
None
CanPickUpItem(ItemObject item, [table parameters]) boolean Checks for room in an existing stack or free inventory slots to add the given item to the inventory. If the item can be added to the inventory, returns true. If the inventory is full or the item otherwise cannot be added, returns false. Supports the same parameters as PickUpItem(). None
PickUpItem(ItemObject item, [table parameters]) boolean Creates an inventory item from an ItemObject that exists in the world, taking 1 count from the ItemObject. Destroys the ItemObject if the inventory item is successfully created and the ItemObject count has been reduced to zero. Returns true if the item was picked up. Returns false and logs a warning if the item could not be picked up.
Supported parameters include:
count (integer): Determines the number of items taken from the specified ItemObject. If the ItemObject still has a count greater than zero after this operation, it is not destroyed. Defaults to 1.
all (boolean): If true, picks up all of the given item's count instead of just 1. Overrides count if both are specified.
None
CanMoveFromSlot(integer fromSlot, integer toSlot, [table parameters]) boolean Checks if an item can be moved from one slot to another. If the item can be moved, returns true. Returns false if it cannot be moved. Supports the same parameters as MoveFromSlot(). None
MoveFromSlot(integer fromSlot, integer toSlot, [table parameters]) boolean Moves an inventory item and its entire count from one slot to another. If the target slot is empty, the stack is moved. If the target slot is occupied by a matching item, the stack will merge as much as it can up to its maximumStackCount. If the target slot is occupied by a non-matching item, the stacks will swap. Returns true if the operation succeeded. Returns false and logs a warning if the operation failed.
Supported parameters include:
count (integer): Specifies the number of items to move. When swapping with another stack containing a non-matching item, this operation will fail unless count is the entire stack.
None
CanRemoveItem(string itemAssetId, [table parameters]) boolean Checks if an item can be removed from the inventory. If the item can be removed, returns true. Returns false if it cannot be removed. Supports the same parameters as RemoveItem(). None
RemoveItem(string itemAssetId, [table parameters]) boolean Deletes 1 item of the specified asset from the inventory. Returns true if the operation succeeded. Returns false and logs a warning if the operation failed.
Supported parameters include:
count (integer): Specifies the number of the item to be removed. Defaults to 1.
all (boolean): If true, removes all of the specified items instead of just 1. Overrides count if both are specified.
None
CanRemoveFromSlot(integer slot, [table parameters]) boolean Checks if an item can be removed from an inventory slot. If the item can be removed, returns true. Returns false if it cannot be removed. Supports the same parameters as RemoveFromSlot(). None
RemoveFromSlot(integer slot, [table parameters]) boolean Deletes the inventory item and its entire count from the specified inventory slot. Returns true if the operation succeeded. Returns false and logs a warning if the operation failed.
Supported parameters include:
count (integer): Specifies the number of the item to be removed. Defaults to the total count in the specified slot.
None
CanDropItem(string itemAssetId, [table parameters]) boolean Checks if an item can be dropped from the inventory. If the item can be dropped, returns true. Returns false if it cannot be dropped. Supports the same parameters as DropItem(). None
DropItem(string itemAssetId, [table parameters]) boolean Removes 1 item of the specified asset from the inventory and creates an ItemObject with the item's properties. Spawns the ItemObject at the position of the inventory in the world, or at the position of the owner player's feet if the inventory has been assigned to a player. Returns true if the operation succeeded. Returns false and logs a warning if the operation failed.
Supported parameters include:
count (integer): Specifies the number of the item to be dropped. Defaults to 1.
all (boolean): If true, drops all of the specified items instead of just 1. Overrides count if both are specified.
dropTo (ItemObject): Specifies a pre-existing ItemObject to drop the items onto. Doing this will add to that ItemObject's count. If the ItemObject's maximum stack count would be exceeded by this operation, it will fail, and this function will return false.
parent (CoreObject): Creates the new ItemObject as a child of the specified CoreObject. Can only be used if dropTo is not specified.
position (Vector3): Specifies the world position at which the ItemObject is spawned, or the relative position if a parent is specified. Can only be used if dropTo is not specified.
rotation (Rotation or Quaternion): Specifies the world rotation at which the ItemObject is spawned, or the relative rotation if a parent is specified. Can only be used if dropTo is not specified.
scale (Vector3): Specifies the world scale with which the ItemObject is spawned, or the relative scale if a parent is specified. Can only be used if dropTo is not specified.
transform (Transform): Specifies the world transform at which the ItemObject is spawned, or the relative transform if a parent is specified. Can only be used if dropTo is not specified, and is mutually exclusive with position, rotation, and scale.
Additional parameters supported by World.SpawnAsset() may also be supported here.
None
CanDropFromSlot(integer slot, [table parameters]) boolean Checks if an item can be dropped from an inventory slot. If the item can be dropped, returns true. Returns false if it cannot be dropped. Supports the same parameters as DropFromSlot(). None
DropFromSlot(integer slot, [table parameters]) boolean Drops the entire contents of a specified slot, creating an ItemObject with the item's properties. Spawns the ItemObject at the position of the inventory in the world, or at the position of the owner player's feet if the inventory has been assigned to a player. Returns true if the operation succeeded. Returns false and logs a warning if the operation failed. If the full item count is successfully dropped, the slot will be left empty.
Supported parameters include:
count (integer): Specifies the number of the item to be dropped. If not specified, the total number of items in this slot will be dropped.
dropTo (ItemObject): Specifies a pre-existing ItemObject to drop the items onto. Doing this will add to that ItemObject's count. If the ItemObject's max stack count would be exceeded by this operation, it will fail, and this function will return false.
parent (CoreObject): Creates the new ItemObject as a child of the specified CoreObject. Can only be used if dropTo is not specified.
position (Vector3): Specifies the world position at which the ItemObject is spawned, or the relative position if a parent is specified. Can only be used if dropTo is not specified.
rotation (Rotation or Quaternion): Specifies the world rotation at which the ItemObject is spawned, or the relative rotation if a parent is specified. Can only be used if dropTo is not specified.
scale (Vector3): Specifies the world scale with which the ItemObject is spawned, or the relative scale if a parent is specified. Can only be used if dropTo is not specified.
transform (Transform): Specifies the world transform at which the ItemObject is spawned, or the relative transform if a parent is specified. Can only be used if dropTo is not specified, and is mutually exclusive with position, rotation, and scale.
Additional parameters supported by World.SpawnAsset() may also be supported here.
None
CanGiveItem(string itemAssetId, Inventory recipient, [table parameters]) boolean Checks if an item can be transferred to the specified recipient inventory. If the item can be transferred, returns true. Returns false if it cannot be transferred. Supports the same parameters as GiveItem(). None
GiveItem(string itemAssetId, Inventory recipient, [table parameters]) boolean Transfers an item, specified by item asset ID, from this inventory to the given recipient inventory. Returns true if the operation succeeded. Returns false and logs a warning if the operation failed.
Supported parameters include:
count (integer): Specifies the number of the item to be transferred. Defaults to 1.
all (boolean): If true, transfers all of the specified items instead of just 1. Overrides count if both are specified.
None
CanGiveFromSlot(integer slot, Inventory recipient, [table parameters]) boolean Checks if a slot can be transferred to the specified recipient inventory. If the item can be transferred, returns true. Returns false if it cannot be transferred. Supports the same parameters as GiveFromSlot(). None
GiveFromSlot(integer slot, Inventory recipient, [table parameters]) boolean Transfers the entire stack of a given slot to the given recipient inventory. Returns true if the operation succeeded. Returns false and logs a warning if the operation failed.
Supported parameters include:
count (integer): Specifies the number of the item to be transferred. If not specified, the total number of items in this slot will be transferred.
None
Known Issues
  • Using inventory:DropItem(assetId,{all=true}) OR inventory:DropItem(assetId,{count=-1}) only drops the first stack of the item found in the inventory instead of all the items of the given ID.
  • Inventory:GiveItem() does currently not work.

Events

Event Name Return Type Description Tags
ownerChangedEvent Event<Inventory inventory> Fired when the inventory's owner has changed. None
resizedEvent Event<Inventory inventory> Fired when the inventory's size has changed. None
changedEvent Event<Inventory inventory, integer slot> Fired when the contents of an inventory slot have changed. This includes when the item in that slot is added, given, received, dropped, moved, resized, or removed. None
itemPropertyChangedEvent Event<Inventory inventory, InventoryItem item, string propertyName> Fired when an inventory item's dynamic custom property value has changed. None

InventoryItem

Properties

Property Name Return Type Description Tags
itemAssetId string Asset ID defining this Item's properties. Read-Only
itemTemplateId string Asset reference that is spawned as a child of an ItemObject when spawned in the world. May be nil. Read-Only
maximumStackCount integer The maximum number of items in one stack of this item. Zero or negative numbers indicate no limit. Read-Only
count integer The number of items this object represents. Read-Write
inventory Inventory The Inventory which owns this item. Read-Only
slot integer The slot number to which this item has been assigned within its owning Inventory. Read-Only
name string The name of this item, inherited from the Item asset. Read-Only

Functions

Function Name Return Type Description Tags
GetCustomProperties() table Returns a table containing the names and values of all custom properties on this item. Initial values are inherited from the Item asset defining this item. None
GetCustomProperty(string propertyName) value, boolean Returns the value of a specific custom property or nil if the Item does not possess the custom property. The second return value is true if the property is found or false if it is not. Initial values are inherited from the Item asset defining this item. None
SetCustomProperty(string propertyName, value) boolean Sets the value of a custom property. The value must match the existing type of the property. Returns true if the property was successfully set. If the property could not be set, returns false or raises an error depending on the cause of the failure. None

Input

  • New: Added functions:

    Function Name Return Type Description Tags
    Input.GetActionInputLabel(string actionName, [table parameters]) string Returns a string label indicating the key or button assigned to the specified action. Returns nil if actionName is not a valid action or if an invalid direction parameter is specified for axis and direction bindings. Returns "None" for valid actions with no control bound.
    Supported parameters include:
    direction (string): Required for axis and direction bindings, specifying "positive" or "negative" for axis bindings, or "up", "down", "left", or "right" for direction bindings.
    inputType (InputType): Specifies whether to return a label for keyboard and mouse or controller. Defaults to the current active input type.
    secondary (boolean): When true and returning a label for keyboard and mouse, returns a label for the secondary input.
    Client-Only
    Input.IsInputTypeEnabled(InputType) boolean Returns true when the current device supports the given input type. For example, Input.IsInputEnabled(InputType.CONTROLLER) will return true if a gamepad is connected. Client-Only
  • New: Added actionHook:

    Hook Name Return Type Description Tags
    actionHook Hook<Player player, table actionList> Hook called each frame with a list of changes in action values since the previous frame. The actionList table is an array of tables with the structure {action = "actionName", value = number or Vector2} for each action whose value has changed since the last frame. If no values have changed, actionList will be empty, even if there are actions currently being held. Entries in the table can be added, removed, or changed and will affect whether pressed and released events fire. If a non-zero value is changed to zero then Input.actionReleasedEvent will fire for that action. If a zero value changes to non-zero then Input.actionPressedEvent will fire. Client-Only

Player

  • New: Added new GetInventories() function:

    Function Name Return Type Description Tags
    GetInventories() Array<Inventory> Returns a list of Inventory objects assigned to the player. If the player has no assigned inventories, this list is empty. None

UI

  • New: Added the following functions:

    Function Name Return Type Description Tags
    UI.IsVoiceChatWidgetVisible() boolean Returns whether the voice chat widget is currently visible. Note that this may return true when the voice chat widget is not currently displaying anything on the screen. Client-Only
    UI.SetVoiceChatWidgetVisible(boolean isVisible) None Sets whether the voice chat widget is currently visible. Client-Only

Vehicle

  • New: Added a canExit property added to vehicles:

    Property Name Return Type Description Tags
    canExit boolean Returns true if the driver of the vehicle is allowed to exit using the Vehicle Exit binding. Read-Only
  • Changed: Removed old exit binding property, existing vehicles with the exit binding will still show up and work as expected.

Learn more on our API documentation site.

Core Content

  • New: Replaced the "Abilities Display" component with a new version that can show ability's Action Binding label and detect input type.

  • New: Updated Core Content weapons and vehicles to support new action binding systems and organized each component into them into Project Content folders.

  • New: Updated default bindings template in Core Content to support weapon bindings by default.

  • New: Updated all vehicle components in Core Content to newer versions of their template.

  • Changed: The following smart audio assets have had their smart properties [Start Time Delay Min/Max] removed since these properties were added to all audio assets as a default parameter:

    • Ambience City Plane Passby 01 SFX
    • Ambience City Emergency Sirens Passby Set 01 SFX
    • Nature Thunder Clap Boom Set 01 SFX
    • Creature Wolf Howls & Calls Set 01 SFX
    • Creature Owl Calls Set 01 SFX
  • If your game utilizes any of these assets with a start time delay min/max, you will have to edit these assets in your projects with your desired start time delay and republish.

  • Changed: Renamed the following assets:

    • Creature Owl Calling 01 SFX > Creature Distant Loon Calling 01 SFX
    • Creature Owl Calls Set 01 SFX > Creature Owl and Loon Distant Calls Set 01 SFX
  • Fixed: Sun Settings Object: Corrected sun and bloom scale mismatch issue.

7 Likes

Examples of inventory usage, by blackdheart:

3 Likes

It's exciting to finally have an official inventory/items API!

I was just getting the hang of the inventory system that comes with Gatherables and Producers, though. Will there be any patches or tutorials to bridge the two systems in the future?

1 Like