Skip to content

Commit 942f2af

Browse files
committed
Low impact fix for possible zombie items from MakePermanent action
1 parent bf53071 commit 942f2af

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

  • Assets/Scripts/Game/Questing

Assets/Scripts/Game/Questing/Item.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Source Code: https://github.com/Interkarma/daggerfall-unity
66
// Original Author: Lypyl (lypyldf@gmail.com), Gavin Clayton (interkarma@dfworkshop.net)
77
// Contributors: Hazelnut
8-
//
8+
//
99
// Notes:
1010
//
1111

@@ -19,7 +19,7 @@
1919
using DaggerfallWorkshop.Game.Guilds;
2020

2121
/*Example patterns:
22-
*
22+
*
2323
* Item _gold_ gold
2424
* Item _gold1_ gold range 5 to 25
2525
* Item talisman talisman
@@ -281,8 +281,19 @@ public void MakePermanent()
281281
madePermanent = true;
282282

283283
// Set current DaggerfallUnityItem instance as permanent
284-
if (DaggerfallUnityItem != null)
285-
DaggerfallUnityItem.MakePermanent();
284+
if (item != null)
285+
item.MakePermanent();
286+
287+
// Make sure permanency is synced for items in player item collections
288+
Entity.PlayerEntity playerEntity = GameManager.Instance.PlayerEntity;
289+
DaggerfallUnityItem[] items = playerEntity.Items.ExportQuestItems(ParentQuest.UID, Symbol);
290+
if (items == null || items.Length == 0)
291+
return;
292+
293+
foreach (DaggerfallUnityItem dfitem in items)
294+
{
295+
dfitem.MakePermanent();
296+
}
286297
}
287298

288299
#endregion

0 commit comments

Comments
 (0)