Adds barotrauma (pressure damage) (#1605)
* Adds barotrauma, disables it for now * At least show status effect, but don't damage the mobs * Fix switch misuse
This commit is contained in:
committed by
GitHub
parent
079937a9fe
commit
ffc9a24ea0
@@ -8,6 +8,7 @@ using Content.Server.GameObjects.Components.Items.Storage;
|
||||
using Content.Server.GameObjects.EntitySystems.Click;
|
||||
using Content.Server.Interfaces.GameObjects.Components.Interaction;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Interfaces.GameObjects;
|
||||
using Content.Shared.GameObjects;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Robust.Server.GameObjects.Components.Container;
|
||||
@@ -26,7 +27,7 @@ using static Content.Shared.GameObjects.SharedInventoryComponent.ClientInventory
|
||||
namespace Content.Server.GameObjects
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class InventoryComponent : SharedInventoryComponent, IExAct, IEffectBlocker
|
||||
public class InventoryComponent : SharedInventoryComponent, IExAct, IEffectBlocker, IPressureProtection
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||
@@ -51,6 +52,52 @@ namespace Content.Server.GameObjects
|
||||
}
|
||||
}
|
||||
|
||||
// Optimization: Cache this
|
||||
[ViewVariables]
|
||||
public float HighPressureMultiplier
|
||||
{
|
||||
get
|
||||
{
|
||||
var multiplier = 1f;
|
||||
|
||||
foreach (var (slot, containerSlot) in SlotContainers)
|
||||
{
|
||||
foreach (var entity in containerSlot.ContainedEntities)
|
||||
{
|
||||
foreach (var protection in entity.GetAllComponents<IPressureProtection>())
|
||||
{
|
||||
multiplier *= protection.HighPressureMultiplier;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return multiplier;
|
||||
}
|
||||
}
|
||||
|
||||
// Optimization: Cache this
|
||||
[ViewVariables]
|
||||
public float LowPressureMultiplier
|
||||
{
|
||||
get
|
||||
{
|
||||
var multiplier = 1f;
|
||||
|
||||
foreach (var (slot, containerSlot) in SlotContainers)
|
||||
{
|
||||
foreach (var entity in containerSlot.ContainedEntities)
|
||||
{
|
||||
foreach (var protection in entity.GetAllComponents<IPressureProtection>())
|
||||
{
|
||||
multiplier *= protection.LowPressureMultiplier;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return multiplier;
|
||||
}
|
||||
}
|
||||
|
||||
bool IEffectBlocker.CanSlip()
|
||||
{
|
||||
if(Owner.TryGetComponent(out InventoryComponent inventoryComponent) &&
|
||||
|
||||
Reference in New Issue
Block a user