Page MenuHomeFeedback Tracker

GetInventory().CreateInInventory(...) doesn't respect CanReceiveItemIntoCargo
Assigned, UrgentPublic

Description

This bug has been around for as long as everyone can remember.

CreateInInventory does a FindFirstFreeLocationForNewEntity, a native function, which doesn't check for CanReceiveItemIntoCargo of the inventory owner. This has always caused a lot of grief with all mods which create items (e.g. admin tools, traders, etc. )

We can obviously maybe do some workarounds but the amount of work required for us to make this possible (and every modder would have to) is not feasible. It generally doesn't work well with high population servers having to do some recursive searches for free inventory in script.

An example of vanilla item where this behaviour is not respected is the Barrel. If you use an admin tool to spawn(with player.GetInventory().CreateInInventory) a Barrel, then spawn another, it will spawn it inside the inventory of the first barrel. This also has been causing massive issues in 1.25 where you cannot drop the barrel since it has something in inventory. (which is another issue in itself, always allow us to drop items from hands even if the rule says we couldn't take it in hands)

Could you please add a check for CanReceiveItemIntoCargo in CreateInInventory? A similar function which checks if we can receive any item or specific item type (string or typename) would be useful as well as we don't have the item created yet.

Details

Severity
Major
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
General

Event Timeline

Helkhiana updated the task description. (Show Details)May 30 2024, 5:16 PM
Geez changed the task status from New to Assigned.May 31 2024, 12:05 PM

I just wanted to add something I've noticed. It's related to FindFirstFreeLocation

When splitting an item in inventory, if you have an item with cargo e.g. FirstAidKit, which has CanReceiveItemIntoCargo returning false due to the new rules of AreChildrenAccessible, the new split item still goes inside it's cargo. Yet another example where we don't use CanReceiveItemIntoCargo.

This is also a big issue for us, and we hope there is a fix planned.

ntepup added a subscriber: ntepup.Jun 19 2024, 12:26 PM
inkihh added a subscriber: inkihh.Jun 24 2024, 10:56 AM

I’ve also run into this issue and would appreciate you guys taking a look at it.

Please address this issue as it is causing quite a bit of grief for many players.

Kreser added a subscriber: Kreser.Jun 24 2024, 2:20 PM
Wink added a subscriber: Wink.Jun 24 2024, 3:46 PM
Wink added a comment.Jun 24 2024, 4:10 PM

You know it's bad when storage items have to be REMOVED from traders.

NATION added a subscriber: NATION.Jun 30 2024, 7:36 PM

@Geez Any news on this bug issue?

Geez added a comment.Jul 18 2024, 10:57 AM

@Geez Any news on this bug issue?

unfortunately no news I could proivde.