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

Prone move mode #46750

Merged
merged 33 commits into from
Aug 8, 2021
Merged

Prone move mode #46750

merged 33 commits into from
Aug 8, 2021

Conversation

J-Cieplinski
Copy link
Contributor

@J-Cieplinski J-Cieplinski commented Jan 14, 2021

Summary

Features "Added prone move mode"

Purpose of change

Prompted by #45817

Describe the solution

Added lying down to the game and sleeping makes you automatically lie down at the beginning.
Decreased movement and sound made when prone.
Decreased creature visibility when prone
Added "CRUTCHES" flag for weapons
Added Crutches item (need to be balanced for the game)
Added "CRUTCHES" flag to walking cane weapon
If both of player's legs are broken and he has no crutches equipped movement causes character to go prone

Testing

In-game testing

Additional context

Unless it is possible to modify(decrease) the eyesight/eye-level of character when lying down then I think it ready for merge.

src/activity_actor.cpp Outdated Show resolved Hide resolved
@anothersimulacrum
Copy link
Member

How about prone, instead of lying down?

@BrettDong BrettDong added [C++] Changes (can be) made in C++. Previously named `Code` Mechanics: Character / Player Character / Player mechanics labels Jan 15, 2021
@Xaleth
Copy link
Contributor

Xaleth commented Jan 15, 2021

It would be cleaner if the variables were renamed to "prone" instead of lying down, IMO.

And also would there be a greater penalty moving onto furniture while prone?

@Qrox
Copy link
Contributor

Qrox commented Jan 15, 2021

Also, acid should hurt your whole body when you're prone.

@J-Cieplinski
Copy link
Contributor Author

Also, acid should hurt your whole body when you're prone.

it is already done by

bool Character::is_on_ground() const
{
    return get_working_leg_count() < 2 || has_effect( effect_downed ) || is_lying_down();
}

@J-Cieplinski
Copy link
Contributor Author

And also would there be a greater penalty moving onto furniture while prone?

From what I'm seeing it isn't currently supported even for crouching. Each furniture has a specified in json move cost that comes from it and that's it. I think adding it would be out of scope for this PR

@J-Cieplinski J-Cieplinski changed the title [CR] Lying down move mode [CR] Prone move mode Jan 15, 2021
@J-Cieplinski
Copy link
Contributor Author

J-Cieplinski commented Jan 15, 2021

How about prone, instead of lying down?

Done

@ghost
Copy link

ghost commented Jan 15, 2021

Both legs broken, w/out splints, should also result in prone move mode by default.

@J-Cieplinski
Copy link
Contributor Author

Both legs broken, w/out splints, should also result in prone move mode by default.

Done

@actual-nh
Copy link
Contributor

actual-nh commented Jan 16, 2021

You might want to do a search in the code for "downed". For instance, this indicates a need to take a look at player::pause (in player.cpp), which checks for the downed effect if the player is on fire. Another is player::throw_item (in ranged.cpp), although soldiers are trained to throw grenades while prone IIRC, so only checking for the (involuntary) downed effect may be fine. A third is Character::on_hit (in character.cpp) - if you're already prone, having on roller blades/whatever should't really matter for the effects of hitting you.

@J-Cieplinski
Copy link
Contributor Author

J-Cieplinski commented Jan 16, 2021

You might want to do a search in the code for "downed". For instance, this indicates a need to take a look at player::pause (in player.cpp), which checks for the downed effect if the player is on fire. Another is player::throw_item (in ranged.cpp), although soldiers are trained to throw grenades while prone IIRC, so only checking for the (involuntary) downed effect may be fine. A third is Character::on_hit (in character.cpp) - if you're already prone, having on roller blades/whatever should't really matter for the effects of hitting you.

Ok I see. Although I wonder why Character::on_hit would use has_effect explicitly when Character::is_on_ground() exists. Same with being on fire

@J-Cieplinski
Copy link
Contributor Author

@actual-nh are you also suggesting to (in some cases) change creature current move mode to prone upon being downed? Taking a quick look I think it would be doable unless Character::try_remove_downed is not a method that removes these kinds of downed effects add_effect( effect_downed, 2_turns, false, 0, true );

@actual-nh
Copy link
Contributor

@actual-nh are you also suggesting to (in some cases) change creature current move mode to prone upon being downed? Taking a quick look I think it would be doable unless Character::try_remove_downed is not a method that removes these kinds of downed effects add_effect( effect_downed, 2_turns, false, 0, true );

I was more making a general suggestion that "downed" and "prone" should have something to do with one another, but that is indeed one way to do it - although keeping in mind "downed", as an involuntary status, does appear to imply a greater degree of immobility (e.g., dodge should be reduced but not eliminated by being prone - rolling). Character::try_remove_downed looks to (try to) remove anything considered "downed".

@actual-nh
Copy link
Contributor

You might want to do a search in the code for "downed". For instance, this indicates a need to take a look at player::pause (in player.cpp), which checks for the downed effect if the player is on fire. Another is player::throw_item (in ranged.cpp), although soldiers are trained to throw grenades while prone IIRC, so only checking for the (involuntary) downed effect may be fine. A third is Character::on_hit (in character.cpp) - if you're already prone, having on roller blades/whatever should't really matter for the effects of hitting you.

Ok I see. Although I wonder why Character::on_hit would use has_effect explicitly when Character::is_on_ground() exists. Same with being on fire

I agree Character::on_hit should probably be using Character::is_on_ground(). Being on fire may be a different case - a broken leg is not going to be a help in rolling around - but this actually may argue for only being prone (not "downed") affecting putting out a fire.

@J-Cieplinski
Copy link
Contributor Author

