Skip to content
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

Firearms expansion. #6169

Merged
merged 15 commits into from Feb 19, 2014

Conversation

Projects
None yet
4 participants
@Rivet-the-Zombie
Copy link
Member

commented Feb 18, 2014

Isn't it odd how firearms never really malfunction or show any wear and tear? Or how all bullets are equal when it comes to quality and manufacturing? Or how the self-taught player character can turn out perfect quality reloads and sound suppressors using scrounged bits of trash?

This aims to fix all of that.

new system of firearm malfunctions, misfires, and failures which can require maintenance
firearms can take damage and be repaired using a calibrated tool kit
4 new gun mods
2 new tools
many new recipes
many new ammunition types
many bug fixes

fixes #6162

Rivet-the-Zombie added some commits Feb 17, 2014

First pass.
Misfire means the round didn't work as planned. Since these failures are
determined solely by the weapon's durability stat, they should be
classified as weapon malfunctions, not as failings of the ammunition.
Also, some guns are basically immune to malfunction in the fashion that
we're simulating here (like revolvers, single-shot weapons, laser guns,
bionics, &etc) so I've added a flag that can be used to make some guns
immune to the standard malfunction chance.
Adding NEVER_MISFIRES flag for fancy ammunition like military-grade s…
…tuff and lasers.

Now all ammunition that doesn't have the NEVER_MISFIRES tag has a one_in
(1728) chance of being a dud that doesn't fire. Now we're beginning to
separate ammunition quality from firearm quality.
Reloaded rounds and recipe bugfixes!
First pass on this part, hold on for the really good stuff that's yet to
come!
Made the suppressor that players produce via crafting into a crafted_…
…suppressor with reduced stats. Slightly buffed OEM supressor.
if (is_underwater() && !weapon.has_flag("WATERPROOF_GUN") && one_in(firing->durability)) {
g->add_msg_player_or_npc(this, _("Your weapon misfires with a wet click!"),
_("<npcname>'s weapon misfires with a wet click!") );
if (is_underwater() && !weapon.has_flag("WATERPROOF_GUN") && one_in(firing->durability)) { // here we check if we're underwater and whether we should misfire as a result

This comment has been minimized.

Copy link
@kevingranade

kevingranade Feb 18, 2014

Member

Two little requests. One is please put the comments on their own lines, generally above the code. These can scroll off the right side of my editor and make them hard to read. Generally the break is at column 100.
Second consider sticking these in their own function. It's a sizeable chunk of related game logic centered on the gun and ammo objects and giving it it;s on function makes it easier to find among other things.

This comment has been minimized.

Copy link
@Rivet-the-Zombie

Rivet-the-Zombie Feb 18, 2014

Author Member

I'm not sure how to go about making a special function for this. I'm perfectly willing to do so, but I'll need assistance.

This comment has been minimized.

Copy link
@kevingranade

kevingranade Feb 18, 2014

Member

I'll show you the syntax the next time we're both on irc.

@kevingranade

This comment has been minimized.

Copy link
Member

commented Feb 18, 2014

Awesome as usual! one thing, I haven't looked at the firing code in a while. What does damaging the gun actually do?

@Rivet-the-Zombie

This comment has been minimized.

Copy link
Member Author

commented Feb 18, 2014

It reduces the gun's stats across the board, weakening it in all categories.

Rivet-the-Zombie added some commits Feb 18, 2014

@wito

This comment has been minimized.

Copy link
Contributor

commented Feb 18, 2014

Players should, as skill becomes sufficient, be able to produce full-quality ammo.

@Rivet-the-Zombie

This comment has been minimized.

Copy link
Member Author

commented Feb 18, 2014

Yep that's in the plans. I just wanted to PR this one before the code became outdated by subsequent PRs. I'll toss together a second PR of high-tier recipes that allow you to produce proper duplicates of OEM bullets soon.

@wito

This comment has been minimized.

Copy link
Contributor

commented Feb 18, 2014

Some kind of recipe replacement should probably be added together with that, to reduce clutter.

Some kind of tag or property, maybe? "obsoleted_by"?

@Lain-

This comment has been minimized.

Copy link
Contributor

commented Feb 18, 2014

This is pretty sweet! Looking forward to this.

@kevingranade kevingranade merged commit 0fb704d into CleverRaven:master Feb 19, 2014

1 check failed

default Unmergeable pull request.

@Rivet-the-Zombie Rivet-the-Zombie deleted the Rivet-the-Zombie:no-misfires-flag branch Feb 19, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.