Make portals use ICollideBehavior and set collidable.Hard to false (#2186)
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using Content.Shared.GameObjects.Components.Movement;
|
using Content.Shared.GameObjects.Components.Movement;
|
||||||
|
using Content.Shared.GameObjects.Components.Portal;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Interfaces.GameObjects.Components;
|
using Robust.Client.Interfaces.GameObjects.Components;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Content.Shared.GameObjects.Components.Movement;
|
using Content.Shared.GameObjects.Components.Movement;
|
||||||
|
using Content.Shared.GameObjects.Components.Portal;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Interfaces.GameObjects.Components;
|
using Robust.Client.Interfaces.GameObjects.Components;
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using Content.Shared.GameObjects.Components.Portal;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
|
||||||
|
namespace Content.Client.GameObjects.Components.Portal
|
||||||
|
{
|
||||||
|
[RegisterComponent]
|
||||||
|
public class PortalComponent : SharedPortalComponent
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,7 +21,6 @@
|
|||||||
"HeatResistance",
|
"HeatResistance",
|
||||||
"Teleportable",
|
"Teleportable",
|
||||||
"ItemTeleporter",
|
"ItemTeleporter",
|
||||||
"Portal",
|
|
||||||
"EntityStorage",
|
"EntityStorage",
|
||||||
"Wirecutter",
|
"Wirecutter",
|
||||||
"Screwdriver",
|
"Screwdriver",
|
||||||
|
|||||||
@@ -1,26 +1,22 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Shared.GameObjects.Components.Movement;
|
using Content.Shared.GameObjects.Components.Portal;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.GameObjects.EntitySystems;
|
using Robust.Server.GameObjects.EntitySystems;
|
||||||
using Robust.Server.Interfaces.GameObjects;
|
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects.Components;
|
using Robust.Shared.GameObjects.Components;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using Robust.Shared.Timers;
|
using Robust.Shared.Timers;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Movement
|
namespace Content.Server.GameObjects.Components.Portal
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class ServerPortalComponent : SharedPortalComponent
|
public class PortalComponent : SharedPortalComponent, ICollideBehavior
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IServerEntityManager _serverEntityManager = default!;
|
|
||||||
|
|
||||||
// Potential improvements: Different sounds,
|
// Potential improvements: Different sounds,
|
||||||
// Add Gateways
|
// Add Gateways
|
||||||
// More efficient form of GetEntitiesIntersecting,
|
// More efficient form of GetEntitiesIntersecting,
|
||||||
@@ -42,10 +38,13 @@ namespace Content.Server.GameObjects.Components.Movement
|
|||||||
base.ExposeData(serializer);
|
base.ExposeData(serializer);
|
||||||
// How long will the portal stay up: 0 is infinite
|
// How long will the portal stay up: 0 is infinite
|
||||||
serializer.DataField(ref _aliveTime, "alive_time", 10.0f);
|
serializer.DataField(ref _aliveTime, "alive_time", 10.0f);
|
||||||
|
|
||||||
// How long before a specific person can go back into it
|
// How long before a specific person can go back into it
|
||||||
serializer.DataField(ref _individualPortalCooldown, "individual_cooldown", 2.1f);
|
serializer.DataField(ref _individualPortalCooldown, "individual_cooldown", 2.1f);
|
||||||
|
|
||||||
// How long before anyone can go in it
|
// How long before anyone can go in it
|
||||||
serializer.DataField(ref _overallPortalCooldown, "overall_cooldown", 2.0f);
|
serializer.DataField(ref _overallPortalCooldown, "overall_cooldown", 2.0f);
|
||||||
|
|
||||||
serializer.DataField(ref _departureSound, "departure_sound", "/Audio/Effects/teleport_departure.ogg");
|
serializer.DataField(ref _departureSound, "departure_sound", "/Audio/Effects/teleport_departure.ogg");
|
||||||
serializer.DataField(ref _arrivalSound, "arrival_sound", "/Audio/Effects/teleport_arrival.ogg");
|
serializer.DataField(ref _arrivalSound, "arrival_sound", "/Audio/Effects/teleport_arrival.ogg");
|
||||||
}
|
}
|
||||||
@@ -54,12 +53,9 @@ namespace Content.Server.GameObjects.Components.Movement
|
|||||||
{
|
{
|
||||||
// This will blow up an entity it's attached to
|
// This will blow up an entity it's attached to
|
||||||
base.OnAdd();
|
base.OnAdd();
|
||||||
if (Owner.TryGetComponent<ICollidableComponent>(out var collide))
|
|
||||||
{
|
|
||||||
//collide.IsHardCollidable = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
_state = PortalState.Pending;
|
_state = PortalState.Pending;
|
||||||
|
|
||||||
if (_aliveTime > 0)
|
if (_aliveTime > 0)
|
||||||
{
|
{
|
||||||
Timer.Spawn(TimeSpan.FromSeconds(_aliveTime), () => Owner.Delete());
|
Timer.Spawn(TimeSpan.FromSeconds(_aliveTime), () => Owner.Delete());
|
||||||
@@ -68,16 +64,12 @@ namespace Content.Server.GameObjects.Components.Movement
|
|||||||
|
|
||||||
public bool CanBeConnected()
|
public bool CanBeConnected()
|
||||||
{
|
{
|
||||||
if (_connectingTeleporter == null)
|
return _connectingTeleporter == null;
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TryConnectPortal(IEntity otherPortal)
|
public void TryConnectPortal(IEntity otherPortal)
|
||||||
{
|
{
|
||||||
if (otherPortal.TryGetComponent<ServerPortalComponent>(out var connectedPortal) && connectedPortal.CanBeConnected())
|
if (otherPortal.TryGetComponent<PortalComponent>(out var connectedPortal) && connectedPortal.CanBeConnected())
|
||||||
{
|
{
|
||||||
_connectingTeleporter = otherPortal;
|
_connectingTeleporter = otherPortal;
|
||||||
connectedPortal._connectingTeleporter = Owner;
|
connectedPortal._connectingTeleporter = Owner;
|
||||||
@@ -87,7 +79,7 @@ namespace Content.Server.GameObjects.Components.Movement
|
|||||||
|
|
||||||
public void TryChangeState(PortalState targetState)
|
public void TryChangeState(PortalState targetState)
|
||||||
{
|
{
|
||||||
if (Owner == null || Deleted)
|
if (Deleted)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -102,8 +94,10 @@ namespace Content.Server.GameObjects.Components.Movement
|
|||||||
|
|
||||||
private void ReleaseCooldown(IEntity entity)
|
private void ReleaseCooldown(IEntity entity)
|
||||||
{
|
{
|
||||||
if (Owner == null || Deleted)
|
if (Deleted)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ImmuneEntities.Contains(entity))
|
if (ImmuneEntities.Contains(entity))
|
||||||
{
|
{
|
||||||
@@ -111,77 +105,52 @@ namespace Content.Server.GameObjects.Components.Movement
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_connectingTeleporter != null &&
|
if (_connectingTeleporter != null &&
|
||||||
_connectingTeleporter.TryGetComponent<ServerPortalComponent>(out var otherPortal))
|
_connectingTeleporter.TryGetComponent<PortalComponent>(out var otherPortal))
|
||||||
{
|
{
|
||||||
otherPortal.ImmuneEntities.Remove(entity);
|
otherPortal.ImmuneEntities.Remove(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<IEntity> GetPortableEntities()
|
|
||||||
{
|
|
||||||
foreach (var entity in _serverEntityManager.GetEntitiesIntersecting(Owner))
|
|
||||||
{
|
|
||||||
if (IsEntityPortable(entity))
|
|
||||||
{
|
|
||||||
yield return entity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool IsEntityPortable(IEntity entity)
|
private bool IsEntityPortable(IEntity entity)
|
||||||
{
|
{
|
||||||
// TODO: Check if it's slotted etc. Otherwise the slot item itself gets ported.
|
// TODO: Check if it's slotted etc. Otherwise the slot item itself gets ported.
|
||||||
if (!ImmuneEntities.Contains(entity) && entity.HasComponent<TeleportableComponent>())
|
return !ImmuneEntities.Contains(entity) &&
|
||||||
{
|
entity.HasComponent<TeleportableComponent>();
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Fix portal updates for performance
|
|
||||||
public void OnUpdate()
|
|
||||||
{
|
|
||||||
if (_onCooldown == false)
|
|
||||||
{
|
|
||||||
foreach (var entity in GetPortableEntities())
|
|
||||||
{
|
|
||||||
TryPortalEntity(entity);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartCooldown()
|
public void StartCooldown()
|
||||||
{
|
{
|
||||||
if (_overallPortalCooldown > 0 && _onCooldown == false)
|
if (_overallPortalCooldown <= 0 || _onCooldown)
|
||||||
{
|
|
||||||
_onCooldown = true;
|
|
||||||
TryChangeState(PortalState.RecentlyTeleported);
|
|
||||||
if (_connectingTeleporter != null)
|
|
||||||
{
|
|
||||||
_connectingTeleporter.TryGetComponent<ServerPortalComponent>(out var otherPortal);
|
|
||||||
if (otherPortal != null)
|
|
||||||
{
|
|
||||||
otherPortal.TryChangeState(PortalState.RecentlyTeleported);
|
|
||||||
Timer.Spawn(TimeSpan.FromSeconds(_overallPortalCooldown), () =>
|
|
||||||
{
|
|
||||||
_onCooldown = false;
|
|
||||||
TryChangeState(PortalState.Pending);
|
|
||||||
otherPortal.TryChangeState(PortalState.Pending);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
// Just in case?
|
// Just in case?
|
||||||
_onCooldown = false;
|
_onCooldown = false;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_onCooldown = true;
|
||||||
|
TryChangeState(PortalState.RecentlyTeleported);
|
||||||
|
|
||||||
|
if (_connectingTeleporter == null ||
|
||||||
|
!_connectingTeleporter.TryGetComponent<PortalComponent>(out var otherPortal))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
otherPortal.TryChangeState(PortalState.RecentlyTeleported);
|
||||||
|
|
||||||
|
Timer.Spawn(TimeSpan.FromSeconds(_overallPortalCooldown), () =>
|
||||||
|
{
|
||||||
|
_onCooldown = false;
|
||||||
|
TryChangeState(PortalState.Pending);
|
||||||
|
otherPortal.TryChangeState(PortalState.Pending);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TryPortalEntity(IEntity entity)
|
public void TryPortalEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
if (ImmuneEntities.Contains(entity) || _connectingTeleporter == null)
|
if (ImmuneEntities.Contains(entity) ||
|
||||||
|
_connectingTeleporter == null ||
|
||||||
|
!IsEntityPortable(entity))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -195,11 +164,20 @@ namespace Content.Server.GameObjects.Components.Movement
|
|||||||
entity.Transform.Coordinates = position;
|
entity.Transform.Coordinates = position;
|
||||||
soundPlayer.PlayAtCoords(_arrivalSound, entity.Transform.Coordinates);
|
soundPlayer.PlayAtCoords(_arrivalSound, entity.Transform.Coordinates);
|
||||||
TryChangeState(PortalState.RecentlyTeleported);
|
TryChangeState(PortalState.RecentlyTeleported);
|
||||||
|
|
||||||
// To stop spam teleporting. Could potentially look at adding a timer to flush this from the portal
|
// To stop spam teleporting. Could potentially look at adding a timer to flush this from the portal
|
||||||
ImmuneEntities.Add(entity);
|
ImmuneEntities.Add(entity);
|
||||||
_connectingTeleporter.GetComponent<ServerPortalComponent>().ImmuneEntities.Add(entity);
|
_connectingTeleporter.GetComponent<PortalComponent>().ImmuneEntities.Add(entity);
|
||||||
Timer.Spawn(TimeSpan.FromSeconds(_individualPortalCooldown), () => ReleaseCooldown(entity));
|
Timer.Spawn(TimeSpan.FromSeconds(_individualPortalCooldown), () => ReleaseCooldown(entity));
|
||||||
StartCooldown();
|
StartCooldown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CollideWith(IEntity collidedWith)
|
||||||
|
{
|
||||||
|
if (_onCooldown == false)
|
||||||
|
{
|
||||||
|
TryPortalEntity(collidedWith);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Movement
|
namespace Content.Server.GameObjects.Components.Portal
|
||||||
{
|
{
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class TeleportableComponent : Component
|
public class TeleportableComponent : Component
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Shared.GameObjects.Components.Movement;
|
using Content.Shared.GameObjects.Components.Portal;
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
using Content.Shared.Utility;
|
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Server.GameObjects.EntitySystems;
|
using Robust.Server.GameObjects.EntitySystems;
|
||||||
using Robust.Server.Interfaces.GameObjects;
|
using Robust.Server.Interfaces.GameObjects;
|
||||||
@@ -11,7 +10,6 @@ using Robust.Shared.GameObjects;
|
|||||||
using Robust.Shared.GameObjects.Components;
|
using Robust.Shared.GameObjects.Components;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
using Robust.Shared.Interfaces.Map;
|
|
||||||
using Robust.Shared.Interfaces.Random;
|
using Robust.Shared.Interfaces.Random;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
@@ -20,11 +18,10 @@ using Robust.Shared.Serialization;
|
|||||||
using Robust.Shared.Timers;
|
using Robust.Shared.Timers;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Movement
|
namespace Content.Server.GameObjects.Components.Portal
|
||||||
{
|
{
|
||||||
|
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class ServerTeleporterComponent : Component, IAfterInteract
|
public class TeleporterComponent : Component, IAfterInteract
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IServerEntityManager _serverEntityManager = default!;
|
[Dependency] private readonly IServerEntityManager _serverEntityManager = default!;
|
||||||
[Dependency] private readonly IRobustRandom _spreadRandom = default!;
|
[Dependency] private readonly IRobustRandom _spreadRandom = default!;
|
||||||
@@ -110,7 +107,7 @@ namespace Content.Server.GameObjects.Components.Movement
|
|||||||
{
|
{
|
||||||
// Added this component to avoid stacking portals and causing shenanigans
|
// Added this component to avoid stacking portals and causing shenanigans
|
||||||
// TODO: Doesn't do a great job of stopping stacking portals for directed
|
// TODO: Doesn't do a great job of stopping stacking portals for directed
|
||||||
if (entity.HasComponent<ICollidableComponent>() || entity.HasComponent<ServerTeleporterComponent>())
|
if (entity.HasComponent<ICollidableComponent>() || entity.HasComponent<TeleporterComponent>())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -154,7 +151,7 @@ namespace Content.Server.GameObjects.Components.Movement
|
|||||||
// TODO: Check the user's spot? Upside is no stacking TPs but downside is they can't unstuck themselves from walls.
|
// TODO: Check the user's spot? Upside is no stacking TPs but downside is they can't unstuck themselves from walls.
|
||||||
foreach (var entity in _serverEntityManager.GetEntitiesIntersecting(user.Transform.MapID, target))
|
foreach (var entity in _serverEntityManager.GetEntitiesIntersecting(user.Transform.MapID, target))
|
||||||
{
|
{
|
||||||
if (entity.HasComponent<ICollidableComponent>() || entity.HasComponent<ServerPortalComponent>())
|
if (entity.HasComponent<ICollidableComponent>() || entity.HasComponent<PortalComponent>())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -231,13 +228,12 @@ namespace Content.Server.GameObjects.Components.Movement
|
|||||||
// Call Delete here as the teleporter should have control over portal longevity
|
// Call Delete here as the teleporter should have control over portal longevity
|
||||||
// Departure portal
|
// Departure portal
|
||||||
var departurePortal = _serverEntityManager.SpawnEntity("Portal", user.Transform.Coordinates);
|
var departurePortal = _serverEntityManager.SpawnEntity("Portal", user.Transform.Coordinates);
|
||||||
departurePortal.TryGetComponent<ServerPortalComponent>(out var departureComponent);
|
|
||||||
|
|
||||||
// Arrival portal
|
// Arrival portal
|
||||||
var arrivalPortal = _serverEntityManager.SpawnEntity("Portal", targetGrid);
|
var arrivalPortal = _serverEntityManager.SpawnEntity("Portal", targetGrid);
|
||||||
if (arrivalPortal.TryGetComponent<ServerPortalComponent>(out var arrivalComponent))
|
if (arrivalPortal.TryGetComponent<PortalComponent>(out var arrivalComponent))
|
||||||
{
|
{
|
||||||
// Connect. TODO: If the OnUpdate in ServerPortalComponent is changed this may need to change as well.
|
// Connect.
|
||||||
arrivalComponent.TryConnectPortal(departurePortal);
|
arrivalComponent.TryConnectPortal(departurePortal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -251,7 +247,6 @@ namespace Content.Server.GameObjects.Components.Movement
|
|||||||
user.Transform.WorldPosition = vector;
|
user.Transform.WorldPosition = vector;
|
||||||
soundPlayer.PlayAtCoords(_arrivalSound, user.Transform.Coordinates);
|
soundPlayer.PlayAtCoords(_arrivalSound, user.Transform.Coordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
using Content.Server.GameObjects.Components.Movement;
|
|
||||||
using JetBrains.Annotations;
|
|
||||||
using Robust.Shared.GameObjects.Systems;
|
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.EntitySystems
|
|
||||||
{
|
|
||||||
[UsedImplicitly]
|
|
||||||
internal sealed class PortalSystem : EntitySystem
|
|
||||||
{
|
|
||||||
// TODO: Someone refactor portals
|
|
||||||
public override void Update(float frameTime)
|
|
||||||
{
|
|
||||||
foreach (var comp in ComponentManager.EntityQuery<ServerPortalComponent>())
|
|
||||||
{
|
|
||||||
comp.OnUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.Serialization;
|
|
||||||
|
|
||||||
namespace Content.Shared.GameObjects.Components.Movement
|
|
||||||
{
|
|
||||||
public abstract class SharedPortalComponent : Component {
|
|
||||||
public override string Name => "Portal";
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
|
||||||
public enum PortalVisuals
|
|
||||||
{
|
|
||||||
State
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
|
||||||
public enum PortalState
|
|
||||||
{
|
|
||||||
RecentlyTeleported,
|
|
||||||
Pending,
|
|
||||||
UnableToTeleport,
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.GameObjects.Components;
|
||||||
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
|
namespace Content.Shared.GameObjects.Components.Portal
|
||||||
|
{
|
||||||
|
public abstract class SharedPortalComponent : Component
|
||||||
|
{
|
||||||
|
public override string Name => "Portal";
|
||||||
|
|
||||||
|
public override void OnAdd()
|
||||||
|
{
|
||||||
|
base.OnAdd();
|
||||||
|
|
||||||
|
if (Owner.TryGetComponent<ICollidableComponent>(out var collidable))
|
||||||
|
{
|
||||||
|
collidable.Hard = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public enum PortalVisuals
|
||||||
|
{
|
||||||
|
State
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public enum PortalState
|
||||||
|
{
|
||||||
|
RecentlyTeleported,
|
||||||
|
Pending,
|
||||||
|
UnableToTeleport,
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ using Robust.Shared.GameObjects;
|
|||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
namespace Content.Shared.GameObjects.Components.Movement
|
namespace Content.Shared.GameObjects.Components.Portal
|
||||||
{
|
{
|
||||||
public enum ItemTeleporterState
|
public enum ItemTeleporterState
|
||||||
{
|
{
|
||||||
Reference in New Issue
Block a user