Page MenuHomeFeedback Tracker

Logic to Clothing class -> CanPutInCargo, CanReceiveItemIntoCargo and CanLoadItemIntoCargo
Assigned, UrgentPublic

Description

Due to ticket T152125 being closed, I am opening this new ticket to keep track of when the logic in clothing class will be fixed.

[Mostly a copy of message i posted under T152125 ]
I'll bring more light to this issue as the reason for ticket T152125 wasn't made clear enough and it hasn't been emphasised why we need this to be done ASAP. DayZ Team made a change to CanPutInCargo, CanReceiveItemIntoCargo and CanLoadItemIntoCargo for Clothing_Base class due to a bug i reported: T151500 to avoid allowing players to take items from ground into inventory of clothes that are in cargo of player.

Most of us thought it would just make it easier for us to give us access to have our own rules for clothing but your team can fix it for us instead. 1.09 has brought even more issues with this logic put in place in Clothing class.

Behaviour description as patches changed the logic inside these "events":

1.07 Behaviour:
2 examples->
A.) A storage item (locker) has slot for body (jacket). Player can attach Jacket to the locker and they can add more items inside jacket to store them over time.
B.) )A backpack with an attachment of another container. Player is able to attach this container to the bag and add items to it to carry around.

1.08 Behaviour:
A.) The locker is able to receive the jacket(with or without items inside) in the slot. But the player is not able to add items inside the jacket while it's being attached to the locker.
B.) The bag is able to receive the container(with or without items inside) in slot. But the player is not able to add more items inside the container while it's attached to backpack
For most instances of attachments of type B, players also lost items inside those containers attached to other clothes.

1.09 Behaviour:
Both A and B have same behaviour as before with the exception now it WILL ALWAYS delete or spit out the items from the jacket or container attached to backpack.

With the help from MDC I've been able to override the class Clothing and make a mod fix. These conditions satisfy ALL bugs encountered, including the one I reported during 1.08 experimental. During my tests, there was no loss of items inside cargo. I might have missed something as I'm not perfect either but hopefully we can work together in fixing this. This is causing immense grief to a lot of players and modders.

With the current conditions in Clothing, players lose all items inside clothes stored on attachment of a container, which is why this is so urgent to be fixed by BI. While we can run a mod to help us with it it shouldn't be the way to go. And to be honest I don't understand why your team went to such lengths to check if the parent is man and if that and that. Seems absolutely pointless.

This is the solution that has been used now by several big community servers, with the mod having over 25k subscribers on workshop (plus more as they can repack the pbo).

override bool CanPutInCargo( EntityAI parent )
{
	bool is_hidden_stash_exception = false;		
	if ( parent.IsInherited( UndergroundStash ) )
		return super.CanPutInCargo( parent );

	if ( GetNumberOfItems() != 0)
		return false;
	return super.CanPutInCargo( parent );
}
	
override bool CanReceiveItemIntoCargo( EntityAI item )
{
	if (GetInventory().IsInCargo())
		return false;
	return super.CanReceiveItemIntoCargo(item);
}
	
override bool CanLoadItemIntoCargo(EntityAI item)
{
	if (GetInventory().IsInCargo())
		return false;
	return super.CanLoadItemIntoCargo(item);
}

Details

Severity
Major
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
General

Event Timeline

broman added a subscriber: broman.Sep 25 2020, 10:18 PM

@Helkhiana thank you for sharing this fix!

lava76 added a subscriber: lava76.Sep 26 2020, 12:06 AM
Jest added a subscriber: Jest.Sep 26 2020, 3:50 AM
Geez changed the task status from New to Assigned.Sep 29 2020, 12:20 PM
polpa added a subscriber: polpa.Oct 2 2020, 8:24 AM
Xairo added a subscriber: Xairo.Dec 23 2020, 4:56 PM
Helkhiana added a comment.EditedJan 5 2021, 9:25 PM

The mod now has close to 200k subscribers. This should emphasize the importance of fixing this issue which has been around for way too long. With 1.10 update it was made actually again worse because I cannot override just a couple scripts, I have to override the whole ItemBase folder. This means any updates from DayZ in that folder I must update mine as well...
https://steamcommunity.com/sharedfiles/filedetails/?id=2225837273

lava76 added a comment.Jan 5 2021, 9:49 PM

This should be enough for 1.10 and is what I'm currently using:

modded class Clothing
{
	// Conditions
	override bool CanPutInCargo( EntityAI parent )
	{
		if ( parent.IsInherited( UndergroundStash ) )
			return super.CanPutInCargo( parent );

		if ( GetNumberOfItems() != 0)
			return false;
		return true;
	}
	
	override bool CanReceiveItemIntoCargo( EntityAI item )
	{
		if (GetInventory().IsInCargo())
			return false;
		return true;
	}
	
	override bool CanLoadItemIntoCargo(EntityAI item)
	{
		return true;
	}
}
Smok3_ added a subscriber: Smok3_.Jan 15 2021, 8:21 AM

Can you fix this bug Bohemia please!!!!!

With 1.10 update it was made actually again worse because I cannot override just a couple scripts, I have to override the whole ItemBase folder. This means any updates from DayZ in that folder I must update mine as well...

In case it didn't become clear by my earlier comment: No you don't. All you need to have for 1.10 is a single file with modded class clothing etc., like above, in 4_World. No PBO prefix trickery, no other files needing to be included. For 1.11 it will become even easier because you won't even be required to override all of CanPutInCargo/CanReceiveItemInCargo/CanLoadItemIntoCargo, as the checks are then in (fewer) separate methods that you can override.

Can you fix this bug Bohemia please!!!!!

It's not a bug. It's how vanilla DaYZ is setup to work. If you want it to work differently, you can easily override it since 1.10 with your own mods.

Lava76,

Back when 1.10 exp came out, I did extensive testing and I wasn't satisfied with the testing results of using modded the way you did. It's been a while and I can't remember which scenario failed. The devs have now implemented a new way to override in 1.11 as posted in patch-notes for this ticket specifically. I know of it already :)