• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubybathyscaphegamephpguiwindowsc翻訳pythonomegattwitterframeworkbtronarduinovb.net計画中(planning stage)directxpreviewertestゲームエンジンdom

VS plugin mod for Basic Armour


Commit MetaInfo

Revision719bfd0cacfa7bd9dd4a3a0533b18264062cf01b (tree)
Zeit2019-06-12 09:16:48
Autormelchior <melchior@user...>
Commitermelchior

Log Message

Fixed Environmental damage from throwing exception
Prevent heals from decaying armour
Change for possible null-ref by using self as damage source for item decay

Ändern Zusammenfassung

Diff

--- a/ArmourMod/Armour/EntityArmourPlayer.cs
+++ b/ArmourMod/Armour/EntityArmourPlayer.cs
@@ -185,12 +185,20 @@ namespace ArmourMod
185185 /// <param name="damage">Damage.</param>
186186 public override bool ReceiveDamage(DamageSource damageSource, float damage)
187187 {
188- if (damageSource.Type != EnumDamageType.Heal)
188+ if
189+ (
190+ damageSource.Type == EnumDamageType.BluntAttack ||
191+ damageSource.Type == EnumDamageType.PiercingAttack ||
192+ damageSource.Type == EnumDamageType.SlashingAttack ||
193+ damageSource.Type == EnumDamageType.Crushing ||
194+ damageSource.Type == EnumDamageType.Fire
195+ )
189196 {
190197 float beforeDamage = damage;
191198 //TODO: evaluate postion vector of strike to determine WHEN position of armour offers protection
192199
193- if (DamageFilters.Count > 0) {
200+ if (DamageFilters != null && DamageFilters.Count > 0)
201+ {
194202 //Evaluate damge type
195203 //Reduce by any applicable filter(s)
196204 //Pass along
@@ -223,23 +231,31 @@ namespace ArmourMod
223231
224232 default:
225233
234+ if (damageSource.Source == EnumDamageSource.Player) {
235+ #if DEBUG
236+ Logger.Warning("Player did unhandled type of damage {0}", damageSource.Type );
237+ #endif
238+ }
239+
226240 break;
227241 }
228- }
229242
230- #if DEBUG
231- Logger.VerboseDebug("Reduced: {0} Dmg from {2}; [{1}]", damage, damageSource.Type.ToString( ), beforeDamage);
232- #endif
243+ if (damage > 0) {
244+ #if DEBUG
245+ Logger.VerboseDebug("Reduced: {0} Dmg from {2}; [{1}]", damage, damageSource.Type.ToString( ), beforeDamage);
246+ #endif
233247
234- //All worn Armours adsorb damage themselves...
235- List<EnumCharacterDressType> slotsList = this.DamageFilters.Keys.ToList();
248+ //All worn Armours adsorb damage themselves...
249+ List<EnumCharacterDressType> slotsList = this.DamageFilters.Keys.ToList( );
236250
237- foreach (var slotId in slotsList) {
238- ItemSlot slot = this.GearInventory[(int)slotId];
239- Item armourItem = slot.Itemstack.Item;
251+ foreach (var slotId in slotsList) {
252+ ItemSlot slot = this.GearInventory[( int )slotId];
253+ Item armourItem = slot.Itemstack.Item;
240254
241- armourItem.DamageItem(ServerAPI.World, damageSource.SourceEntity, slot, 1);
242- }
255+ armourItem.DamageItem(ServerAPI.World, this, slot, 1);
256+ }
257+ }
258+ }
243259 }
244260
245261 return base.ReceiveDamage(damageSource, damage);
--- a/ArmourMod/Armour/ItemArmour.cs
+++ b/ArmourMod/Armour/ItemArmour.cs
@@ -23,14 +23,14 @@ namespace ArmourMod
2323 this.Durability}));
2424 }
2525
26- //Display Protection values
26+ //Display Protection values & Weight / dissadvantages
2727 var blunt = stack.ItemAttributes["BluntProtection"].AsFloat( );
2828 var piercing = stack.ItemAttributes["PiercingProtection"].AsFloat( );
2929 var slashing = stack.ItemAttributes["SlashingProtection"].AsFloat( );
3030 var crushing = stack.ItemAttributes["CrushingProtection"].AsFloat( );
3131 var flame = stack.ItemAttributes["FireProtection"].AsFloat( );
3232
33- dsc.AppendFormat("Protection:\n Blunt {0:P1}\n Piercing {1:P1}\n Slashing {2:P1}\n Crushing {3:P1}\n Flame {4:P1}",
33+ dsc.AppendFormat("Protection:\n Blunt {0:P1}\n Piercing {1:P1}\n Slashing {2:P1}\n Crushing {3:P1}\n Flame {4:P1}\n",
3434 blunt,
3535 piercing,
3636 slashing,
@@ -46,6 +46,10 @@ namespace ArmourMod
4646 dsc.AppendLine(Lang.Get("Cloth Category: {0}", Lang.Get("clothcategory-" + stack.ItemAttributes["clothescategory"].AsString( ))));
4747 }
4848 }
49+
50+ //IDEA: Shackles = "Armour" that has high encumberance - and 'sticks' to player; needs specific key to remove
51+ //TODO: Shackle & Key item, (Closed) Shackle ItemArmour
52+
4953 }
5054 }
5155
--- a/ArmourMod/modinfo.json
+++ b/ArmourMod/modinfo.json
@@ -3,9 +3,9 @@
33 "name": "Basic Armour Mod",
44 "description" : "Leather, Plate, Scale & More",
55 "authors": ["Melchior", "Bunnyviking"],
6- "version": "0.1.7",
6+ "version": "0.1.8",
77 "dependencies": {
8- "game": "1.9.7",
8+ "game": "1.9.9",
99 "survival": ""
1010 },
1111 "website": "http://nowebsite.nope"