@actual-nh are you also suggesting to (in some cases) change creature current move mode to prone upon being downed? Taking a quick look I think it would be doable unless Character::try_remove_downed is not a method that removes these kinds of downed effects add_effect( effect_downed, 2_turns, false, 0, true );

I was more making a general suggestion that "downed" and "prone" should have something to do with one another, but that is indeed one way to do it - although keeping in mind "downed", as an involuntary status, does appear to imply a greater degree of immobility (e.g., dodge should be reduced but not eliminated by being prone - rolling). Character::try_remove_downed looks to (try to) remove anything considered "downed".

From what I'm seeing and from the given examples(ie being on fire) "downed" is used rather universally. It fulfilled the role of indicator that character was just lying down, that got swept of their feet, got knocked down etc. Wide range from "just sitting" to "incapacitated". Dunno if i want to get into that

@J-Cieplinski J-Cieplinski changed the title [CR] Prone move mode Prone move mode Jan 17, 2021
src/melee.cpp Outdated Show resolved Hide resolved
src/melee.cpp Outdated Show resolved Hide resolved
J-Cieplinski and others added 3 commits January 28, 2021 13:33
Co-authored-by: Jianxiang Wang (王健翔) <[email protected]>
Co-authored-by: Jianxiang Wang (王健翔) <[email protected]>
Co-authored-by: Jianxiang Wang (王健翔) <[email protected]>
@Kelenius
Copy link
Contributor

Added lying down to the game and sleeping makes you automatically lie down at the beginning.

Do you get up when you wake up automatically as well?

@J-Cieplinski
Copy link
Contributor Author

Added lying down to the game and sleeping makes you automatically lie down at the beginning.

Do you get up when you wake up automatically as well?

Discussed previously, added in yesterday's commit

@int-ua
Copy link
Contributor

int-ua commented Jan 29, 2021

Translating the PR Validator message into English: the SUMMARY: part should be removed from the summary line, the format was updated recently.

@WilliamtheCardboardBox
Copy link

I'm not sure if this PR is good to cover this, but proning through broken glass should more than likely mess the player up. Perhaps we could check if the player has any uncovered limbs and apply bleeding/brute damage when a move is made into broken glass? Essentially the same principle as acid damaging the player's body when prone.

data/json/items/melee/bludgeons.json Outdated Show resolved Hide resolved
data/json/items/melee/bludgeons.json Show resolved Hide resolved
data/json/items/melee/bludgeons.json Show resolved Hide resolved
src/avatar_action.cpp Outdated Show resolved Hide resolved
!you.is_prone() ) {
you.set_movement_mode( move_mode_id( "prone" ) );
you.add_msg_if_player( m_bad,
_( "Your broken legs can't hold your weight and you fall down in pain." ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's pain mentioned in message, maybe then actually add some pain on this event?

add_msg_if_player( m_bad, _( "Your broken legs cannot hold you and you fall down." ) );
set_movement_mode( move_mode_id( "prone" ) );
} else if( is_on_ground() ) {
add_msg_if_player( m_warning, _( "You cannot fight while on the ground." ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe in the future we should allow fighting (defending only?) while lying down, if your arms ain't broken.

src/move_mode.cpp Outdated Show resolved Hide resolved
@Fosheze
Copy link
Contributor

Fosheze commented Mar 12, 2021

I'm not sure how difficult it would be to add in or if it is out of scope but weapon bipods should work while prone anywhere. It would be nice to not have to dig an embankment every time I want to use a bipod.

Co-authored-by: Anton Burmistrov <[email protected]>
@J-Cieplinski
Copy link
Contributor Author

I'm not sure how difficult it would be to add in or if it is out of scope but weapon bipods should work while prone anywhere. It would be nice to not have to dig an embankment every time I want to use a bipod.

Definitely out of scope :)

Co-authored-by: Anton Burmistrov <[email protected]>
@Night-Pryanik
Copy link
Contributor

@J-Cieplinski could you please resolve conflicts?

@J-Cieplinski
Copy link
Contributor Author

@Night-Pryanik I've resolved using git functionality as I don't have a project set up on my machine right now.

However I think that activate_crouch_mode is a bit redundant now and I can't really do deep dive in the code to find and replace it with toggle function.

src/handle_action.cpp Outdated Show resolved Hide resolved
src/avatar.cpp Outdated Show resolved Hide resolved
@ZhilkinSerg ZhilkinSerg merged commit 1330146 into CleverRaven:master Aug 8, 2021
@Ivan-Shestakov
Copy link
Contributor

Wow, playing with UndeadPeople tileset, and it missing an indication my char is prone messed with me several times last night.
They don't move to walking after sleep, and after emerging from home basement - suddenly get attacked by flash-speed zomboes - not nice.
@J-Cieplinski I see you mention very early in this pr discussion you're handling this, please recheck that it isn't lost in git-merge somewhere.

@ZhilkinSerg
Copy link
Contributor

ZhilkinSerg commented Aug 9, 2021

Wow, playing with UndeadPeople tileset, and it missing an indication my char is prone messed with me several times last night.
They don't move to walking after sleep, and after emerging from home basement - suddenly get attacked by flash-speed zomboes - not nice.
@J-Cieplinski I see you mention very early in this pr discussion you're handling this, please recheck that it isn't lost in git-merge somewhere.

Did tileset author/maintainer add overlay for new move mode?

{ "id": [ "overlay_male_prone", "overlay_female_prone" ], "fg": 1234567890 },

@Ivan-Shestakov
Copy link
Contributor

Not yet, as far as I can see... @SomeDeadGuy I hope you get to it, when possible...

satheon49 pushed a commit to satheon49/Cataclysm-DDA that referenced this pull request Aug 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Mechanics: Character / Player Character / Player mechanics
Projects
None yet
Development

Successfully merging this pull request may close these issues.