-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
281 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Content.Server.DoAfter; | ||
using Content.Shared.DoAfter; | ||
using Content.Shared.Standing; | ||
|
||
namespace Content.Server.Standing; | ||
public sealed class StandingStateController : SharedStandingStateController | ||
{ | ||
[Dependency] private readonly DoAfterSystem _doAfter = default!; | ||
|
||
public override void HandleToggleStandingInput(EntityUid uid) | ||
{ | ||
if (!TryComp<StandingStateComponent>(uid, out var standing) || !standing.CanCrawl || !standing.CanStandUp) | ||
return; | ||
|
||
if (standing.Standing) | ||
{ | ||
var doAfterArgs = new DoAfterArgs(EntityManager, uid, standing.DownDelay, new DownDoAfterEvent(), uid) | ||
{ | ||
BlockDuplicate = true, | ||
BreakOnDamage = true, | ||
}; | ||
_doAfter.TryStartDoAfter(doAfterArgs); | ||
} | ||
else | ||
{ | ||
var doAfterArgs = new DoAfterArgs(EntityManager, uid, standing.StandDelay, new StandDoAfterEvent(), uid) | ||
{ | ||
BlockDuplicate = true, | ||
BreakOnDamage = true, | ||
}; | ||
_doAfter.TryStartDoAfter(doAfterArgs); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using Content.Shared.Input; | ||
using Robust.Shared.Input; | ||
using Robust.Shared.Input.Binding; | ||
using Robust.Shared.Physics.Controllers; | ||
using Robust.Shared.Player; | ||
|
||
namespace Content.Shared.Standing | ||
{ | ||
public abstract class SharedStandingStateController : VirtualController | ||
{ | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
CommandBinds.Builder | ||
.Bind(ContentKeyFunctions.ToggleStanding, new StandingInputCmdHandler(this)) | ||
.Register<SharedStandingStateController>(); | ||
} | ||
|
||
public abstract void HandleToggleStandingInput(EntityUid uid); | ||
|
||
private sealed class StandingInputCmdHandler : InputCmdHandler | ||
{ | ||
private readonly SharedStandingStateController _controller; | ||
|
||
public StandingInputCmdHandler(SharedStandingStateController controller) | ||
{ | ||
_controller = controller; | ||
} | ||
|
||
public override bool HandleCmdMessage(IEntityManager entManager, ICommonSession? session, IFullInputCmdMessage message) | ||
{ | ||
if (session?.AttachedEntity == null) return true; | ||
|
||
if (message.State == BoundKeyState.Down) | ||
_controller.HandleToggleStandingInput(session.AttachedEntity.Value); | ||
|
||
return true; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.