Adds FlammableComponent, humans can now catch on fire. (#2115)

This commit is contained in:
Víctor Aguilera Puerto
2020-09-22 15:40:04 +02:00
committed by GitHub
parent 4c34a12c67
commit 31e0dfc10c
33 changed files with 457 additions and 54 deletions

View File

@@ -1,8 +1,10 @@
using System;
using System.Diagnostics;
using Content.Server.GameObjects.Components.Mobs;
using Content.Shared.Atmos;
using Content.Shared.Damage;
using Content.Shared.GameObjects.Components.Damage;
using Content.Shared.GameObjects.Components.Mobs;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components;
using Robust.Shared.Serialization;
@@ -72,11 +74,51 @@ namespace Content.Server.GameObjects.Components.Temperature
damageType = DamageType.Cold;
}
if (Owner.TryGetComponent(out ServerStatusEffectsComponent status))
{
switch(CurrentTemperature)
{
// Cold strong.
case var t when t <= 260:
status.ChangeStatusEffect(StatusEffect.Temperature, "/Textures/Interface/StatusEffects/Temperature/cold3.png", null);
break;
// Cold mild.
case var t when t <= 280 && t > 260:
status.ChangeStatusEffect(StatusEffect.Temperature, "/Textures/Interface/StatusEffects/Temperature/cold2.png", null);
break;
// Cold weak.
case var t when t <= 292 && t > 280:
status.ChangeStatusEffect(StatusEffect.Temperature, "/Textures/Interface/StatusEffects/Temperature/cold1.png", null);
break;
// Safe.
case var t when t <= 327 && t > 292:
status.RemoveStatusEffect(StatusEffect.Temperature);
break;
// Heat weak.
case var t when t <= 335 && t > 327:
status.ChangeStatusEffect(StatusEffect.Temperature, "/Textures/Interface/StatusEffects/Temperature/hot1.png", null);
break;
// Heat mild.
case var t when t <= 345 && t > 335:
status.ChangeStatusEffect(StatusEffect.Temperature, "/Textures/Interface/StatusEffects/Temperature/hot2.png", null);
break;
// Heat strong.
case var t when t > 345:
status.ChangeStatusEffect(StatusEffect.Temperature, "/Textures/Interface/StatusEffects/Temperature/hot3.png", null);
break;
}
}
if (!damageType.HasValue) return;
if (!Owner.TryGetComponent(out IDamageableComponent component)) return;
component.ChangeDamage(damageType.Value, tempDamage, false);
Debug.Write($"Temp is: {CurrentTemperature}");
}
/// <summary>