[1.0] Degradation (2019-11-26)

Started by LimeTreeSnake, November 16, 2018, 02:29:18 AM

Previous topic - Next topic

LimeTreeSnake

-Degradation -


-Description-
This mod makes sure that all your stuff breaks down with passive and active use. Using weapons wear them down and they can jam.


-Features-

  • Mod settings where you can turn on and off features and change degradation values, including daily vanilla apparel deterioration
  • Randomize damage done to your items.
  • Degradation for NPC.
  • Quality of item matters for degrading, make your legendary weapons everlasting
  • Jamming when firing badly damaged weapons!
  • Bullet count matters for degradation.
  • All features Toggleable.

-Special Thanks to-

  • Jecrell: cause he is great and his code helped me a lot.
  • Pardeike: cause of his work on Harmony.
  • XeoNovaDan: For his suggestion regarding quality.
  • LegendBraki: For his many suggestions.

-Compatibility-

  • Adding/removing this mod mid-save may or may not have unforeseen consequences but so is true for all mods right?
  • CE
  • Minigun 2


-Links-
Ludeon
GitHub
Steam Workshop
Discord

-Patreon-
I created a Patreon account since some people have asked for a way to support me!


-Updates-
2019-11-26
- The used weapon should be damaged correctly in case of multiple possible sources.
- Bullet Matters formula revised to actually do what it is supposed to. . .
- Jamming works again.
- Remade old firing code and fast exits.
- Much sturdier weapon, undamaged weapons won't take any damage even at 100%.

-License-
You may use this code as however you want. However, do notify me as I'd love to hear if people find use of my code! :)

Canute

Lindorm,
thanks for this mod.
But could you please add a non-steam download ?
If you want it workshop only, no problem, but then there is no reason for a forum entry.

LimeTreeSnake

Quote from: Canute on November 16, 2018, 12:08:19 PM
Lindorm,
thanks for this mod.
But could you please add a non-steam download ?
If you want it workshop only, no problem, but then there is no reason for a forum entry.

Apologies! I've uploaded the whole code to github including source code.
You can find it here -> https://github.com/LimeTreeSnake/Equipment-Deterioration

LimeTreeSnake

Update: Added functionality for deterioration of weapons upon use.

LimeTreeSnake

Critical Update, resolved issue with turrets and other non-pawn things being calculated.

CruelBanana

I've been waiting so damn long for this mod to happen, thanks a grand! This is a feature that is truly lacking from vanilla game.

WolfgangPolska

Does it work on modded equipment? Should I place it high or low on modlist?
I have no idea how, but it works!!!

LimeTreeSnake

Quote from: WolfgangPolska on May 16, 2019, 03:11:38 PM
Does it work on modded equipment? Should I place it high or low on modlist?

Yes, I've been using it with tons of weapon mods without fault.
It uses harmony thus inserts itself whenever a certain firing method is called. It should not truly matter where you put this mod in the mod load order but I tend to keep it rather high up / middle.

Should you face any issues, do tell!

Razzoriel

Hi, is this mod still functional? I'd love to see a version that adds a stat for a weapon so one can customize the amount of shots a weapon fires before it takes a degradation hit, so we can have different weapons with different degradation patterns. It would mesh really well with repairing.

LimeTreeSnake

Apologies for the late reply!
I am still using my mod, had no problems with it so far. :)

Your suggestion does sound neat but that'd require patching all weapons with said stat.
As of this moment, weapons that fire a lot of rounds tend to take (albeit I'd claim more realistic) more damage as a consequence which in turn does not bode well for miniguns and whatnot. Although you can tweak the rate of degradation to a much lower rate, say, 0.1% chance of 1 damage per bullet and just keep the daily chance of degradation.
I'll play around with the thought and I just might come up with an alternative calculation for individual weapons as per suggestion.

Razzoriel

Quote from: LimeTreeSnake on July 18, 2019, 07:22:07 AM
Apologies for the late reply!
I am still using my mod, had no problems with it so far. :)

Your suggestion does sound neat but that'd require patching all weapons with said stat.
As of this moment, weapons that fire a lot of rounds tend to take (albeit I'd claim more realistic) more damage as a consequence which in turn does not bode well for miniguns and whatnot. Although you can tweak the rate of degradation to a much lower rate, say, 0.1% chance of 1 damage per bullet and just keep the daily chance of degradation.
I'll play around with the thought and I just might come up with an alternative calculation for individual weapons as per suggestion.
Yes, a very small percentage as a chance to damage the gun per shot is the ideal approach to take, since on average it will drop durability at the same rate. However, i'd warn you that it would only be feasible with other mods in conjunction, such as Mending, so players can maintain their Legendary weapons, or keep this percentage really really low so only a very unlucky streak would drop the weapon's durability.

LimeTreeSnake

Quote from: Razzoriel on July 23, 2019, 06:37:18 PM
Yes, a very small percentage as a chance to damage the gun per shot is the ideal approach to take, since on average it will drop durability at the same rate. However, i'd warn you that it would only be feasible with other mods in conjunction, such as Mending, so players can maintain their Legendary weapons, or keep this percentage really really low so only a very unlucky streak would drop the weapon's durability.

Indeed, it is already possible to tweak the deterioration rate in the mod settings. It is also entirely possible to change the rate depending if it's a melee weapon or a ranged weapon. :) Simply use the slider in the mod settings to change the values to whatever you prefer.

I for one relish the fact that weapons with time break down, much more interesting in the tribal runs I do whenever I get my hands on a weapon far beyond my own technology level. However, as you say, using this mod in conjunction with say, mending mod does add another layer of depth.

LimeTreeSnake

#12
New update out.

2019-08-08
   -Added more deterioation options,
   -option for quality affecting deterioation,
   -bugfix: weapons detoriating upon use no longer cause a null exception.
   -New mod settings interface.

LimeTreeSnake

#13
Another update:

2019-08-09
   -Changed firing logic. Now deals damage per burst instead of per bullet.
   -Added option "Bullet Matters" which increase percentage chance for deterioration depending on amount of bullets per burst.
   -Added Changeable Values per bullet.
   -Made sure World Pawns does not have their items deteriorate.
   -Option for users to exclude/include NPC deterioration.
   -Updated mod interface and made a few changes.
   -Code optimization

LimeTreeSnake

#14
Pushed yet another update cause I have no life.
2019-08-10
   -Added Jamming logic.
   -Rearranged once again the UI.
   -Fixed an calculation issue where typecasting could have saved me a lot of trouble.
   -"Bullet Matters" works now as it should. lol.
   -Clarified info regarding Bullet Matters.
   -[XND]Proper Shotgun now works and so hopefully should every mod that has its own verbs.
   Hotfix:
      -Added a check to ensure that jamming only affects pawns with weapons.
      -Ammended the wild predators getting stuck.