Move "players don't collide with mobs" to shared to fix mispredicts on it.
This commit is contained in:
@@ -119,7 +119,6 @@ namespace Content.Client
|
||||
"Airlock",
|
||||
"MedicalScanner",
|
||||
"WirePlacer",
|
||||
"Species",
|
||||
"Drink",
|
||||
"Food",
|
||||
"FoodContainer",
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Mobs
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(SharedSpeciesComponent))]
|
||||
public class SpeciesComponent : SharedSpeciesComponent
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -10,16 +10,15 @@ using Content.Shared.GameObjects.Components.Movement;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Interfaces.Player;
|
||||
using Robust.Shared.ContentPack;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Network;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(SharedSpeciesComponent))]
|
||||
public class SpeciesComponent : SharedSpeciesComponent, IActionBlocker, IOnDamageBehavior, IExAct, IRelayMoveInput
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -14,25 +14,10 @@ namespace Content.Server.GameObjects.Components.Movement
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(IMoverComponent))]
|
||||
public class PlayerInputMoverComponent : SharedPlayerInputMoverComponent, IMoverComponent, ICollideSpecial
|
||||
public class PlayerInputMoverComponent : SharedPlayerInputMoverComponent
|
||||
{
|
||||
public override GridCoordinates LastPosition { get; set; }
|
||||
|
||||
public override float StepSoundDistance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Special collision override, can be used to give custom behaviors deciding when to collide
|
||||
/// </summary>
|
||||
/// <param name="collidedwith"></param>
|
||||
/// <returns></returns>
|
||||
bool ICollideSpecial.PreventCollide(IPhysBody collidedwith)
|
||||
{
|
||||
// Don't collide with other mobs
|
||||
if (collidedwith.Owner.TryGetComponent<SpeciesComponent>(out var collidedSpeciesComponent))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Components;
|
||||
using Robust.Shared.Interfaces.Configuration;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -15,7 +17,7 @@ using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Shared.GameObjects.Components.Movement
|
||||
{
|
||||
public abstract class SharedPlayerInputMoverComponent : Component, IMoverComponent
|
||||
public abstract class SharedPlayerInputMoverComponent : Component, IMoverComponent, ICollideSpecial
|
||||
{
|
||||
// This class has to be able to handle server TPS being lower than client FPS.
|
||||
// While still having perfectly responsive movement client side.
|
||||
@@ -261,6 +263,12 @@ namespace Content.Shared.GameObjects.Components.Movement
|
||||
return vec;
|
||||
}
|
||||
|
||||
bool ICollideSpecial.PreventCollide(IPhysBody collidedWith)
|
||||
{
|
||||
// Don't collide with other mobs
|
||||
return collidedWith.Owner.HasComponent<SharedSpeciesComponent>();
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
private sealed class MoverComponentState : ComponentState
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user