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

skYYman
Copy link
Contributor

@skYYman skYYman 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}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 4 spaces rather than tabs.

@Coolthulhu
Copy link
Contributor

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

@skYYman
Copy link
Contributor Author

skYYman commented Jun 23, 2015

Indeed, it is.

Jenkins you old scallywag.

//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( ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Marrim
Copy link
Contributor

Marrim 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
Copy link
Contributor Author

skYYman 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
Copy link
Contributor

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 );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@skYYman
Copy link
Contributor Author

skYYman 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
@skYYman
Copy link
Contributor Author

skYYman commented Jun 25, 2015

The gas works but I can't figure out how to create it at the pointer, rather than just make it explode out of the character. I don't know how to reference the impact.

@Coolthulhu
Copy link
Contributor

Told you in the forum thread: in damage.cpp.

Most of the file is one big function that does exactly that for many different types of ammo.

@@ -2071,6 +2093,23 @@ void map::player_in_field( player &u )
}
break;

case fd_fungicidal_gas:
// Fungicidal gas makes you cough.
// Thick fungicidal gas has a chance to poison you.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if you've crossed a fungal threshold like mycus or marloss? Shouldn't it be doing extra damage/poison to you?


if( effects.count( "GAS_FUNGICIDAL" ) > 0 ) {
for( auto &&pt : g->m.points_in_radius( p, 1, 0 ) ) {
g->m.add_field( pt, fd_fungicidal_gas, 4, 0 );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you're adding a field with density 4. This will be ignored: density is capped at 3 at the moment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know. I thought this might let the gas linger longer so it simulates the effect of 'sinking in'. Should I revert it to 3?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

map::add_field clips the density to 3, so having 4 here won't do anything.

Not sure what you mean by 'sinking in' here. That would probably be achieved better by changing the numbers in field processing, though. spread_gas has arguments like spread chance, outdoor dispersal speedup etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought there was some kind of counter that reduces field density after a certain amount of time. Figured, if I set it higher the gas remains there longer, thereby simulating the gas 'hanging in the air' after it has been sprayed.
I'll look into spread_gas, that sounds exactly like what I need to modify.

"type" : "ammunition_type",
"id" : "gas_fungicidal",
"name" : "fungicidal gas",
"default" : "gas_fungicidal"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I did that ;) Still did not work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh forgot: the same in the thrower.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor Author

skYYman 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" ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

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
// 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") ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invert this if:

if( gas proof ) {
    break;
}

@kevingranade
Copy link
Member

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() );
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't do anything with the inhaled variable.

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

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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants