@@ -181,6 +181,15 @@ namespace Content.Shared.CCVar
|
|||||||
public static readonly CVarDef<float> StopSpeed =
|
public static readonly CVarDef<float> StopSpeed =
|
||||||
CVarDef.Create("physics.stop_speed", 0.1f);
|
CVarDef.Create("physics.stop_speed", 0.1f);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether mobs can push objects like lockers.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Technically client doesn't need to know about it but this may prevent a bug in the distant future so it stays.
|
||||||
|
/// </remarks>
|
||||||
|
public static readonly CVarDef<bool> MobPushing =
|
||||||
|
CVarDef.Create("physics.mob_pushing", true, CVar.REPLICATED);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ambience
|
* Ambience
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,23 +1,34 @@
|
|||||||
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.Movement.Components;
|
using Content.Shared.Movement.Components;
|
||||||
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Physics.Collision;
|
|
||||||
using Robust.Shared.Physics.Dynamics;
|
using Robust.Shared.Physics.Dynamics;
|
||||||
|
|
||||||
namespace Content.Shared.Movement.EntitySystems
|
namespace Content.Shared.Movement.EntitySystems
|
||||||
{
|
{
|
||||||
public sealed class SharedMobMoverSystem : EntitySystem
|
public sealed class SharedMobMoverSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
private bool _pushingEnabled;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
Get<SharedPhysicsSystem>().KinematicControllerCollision += HandleCollisionMessage;
|
Get<SharedPhysicsSystem>().KinematicControllerCollision += HandleCollisionMessage;
|
||||||
|
IoCManager.Resolve<IConfigurationManager>().OnValueChanged(CCVars.MobPushing, SetPushing, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetPushing(bool value)
|
||||||
|
{
|
||||||
|
_pushingEnabled = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Shutdown()
|
public override void Shutdown()
|
||||||
{
|
{
|
||||||
base.Shutdown();
|
base.Shutdown();
|
||||||
|
IoCManager.Resolve<IConfigurationManager>().UnsubValueChanged(CCVars.MobPushing, SetPushing);
|
||||||
Get<SharedPhysicsSystem>().KinematicControllerCollision -= HandleCollisionMessage;
|
Get<SharedPhysicsSystem>().KinematicControllerCollision -= HandleCollisionMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,6 +37,8 @@ namespace Content.Shared.Movement.EntitySystems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void HandleCollisionMessage(Fixture ourFixture, Fixture otherFixture, float frameTime, Vector2 worldNormal)
|
private void HandleCollisionMessage(Fixture ourFixture, Fixture otherFixture, float frameTime, Vector2 worldNormal)
|
||||||
{
|
{
|
||||||
|
if (!_pushingEnabled) return;
|
||||||
|
|
||||||
var otherBody = otherFixture.Body;
|
var otherBody = otherFixture.Body;
|
||||||
|
|
||||||
if (otherBody.BodyType != BodyType.Dynamic || !otherFixture.Hard) return;
|
if (otherBody.BodyType != BodyType.Dynamic || !otherFixture.Hard) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user