Ludeon Forums

RimWorld => Mods => Releases => Topic started by: LimeTreeSnake on November 16, 2018, 02:29:18 AM

Title: [1.0] Degradation (2019-11-26)
Post by: LimeTreeSnake on November 16, 2018, 02:29:18 AM
-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-

-Special Thanks to-

-Compatibility-


-Links-
Ludeon (https://ludeon.com/forums/index.php?topic=46890.msg445480)
GitHub (https://github.com/LimeTreeSnake/Degradation)
Steam Workshop (https://steamcommunity.com/sharedfiles/itemedittext/?id=1565674984)
Discord (https://discord.gg/x2Xn7Wj)

-Patreon-
I created a Patreon account (https://www.patreon.com/LimeTreeSnake) 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! :)
Title: Re: [1.0] Equipment Deterioration
Post by: 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.
Title: Re: [1.0] Equipment Deterioration
Post by: LimeTreeSnake on November 16, 2018, 12:26:06 PM
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 (https://github.com/LimeTreeSnake/Equipment-Deterioration)
Title: Re: [1.0] Equipment Deterioration
Post by: LimeTreeSnake on November 19, 2018, 08:18:09 AM
Update: Added functionality for deterioration of weapons upon use.
Title: Re: [1.0] Equipment Deterioration
Post by: LimeTreeSnake on November 25, 2018, 07:41:33 AM
Critical Update, resolved issue with turrets and other non-pawn things being calculated.
Title: Re: [1.0] Equipment Deterioration
Post by: CruelBanana on November 25, 2018, 08:25:32 AM
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.
Title: Re: [1.0] Equipment Deterioration
Post by: WolfgangPolska on May 16, 2019, 03:11:38 PM
Does it work on modded equipment? Should I place it high or low on modlist?
Title: Re: [1.0] Equipment Deterioration
Post by: LimeTreeSnake on May 17, 2019, 04:54:05 AM
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!
Title: Re: [1.0] Equipment Deterioration
Post by: Razzoriel on July 08, 2019, 09:26:50 AM
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.
Title: Re: [1.0] Equipment Deterioration
Post by: 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.
Title: Re: [1.0] Equipment Deterioration
Post by: Razzoriel on July 23, 2019, 06:37:18 PM
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.
Title: Re: [1.0] Equipment Deterioration
Post by: LimeTreeSnake on July 24, 2019, 03:21:04 AM
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.
Title: Re: [1.0] Equipment Deterioration (2019-08-08)
Post by: LimeTreeSnake on August 08, 2019, 07:27:24 AM
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.
Title: Re: [1.0] Equipment Deterioration (2019-08-10)
Post by: LimeTreeSnake on August 09, 2019, 05:48:49 PM
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
Title: Re: [1.0] Equipment Deterioration (2019-08-10)
Post by: LimeTreeSnake on August 10, 2019, 08:27:24 AM
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.
Title: Re: [1.0] Equipment Deterioration (2019-08-14)
Post by: LimeTreeSnake on August 14, 2019, 05:44:24 AM
Minor update for that je ne sais quoi quality of life.
2018-10-14
   -Textbox input for percentage value in the equipment deterioration settings.
   -Button to revert to default settings.
   Fix:
      -Textbox decimal values possible.
Title: Re: [1.0] Equipment Deterioration (2019-08-14)
Post by: WolfgangPolska on August 21, 2019, 11:34:59 AM
Weapons dont get damage while shooting ;c
Title: Re: [1.0] Equipment Deterioration (2019-08-14)
Post by: LimeTreeSnake on August 21, 2019, 12:16:29 PM
Apologies, was a bug added when I added the jamming feature. It should be fixed now. Do tell if you find any other issues!
Title: Re: [1.0] Equipment Deterioration (2019-08-21)
Post by: Alistaire on August 28, 2019, 09:20:48 AM
Just wanted to say this mod seems 100% compatible with CombatExtended, for anyone wondering.
Title: Re: [1.0] Equipment Deterioration (2019-09-08)
Post by: LimeTreeSnake on September 08, 2019, 09:21:06 AM
2019-09-08
   - Added check that it actually is activated if it should deteriorate instead of taking it for granted...

whoooops
Title: Re: [1.0] Equipment Deterioration (2019-09-12)
Post by: LimeTreeSnake on September 12, 2019, 03:31:36 PM
2019-09-12
-Made a check to see if instance is a building, if so then it should not be calculated.
-added a check to disqualify miniguns (Minigun 2) from firing calculation. Toggleable in the modsettings.
Title: Re: [1.0] Degradation (2019-11-26)
Post by: LimeTreeSnake on November 26, 2019, 10:01:30 AM
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%.
Title: Re: [1.0] Degradation (2019-11-26)
Post by: Hjkma on January 05, 2020, 08:49:46 AM
Weapons degradation alerts are always shown, no matter what value is set in the settings, 25 or 95, a warning is still shown as soon as the quality drops below 100%.
Title: Re: [1.0] Degradation (2019-11-26)
Post by: geojak on January 13, 2020, 05:23:44 PM
i fixed the problem with the warning always showing below 100%. it was rather easy.

the mod calcualtes current health of item / max health of item < set level at which it should warm.

current and max health are somehow treated as integers so so i can only store 0 1 and 0,xx will always be rounded down to 0.

adding in a type cast (float) seemed to help.
Title: Re: [1.0] Degradation (2019-11-26)
Post by: geojak on January 14, 2020, 04:59:25 PM
fixed the error with turrets on shot trying to degrade their non existant weapon
Title: Re: [1.0] Degradation (2019-11-26)
Post by: 12345abcde on January 18, 2020, 10:19:15 AM
Quote from: geojak on January 14, 2020, 04:59:25 PM
fixed the error with turrets on shot trying to degrade their non existant weapon
Thanks for this. Just want to point out this only fixes mini turrets, other turrets still have errors, not as big of a deal though.
Title: Re: [1.0] Degradation (2019-11-26)
Post by: 12345abcde on January 19, 2020, 02:46:09 PM
I seem to have found a bug as well, if the guns are at 100% hit pots, they never degrade. I have vanilla degradation turned on and they never degrade, no matter how much time passes or how much they shoot.
Weapons below 100% do degrade both with vanilla method and shooting.
Title: Re: [1.0] Degradation (2019-11-26)
Post by: geojak on January 20, 2020, 01:58:00 PM
That is actually a feature I think. I also didn't like it a d removed it from my personal version. (not the one posted here)
Title: Re: [1.0] Degradation (2019-11-26)
Post by: ruPal on January 20, 2020, 03:56:42 PM
Is this mod Combat Extended compatible? I have tested it with 100 shots, but weapon didn't degrade (even been when damaged before).
Title: Re: [1.0] Degradation (2019-11-26)
Post by: 12345abcde on January 20, 2020, 05:38:08 PM
Quote from: geojak on January 20, 2020, 01:58:00 PM
That is actually a feature I think. I also didn't like it a d removed it from my personal version. (not the one posted here)
Could you please share that one as well? I'd much rather have it that way too. Thanks.
Title: Re: [1.0] Degradation (2019-11-26)
Post by: geojak on January 21, 2020, 04:46:17 PM
well this is the altered version i use (plus sources), but it is stripped of some features i were not using in hopes of optimizing performance by reducing garbace colletion of c#. (it is not really relevant nor noticable)

the version i posted before was the original with my attempt at fixing the 2 bugs and leaving the rest unchanged.

This is not my mod. i feel a bit uneasy posting here anything beyond bug fixes...
Title: Re: [1.0] Degradation (2019-11-26)
Post by: 12345abcde on January 22, 2020, 03:33:01 AM
Quote from: geojak on January 21, 2020, 04:46:17 PM
well this is the altered version i use (plus sources), but it is stripped of some features i were not using in hopes of optimizing performance by reducing garbace colletion of c#. (it is not really relevant nor noticable)

the version i posted before was the original with my attempt at fixing the 2 bugs and leaving the rest unchanged.

This is not my mod. i feel a bit uneasy posting here anything beyond bug fixes...
I'll check it out, thanks.
Title: Re: [1.0] Degradation (2019-11-26)
Post by: 12345abcde on January 22, 2020, 02:28:38 PM
Quote from: geojak on January 21, 2020, 04:46:17 PM
well this is the altered version i use (plus sources), but it is stripped of some features i were not using in hopes of optimizing performance by reducing garbace colletion of c#. (it is not really relevant nor noticable)

the version i posted before was the original with my attempt at fixing the 2 bugs and leaving the rest unchanged.

This is not my mod. i feel a bit uneasy posting here anything beyond bug fixes...
It's exactly how I wanted. Thank you very much!
Title: Re: [1.0] Degradation (2019-11-26)
Post by: Obscene on January 31, 2020, 03:51:20 PM
Quote from: geojak on January 21, 2020, 04:46:17 PM
well this is the altered version i use (plus sources), but it is stripped of some features i were not using in hopes of optimizing performance by reducing garbace colletion of c#. (it is not really relevant nor noticable)

the version i posted before was the original with my attempt at fixing the 2 bugs and leaving the rest unchanged.

This is not my mod. i feel a bit uneasy posting here anything beyond bug fixes...
Your altered version to this mod actually works incredibly well even with weapons that were unaffected by the original mod. Can we hope to have this on steam workshop?
Title: Re: [1.0] Degradation (2019-11-26)
Post by: LimeTreeSnake on February 02, 2020, 05:53:39 AM
Many thanks for doing this!
I will get to updating my mod with more features as I find time. Have been cooperating a lot with OskarPotocki and have not had much time to work on my own mods lately. *sighs* But I will get to it. In the meanwhile, use Geojak's version as it seems to be a stable version!