Urist's damage and health thing. (#10)
* Add prototype for temperature testing entity. * Add Damageable, Destructible, Temperature. Add a prototype based on those. * Works and cleaned up. * Nerf
This commit is contained in:
committed by
GitHub
parent
7597cd9172
commit
6f89d0672d
@@ -0,0 +1,30 @@
|
||||
using Content.Server.GameObjects;
|
||||
using SS14.Shared.Interfaces.GameObjects;
|
||||
using System;
|
||||
|
||||
namespace Content.Server.Interfaces.GameObjects
|
||||
{
|
||||
public interface IDamageableComponent : IComponent
|
||||
{
|
||||
event EventHandler<DamageThresholdPassedEventArgs> DamageThresholdPassed;
|
||||
ResistanceSet Resistances { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The function that handles receiving damage.
|
||||
/// Converts damage via the resistance set then applies it
|
||||
/// and informs components of thresholds passed as necessary.
|
||||
/// </summary>
|
||||
/// <param name="damageType">Type of damage being received.</param>
|
||||
/// <param name="amount">Amount of damage being received.</param>
|
||||
void TakeDamage(DamageType damageType, int amount);
|
||||
|
||||
/// <summary>
|
||||
/// Handles receiving healing.
|
||||
/// Converts healing via the resistance set then applies it
|
||||
/// and informs components of thresholds passed as necessary.
|
||||
/// </summary>
|
||||
/// <param name="damageType">Type of damage being received.</param>
|
||||
/// <param name="amount">Amount of damage being received.</param>
|
||||
void TakeHealing(DamageType damageType, int amount);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using SS14.Shared.Interfaces.GameObjects;
|
||||
|
||||
namespace Content.Server.Interfaces.GameObjects
|
||||
{
|
||||
public interface ITemperatureComponent : IComponent
|
||||
{
|
||||
float CurrentTemperature { get; }
|
||||
}
|
||||
}
|
||||
27
Content.Server/Interfaces/GameObjects/IOnDamageBehavior.cs
Normal file
27
Content.Server/Interfaces/GameObjects/IOnDamageBehavior.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.GameObjects;
|
||||
|
||||
namespace Content.Server.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Any component/entity that has behaviour linked to taking damage should implement this interface.
|
||||
/// TODO: Don't know how to work around this currently, but due to how events work
|
||||
/// you need to hook it up to the DamageableComponent via Initialize().
|
||||
/// See DestructibleComponent.Initialize() for an example.
|
||||
/// </summary>
|
||||
interface IOnDamageBehavior
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a list of all DamageThresholds this component/entity are interested in.
|
||||
/// </summary>
|
||||
/// <returns>List of DamageThresholds to be added to DamageableComponent for watching.</returns>
|
||||
List<DamageThreshold> GetAllDamageThresholds();
|
||||
|
||||
/// <summary>
|
||||
/// Damage threshold passed event hookup.
|
||||
/// </summary>
|
||||
/// <param name="obj">Damageable component.</param>
|
||||
/// <param name="e">Damage threshold and whether it's passed in one way or another.</param>
|
||||
void OnDamageThresholdPassed(object obj, DamageThresholdPassedEventArgs e);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user