-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Limit the kinds of terrain that are vulnerable to mattack::growplants #35778
Conversation
bcb5360
to
8d90892
Compare
src/monattack.cpp
Outdated
"DIGGABLE", "ROAD", "RAIL", "TREE", "WALL" | ||
} ) { | ||
if( g->m.has_flag_ter( flag, p ) ) { | ||
goto okay; |
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 can put this loop into a separate function and return from within the loop so you avoid using goto.
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.
Why?
Avoid auto, never use goto. From a game logic point of view, I suspect the only flag we actually care about here is DIGGABLE, which makes things even simpler. I like the logic of simply needing to retreat to man made structures to avoid most of the danger. |
Probably it's just because my C++ is rusty, but I'm not sure what that is or how I would solve the problem with it.
Oh, I see. I thought it was intended that triffid queens could tear up buildings. |
Long term, not in this pr, it would be nice to make flammable flagged terrain become overgrown with vines rather than replaced fully with trees |
8d90892
to
eebc5da
Compare
This PR now takes a completely different approach, per Kevin's comment. Check it out. |
src/monattack.cpp
Outdated
// types we create (it's important that we can destroy our own | ||
// trees, so we can't trap ourself). | ||
if( !( g->m.has_flag_ter( "DIGGABLE", p ) || | ||
g->m.ter( p ) == t_tree_young || g->m.ter( p ) == t_tree ) ) { |
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 recommend checking for the "TREE" flag instead of "t_tree". There are all kinds of trees in the game, and they all have different ids.
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 know, but I didn't think we would want to allow triffid queens to destroy fruit trees, etc.; the only reason to allow tree destruction at all is to keep them from getting trapped.
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.
Outworld triffids won't differentiate between Earth plant genera.
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.
Okay, done. We still need an explicit check for t_tree_young
because it's not a TREE
.
eebc5da
to
2e4ffd5
Compare
Regarding the "Mutations / Traits / Professions" tag, this function should only be available to triffid queens, not player plant-type mutants (yet?). |
Summary
SUMMARY: Balance "Limit the kinds of terrain that are vulnerable to mattack::growplants"
Purpose of change
The TODO comment I replaced said "Make this sensible - it can destroy EVERYTHING". Triffid queens could destroy liquids, stairs, computers, etc.
Fixes #24995.
Describe the solution
Only DIGGABLE terrain or trees can be affected by triffid queens.
Testing
I watched a triffid queen tear up the area outside a shelter without affecting the inside.