PreventCollision with strap component while buckled to it (#2694)

* AvoidCollision if collided entity is the one that the character is buckled to

* Attempt to PreventCollision after the player is unbuckled but still colliding with StrapComponent

* Moved PreventCollide to the Shared script.

* Add WakeBody to keep updating the physics collision while being on a collidable strap component.

* Addressed some of metalgearsloth's suggestions:
- Made EntityBuckledTo,IsOnStrapEntityThisFrame and DontCollide not virtual
-Made EntityBuckledTo nullable
-Don't call update on Paused BuckleComponents
-Removed EntityBuckledTo variable declaration in BuckleComponent because it's not needed anymore
-Call TryUnbuckle if (!IsOnStrapEntityThisFrame && DontCollide) to set BuckledTo entity to null.

* Formatting

Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>

* Formatting

Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>

* Formatting again :P

Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>

* Formatting

Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>

* Formatting

Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>

* Renamed variable EntityBuckledTo to LastEntityBuckledTo

* As per DrSmugLeaf suggestion: Added [ComponentDependency] to the Body variable.

Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
Morshu32
2020-12-18 20:12:53 +01:00
committed by GitHub
parent 9c381dc174
commit 19bd739b0d
4 changed files with 67 additions and 7 deletions

View File

@@ -26,6 +26,14 @@ namespace Content.Server.GameObjects.EntitySystems
SubscribeLocalEvent<EntRemovedFromContainerMessage>(ContainerModified);
}
public override void Update(float frameTime)
{
foreach (var comp in ComponentManager.EntityQuery<BuckleComponent>(false))
{
comp.Update();
}
}
public override void Shutdown()
{
base.Shutdown();