space-station-14
space-station-14 copied to clipboard
Projectiles and hitscans only hit mobs that are laying down if you're directly aiming at them.
About the PR
resolves #22564
resolves #18763 (I didn't see the suggestions in this issue, so if the solution mentioned in the issue is the better one I can try converting it to that)
resolves #21497
resolves #10143
Projectiles and hitscans now don't collide with entities if they are laying down(crit/stun/slip) unless directly aimed at. Projectiles and hitscans now collide with a dead body if it's directly aimed at. Dead entities no longer have their collision disabled.
Thrown objects will now always miss people laying down.
As can be seen in the video when I start spraying at the end, the bullets won't hit because the screen shake offsets the screen position and makes you miss the target if you compensate for the shaking and try to keep the cursor on target. If you just don't move your cursor you will keep hitting the target since the cursor will technically still be on the mob, it just looks like it isn't because of the screen shake.
~~Requires stuff from #23908 to make hitscans work(I can also just port over the parts I need)~~
- [x] Make hitscans collide with laying down entities when directly aimed at.
Why / Balance
If a mob is laying on the floor bullets should go over them unless explicitly aimed at, people don't shoot guns from feet height. It will make explosive ammunitions way less risky to use, since it won't explode if colliding with the crit person laying in front of you that you didn't see. Allows people to drag someone to safety while also shooting back at the assailant without magdumping the person they are dragging.
Technical details
Entities that are laying down(crit/slip/stun) get their StandingLayer subtracted and their LayingDownLayer added to their CollisionLayer(Stored on StandingStateComponent). Projectiles don't collide with the resulting layer. Now that dead entities don't have collision disabled, sprays can also collide with them.
If the user has their cursor on an entity that has the StandingStateComponent, the target is stored on the GunComponent(did this so I don't have to pass it through a lot of methods, can be changed to that though). If a target is stored, the shot projectiles CollisionMask will get the targets LayingDownLayer added, this makes the projectile hit what they normally would hit, but also allows them to collide with laying down entities. At the same time the projectile is given the TargetedProjectileComponent, this component stores the target that the user clicked on for the projectile to use later when colliding.
If a projectile with the TargetedProjectileComponent collides with an entity that is standing, it will hit the entity and deal it's damage as long as the entity is not dead. If a projectile with the TargetedProjectileComponent collides with an entity that is laying down, it will check if the entity is it's target. If it's the target it will collide and deal it's damage, if it's not the target the collision is cancelled.
An entity that collided with a hitscan's collisionray will be ignored if it's dead or if it's laying down.
Media
https://github.com/space-wizards/space-station-14/assets/137322659/022bd108-d6d3-4068-b5d4-8e48ca42ac9f
- [X] I have added screenshots/videos to this PR showcasing its changes ingame, or this PR does not require an ingame showcase
Changelog
:cl: Dygon
- tweak: Projectiles and lasers now don't hit mobs that are laying down(crit/stun/slip), unless directly aimed at.
- tweak: Dead mobs can now be hit by projectiles and lasers if the body is directly aimed at.
- tweak: Thrown objects will now always miss mobs that are laying down.
- fix: Fire extinguishers are now able to extinguish dead mobs.
Added a video and made hitscans able to aim at bodies on the floor.
I changed it so the LayingDownMobLayer gets applied when an entity falls down instead of when their MobState changes to crit/dead. This makes it so projectiles will also fly over mobs that have slipped or got stunned(they're also on the floor after all).
~~Mobs laying on beds also don't get hit unless aimed at so people can technically lay on a rollerbed that's being dragged while shooting the enemy, and only get hit in return if they're directly aimed at. This probably needs to be changed.~~
Currently people in chairs still get hit by projectiles even when dead(since they're technically still standing upright). I probably need to put a damage cap on this, or make them also only get hit when aimed at, because I can already see people putting a body on a chair and using it as an unbreakable bullet shield.
Now that it's based on if people are laying down, making a laying down action to dodge bullets will also be possible. Probably should be something like a toggle with a cooldown for standing up again. Should also prevents having anything in your hands while on the floor.(Might make a PR for it after this gets merged).
Finally, thanks for a fantastic PR.
Now that it's based on if people are laying down, making a laying down action to dodge bullets will also be possible. Probably should be something like a toggle with a cooldown for standing up again. Should also prevents having anything in your hands while on the floor.(Might make a PR for it after this gets merged).
Prone position and movement :trollface:
Prone position and movement :trollface:
oh shit yeah, wheelchair bound players rejoice!
Get off wheelchair, hide behind other prone bodies and spam your guns :trollface:
if power gamers want to stroll around in a wheel chair so they can hide behind a dead body be my fucking guest
Why can't you just add a mask / layer for the clicked on target to the raycast / projectile? Will be much cleaner than adding hundreds of lines of shaky fixture handling.
Projectiles now get the LayingDownLayer stored on the targeted entity's StandingStateComponent added to their mask.
Downed entities now get their StandingLayer, which is stored on their StandingStateComponent, subtracted from their CollisionLayer, and get their LayingDownLayer added to their CollisionLayer.
Because it looks a bit weird when projectiles pass through entities that look like they are standing(chair), or on a higher elevation(bed), dead entities buckled to chairs/beds still get hit if not aimed at while they are on top of it. Side effect of this is that it allows bodies on chairs/beds to be used as indestructible bullet shields, I still need to decide on the best way to handle buckled dead entities.
Some ideas I had: 1: Keep it as it is currently in the PR(metagamers will probably take a body on a rollerbed with them when going into combat). 2: Dead bodies buckled to chairs/beds can't get hit unless directly aimed at, like any other crit/dead person. 3: Bodies in chairs/beds get hit even if not directly aimed at, and projectiles deal damage to the body + they penetrate. 4: Bodies in chairs/beds get hit even if not directly aimed at, and bodies get gibbed at x amount of piercing damage. 5: Bodies in chairs/beds get hit by projectiles even if not directly aimed at, until a certain amount of damage has been reached, after which bullets won't collide unless the body is directly aimed at.
Currently only entities with the StandingStateComponent can be aimed at, should I make it so players can aim at any entity? This might be annoying if the floor is littered with trash and you accidentally shoot a banana peel on the floor instead of your target(doesn't happen if aiming behind your target though).
This pull request has conflicts, please resolve those before we can evaluate the pull request.
This pull request has conflicts, please resolve those before we can evaluate the pull request.
Buckled entities now get hit if not aimed at, after they die they can only be hit when aimed at. ~~Entities that are laying down now can't attack with any weapons.~~
Ready for a new review
try requesting a review, really want to see this merged
This pull request has conflicts, please resolve those before we can evaluate the pull request.
This pull request has conflicts, please resolve those before we can evaluate the pull request.
[https://github.com/DeltaV-Station/Delta-v/pull/479](DV Lamia PR)
I have this PR as a prerequisite for one of my own downstream PRs, and as such I am willing to take up this PR and finish it should it become derelict. Other than that, I'd be happy to offer any help needed by the author if required. My own Lamia species PR has two issues that can essentially only be fixed with upstream changes, this PR being one such change.
[https://github.com/DeltaV-Station/Delta-v/pull/479](DV Lamia PR)
I have this PR as a prerequisite for one of my own downstream PRs, and as such I am willing to take up this PR and finish it should it become derelict. Other than that, I'd be happy to offer any help needed by the author if required. My own Lamia species PR has two issues that can essentially only be fixed with upstream changes, this PR being one such change.
its derelict at this point, please do it