-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CR] Implement blackpowder fouling mechanics #30985
[CR] Implement blackpowder fouling mechanics #30985
Conversation
Could this be generalized into weapon faults like engines have? |
What for? I can't think of a reason for this. |
There are a lot of ways a gun can get damaged in use, especially if you're abusing it. It's technically possible to fire .380 ACP from a 9x19mm pistol but it will probably damage the extractor. Even with normal use parts are going to wear out sooner or later and you're always going to have to do basic cleaning and maintenance. If we have a system to model this kind of thing for black powder effects it would be most useful generalized so it can be extended later. |
Just looked at it, and seems like it could indeed be implemented in a less invasive way with those. Will tinker with it tomorrow. |
Glad to see someone starting on this. And yeah, this kind of thing is actually why |
Done, the same thing is now done via the fault system. As a bonus, it also opens up the way for any items to have faults, so flashlight lightbulbs could burn out as they are used, bladed weapons could be dulled if used a lot (and that'll need a whetstone or something to fix, not a soldering iron), etc. (if someone codes that) |
Why not base an autoloading gun's ability to cycle on how closely a cartridge's recoil matches a new "cycling_energy" JSON string? |
Well, it can be done, but is it really necessary now to complicate things like that? I can't think of any other severely underpowered cartridge loads that player would have a reason to craft or which could be found. If necessary, "not being able to cycle in most guns" feature could be split off of BLACKPOWDER flag into a separate one. |
@Rail-Runner https://discourse.cataclysmdda.org/t/ammunition-type-overlap-and-uses-for-such-a-thing/9475 |
Got it done, now whether the gun cycles or not is based on "min_cycle_recoil" JSON parameter. For now, I've set it to 90% of default ammo recoil for guns that aren't supposed to cycle with blackpowder, and for 65% of it for guns that can cycle while firing blackpowder loads. I didn't implement maximum recoil (the point at which the gun can be damaged by overpressure loads), as this isn't really related to blackpowder cartridges at all. |
Hey so I do believe the fouling mechanic currently is somewhat broken. As of #35290 I found out that energy weapons do indeed foul according to that description and cannot be cleaned. I have had freshly spawned in new firearms foul. I cannot remove the regular fouling. I can remove the "blackpowder" fouling via (m)end along other faults. But the regular dirt is not removeable in any way to my knowledge.. Intended behavior or a bug? I cannot tell |
@EldritchSigma Filing issues (like you already did) is the correct method. |
Summary
SUMMARY: Features "Implement blackpowder fouling mechanics"
Purpose of change
The main reason is to allow firing blackpowder loads from guns not meant for that (though they will become jammed pretty quickly). Another is to be able to specify which guns can and can't (reasonably) handle blackpowder without just completely removing blackpowder from ammo recipe.
Describe the solution
First, I had to generalize fault mechanics to work for all items, not just engines.
Added two new flags (both were also added to gun classes and all 9x19mm guns):
Blackpowder fouling: slightly reduces gun reliability (by 1) while present on a gun, and adds a chance (1 in 2000) for gun to rust (increasing damage level by 1, capped at max damage before breaking) every turn (via item processing function). Always added to the gun upon firing ammo with BLACKPOWDER effect.
Clogged: prevents gun from firing until it is cleaned. May be added to the gun upon firing ammo with BLACKPOWDER effect, chance of that happening is 1 in (BT), where BT is a new JSON value named "blackpowder_tolerance", which equals 8 by default.
Added a new flag:
"BLACKPOWDER_CYCLE": any gun with this flag will properly cycle (allow firing multiple shots per attack) while firing blackpowder loads. Otherwise, gun will only fire a single shot and stop, effectively making it semi-auto-only.
Added a new ammo effect:
"BLACKPOWDER": notes that the ammo was loaded with blackpowder, causing all the above effects. This applies to ALL guns, not only those not designed to fire blackpowder (muzzleloaders need cleaning too, and will rust otherwise). But such resistant guns could have higher blackpowder tolerance.
Add a new "pipe cleaner" item (+ recipe) to remove both of faults upon use (one at a time). Currently it doesn't use power (because old blackpowder firearms apparently didn't need any to clean them)
Add new JSON value to some 9x19mm guns, and add blackpowder variants of 9x19mm cartridges, and crafting recipes for them (if this PR gets in, this could easily be expanded to other calibers).
Blackpowder loads currently have 30% price, 65% damage and recoil, 50% pierce, and 120% dispersion of equivalent smokeless powder ammo; they also get RECYCLED, BLACKPOWDER and MUZZLE_SMOKE flags, and NEVER_MISFIRES is removed if it was present.
Describe alternatives you've considered
Way too many to list all of them here. Neither of them made much sense or worked well enough, though.
Additional context
Current numbers are very arbitrary, and will likely need some adjusting.