Skip to content

Manual Item Stack Splitting Behavior Does Not Properly Account For Custom/Modded Items #2758

Open
@magicono43

Description

@magicono43

Describe the issue

If using the "manual stack split" behavior in the inventory, necessary attributes for custom/modded items outside the vanilla items won't be carried over properly or at all.

This causes functions for the child stack to no longer work, such as not being able to be restacked with the original parent stack (or any other stack for that matter.) of otherwise identical items. As well as breaking any additional functionality that custom item may have had, such as any "OnUse" functions attached to it normally.

To Reproduce

Have any mod that adds custom items that also stack. When you manually split said stack, the child will no longer function properly, as a result of the "className" attribute now being "null" when looking at the save-data for said child item stack.

Proposed Solution

I think the best way to potentially correct this behavior would be to simply update the "SplitStack" method's current way it recreates the child stack to use the ItemBuilder class' method "CreateItem" rather than how it currently does it.

Specifically changing this:

DaggerfallUnityItem pickedItems = new DaggerfallUnityItem(stack);

To This:

DaggerfallUnityItem pickedItems = ItemBuilder.CreateItem(stack.ItemGroup, stack.TemplateIndex);

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions