Remove starvation damage (#9024)
* Remove starvation damage * remove more * Even more cleanup
This commit is contained in:
@@ -1,8 +1,4 @@
|
|||||||
using Content.Server.Administration.Logs;
|
|
||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
using Content.Shared.Damage;
|
|
||||||
using Content.Shared.Database;
|
|
||||||
using Content.Shared.MobState.Components;
|
|
||||||
using Content.Shared.Movement.Components;
|
using Content.Shared.Movement.Components;
|
||||||
using Content.Shared.Movement.Systems;
|
using Content.Shared.Movement.Systems;
|
||||||
using Content.Shared.Nutrition.Components;
|
using Content.Shared.Nutrition.Components;
|
||||||
@@ -70,10 +66,6 @@ namespace Content.Server.Nutrition.Components
|
|||||||
{ HungerThreshold.Starving, AlertType.Starving },
|
{ HungerThreshold.Starving, AlertType.Starving },
|
||||||
};
|
};
|
||||||
|
|
||||||
[DataField("damage", required: true)]
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
|
||||||
public DamageSpecifier Damage = default!;
|
|
||||||
|
|
||||||
public void HungerThresholdEffect(bool force = false)
|
public void HungerThresholdEffect(bool force = false)
|
||||||
{
|
{
|
||||||
if (_currentHungerThreshold != _lastHungerThreshold || force)
|
if (_currentHungerThreshold != _lastHungerThreshold || force)
|
||||||
@@ -173,21 +165,6 @@ namespace Content.Server.Nutrition.Components
|
|||||||
|
|
||||||
if (_currentHungerThreshold != HungerThreshold.Dead)
|
if (_currentHungerThreshold != HungerThreshold.Dead)
|
||||||
return;
|
return;
|
||||||
// --> Current Hunger is below dead threshold
|
|
||||||
|
|
||||||
if (!_entMan.TryGetComponent(Owner, out MobStateComponent? mobState))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!mobState.IsDead())
|
|
||||||
{
|
|
||||||
// --> But they are not dead yet.
|
|
||||||
_accumulatedFrameTime += frametime;
|
|
||||||
if (_accumulatedFrameTime >= 1)
|
|
||||||
{
|
|
||||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(Owner, Damage * (int) _accumulatedFrameTime, true);
|
|
||||||
_accumulatedFrameTime -= (int) _accumulatedFrameTime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateCurrentThreshold()
|
private void UpdateCurrentThreshold()
|
||||||
@@ -196,12 +173,6 @@ namespace Content.Server.Nutrition.Components
|
|||||||
// _trySound(calculatedThreshold);
|
// _trySound(calculatedThreshold);
|
||||||
if (calculatedHungerThreshold != _currentHungerThreshold)
|
if (calculatedHungerThreshold != _currentHungerThreshold)
|
||||||
{
|
{
|
||||||
var logManager = IoCManager.Resolve<IAdminLogManager>();
|
|
||||||
if (_currentHungerThreshold == HungerThreshold.Dead)
|
|
||||||
logManager.Add(LogType.Hunger, $"{_entMan.ToPrettyString(Owner):entity} has stopped starving");
|
|
||||||
else if (calculatedHungerThreshold == HungerThreshold.Dead)
|
|
||||||
logManager.Add(LogType.Hunger, $"{_entMan.ToPrettyString(Owner):entity} has started starving");
|
|
||||||
|
|
||||||
_currentHungerThreshold = calculatedHungerThreshold;
|
_currentHungerThreshold = calculatedHungerThreshold;
|
||||||
HungerThresholdEffect();
|
HungerThresholdEffect();
|
||||||
Dirty();
|
Dirty();
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
using Content.Shared.Damage;
|
|
||||||
|
|
||||||
namespace Content.Server.Nutrition.Components
|
namespace Content.Server.Nutrition.Components
|
||||||
{
|
{
|
||||||
@@ -50,10 +49,5 @@ namespace Content.Server.Nutrition.Components
|
|||||||
{ThirstThreshold.Thirsty, AlertType.Thirsty},
|
{ThirstThreshold.Thirsty, AlertType.Thirsty},
|
||||||
{ThirstThreshold.Parched, AlertType.Parched},
|
{ThirstThreshold.Parched, AlertType.Parched},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
[DataField("damage", required: true)]
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
|
||||||
public DamageSpecifier Damage = default!;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,24 +135,9 @@ namespace Content.Server.Nutrition.EntitySystems
|
|||||||
var calculatedThirstThreshold = GetThirstThreshold(component, component.CurrentThirst);
|
var calculatedThirstThreshold = GetThirstThreshold(component, component.CurrentThirst);
|
||||||
if (calculatedThirstThreshold != component.CurrentThirstThreshold)
|
if (calculatedThirstThreshold != component.CurrentThirstThreshold)
|
||||||
{
|
{
|
||||||
if (component.CurrentThirstThreshold == ThirstThreshold.Dead)
|
|
||||||
_adminLogger.Add(LogType.Thirst, $"{EntityManager.ToPrettyString(component.Owner):entity} has stopped taking dehydration damage");
|
|
||||||
else if (calculatedThirstThreshold == ThirstThreshold.Dead)
|
|
||||||
_adminLogger.Add(LogType.Thirst, $"{EntityManager.ToPrettyString(component.Owner):entity} has started taking dehydration damage");
|
|
||||||
|
|
||||||
component.CurrentThirstThreshold = calculatedThirstThreshold;
|
component.CurrentThirstThreshold = calculatedThirstThreshold;
|
||||||
UpdateEffects(component);
|
UpdateEffects(component);
|
||||||
}
|
}
|
||||||
if (component.CurrentThirstThreshold == ThirstThreshold.Dead)
|
|
||||||
{
|
|
||||||
if (!EntityManager.TryGetComponent(component.Owner, out MobStateComponent? mobState))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!mobState.IsDead())
|
|
||||||
{
|
|
||||||
_damage.TryChangeDamage(component.Owner, component.Damage, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_accumulatedFrameTime -= 1;
|
_accumulatedFrameTime -= 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -167,13 +167,7 @@
|
|||||||
# - Hunger TODO: eating on the floor and fix weird AI endless stomach
|
# - Hunger TODO: eating on the floor and fix weird AI endless stomach
|
||||||
# - Thirst
|
# - Thirst
|
||||||
- type: Hunger
|
- type: Hunger
|
||||||
damage:
|
|
||||||
types:
|
|
||||||
Blunt: 2
|
|
||||||
- type: Thirst
|
- type: Thirst
|
||||||
damage:
|
|
||||||
types:
|
|
||||||
Blunt: 2
|
|
||||||
- type: Barotrauma
|
- type: Barotrauma
|
||||||
damage:
|
damage:
|
||||||
types:
|
types:
|
||||||
|
|||||||
@@ -46,13 +46,7 @@
|
|||||||
soundHit:
|
soundHit:
|
||||||
path: /Audio/Effects/hit_kick.ogg
|
path: /Audio/Effects/hit_kick.ogg
|
||||||
- type: Hunger
|
- type: Hunger
|
||||||
damage:
|
|
||||||
types:
|
|
||||||
Blunt: 2
|
|
||||||
- type: Thirst
|
- type: Thirst
|
||||||
damage:
|
|
||||||
types:
|
|
||||||
Blunt: 2
|
|
||||||
# Organs
|
# Organs
|
||||||
- type: InjectableSolution
|
- type: InjectableSolution
|
||||||
solution: chemicals
|
solution: chemicals
|
||||||
|
|||||||
Reference in New Issue
Block a user