Airlock hacking (#329)
* Airlock hacking * Added status text * Whoops don't need this * Update Content.Server/GameObjects/Components/Doors/AirlockComponent.cs Co-Authored-By: Pieter-Jan Briers <pieterjan.briers@gmail.com> * ComponentReference ServerDoorComponent * Suggested name
This commit is contained in:
committed by
Pieter-Jan Briers
parent
34f4731c9b
commit
36078382e4
@@ -17,7 +17,7 @@ namespace Content.Server.GameObjects
|
||||
{
|
||||
public override string Name => "Door";
|
||||
|
||||
private DoorState _state = DoorState.Closed;
|
||||
protected DoorState _state = DoorState.Closed;
|
||||
|
||||
private float OpenTimeCounter;
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Content.Server.GameObjects
|
||||
base.OnRemove();
|
||||
}
|
||||
|
||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||
protected virtual void ActivateImpl(ActivateEventArgs eventArgs)
|
||||
{
|
||||
if (_state == DoorState.Open)
|
||||
{
|
||||
@@ -57,6 +57,11 @@ namespace Content.Server.GameObjects
|
||||
}
|
||||
}
|
||||
|
||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||
{
|
||||
ActivateImpl(eventArgs);
|
||||
}
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null, IComponent component = null)
|
||||
{
|
||||
base.HandleMessage(message, netChannel, component);
|
||||
@@ -80,15 +85,27 @@ namespace Content.Server.GameObjects
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool CanOpen()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CanOpen(IEntity user)
|
||||
{
|
||||
if (!CanOpen()) return false;
|
||||
if (!Owner.TryGetComponent(out AccessReader accessReader))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return accessReader.IsAllowed(user);
|
||||
}
|
||||
|
||||
public void TryOpen(IEntity user)
|
||||
{
|
||||
if (Owner.TryGetComponent(out AccessReader accessReader))
|
||||
if (!CanOpen(user))
|
||||
{
|
||||
if (!accessReader.IsAllowed(user))
|
||||
{
|
||||
Deny();
|
||||
return;
|
||||
}
|
||||
Deny();
|
||||
return;
|
||||
}
|
||||
Open();
|
||||
}
|
||||
@@ -135,7 +152,7 @@ namespace Content.Server.GameObjects
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Deny()
|
||||
public virtual void Deny()
|
||||
{
|
||||
_appearance.SetData(DoorVisuals.VisualState, DoorVisualState.Deny);
|
||||
Timer.Spawn(DenyTime, () =>
|
||||
@@ -145,7 +162,7 @@ namespace Content.Server.GameObjects
|
||||
}
|
||||
|
||||
private const float AUTO_CLOSE_DELAY = 5;
|
||||
public void OnUpdate(float frameTime)
|
||||
public virtual void OnUpdate(float frameTime)
|
||||
{
|
||||
if (_state != DoorState.Open)
|
||||
{
|
||||
@@ -163,7 +180,7 @@ namespace Content.Server.GameObjects
|
||||
}
|
||||
}
|
||||
|
||||
private enum DoorState
|
||||
protected enum DoorState
|
||||
{
|
||||
Closed,
|
||||
Open,
|
||||
|
||||
Reference in New Issue
Block a user