Files
tbd-station-14/Content.Server/GameObjects/Components/Mobs/DamageStates.cs
clusterfack 37df61113e Species Component (#130)
* Fix this
fug
oksure
Creates the initial species component, damage states, and threshold templates and hooks them into the damageable component

* More rebase fixes

* test

* Pre future rebase

* Please

* Lol

* Lol2

* SHADERS

* Update Engine

* yml file

* Fix an initialization issue, injects dependencies

* Fix error in loading shaders

* Makes a master character ui controller component added upon client attachment to entity and remove upon client detachment from entity

* Fixes just about everytrhing

* Address PJB's comments

* geeze

* Make overlays work in worldspace instead of screen space and not cover user interfaces

* update submodule
2018-12-13 14:47:18 +01:00

105 lines
2.4 KiB
C#

using Content.Server.GameObjects.EntitySystems;
using SS14.Server.GameObjects;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Maths;
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
{
void EnterState(IEntity entity);
void ExitState(IEntity entity);
}
/// <summary>
/// Standard state that a species is at with no damage or negative effect
/// </summary>
public struct NormalState : DamageState
{
public void EnterState(IEntity entity){}
public void ExitState(IEntity entity){}
bool IActionBlocker.CanInteract()
{
return true;
}
bool IActionBlocker.CanMove()
{
return true;
}
bool IActionBlocker.CanUse()
{
return true;
}
}
/// <summary>
/// A state in which you are disabled from acting due to damage
/// </summary>
public struct CriticalState : DamageState
{
public void EnterState(IEntity entity) { }
public void ExitState(IEntity entity) { }
bool IActionBlocker.CanInteract()
{
return false;
}
bool IActionBlocker.CanMove()
{
return false;
}
bool IActionBlocker.CanUse()
{
return false;
}
}
/// <summary>
/// A damage state which will allow ghosting out of mobs
/// </summary>
public struct DeadState : DamageState
{
public void EnterState(IEntity entity)
{
if(entity.TryGetComponent(out SpriteComponent sprite))
{
sprite.Rotation = sprite.Rotation + Angle.FromDegrees(90);
}
}
public void ExitState(IEntity entity)
{
if (entity.TryGetComponent(out SpriteComponent sprite))
{
sprite.Rotation = sprite.Rotation - Angle.FromDegrees(90);
}
}
bool IActionBlocker.CanInteract()
{
return false;
}
bool IActionBlocker.CanMove()
{
return false;
}
bool IActionBlocker.CanUse()
{
return false;
}
}
}