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

Hiding #28593

Closed
wants to merge 127 commits into from

Conversation

Projects
None yet
8 participants
@Fris0uman
Copy link
Contributor

commented Mar 9, 2019

Summary

SUMMARY: Features "Adds action to hide in appropritate furniture/terrain"

Purpose of change

Flesh out the hiding mechanic introduced with HIDE_PLACE flag

Describe the solution

Hiding is an action bound to j by default.
Stand next to elligible tile, press j and choose the direction : if the place is elligible for hiding in it, the game checks your size, and if you're small enough you move to the tile and are hidden in it.

Furniture Max Size Allowed NO_SIGHT CONNECT
Pillow Fort Medium YES NO
Brick Kiln Tiny NO NO
Metal Kiln Empty Tiny NO NO
Rock Kiln Tiny NO NO
Rock Forge Tiny NO NO
Forge Tiny NO NO
Open Crate Medium YES NO
Dumpster Medium YES YES
Dryer Small YES NO
Washing Machine Small YES NO
Locker Small YES NO
Dresser Medium YES NO
Fridge Small YES NO
Mail Box Tiny YES NO
Recycle Bin Tiny YES NO
Trash Can Tiny YES NO
Cupboard Small YES NO
Wardrobe Medium YES NO

I also edited how get_size() works for player, so now size mutation actually changes your size. Instead of always being a medium size creature, players can actually be anything between tiny small and huge.

  • SIZE EFECTS :
    • This won't affect traps since only tiny creature are immune to some traps
    • This will affect visibility when crouched : this is probably intended behaviour as the code for crouch check for size of the player and not for the mutations.
    • This might affect probability to get shot, and the proba to hit NPC of non medium size
    • Same for melee combat small player should be harder to hit
    • This will affect collision with vehicle : a huge player/NPC will have more stoping power than a medium one.

Dumpster are no longer passable, they were briefly passable when I made HIDE_PLACE flag to allow things to actually hide in it, but now it's not necessary anymore so I reverted it back to what it was before.

Walking on a tile with HIDE_PLACE flag doesn't do anything.
Hiding in a tile might be possible even if the tile is impassable, meaning that you can use it to pass through a locker for example. But you can't use it to pass through impassable tile, as you'll be sent back to your entry point when leaving the hiding place.
You can't hide from one impassable hiding place into another impassable hiding place unless it's of the same furniture type and has the CONNECT flag.

Describe alternatives you've considered

Additional context

What's left to do :

  • Make sure move cost is correctly applied
  • Apllying NO_SIGHT correctly
  • Validate the list of HIDE_PLACE furniture
  • Info about hiding properties are displayed in extended description
  • NPCs can hide in passable tiles
  • Monsters have 1/10 chance to hide in any adjacent hide_place tile on their way

The list of furniture/terrain that can hide a creature needs to be validated so feel free to express yourself on what should be added or removed from the list and why.
Also we need to agree on what are the size constraints and if there should be a NO_SIGHT penalty or not for each one.

The fact that hiding is now an action, and don't just work by walking on a tile, means that it's more complicated to do for AIs. My aim here is to make it possible for an AI to "randomly" get inside a furniture to hide.
Doing the right thing and implementing correct AI decision making on when and where to hide is beyond my abbilities. But the current implementation should allow for someone else to do it : hide is a Creature classe function so it can be applied to player, monster and NPCs.

I'm oppen to suggestion for the default key, currently j .

Show resolved Hide resolved src/descriptions.cpp Outdated
Show resolved Hide resolved src/handle_action.cpp Outdated
Show resolved Hide resolved src/npcmove.cpp Outdated
Show resolved Hide resolved src/npcmove.cpp Outdated

Night-Pryanik and others added some commits Apr 25, 2019

Update doc/JSON_FLAGS.md
Co-Authored-By: Fris0uman <41293484+Fris0uman@users.noreply.github.com>
Update src/creature.cpp
Co-Authored-By: Fris0uman <41293484+Fris0uman@users.noreply.github.com>
Update src/creature.cpp
Co-Authored-By: Fris0uman <41293484+Fris0uman@users.noreply.github.com>
Update src/creature.cpp
Co-Authored-By: Fris0uman <41293484+Fris0uman@users.noreply.github.com>
Update src/creature.cpp
Co-Authored-By: Fris0uman <41293484+Fris0uman@users.noreply.github.com>
Update src/creature.cpp
Co-Authored-By: Fris0uman <41293484+Fris0uman@users.noreply.github.com>
Update src/creature.cpp
Co-Authored-By: Fris0uman <41293484+Fris0uman@users.noreply.github.com>
Update src/creature.cpp
Co-Authored-By: Fris0uman <41293484+Fris0uman@users.noreply.github.com>
Update src/descriptions.cpp
Co-Authored-By: Fris0uman <41293484+Fris0uman@users.noreply.github.com>
Update src/descriptions.cpp
Co-Authored-By: Fris0uman <41293484+Fris0uman@users.noreply.github.com>
Update src/descriptions.cpp
Co-Authored-By: Fris0uman <41293484+Fris0uman@users.noreply.github.com>
Update src/descriptions.cpp
Co-Authored-By: Fris0uman <41293484+Fris0uman@users.noreply.github.com>
Update src/descriptions.cpp
Co-Authored-By: Fris0uman <41293484+Fris0uman@users.noreply.github.com>
Update src/handle_action.cpp
Co-Authored-By: Fris0uman <41293484+Fris0uman@users.noreply.github.com>
Update src/npcmove.cpp
Co-Authored-By: Fris0uman <41293484+Fris0uman@users.noreply.github.com>
Update src/npcmove.cpp
Co-Authored-By: Fris0uman <41293484+Fris0uman@users.noreply.github.com>
@Fris0uman

This comment has been minimized.

Copy link
Contributor Author

commented Apr 25, 2019

So after messing around a bit with iexamine, I'm not sure it's a good idea to add hiding as an examine action because it might become very anoying to go through the menu each time you try to get something from a wardrob or a locker.

@ZhilkinSerg ZhilkinSerg self-assigned this May 4, 2019

@kevingranade
Copy link
Member

left a comment

Sorry I haven't gotten around to re-reviewing this in so long, I've barely been able to keep up with bugfixes recently.

My last feedback was that overriding impassable for this purpose is NOT OK. There is way too much code that treats impassable as holy writ, I don't want to maintain a feature going forward that violates this assumption. It's way too likely to break strange things all over the place.

@Fris0uman Fris0uman closed this May 11, 2019

@Fris0uman

This comment has been minimized.

Copy link
Contributor Author

commented May 11, 2019

The crouching system already does most of the hiding stuff, so I'm just going to re-submit the part about player size and let the hiding in furniture idea rest for now.

@ZhilkinSerg ZhilkinSerg removed their assignment May 11, 2019

@Fris0uman Fris0uman deleted the Fris0uman:Hiding branch Jun 29, 2019

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.