Skip to content

Commit

Permalink
Merge pull request #2633 from ajrb/noEncumbranceInTemplates
Browse files Browse the repository at this point in the history
Move the hardcoding of items that don't encumber into templates
  • Loading branch information
ajrb authored Apr 7, 2024
2 parents 41ae903 + 7705186 commit 8fe82d8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
24 changes: 16 additions & 8 deletions Assets/Resources/ItemTemplates.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1877,7 +1877,8 @@
"worldTextureArchive": 0,
"worldTextureRecord": 0,
"playerTextureArchive": 213,
"playerTextureRecord": 1
"playerTextureRecord": 1,
"hasNoEncumbrance": true
},
{
"index": 94,
Expand All @@ -1897,7 +1898,8 @@
"worldTextureArchive": 0,
"worldTextureRecord": 0,
"playerTextureArchive": 201,
"playerTextureRecord": 0
"playerTextureRecord": 0,
"hasNoEncumbrance": true
},
{
"index": 95,
Expand All @@ -1917,7 +1919,8 @@
"worldTextureArchive": 0,
"worldTextureRecord": 0,
"playerTextureArchive": 213,
"playerTextureRecord": 1
"playerTextureRecord": 1,
"hasNoEncumbrance": true
},
{
"index": 96,
Expand All @@ -1937,7 +1940,8 @@
"worldTextureArchive": 0,
"worldTextureRecord": 0,
"playerTextureArchive": 213,
"playerTextureRecord": 1
"playerTextureRecord": 1,
"hasNoEncumbrance": true
},
{
"index": 97,
Expand All @@ -1957,7 +1961,8 @@
"worldTextureArchive": 0,
"worldTextureRecord": 0,
"playerTextureArchive": 213,
"playerTextureRecord": 1
"playerTextureRecord": 1,
"hasNoEncumbrance": true
},
{
"index": 98,
Expand All @@ -1977,7 +1982,8 @@
"worldTextureArchive": 0,
"worldTextureRecord": 0,
"playerTextureArchive": 213,
"playerTextureRecord": 1
"playerTextureRecord": 1,
"hasNoEncumbrance": true
},
{
"index": 99,
Expand Down Expand Up @@ -2638,7 +2644,8 @@
"worldTextureRecord": 16,
"playerTextureArchive": 0,
"playerTextureRecord": 0,
"isNotRepairable": true
"isNotRepairable": true,
"hasNoEncumbrance": true
},
{
"index": 132,
Expand Down Expand Up @@ -5762,6 +5769,7 @@
"worldTextureArchive": 209,
"worldTextureRecord": 8,
"playerTextureArchive": 0,
"playerTextureRecord": 0
"playerTextureRecord": 0,
"hasNoEncumbrance": true
}
]
1 change: 1 addition & 0 deletions Assets/Scripts/API/ItemsFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public struct ItemTemplate

// DFU extension fields
public bool isNotRepairable; // Defaults to false if not specified
public bool hasNoEncumbrance; // Indicates an items weight doesn't count for encumbrance, defaults to false
}

/// <summary>
Expand Down
9 changes: 5 additions & 4 deletions Assets/Scripts/Game/Items/DaggerfallUnityItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -662,13 +662,14 @@ public bool IsOfTemplate(int templateIndex)
return (TemplateIndex == templateIndex);
}

// Horses, carts, arrows and maps are not counted against encumbrance.
// By default horses, carts, arrows and maps are not counted against encumbrance.
// Denoted by "hasNoEncumbrance": true in template.
public float EffectiveUnitWeightInKg()
{
if (ItemGroup == ItemGroups.Transportation || TemplateIndex == (int)Weapons.Arrow ||
IsOfTemplate(ItemGroups.MiscItems, (int)MiscItems.Map))
if (ItemTemplate.hasNoEncumbrance)
return 0f;
return weightInKg;
else
return weightInKg;
}

/// <summary>
Expand Down

0 comments on commit 8fe82d8

Please sign in to comment.