• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

VS plugin mod for Basic Armour


Commit MetaInfo

Revisiond46f62d2b3166fd3e1b8c3ce2b915852b91d46c4 (tree)
Zeit2019-07-25 10:21:26
Autormelchior <melchior@user...>
Commitermelchior

Log Message

feature progress on buckler shields

Ändern Zusammenfassung

Diff

--- a/ArmourMod/Armour/DamageFilter.cs
+++ b/ArmourMod/Armour/DamageFilter.cs
@@ -13,7 +13,7 @@ namespace ArmourMod
1313 slashingPercent = slash;
1414 crushingPercent = crush;
1515 firePercent = fire;
16- encumberancePercent = 0;
16+ encumberanceMultiplier = 1f;
1717 }
1818
1919 public DamageFilter(float blunt, float pierce, float slash, float crush, float fire, float encP)
@@ -23,7 +23,7 @@ namespace ArmourMod
2323 slashingPercent = slash;
2424 crushingPercent = crush;
2525 firePercent = fire;
26- encumberancePercent = encP;
26+ encumberanceMultiplier = encP;
2727 }
2828
2929 public float bluntPercent;
@@ -31,7 +31,7 @@ namespace ArmourMod
3131 public float slashingPercent;
3232 public float crushingPercent;
3333 public float firePercent;
34- public float encumberancePercent;
34+ public float encumberanceMultiplier;
3535
3636 //TODO:Threshold values;
3737
@@ -43,7 +43,7 @@ namespace ArmourMod
4343 var slashing = armourInSlot.Itemstack.ItemAttributes["SlashingProtection"].AsFloat( );
4444 var crushing = armourInSlot.Itemstack.ItemAttributes["CrushingProtection"].AsFloat( );
4545 var flame = armourInSlot.Itemstack.ItemAttributes["FireProtection"].AsFloat( );
46- var encumberance = armourInSlot.Itemstack.ItemAttributes["Encumberance"].AsFloat( );
46+ var encumberance = armourInSlot.Itemstack.ItemAttributes["Encumberance"].AsFloat(1F);
4747
4848 return new DamageFilter(blunt, piercing, slashing, crushing, flame, encumberance);
4949 }
--- a/ArmourMod/Armour/EntityArmourPlayer.cs
+++ b/ArmourMod/Armour/EntityArmourPlayer.cs
@@ -23,6 +23,9 @@ namespace ArmourMod
2323 //Pre-compute values;
2424 private DamageFilter finalFilter;
2525
26+ private const string armourEncumberanceKey = "ArmourEncumberance";
27+
28+
2629 internal ArmourModConfig CachedConfiguration
2730 {
2831 get
@@ -267,10 +270,10 @@ namespace ArmourMod
267270 {
268271 DamageFilter dmgFilt = DamageFilter.ConstructFilter( watchedSlot );
269272 #if DEBUG
270- Logger.VerboseDebug( "Armour Filter Props: B{0} P{1} S{2} C{3} F{4}", dmgFilt.bluntPercent, dmgFilt.piercingPercent, dmgFilt.slashingPercent, dmgFilt.crushingPercent, dmgFilt.firePercent );
273+ Logger.VerboseDebug( "Armour Filter Props: B{0} P{1} S{2} C{3} F{4} E{5}", dmgFilt.bluntPercent, dmgFilt.piercingPercent, dmgFilt.slashingPercent, dmgFilt.crushingPercent, dmgFilt.firePercent, dmgFilt.encumberanceMultiplier );
271274 #endif
272275 DamageFilters[(EnumCharacterDressType)slotId] = dmgFilt;
273- RecomputeDamageFilterPercents( );
276+ RecomputeDamageFilterProps( );
274277 }
275278 }
276279 } else if (watchedSlot.StorageType == EnumItemStorageFlags.Outfit){
@@ -279,7 +282,7 @@ namespace ArmourMod
279282 Logger.VerboseDebug( "Removed a AF item from SlotId:{0}",slotId );
280283 #endif
281284 DamageFilters.Remove((EnumCharacterDressType)slotId);
282- RecomputeDamageFilterPercents( );
285+ RecomputeDamageFilterProps( );
283286 }
284287 }
285288
@@ -302,10 +305,10 @@ namespace ArmourMod
302305 if (CheckIfItemHasDamageFilter(handSlot)) {
303306 DamageFilter dmgFilt = DamageFilter.ConstructFilter(handSlot);
304307 #if DEBUG
305- Logger.VerboseDebug("Armour Filter Props: B{0} P{1} S{2} C{3} F{4}", dmgFilt.bluntPercent, dmgFilt.piercingPercent, dmgFilt.slashingPercent, dmgFilt.crushingPercent, dmgFilt.firePercent);
308+ Logger.VerboseDebug("Armour Filter Props: B{0} P{1} S{2} C{3} F{4} E{5}", dmgFilt.bluntPercent, dmgFilt.piercingPercent, dmgFilt.slashingPercent, dmgFilt.crushingPercent, dmgFilt.firePercent, dmgFilt.encumberanceMultiplier);
306309 #endif
307310 DamageFilters[EnumCharacterDressType.Arm] = dmgFilt;
308- RecomputeDamageFilterPercents( );
311+ RecomputeDamageFilterProps( );
309312 }
310313 }
311314 } else {
@@ -314,7 +317,7 @@ namespace ArmourMod
314317 Logger.VerboseDebug("Removed a AF from SlotId:{0}", slotId);
315318 #endif
316319 DamageFilters.Remove(EnumCharacterDressType.Arm);
317- RecomputeDamageFilterPercents( );
320+ RecomputeDamageFilterProps( );
318321 }
319322 }
320323 }
@@ -348,7 +351,9 @@ namespace ArmourMod
348351 /// <param name="byPlayer">By player.</param>
349352 private void HandlePlayerSpawn(IClientPlayer byPlayer)
350353 {
354+ #if DEBUG
351355 Logger.VerboseDebug("Handling Spawn for: {0}", byPlayer.PlayerName);
356+ #endif
352357
353358 if (byPlayer.Entity != null && byPlayer.Entity is EntityArmourPlayer) {
354359 EntityArmourPlayer targetPlayer = byPlayer.Entity as EntityArmourPlayer;//CHECK: Cast from - not actual instance?
@@ -392,10 +397,10 @@ namespace ArmourMod
392397
393398
394399 private void HandlePlayerDespawn(IClientPlayer byPlayer)
395- {
396- //Unlink watcher event
400+ {
401+ #if DEBUG
397402 Logger.VerboseDebug("Handling Despawn for: {0}", byPlayer.PlayerName);
398-
403+ #endif
399404 }
400405
401406
@@ -424,7 +429,7 @@ namespace ArmourMod
424429 DamageFilter dmgFilt = DamageFilter.ConstructFilter( itemSlot);
425430
426431 #if DEBUG
427- CoreAPI.World.Logger.VerboseDebug( "Armour Filter Props: B{0} P{1} S{2} C{3} F{4}", dmgFilt.bluntPercent, dmgFilt.piercingPercent, dmgFilt.slashingPercent, dmgFilt.crushingPercent, dmgFilt.firePercent );
432+ CoreAPI.World.Logger.VerboseDebug( "Armour Filter Props: B{0} P{1} S{2} C{3} F{4} E{5}", dmgFilt.bluntPercent, dmgFilt.piercingPercent, dmgFilt.slashingPercent, dmgFilt.crushingPercent, dmgFilt.firePercent, dmgFilt.encumberanceMultiplier );
428433 #endif
429434
430435 DamageFilters.Add((EnumCharacterDressType)slotId,dmgFilt);
@@ -435,11 +440,11 @@ namespace ArmourMod
435440 }
436441
437442 if ( DamageFilters.Count > 0 ) {
438- RecomputeDamageFilterPercents( );
443+ RecomputeDamageFilterProps( );
439444 }
440445 }
441446
442- private void RecomputeDamageFilterPercents()
447+ private void RecomputeDamageFilterProps()
443448 {
444449 if (DamageFilters != null && DamageFilters.Count > 0)
445450 {
@@ -461,7 +466,17 @@ namespace ArmourMod
461466
462467 finalFilter.firePercent = DamageFilters.Sum( df => df.Value.firePercent );
463468 finalFilter.firePercent = Math.Abs( finalFilter.firePercent );
464- finalFilter.firePercent = Math.Min( 0.95F, finalFilter.firePercent );
469+ finalFilter.firePercent = Math.Min( 0.95F, finalFilter.firePercent );
470+
471+ finalFilter.encumberanceMultiplier = DamageFilters.Min(df => df.Value.encumberanceMultiplier);
472+ //Encumberance needs direct application / removal here;
473+ if (finalFilter.encumberanceMultiplier > 0 && finalFilter.encumberanceMultiplier < 1.0) {
474+ this.SetWalkSpeedModifier(armourEncumberanceKey, finalFilter.encumberanceMultiplier, false);
475+ Logger.VerboseDebug("New Walk Speed Mult: {0}", this.GetWalkSpeedMultiplier( ));
476+ } else {
477+ this.RemoveWalkSpeedModifier(armourEncumberanceKey);
478+ }
479+
465480 }
466481 }
467482
--- a/ArmourMod/Armour/ItemArmour.cs
+++ b/ArmourMod/Armour/ItemArmour.cs
@@ -18,9 +18,15 @@ namespace ArmourMod
1818 //base.GetHeldItemInfo(stack, dsc, world, withDebugInfo);
1919
2020 if (this.Durability > 1) {
21- dsc.AppendLine(Lang.Get("Durability: {0} / {1}", new object[] {
22- stack.Attributes.GetInt ("durability", this.Durability),
23- this.Durability}));
21+
22+ int defDur = stack.Attributes.GetInt("durability", this.Durability);
23+
24+ //byte greenComponent = (byte)(255 * (float)this.Durability / (float)defDur);
25+ //byte redComponent = (byte)(0xff - greenComponent);
26+
27+ //dsc.Append($"<font color='#{greenComponent:X2}{redComponent:X2}00'>");
28+ dsc.AppendLine(Lang.Get("Durability: {0} / {1}", new object[] { defDur, this.Durability}));
29+ //dsc.Append("</font>\n");
2430 }
2531
2632 //Display Protection values & Weight / dissadvantages
@@ -29,23 +35,18 @@ namespace ArmourMod
2935 var slashing = stack.ItemAttributes["SlashingProtection"].AsFloat( );
3036 var crushing = stack.ItemAttributes["CrushingProtection"].AsFloat( );
3137 var flame = stack.ItemAttributes["FireProtection"].AsFloat( );
32- var encumberance = stack.ItemAttributes["Encumberance"].AsFloat( );
38+ var encumberance = stack.ItemAttributes["Encumberance"].AsFloat(1F );
3339
34- dsc.AppendFormat($"Blunt {blunt:P1}\n Piercing {piercing:P1}\n Slashing {slashing:P1}\n Crushing {crushing:P1}\n Flame {flame:P1}\n Encumberance {encumberance:P1}\n");
40+ dsc.AppendFormat($"Blunt {blunt:P1}\n Piercing {piercing:P1}\n Slashing {slashing:P1}\n Crushing {crushing:P1}\n Flame {flame:P1}\n Encumberance {encumberance:N2}X\n");
3541
3642 EnumCharacterDressType dresstype;
3743 string strdress = stack.ItemAttributes["clothescategory"].AsString( );
3844
39- if (!Enum.TryParse(strdress, true, out dresstype)) {
40- dsc.AppendLine(Lang.Get("Cloth Category: Unknown"));
41- } else {
45+ if (Enum.TryParse(strdress, true, out dresstype)) {
4246 dsc.AppendLine(Lang.Get("Cloth Category: {0}", Lang.Get("clothcategory-" + stack.ItemAttributes["clothescategory"].AsString( ))));
4347 }
44- }
45-
46- //IDEA: Shackles = "Armour" that has high encumberance - and 'sticks' to player; needs specific key to remove
47- //TODO: Shackle & Key item, (Closed) Shackle ItemArmour
4848
49+ }
4950 }
5051 }
5152
--- a/ArmourMod/assets/armourmod/itemtypes/wearable/clothes-upperbodyover-vest.json
+++ b/ArmourMod/assets/armourmod/itemtypes/wearable/clothes-upperbodyover-vest.json
@@ -56,7 +56,8 @@
5656 PiercingProtection:0.3,
5757 SlashingProtection:0.3,
5858 CrushingProtection:0.3,
59- FireProtection:0.14
59+ FireProtection:0.14,
60+ Encumberance:0.90
6061 },
6162 "*-lamellar": {
6263 clothescategory: "upperbodyover",
@@ -65,7 +66,8 @@
6566 PiercingProtection:0.35,
6667 SlashingProtection:0.35,
6768 CrushingProtection:0.35,
68- FireProtection:0.14
69+ FireProtection:0.14,
70+ Encumberance:0.87
6971 },
7072 "*-platechest": {
7173 clothescategory: "upperbodyover",
@@ -74,7 +76,8 @@
7476 PiercingProtection:0.3,
7577 SlashingProtection:0.37,
7678 CrushingProtection:0.31,
77- FireProtection:0.2
79+ FireProtection:0.2,
80+ Encumberance:0.85
7881 },
7982 "*-scale": {
8083 clothescategory: "upperbodyover",
@@ -83,7 +86,8 @@
8386 PiercingProtection:0.26,
8487 SlashingProtection:0.27,
8588 CrushingProtection:0.25,
86- FireProtection:0.1
89+ FireProtection:0.1,
90+ Encumberance:0.90
8791 },
8892 "*-chain": {
8993 clothescategory: "upperbodyover",
@@ -92,21 +96,24 @@
9296 PiercingProtection:0.25,
9397 SlashingProtection:0.25,
9498 CrushingProtection:0.2,
95- FireProtection:0.05
99+ FireProtection:0.05,
100+ Encumberance:0.95
96101 },
97102 "*-studdedleather": {
98103 clothescategory: "upperbodyover",
99104 inCharacterCreationDialog: false,
100105 SlashingProtection:0.17,
101106 BluntProtection:0.2,
102- FireProtection:0.19
107+ FireProtection:0.19,
108+ Encumberance:0.98
103109 },
104110 "*-leather": {
105111 clothescategory: "upperbodyover",
106112 inCharacterCreationDialog: false,
107113 BluntProtection:0.12,
108114 SlashingProtection:0.15,
109- FireProtection:0.2
115+ FireProtection:0.2,
116+ Encumberance:0.99
110117 },
111118 "*":{
112119 clothescategory: "upperbodyover",
--- a/ArmourMod/assets/armourmod/itemtypes/wearable/item-offhand-buckler.json
+++ b/ArmourMod/assets/armourmod/itemtypes/wearable/item-offhand-buckler.json
@@ -19,12 +19,12 @@
1919 creativeinventory: { "general": ["*"], "items": ["*"], "clothing": ["*"] },
2020 textures: {
2121 aged:{ base: "game:block/wood/debarked/aged"},
22- },
23-
22+ },
2423 fpHandTransform: {
25- translation: { x: 0, y: 0, z: 0 },
26- rotation: { x: 17, y: 38, z: -33 },
27- scale: 1.5
24+ translation: { x: 0, y: -0.05, z: -0.6 },
25+ rotation: { x: -100, y: -180, z: 90 },
26+ origin: { x: 0.5, y: 0, z: 0.5 },
27+ scale: 0.8
2828 },
2929 guiTransform: {
3030 translation: { x: 0, y: 1, z: 0 },
@@ -34,7 +34,7 @@
3434 },
3535 tpHandTransform: {
3636 translation: { x: 0, y: -0.05, z: -0.6 },
37- rotation: { x: -65, y: -180, z: 90 },
37+ rotation: { x: -90, y: -180, z: 90 },
3838 origin: { x: 0.5, y: 0, z: 0.5 },
3939 scale: 0.8
4040 },