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
Conversation
"qualities":[ | ||
{"id":"SAW_M_FINE","level":1,"amount":1}, | ||
{"id":"SCREW_FINE","level":1,"amount":1}, | ||
{"id":"HAMMER","level":2,"amount":1} |
There was a problem hiding this comment.
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.
Also, check that "Details" button on the page, right to "Failed". It can be informative. |
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( ) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Minor note: perhaps call the ammo type "chemical spray", since it can eventually be expanded to other types, not just fungicide? |
Another thing: |
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 ); |
There was a problem hiding this comment.
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.
That explains that. |
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. |
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. |
There was a problem hiding this comment.
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 ); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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"
.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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" ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both of those else if
s 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
Balancing:
|
// 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") ) { |
There was a problem hiding this comment.
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;
}
Working great in a quick test I gave it (annihilating a fungal tower), but I agree with Coolthulu's points. |
u.hurtall( rng( density, density * 2 ), nullptr ); | ||
u.add_msg_if_player( m_bad, _("The %s makes you feel sick."), cur->name().c_str() ); | ||
} | ||
} |
There was a problem hiding this comment.
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.
Fixed missing messages on my side. For the future:
|
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.