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

[RDY] Adds weapon chemical launcher and new fungicidal gas type as ammo #12765

Merged
merged 14 commits into from Jul 2, 2015

Conversation

Projects
None yet
6 participants
@skYYman
Copy link
Contributor

commented Jun 23, 2015

So here is my first ever contribution to CDDA.

I am a total newbie when it comes to git and I am not really sure where everything goes so far, so please bear with me while I learn.

The idea for this weapon originates from http://smf.cataclysmdda.com/index.php?topic=10630.msg238369#msg238369.

With guidance from Coolthulhu I managed to come up with the below stuff so far.

"qualities":[
{"id":"SAW_M_FINE","level":1,"amount":1},
{"id":"SCREW_FINE","level":1,"amount":1},
{"id":"HAMMER","level":2,"amount":1}

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jun 23, 2015

Contributor

Use 4 spaces rather than tabs.

@@ -1661,6 +1668,11 @@ bool map::process_fields_in_submap( submap *const current_submap,
make_rubble( p );
break;

case fd_fungicidal_gas:

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jun 23, 2015

Contributor

If you want to de-fungify terrain, it would be in this block

src/map.cpp Outdated
@@ -3382,6 +3382,10 @@ void map::shoot( const tripoint &p, int &dam,
add_field(p, fd_fire, rng(1, 2), 0 );
}

if (ammo_effects.count("STREAM_GAS") && !one_in(3)) {

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jun 23, 2015

Contributor

Something more descriptive would be better. Something like "FUNGICIDAL_STREAM" or "FUNGICIDAL_TRAIL".

This comment has been minimized.

Copy link
@narc0tiq

narc0tiq Jun 23, 2015

Contributor

STREAM_FUNGICIDE, or maybe STREAM_ANTIFUNGAL?

"symbol" : "=",
"color" : "yellow",
"description" : "Fungicide enhanced with sulfur to create sprayable anti-fungal ammo for the chemical thrower.",
"material" : "hydrocarbons",

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jun 23, 2015

Contributor

You should probably give it some other material. "null" should be fine.
Hydrocarbons is for stuff that fuels fires really well.

], "tools": [
[
[ "fire", -1 ],
[ "toolset", 2 ],

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jun 23, 2015

Contributor

Bump up those numbers a bit. 2 is only enough heat to boil a cup of water.

This comment has been minimized.

Copy link
@skYYman

skYYman Jun 23, 2015

Author Contributor

Ok, didn't really know what that number was supposed to be ^.^

"description": "A bulky, self-made chemical sprayer with an internal conversion mechanism that allows all sorts of chemicals to be dispersed to your surroundings.",
"price": 15000,
"material": ["steel", "plastic"],
"flags": ["FIRE_100", "NEVER_JAMS"],

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jun 23, 2015

Contributor

Fire 100 is quite a lot. With flamethrowers you can acquire the ammo easily by siphoning it from cars. Here you've got to craft every shot.

Fire 20 or 50 should be fine, unless you intend to make the gas very powerful.

This comment has been minimized.

Copy link
@skYYman

skYYman Jun 23, 2015

Author Contributor

I thought that one canister filling of 2000 units (so 20 uses) should be enough to eradicate one large patch of fungus. I can't really tell how the gas will spread by only looking at the code though, so I don't know when it would be considered overpowered. This thing shouldn't be the end-all anti-fungus tool.

[ "pilot_light", 1 ]
],
[
[ "wrench", 1]

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jun 23, 2015

Contributor

Is it supposed to consume the wrench for the construction? You probably want it as a tool quality, not something to be consumed.
If you want something to pump the fuel, foot crank seems to be the common choice. I think pneumatic rifle has it as a component.

This comment has been minimized.

Copy link
@skYYman

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jun 23, 2015

Contributor

Wrenches can be quire valuable here. Since the recipe involves welding, a pipe would be enough here.

Also, add a small or tiny metal tank to the recipe.

"subcategory": "CSC_WEAPON_RANGED",
"skill_used": "mechanics",
"skills_required": [[ "gun", 3 ], [ "cooking", 3]],
"difficulty": 7,

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jun 23, 2015

Contributor

That's quite a lot of requirements there.
I'd drop the gun requirement. Maybe change it to [[ "launchers", 1 ]] or 2.
And 5 mechanics would also be plenty - 7 is for complex, precise stuff. Since the thrower is really bulky, you could also make it more "makeshift".

Early availability is quite important for this kind of stuff, because later on it will be obsoleted by the chain lightning CBM.

This comment has been minimized.

Copy link
@skYYman

skYYman Jun 23, 2015

Author Contributor

Fair point. Never actually got to the point where I had the chain lightning.

Althought the biggest argument for making this thing harder to craft is the fact that it will at some point defungify terrain and afaik there is nothing in the game yet, that does that.

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jun 23, 2015

Contributor

Fire does it very cheaply. Digging holes into fungal bed is a work-intensive, but precise method of fixing it.

This comment has been minimized.

Copy link
@skYYman

skYYman Jun 23, 2015

Author Contributor

:D true
But fire is risky and hard to control and digging is only for masochists.

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jun 23, 2015

Contributor

Still, you can counter a fungal infestation by digging out a small area surrounding your useful stuff and then burning the rest.

@Coolthulhu

This comment has been minimized.

Copy link
Contributor

commented Jun 23, 2015

Also, check that "Details" button on the page, right to "Failed". It can be informative.

@skYYman

This comment has been minimized.

Copy link
Contributor Author

commented Jun 23, 2015

Indeed, it is.

Jenkins you old scallywag.

@skYYman

This comment has been minimized.

Copy link
Owner Author

commented on src/field.cpp in 415cbf0 Jun 23, 2015

Would this work?

Edit: Jenkins says no. I need to crawl deeper.

@skYYman

This comment has been minimized.

Copy link
Owner Author

commented on data/json/items/ranged.json in faebdbc Jun 24, 2015

damn tabstops :>

@skYYman

This comment has been minimized.

Copy link
Owner Author

commented on src/field.cpp in faebdbc Jun 24, 2015

Sadly I have to admit that I don't know enouh C++ to decipher how I'd go about getting the conditions for the if-statements. I was told that it would work with flags but there is no fungus-related flag for terrain. And I can't think of any other way to compare the terrain/furniture on the tile.

//check the terrain and replace it accordingly to simulate the fungus dieing off
auto ter = map_tile.get_ter_t();
auto frn = map_tile.get_furn_t();
if( ) {

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jun 24, 2015

Contributor
if( ter.has_flag( "FUNGAL" ) ) {
    ter_set( p, t_dirt );
}

Don't bring back fungal trees, dirt mounds etc. Fungalized stuff is pretty much only held together by the fungus, once that died it all falls apart.

This comment has been minimized.

Copy link
@skYYman

skYYman Jun 24, 2015

Author Contributor

Wow, I feel silly. That`s pretty much what I wrote in the very beginning. Where exactly is that flag defined? Feels like I searched everywhere for it.

But thank you.

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jun 24, 2015

Contributor

It isn't really defined anywhere - it doesn't do anything on its own. Check the terrain jsons.

@skYYman

This comment has been minimized.

Copy link
Owner Author

commented on src/field.cpp in 61a0b72 Jun 24, 2015

Jenkins and my compiler point to this line causing trouble with initializations but I don't understand where the difference in this case and fd_acid and fd_fire lies.

Edit: problem was the missing scope for the case.

@Marrim

This comment has been minimized.

Copy link
Contributor

commented Jun 24, 2015

Minor note: perhaps call the ammo type "chemical spray", since it can eventually be expanded to other types, not just fungicide?

@skYYman skYYman changed the title [WiP] Chemical Launcher Chemical Launcher Jun 24, 2015

@skYYman skYYman changed the title Chemical Launcher Add weapon chemical launcher and new fungicidal gas type as ammo Jun 24, 2015

@skYYman

This comment has been minimized.

Copy link
Contributor Author

commented Jun 24, 2015

Another thing:
I don't understand the 5 deletions that show up in field.cpp
I never touched these lines and in my original file they are not altered either. Is this a bug?

@Coolthulhu

This comment has been minimized.

Copy link
Contributor

commented Jun 24, 2015

May be just your IDE (codeblocks?). It sometimes cleans up badly ended lines, such as when there's a space before the newline.

const auto &ter = map_tile.get_ter_t();
if( ter.has_flag( "FUNGUS" ) ) {
ter_set( p, t_dirt );
furn_set( p, f_null );

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jun 24, 2015

Contributor

You need to have separate check for furniture. Otherwise when a fungal terrain has a non-fungal furniture, it will be destroyed too.

@skYYman

This comment has been minimized.

Copy link
Contributor Author

commented Jun 24, 2015

That explains that.

@skYYman skYYman changed the title Add weapon chemical launcher and new fungicidal gas type as ammo [WiP] Add weapon chemical launcher and new fungicidal gas type as ammo Jun 24, 2015

"type" : "ammunition_type",
"id" : "gas_fungicidal",
"name" : "fungicidal gas",
"default" : "gas_fungicidal"

This comment has been minimized.

Copy link
@skYYman

skYYman Jun 25, 2015

Author Contributor

I was having trouble with assigning a more general chemical_spray ammo-type. I wanted something like this:
{
"type" : "ammunition_type",
"id" : "chemical_spray",
"name" : "sprayable chemical",
"default" : "gas_fungicidal"
}

But it throws a debug-message, saying gas_fungicidal is not a valid ammo.

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jun 25, 2015

Contributor

Sounds like you only changed it in ammo_types, but not in ammo.json: "gas_fungicidal" had the old "ammo_type" field.

"ammo" field refers to the ammo type id. So if you're changing ammo id to "chemical_spray", the fungicidal gas needs "ammo_type": "chemical_spray".

This comment has been minimized.

Copy link
@skYYman

skYYman Jun 25, 2015

Author Contributor

Yeah I did that ;) Still did not work.

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jun 25, 2015

Contributor

Oh forgot: the same in the thrower.

This comment has been minimized.

Copy link
@skYYman

skYYman Jun 25, 2015

Author Contributor

That's it! Also, it makes much more sense, now that I think about it.

@skYYman skYYman changed the title [WiP] Add weapon chemical launcher and new fungicidal gas type as ammo Add weapon chemical launcher and new fungicidal gas type as ammo Jun 25, 2015

@skYYman skYYman closed this Jun 25, 2015

@skYYman skYYman reopened this Jun 25, 2015

@Coolthulhu Coolthulhu self-assigned this Jun 25, 2015

@skYYman

This comment has been minimized.

Copy link
Contributor Author

commented Jun 25, 2015

Seems like Notepad++ was a little eager and changed all tabstops in the tile_config.json to 4 spaces 😕

inhaled = u.add_env_effect("poison", bp_mouth, 5, 30);
} else if( cur->getFieldDensity() == 2 ) {
inhaled = u.add_env_effect("smoke", bp_mouth, 2, 7);
} else if( u.has_trait("THRESH_MYCUS") || u.has_trait("THRESH_MARLOSS" ) ) {

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jun 25, 2015

Contributor

Both of those else ifs are wrong:

  • Thick gas will not cause coughing, only poison. In many cases coughing can actually be more dangerous than poison
  • Mycus mutant will only get the mycus effect if the density == 1
  • In the mycus block: you don't need to compare density to any of 1, 2 or 3. It can never be lower than 1 or higher than 3
  • Density 1 should do something too. Maybe just a weak (5 turns?) poison effect?
  • Mycus mutants will take the damage even when in full hazmat
@Coolthulhu

This comment has been minimized.

Copy link
Contributor

commented Jun 25, 2015

Balancing:

  • The spray is incredibly inefficient outdoors. The entire charge of 100 spray disperses in just few turns, covering an area of at most 7x7. You should lower that outdoor spread gas penalty and change that FIRE_100 to something more manageable
  • Against fungal terrain, even the hazy cloud is 100% efficient in the first turn. It should probably be a random chance dependent on density. Later on it would be nice to actually depend on terrain too, but for now just something like one_in( 10 / density ) would be fine.

@Coolthulhu Coolthulhu removed their assignment Jun 25, 2015

@skYYman

This comment has been minimized.

Copy link
Owner Author

commented on src/field.cpp in c77226d Jun 26, 2015

This would probably be better handled with some kind of ENV_PROTECT flag on the related and new clothing.

@Coolthulhu

This comment has been minimized.

Copy link

commented on src/field.cpp in c77226d Jun 28, 2015

Why such a huge difference in dispersal speed between indoors and outdoors? It disperses 70 times faster outdoor, meaning that it is going to hang in the air for ages in a house, but will barely last few turns in the open.
It is more of a "puff" than a stream.

Since it is supposed to be used outdoors, it should probably be closer to 20-30 difference, if not even less.

// The gas won't harm you inside a vehicle.
bool inhaled = false;
// Full body suits protect you from the effects of the gas.
if( !u.worn_with_flag("GAS_PROOF") ) {

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jun 28, 2015

Contributor

Invert this if:

if( gas proof ) {
    break;
}
case fd_fungicidal_gas:
// Fungicidal gas is unhealthyand becomes deadly if you cross a related threshold.
{
if (inside) break;

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jun 28, 2015

Contributor

Standards: every if needs it braces.

bool inhaled = false;
// Full body suits protect you from the effects of the gas.
if( !u.worn_with_flag("GAS_PROOF") ) {
if( cur->getFieldDensity() == 3 ) {

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jun 28, 2015

Contributor

Invert those ifs and make them more like a formula. Field code is currently quite bad with the whole if( density == 3) { something; } else if( density == 2 ) type coding, no need to make it worse.

It could work like this: first handle the effects that happen to everyone (inhaled poison), like this:

const int density = cur->getFieldDensity();
inhaled = u.add_env_effect( "poison", bp_mouth, 5, density * 10 );

Then just the fungus stuff:

if( u. fungus check here ) {
    inhaled |= u.add_env_effect( "badpoison", bp_mouth, 5, density * 10 );
    u.hurtall( rng( density, density * 2 ), nullptr );
    u.add_msg_if_player( m_bad, _("hurts")...
}

Note that |=. If you use just the =, partially resisting the gas would give no message. Regular poison inhalation could set it to true, then bad poison could set it back to false if resisted.

No need to have separate messages for burns. If you can get them "for free" it's fine, but here it would look cleaner without a big if/else block.

@@ -2974,7 +2974,7 @@
"environmental_protection" : 20,
"encumbrance" : 37,
"bashing" : -5,
"flags" : ["VARSIZE", "WATERPROOF", "RAINPROOF", "RAD_PROOF","ELECTRIC_IMMUNE", "OUTER"],
"flags" : ["VARSIZE", "WATERPROOF", "RAINPROOF", "RAD_PROOF", "ELECTRIC_IMMUNE", "GAS_PROOF", "OUTER"],

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jun 28, 2015

Contributor

GAS_PROOF would be better as an environmental protection formula (so that you could partially resist it), but it's OK as a tag for now.
When (if?) you add more chemical types later it may be worth considering adding a gas resistance check as a separate function, but probably not as a part of this PR.

This comment has been minimized.

Copy link
@skYYman

skYYman Jun 29, 2015

Author Contributor

I do plan on adding a variety of ammo for the thrower. Will keep that in mind.

@kevingranade

This comment has been minimized.

Copy link
Member

commented Jun 28, 2015

Working great in a quick test I gave it (annihilating a fungal tower), but I agree with Coolthulu's points.

@skYYman skYYman changed the title Add weapon chemical launcher and new fungicidal gas type as ammo [RDY] Adds weapon chemical launcher and new fungicidal gas type as ammo Jun 29, 2015

@Coolthulhu Coolthulhu self-assigned this Jul 2, 2015

u.hurtall( rng( density, density * 2 ), nullptr );
u.add_msg_if_player( m_bad, _("The %s makes you feel sick."), cur->name().c_str() );
}
}

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jul 2, 2015

Contributor

You don't do anything with the inhaled variable.

case fd_fungicidal_gas:
{
dirty_transparency_cache = true;
spread_gas( cur, p, curtype, 120, 10 );

This comment has been minimized.

Copy link
@Coolthulhu

Coolthulhu Jul 2, 2015

Contributor

120 in the third parameter of spread_gas shouldn't do anything above 100. It's a percentage chance.

@Coolthulhu Coolthulhu merged commit 7324aef into CleverRaven:master Jul 2, 2015

1 check passed

default This has been rescheduled for testing as the 'master' branch has been updated.
@Coolthulhu

This comment has been minimized.

Copy link
Contributor

commented Jul 2, 2015

Fixed missing messages on my side.

For the future:

  • The current spreading looks quite weird: the gas immediately spreads to "hazy cloud", then it sits there for a while and disappears. You don't see thick gas much.
  • You could nerf it a bit, at least against boss monsters. One "puff" is enough to kill a boss fungus.
  • At the same time it is still too expensive for large-scale cleaning against fungal terrain.
  • Hitting anything with a 0 damage projectile produces a message "projectile reflects off x's armor". You could change it so that "JET" flag suppresses it.
  • It doesn't affect impassable terrain, like fungal trees (the big ones, young ones die just fine) or fungal walls
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.