Skip to content

Commit 7705186

Browse files
committed
Move the hardcoding of items that don't encumber into templates
This allows mods to change arrows so that their weight counts towards encumbrance.
1 parent 41ae903 commit 7705186

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

Assets/Resources/ItemTemplates.txt

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,7 +1877,8 @@
18771877
"worldTextureArchive": 0,
18781878
"worldTextureRecord": 0,
18791879
"playerTextureArchive": 213,
1880-
"playerTextureRecord": 1
1880+
"playerTextureRecord": 1,
1881+
"hasNoEncumbrance": true
18811882
},
18821883
{
18831884
"index": 94,
@@ -1897,7 +1898,8 @@
18971898
"worldTextureArchive": 0,
18981899
"worldTextureRecord": 0,
18991900
"playerTextureArchive": 201,
1900-
"playerTextureRecord": 0
1901+
"playerTextureRecord": 0,
1902+
"hasNoEncumbrance": true
19011903
},
19021904
{
19031905
"index": 95,
@@ -1917,7 +1919,8 @@
19171919
"worldTextureArchive": 0,
19181920
"worldTextureRecord": 0,
19191921
"playerTextureArchive": 213,
1920-
"playerTextureRecord": 1
1922+
"playerTextureRecord": 1,
1923+
"hasNoEncumbrance": true
19211924
},
19221925
{
19231926
"index": 96,
@@ -1937,7 +1940,8 @@
19371940
"worldTextureArchive": 0,
19381941
"worldTextureRecord": 0,
19391942
"playerTextureArchive": 213,
1940-
"playerTextureRecord": 1
1943+
"playerTextureRecord": 1,
1944+
"hasNoEncumbrance": true
19411945
},
19421946
{
19431947
"index": 97,
@@ -1957,7 +1961,8 @@
19571961
"worldTextureArchive": 0,
19581962
"worldTextureRecord": 0,
19591963
"playerTextureArchive": 213,
1960-
"playerTextureRecord": 1
1964+
"playerTextureRecord": 1,
1965+
"hasNoEncumbrance": true
19611966
},
19621967
{
19631968
"index": 98,
@@ -1977,7 +1982,8 @@
19771982
"worldTextureArchive": 0,
19781983
"worldTextureRecord": 0,
19791984
"playerTextureArchive": 213,
1980-
"playerTextureRecord": 1
1985+
"playerTextureRecord": 1,
1986+
"hasNoEncumbrance": true
19811987
},
19821988
{
19831989
"index": 99,
@@ -2638,7 +2644,8 @@
26382644
"worldTextureRecord": 16,
26392645
"playerTextureArchive": 0,
26402646
"playerTextureRecord": 0,
2641-
"isNotRepairable": true
2647+
"isNotRepairable": true,
2648+
"hasNoEncumbrance": true
26422649
},
26432650
{
26442651
"index": 132,
@@ -5762,6 +5769,7 @@
57625769
"worldTextureArchive": 209,
57635770
"worldTextureRecord": 8,
57645771
"playerTextureArchive": 0,
5765-
"playerTextureRecord": 0
5772+
"playerTextureRecord": 0,
5773+
"hasNoEncumbrance": true
57665774
}
57675775
]

Assets/Scripts/API/ItemsFile.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public struct ItemTemplate
6666

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

7172
/// <summary>

Assets/Scripts/Game/Items/DaggerfallUnityItem.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -662,13 +662,14 @@ public bool IsOfTemplate(int templateIndex)
662662
return (TemplateIndex == templateIndex);
663663
}
664664

665-
// Horses, carts, arrows and maps are not counted against encumbrance.
665+
// By default horses, carts, arrows and maps are not counted against encumbrance.
666+
// Denoted by "hasNoEncumbrance": true in template.
666667
public float EffectiveUnitWeightInKg()
667668
{
668-
if (ItemGroup == ItemGroups.Transportation || TemplateIndex == (int)Weapons.Arrow ||
669-
IsOfTemplate(ItemGroups.MiscItems, (int)MiscItems.Map))
669+
if (ItemTemplate.hasNoEncumbrance)
670670
return 0f;
671-
return weightInKg;
671+
else
672+
return weightInKg;
672673
}
673674

674675
/// <summary>

0 commit comments

Comments
 (0)