Project Zomboid

Project Zomboid

179 arvostelua
[B41] MaintenanceFIX
2
3
   
Palkinto
Lisää suosikkeihin
Lisätty suosikkeihin
Poista suosikeista
Tiedostokoko
Julkaistu
Päivitetty
284.459 KB
28.6.2023 klo 14.06
13.4.2024 klo 20.03
8 muutosilmoitusta ( näytä )

Tilaa ladataksesi
[B41] MaintenanceFIX

Kuvaus
This Mod is no longer needed for B42!

After investigating the maintenance skill in b42, i found that when the game calculates the maintenance mod, it no longer divides it by two, which means in all likelihood, the bug is fixed.

I have yet to confirm if the game modifies the maintenance mod when it asks for it, since I'm a novice programmer and I'm not really sure where to look. If somebody more experienced could point me in the right direction, that would be great.

Until further notice however, it will not be updating. For those still playing b41, it will still be up.

Description:

Removes 'dead' maintenance levels, by making weapons more durable at odd maintenance levels.
Also lets weapon skill contribute more to durability at levels 2, 6, and 10

How Maintenance Works:

So, as a quick recap in case you aren't aware of how maintenance works, each weapon has a chance of breaking when used. for example, a crafted spear has a 1/2 chance of breaking when used. Maintenance, alongside half the weapon skill, are directly added to the denominator of this chance. So a maintenance skill of 2, and a spear skill of 4, will both add 2 to the denominator of 1/2, making it 1/6. Now you are less likely to break your spear.

The problem:

The problem here is that when the game calculates the number to add to the weapon's break chance, it divides it in half. Then, when it needs it actively, it multiples it by 2 again. The problem, is that java effectively rounds any decimals in these calculations down, meaning that odd maintenance levels contribute the same amount as the last even maintenance level, and only weapon skills 4 and 8 actually contribute to the weapon's break chance.

Here are some examples:
Crafted Spear Break Chance: 1/2. Maintenance level(ML) 1, Spear Level (SL) 3.
ML 1 / 2 = 0.5. Rounds down to 0. 0 x 2 = 0.
SL 3 / 2 = 1.5 Rounds down to 1. 1 / 2 = 0.5. Rounds down to 0. 0 x 2 = 0.
Spear break chance = 1 / (2 + 0 + 0) = 1/2. The same as a base spear with no levels.

Crafted Spear Break Chance: 1/2. Maintenance level(ML) 3, Spear Level (SL) 6.
ML 3 / 2 = 1.5. Rounds down to 1. 1 x 2 = 2.
SL 6 / 2 = 3. 3 / 2 = 1.5. Rounds down to 1. 1 x 2 = 2.
Spear break chance = 1 / (2 + 2 + 2) = 1/6. The same as if you wielded the spear with 2 less spear levels and 1 less maintenance level.

What my mod does:

What my mod does is effectively nullifies this quirk in the coding by adding 1 to all weapon's base break chance at odd maintenance levels, and weapon levels 2, 6, and 10. It then removes them at even maintenance levels and weapon levels 4 and 8. There should be no way to tell the weapon's are modified unless you use the Show Weapon's stats mod or something similar. The mod modifies weapons when equipped, and it should work on any melee weapon, modded or otherwise.

Compatability:
Should be compatible with all weapons, including modded ones, as long as they are properly coded as melee weapons and use one of the vanilla weapon categories.

Also compatible with Maintenance Improves Repair, since that is a common question. They alter different things about the game code so there isn't any issues there.

Known Issues:
None, report any you find!

This is my first mod! let me know if there are any strange quirks or anything, thanks!

Workshop ID: 2996013868
Mod ID: MaintenanceFix
39 kommenttia
Redeye 25.12.2024 klo 10.49 
thanks man for checking. I appreciate the work you put into this, no worries. So far it's good, just needs some additional patches.
Virplexer  [tekijä] 24.12.2024 klo 12.56 
@Redeye after investigating, I'm pretty sure the bug this mod was patching is fixed. At least, I know it doesn't divide the maintenance mod by 2 anymore, not quite sure if it alters it when its called though. The division by 2 was causing the problem though, and without it, I'm pretty sure this mod is no longer necessary. Have a good time with B42!
Redeye 22.12.2024 klo 21.29 
they made some changes I think, seems more important now for repairs
Virplexer  [tekijä] 22.12.2024 klo 21.21 
@Redeye I'll try to see if I can get an update out, if not tomorrow then probably past christmas. It should be unchanged for B42 but I'll need to gander at the source code to see if they updated the maintenance skill at all because there's a chance this mod will now be redundant.
Redeye 22.12.2024 klo 18.37 
B42 update please?
ImRenzo 12.10.2024 klo 13.27 
well, i'll try playing with both mods, and if any issues show up, i'll share them here. thanks for the help!
Virplexer  [tekijä] 12.10.2024 klo 12.52 
@ImRenzo should have no compatibility issues, my mod alters weapons when you equip them, so it should work on any melee weapon modded or otherwise.
ImRenzo 12.10.2024 klo 11.40 
does this mod work with Simple Overhaul: Melee Weapons (SOMW)?
92SM 3.7.2024 klo 20.22 
Nice mod :steamthumbsup:
Gamemo 24.5.2024 klo 18.03 
effectively