committed by
GitHub
parent
32c14b0e51
commit
052ea49884
@@ -4,15 +4,13 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Content.Client.GameObjects.Components.Clothing;
|
||||
using Content.Shared.GameObjects.Components.Inventory;
|
||||
using Content.Shared.GameObjects.Verbs;
|
||||
using Content.Shared.GameObjects.Components.Movement;
|
||||
using Content.Shared.Preferences.Appearance;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
|
||||
using static Content.Shared.GameObjects.Components.Inventory.SharedInventoryComponent.ClientInventoryMessage;
|
||||
@@ -81,6 +79,46 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
return item != null && _slots.Values.Any(e => e == item);
|
||||
}
|
||||
|
||||
public override float WalkSpeedModifier
|
||||
{
|
||||
get
|
||||
{
|
||||
var mod = 1f;
|
||||
foreach (var slot in _slots.Values)
|
||||
{
|
||||
if (slot != null)
|
||||
{
|
||||
foreach (var modifier in slot.GetAllComponents<IMoveSpeedModifier>())
|
||||
{
|
||||
mod *= modifier.WalkSpeedModifier;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mod;
|
||||
}
|
||||
}
|
||||
|
||||
public override float SprintSpeedModifier
|
||||
{
|
||||
get
|
||||
{
|
||||
var mod = 1f;
|
||||
foreach (var slot in _slots.Values)
|
||||
{
|
||||
if (slot != null)
|
||||
{
|
||||
foreach (var modifier in slot.GetAllComponents<IMoveSpeedModifier>())
|
||||
{
|
||||
mod *= modifier.SprintSpeedModifier;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mod;
|
||||
}
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
base.HandleComponentState(curState, nextState);
|
||||
@@ -120,6 +158,11 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
||||
_slots.Remove(slot);
|
||||
}
|
||||
}
|
||||
|
||||
if (Owner.TryGetComponent(out MovementSpeedModifierComponent? mod))
|
||||
{
|
||||
mod.RefreshMovementSpeedModifiers();
|
||||
}
|
||||
}
|
||||
|
||||
private void _setSlot(Slots slot, IEntity entity)
|
||||
|
||||
Reference in New Issue
Block a user