@@ -11,13 +11,14 @@ namespace Content.Client.GameObjects.Components.Movement
|
||||
{
|
||||
base.HandleComponentState(curState, nextState);
|
||||
|
||||
if (curState is not ClimbModeComponentState climbModeState)
|
||||
if (curState is not ClimbModeComponentState climbModeState || Body == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IsClimbing = climbModeState.Climbing;
|
||||
OwnerIsTransitioning = climbModeState.IsTransitioning;
|
||||
}
|
||||
|
||||
public override bool IsClimbing { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Movement;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Movement
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(IMoverComponent))]
|
||||
public class PlayerInputMoverComponent : SharedPlayerInputMoverComponent
|
||||
{
|
||||
public override EntityCoordinates LastPosition { get; set; }
|
||||
public override float StepSoundDistance { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using Content.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Projectiles
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class ThrownItemComponent : ProjectileComponent
|
||||
{
|
||||
public override string Name => "ThrownItem";
|
||||
public override uint? NetID => ContentNetIDs.THROWN_ITEM;
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Suspicion
|
||||
{
|
||||
@@ -63,7 +62,7 @@ namespace Content.Client.GameObjects.Components.Suspicion
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ally.TryGetComponent(out IPhysBody physics))
|
||||
if (!ally.TryGetComponent(out IPhysicsComponent physics))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -83,7 +82,7 @@ namespace Content.Client.GameObjects.Components.Suspicion
|
||||
continue;
|
||||
}
|
||||
|
||||
var worldBox = physics.GetWorldAABB();
|
||||
var worldBox = physics.WorldAABB;
|
||||
|
||||
// if not on screen, or too small, continue
|
||||
if (!worldBox.Intersects(in viewport) || worldBox.IsEmpty())
|
||||
@@ -91,7 +90,7 @@ namespace Content.Client.GameObjects.Components.Suspicion
|
||||
continue;
|
||||
}
|
||||
|
||||
var screenCoordinates = _eyeManager.WorldToScreen(physics.GetWorldAABB().TopLeft + (0, 0.5f));
|
||||
var screenCoordinates = _eyeManager.WorldToScreen(physics.WorldAABB.TopLeft + (0, 0.5f));
|
||||
DrawString(screen, _font, screenCoordinates, _traitorText, Color.OrangeRed);
|
||||
}
|
||||
}
|
||||
|
||||
43
Content.Client/GameObjects/EntitySystems/MoverSystem.cs
Normal file
43
Content.Client/GameObjects/EntitySystems/MoverSystem.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.Movement;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.Physics;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Client.GameObjects.EntitySystems
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class MoverSystem : SharedMoverSystem
|
||||
{
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
UpdatesBefore.Add(typeof(PhysicsSystem));
|
||||
}
|
||||
|
||||
public override void FrameUpdate(float frameTime)
|
||||
{
|
||||
var playerEnt = _playerManager.LocalPlayer?.ControlledEntity;
|
||||
|
||||
if (playerEnt == null || !playerEnt.TryGetComponent(out IMoverComponent? mover) || !playerEnt.TryGetComponent(out IPhysicsComponent? physics))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
physics.Predict = true;
|
||||
|
||||
UpdateKinematics(playerEnt.Transform, mover, physics);
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
FrameUpdate(frameTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -85,22 +85,13 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
foreach (var snapGridComponent in grid.GetSnapGridCell(position, SnapGridOffset.Center))
|
||||
{
|
||||
var entity = snapGridComponent.Owner;
|
||||
if (!entity.TryGetComponent(out SubFloorHideComponent subFloorComponent))
|
||||
if (!entity.TryGetComponent(out SubFloorHideComponent subFloorComponent) ||
|
||||
!entity.TryGetComponent(out ISpriteComponent spriteComponent))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var enabled = EnableAll || !subFloorComponent.Running || tileDef.IsSubFloor;
|
||||
|
||||
if (entity.TryGetComponent(out ISpriteComponent spriteComponent))
|
||||
{
|
||||
spriteComponent.Visible = enabled;
|
||||
}
|
||||
|
||||
if (entity.TryGetComponent(out PhysicsComponent physicsComponent))
|
||||
{
|
||||
physicsComponent.CanCollide = enabled;
|
||||
}
|
||||
spriteComponent.Visible = EnableAll || !subFloorComponent.Running || tileDef.IsSubFloor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user