question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

static property contentIds on Inventory component is a reference across entities

See original GitHub issue

This is another weird one but I don’t see anywhere in my codebase where I am explicitly assigning the property in a way that would create a reference so I figured I’d submit a bug report. For context, I based the Inventory, Loot, and take/drop eventing on your game sleepy.

Actual Behavior

I have two actors in my game, the player and a goblin. They both start with an empty Inventory. If either actor adds an item to their Inventory, it will appear in the contentIds array for both actors.

Expected Behavior

Inventory contentIds should not be shared across entities.

Repro

Clone and install this branch.

Open the console in dev tools. Using your mouse, click on the @ and g to log all entities at both locations to the console. Inspect the @ and g entities to confirm that they both have an Inventory component and that inventory.contentIds array is empty.

Use the arrow keys to navigate to a lockpick ~ press the i key when adjacent to the lockpick to activate the interactions menu. Use the a key to pick up the lockpick.

Using your mouse, click on the @ and g to again log all entities at both locations to the console. Inspect the @ and g to confirm that they both have an Inventory component and that inventory.contentIds contains the same id.

Furthermore you can test that they are a reference with the following script in the console (wrld is a global reference to the current world object)

wrld.getEntity(<playerEntityId>).inventory.contentIds == wrld.getEntity(<goblinEntityId>).inventory.contentIds // returns true

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ddmillscommented, Mar 20, 2022

@luetkemj this should be fixed in geotic@4.3.0

1reaction
luetkemjcommented, Mar 17, 2022

Followup

If I assign contentIds to an array in the onAttatched hook - they do not share a reference.

onAttached() {
    this.contentIds = [];
}

I’m wondering if this might be an issue with array type properties in general - I don’t think I really have any others in my game yet that would have been tested in the way.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add entity reference property types · Issue #42 · ddmills/geotic · GitHub
geotic v3 had and which could be used as properties to reference other entities. ... static property contentIds on Inventory component is a...
Read more >
Defining Software Library Metadata - Oracle Help Center
A type and subtype together define the common traits of the entities it represents in terms of common and searchable metadata/configuration properties, ...
Read more >
Static variable in class com.ibm.commerce.order.facade ...
References the constant integer value representing the PACKAGE CatEntry Type. PACKAGE_COMPONENT - Static variable in class com.ibm.commerce.catalog.facade.
Read more >
cXML Reference Guide - Ariba Network
Index. The cXML element is for “transactional” data. The other elements describe static content. Related Information. cXML DTDs [page 14].
Read more >
Bungie.Net API
Destiny 2 app needs for read operations against Destiny 2 data such as inventory, vault, currency, vendors, milestones, progression, etc. ReadUserData. Read ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found