2019-04-04 19:43:01 +02:00
|
|
|
|
using Content.Server.GameObjects.EntitySystems;
|
2019-03-27 17:29:06 +05:00
|
|
|
|
using Content.Shared.GameObjects.Components.Mobs;
|
2019-04-15 21:11:38 -06:00
|
|
|
|
using Robust.Server.GameObjects;
|
|
|
|
|
|
using Robust.Shared.Interfaces.GameObjects;
|
2018-12-13 07:47:19 -06:00
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.GameObjects
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Defines the blocking effect of each damage state, and what effects to apply upon entering or exiting the state
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public interface DamageState : IActionBlocker
|
2019-04-04 19:43:01 +02:00
|
|
|
|
{
|
|
|
|
|
|
void EnterState(IEntity entity);
|
2018-12-13 07:47:19 -06:00
|
|
|
|
|
2019-04-04 19:43:01 +02:00
|
|
|
|
void ExitState(IEntity entity);
|
2019-05-08 09:55:36 +02:00
|
|
|
|
|
|
|
|
|
|
bool IsConscious { get; }
|
2018-12-13 07:47:19 -06:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Standard state that a species is at with no damage or negative effect
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public struct NormalState : DamageState
|
|
|
|
|
|
{
|
2019-04-04 19:43:01 +02:00
|
|
|
|
public void EnterState(IEntity entity)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
2018-12-13 07:47:19 -06:00
|
|
|
|
|
2019-04-04 19:43:01 +02:00
|
|
|
|
public void ExitState(IEntity entity)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
2018-12-13 07:47:19 -06:00
|
|
|
|
|
2019-05-08 09:55:36 +02:00
|
|
|
|
public bool IsConscious => true;
|
|
|
|
|
|
|
2018-12-13 07:47:19 -06:00
|
|
|
|
bool IActionBlocker.CanInteract()
|
|
|
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool IActionBlocker.CanMove()
|
|
|
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool IActionBlocker.CanUse()
|
|
|
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
2019-07-18 23:33:02 +02:00
|
|
|
|
|
|
|
|
|
|
bool IActionBlocker.CanThrow()
|
|
|
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
2019-09-24 03:55:38 -04:00
|
|
|
|
|
|
|
|
|
|
bool IActionBlocker.CanSpeak()
|
|
|
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
2018-12-13 07:47:19 -06:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// A state in which you are disabled from acting due to damage
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public struct CriticalState : DamageState
|
|
|
|
|
|
{
|
2019-04-04 19:43:01 +02:00
|
|
|
|
public void EnterState(IEntity entity)
|
|
|
|
|
|
{
|
2019-03-27 17:29:06 +05:00
|
|
|
|
}
|
2018-12-13 07:47:19 -06:00
|
|
|
|
|
2019-04-04 19:43:01 +02:00
|
|
|
|
public void ExitState(IEntity entity)
|
|
|
|
|
|
{
|
2019-03-27 17:29:06 +05:00
|
|
|
|
}
|
2018-12-13 07:47:19 -06:00
|
|
|
|
|
2019-05-08 09:55:36 +02:00
|
|
|
|
public bool IsConscious => false;
|
|
|
|
|
|
|
2018-12-13 07:47:19 -06:00
|
|
|
|
bool IActionBlocker.CanInteract()
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool IActionBlocker.CanMove()
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool IActionBlocker.CanUse()
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2019-07-18 23:33:02 +02:00
|
|
|
|
|
|
|
|
|
|
bool IActionBlocker.CanThrow()
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2019-09-24 03:55:38 -04:00
|
|
|
|
|
|
|
|
|
|
bool IActionBlocker.CanSpeak()
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2018-12-13 07:47:19 -06:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// A damage state which will allow ghosting out of mobs
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public struct DeadState : DamageState
|
|
|
|
|
|
{
|
2019-04-04 19:43:01 +02:00
|
|
|
|
public void EnterState(IEntity entity)
|
2018-12-13 07:47:19 -06:00
|
|
|
|
{
|
2019-04-04 19:43:01 +02:00
|
|
|
|
if (entity.TryGetComponent(out AppearanceComponent appearance))
|
2018-12-13 07:47:19 -06:00
|
|
|
|
{
|
2019-04-04 19:43:01 +02:00
|
|
|
|
var newState = SharedSpeciesComponent.MobState.Down;
|
|
|
|
|
|
appearance.SetData(SharedSpeciesComponent.MobVisuals.RotationState, newState);
|
2018-12-13 07:47:19 -06:00
|
|
|
|
}
|
2019-10-30 16:27:49 +01:00
|
|
|
|
|
|
|
|
|
|
if (entity.TryGetComponent(out CollidableComponent collidable))
|
|
|
|
|
|
{
|
|
|
|
|
|
collidable.CollisionEnabled = false;
|
|
|
|
|
|
}
|
2018-12-13 07:47:19 -06:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-04-04 19:43:01 +02:00
|
|
|
|
public void ExitState(IEntity entity)
|
2018-12-13 07:47:19 -06:00
|
|
|
|
{
|
2019-04-04 19:43:01 +02:00
|
|
|
|
if (entity.TryGetComponent(out AppearanceComponent appearance))
|
2018-12-13 07:47:19 -06:00
|
|
|
|
{
|
2019-04-04 19:43:01 +02:00
|
|
|
|
var newState = SharedSpeciesComponent.MobState.Stand;
|
|
|
|
|
|
appearance.SetData(SharedSpeciesComponent.MobVisuals.RotationState, newState);
|
2018-12-13 07:47:19 -06:00
|
|
|
|
}
|
2019-10-30 16:27:49 +01:00
|
|
|
|
|
|
|
|
|
|
if (entity.TryGetComponent(out CollidableComponent collidable))
|
|
|
|
|
|
{
|
|
|
|
|
|
collidable.CollisionEnabled = true;
|
|
|
|
|
|
}
|
2018-12-13 07:47:19 -06:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-05-08 09:55:36 +02:00
|
|
|
|
public bool IsConscious => false;
|
|
|
|
|
|
|
2018-12-13 07:47:19 -06:00
|
|
|
|
bool IActionBlocker.CanInteract()
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool IActionBlocker.CanMove()
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool IActionBlocker.CanUse()
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2019-07-18 23:33:02 +02:00
|
|
|
|
|
|
|
|
|
|
bool IActionBlocker.CanThrow()
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2019-09-24 03:55:38 -04:00
|
|
|
|
|
|
|
|
|
|
bool IActionBlocker.CanSpeak()
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2018-12-13 07:47:19 -06:00
|
|
|
|
}
|
|
|
|
|
|
}
|