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

New flag : NO_SIGHT #27719

Merged
merged 14 commits into from Mar 4, 2019

Conversation

Projects
None yet
5 participants
@Fris0uman
Copy link
Contributor

commented Jan 19, 2019

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

@Night-Pryanik

This comment has been minimized.

Copy link
Member

commented Jan 19, 2019

What types of terrain should produce this effect?

@Fris0uman

This comment has been minimized.

Copy link
Contributor Author

commented Jan 19, 2019

I plan on adding it, at least, to Pillow Fort and Dumpster after the merge of #27620
And maybe also to Dresser. The idea is that in combination with HIDE_PLACE some furniture/terrain can be made into hiding places, you get in and you're hidden and can't see out without peeking out of it.
So any kind of terrain you can "get in"

@Fris0uman Fris0uman changed the title [WIP] [CR] NO_SIGHT flag [WIP] [CR] New flag : NO_SIGHT Jan 19, 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.

Copy link
@jbytheway

jbytheway Jan 23, 2019

Contributor

The line breaks here are not sensibly placed.

This comment has been minimized.

Copy link
@Fris0uman

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.

Copy link
@Fris0uman

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.

Copy link
@jbytheway

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.

Copy link
@Fris0uman

Fris0uman Jan 28, 2019

Author Contributor

Done. I used the first suggestion.

This comment has been minimized.

Copy link
@Fris0uman

Fris0uman Jan 28, 2019

Author Contributor

But maybe I should have edited can_see() directly ?

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.

Copy link
@jbytheway

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.

Copy link
@Fris0uman

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.

@kevingranade

This comment has been minimized.

Copy link
Member

commented Jan 28, 2019

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 Fris0uman changed the title [WIP] [CR] New flag : NO_SIGHT New flag : NO_SIGHT Jan 28, 2019

@Fris0uman

This comment has been minimized.

Copy link
Contributor Author

commented Jan 28, 2019

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.

@kevingranade kevingranade changed the base branch from master to development Mar 4, 2019

@kevingranade kevingranade merged commit 1597d82 into CleverRaven:development Mar 4, 2019

2 of 3 checks passed

gorgon-ghprb Build triggered for merge commit.
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@Fris0uman Fris0uman deleted the Fris0uman:NO_SIGHT_FLAG branch Mar 4, 2019

kevingranade added a commit that referenced this pull request Mar 8, 2019

Merge remote-tracking branch 'origin/development'
* origin/development: (60 commits)
  Edit PR template (#28532)
  Update regional_overlay.json
  Update regional_overlay.json
  update mainlined mods to new weighting
  Update regional_map_settings.json
  Updated monster resilence and speed options descriptions
  Let ursine mutants gain PRED mutations without becoming carnivorous
  eggs, eggs, eggs
  added NPC_MISSION_GUARD_ALLY to available_helpers()
  Notify player of number of charges consumed
  Allow consuming part of large item stacks with internal furnace
  astyle (#28494)
  Fixed t_palisade_gate_o name
  Disposable gunmods (#27763)
  Ranged attacks mutations (using fake guns customized via JSON) (#27725)
  New flag : NO_SIGHT (#27719)
  Style fix.
  Disallow washing in the dark and with frozen water (fixed) (#28473)
  Fix typos and reword.
  Fix long overmap location name being overwritten by "Distance to target:" string (#28452)
  ...
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.