Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upNew flag : NO_SIGHT #27719
Conversation
Fris0uman
added some commits
Jan 19, 2019
This comment has been minimized.
This comment has been minimized.
|
What types of terrain should produce this effect? |
This comment has been minimized.
This comment has been minimized.
|
I plan on adding it, at least, to Pillow Fort and Dumpster after the merge of #27620 |
Fris0uman
changed the title
[WIP] [CR] NO_SIGHT flag
[WIP] [CR] New flag : NO_SIGHT
Jan 19, 2019
jbytheway
reviewed
Jan 23, 2019
| !digging() ) ) { | ||
| if( !can_see() || has_effect( effect_no_sight ) || ( underwater && !has_flag( MF_SWIMS ) && | ||
| !has_flag( MF_AQUATIC ) && | ||
| !digging() ) ) { |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Fris0uman
Jan 23, 2019
Author
Contributor
I used the astyle extension on Visual studio and the settings from code_style.md
But I can re arrange things if needed
This comment has been minimized.
This comment has been minimized.
Fris0uman
Jan 26, 2019
Author
Contributor
What would be sensibles line break ? Keeping !has_flag( MF_AQUATIC ) and !digging() on the same line ?
This comment has been minimized.
This comment has been minimized.
jbytheway
Jan 26, 2019
Contributor
I'd suggest either
if( !can_see() || has_effect( effect_no_sight ) ||
( underwater && !has_flag( MF_SWIMS ) && !has_flag( MF_AQUATIC ) && !digging() ) ) {
or
bool swimming = has_flag( MF_SWIMS ) || has_flag( MF_AQUATIC );
if( !can_see() || has_effect( effect_no_sight ) ||
( underwater && !swimming && !digging() ) ) {
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| add_effect( effect_no_sight, 1_turns, num_bp, true ); | ||
| } else if( has_effect( effect_no_sight ) ) { | ||
| remove_effect( effect_no_sight ); | ||
| } |
This comment has been minimized.
This comment has been minimized.
jbytheway
Jan 23, 2019
Contributor
I haven't tested, but this doesn't seem right. It looks like you're adding a 1-turn effect on moving to a location with NO_SIGHT, but won't that wear off after 1 turn if the NPC remains there? An effect doesn't seem like the right approach for this feature. Also, it would be unfortunate to need npc-specific code to make it work (as opposed to code for all creatures or at least all player objects (which currently includes npc).
This comment has been minimized.
This comment has been minimized.
Fris0uman
Jan 23, 2019
•
Author
Contributor
No It uses the same system as "bouldering" effect : it adds a permanent effect and removes it when the creature moves out of the tile. I think it's pretty ugly but it's the only way I found.
As far as I understood the code applying effect from terrain to creature is spread across monstermove.cpp, npcmove.cpp and game.cpp
Basically NO_SIGHT works like UNSTABLE.
But maybe UNSTABLE flag could be re worked as well.
This comment has been minimized.
This comment has been minimized.
|
This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there: https://discourse.cataclysmdda.org/t/creature-sight-range/18579/1 |
Fris0uman
changed the title
[WIP] [CR] New flag : NO_SIGHT
New flag : NO_SIGHT
Jan 28, 2019
This comment has been minimized.
This comment has been minimized.
|
After more testing it appears that it works for player, monster and NPCs. I was getting false negative before because monster spawning directly on the tile don't get the effect, they need to walk on the tile to get it. |
Fris0uman commentedJan 19, 2019
•
edited
Summary
SUMMARY: Content "Adds new flag : NO_SIGHT"Purpose of change
Tiles with NO_SIGHT flag reduce sight of creatures on it to 1
Describe the solution
Tile with NO_SIGHT flag applies effect_no_sight to creature, effect_no_sight reduces sight to 1.
Describe alternatives you've considered
Additional context
As far as I can tell it works.
for player but doesn't for other creatures. But I noticed that effect_in_pit doesn't seem to affect monster sight either.I'd like input on that if possible.
Also if we don't care about making symmetrical with creatures I guess it could only affect players