Page MenuHomeFeedback Tracker

CanReceiveItemIntoCargo not being respected
Assigned, UrgentPublic

Description

CanReceiveItemIntoCargo doesn't seem to be respected when it comes to creating new items. Below is a use case I'm currently using in one of my mods. When using
CreateItemInInventory on the player object, if there is no available inventory space in clothing cargo or child cargos, the item is placed inside the object where it is disallowed. CanReceiveItemIntoCargo does prevent UI usage of moving an item into cargo.

class DogtagCase : ItemBase
{
	// only allow dogtags into the container
	override bool CanReceiveItemIntoCargo(EntityAI item)
	{
		if (!super.CanReceiveItemIntoCargo(item))
			return false;

		if (!item.IsKindOf("Dogtag_Base"))
			return false;

		return true;
	}

	override bool CanLoadItemIntoCargo(EntityAI item)
	{
		if (!super.CanLoadItemIntoCargo(item))
			return false;

		if (!item.IsKindOf("Dogtag_Base"))
			return false;

		return true;
	}

	override bool CanSwapItemInCargo(EntityAI child_entity, EntityAI new_entity)
	{
		if (!super.CanSwapItemInCargo(child_entity, new_entity))
			return false;

		if (!new_entity.IsKindOf("Dogtag_Base"))
			return false;

		return true;
	}
}

Details

Severity
None
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
General
Steps To Reproduce
  1. Create a scripted item class return false for CanReceiveItemIntoCargo
  2. Create scripted item class and place into your inventory
  3. Fill your inventory to where the only available space is for the cargo of the new scripted item class
  4. Use CreateItemInInventory on an hierarchy parent where the new scripted item class is stored

Event Timeline

Geez changed the task status from New to Assigned.Feb 21 2022, 12:07 PM
Yuki added a subscriber: Yuki.May 1 2022, 2:52 PM