Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renames SS14 Stamina to Pain , Adds Custom Stamina and Sliding mechanic #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Content.Client/Content.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\RobustToolbox\MSBuild\Robust.Properties.targets" />
<PropertyGroup>
<!-- Work around https://github.com/dotnet/project-system/issues/4314 -->
Expand All @@ -23,6 +23,9 @@
<ProjectReference Include="..\RobustToolbox\Robust.Client\Robust.Client.csproj" />
<ProjectReference Include="..\Content.Shared\Content.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Pain\" />
</ItemGroup>
<Import Project="..\RobustToolbox\MSBuild\XamlIL.targets" />
<Import Project="..\RobustToolbox\MSBuild\Robust.Analyzers.targets" />
</Project>
1 change: 1 addition & 0 deletions Content.Client/EscapeMenu/UI/Tabs/KeyRebindTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ void AddCheckBox(string checkBoxName, bool currentState, Action<BaseButton.Butto
AddButton(EngineKeyFunctions.MoveDown);
AddButton(EngineKeyFunctions.MoveRight);
AddButton(EngineKeyFunctions.Walk);
AddButton(ContentKeyFunctions.Slide);

AddHeader("ui-options-header-interaction-basic");
AddButton(EngineKeyFunctions.Use);
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Input/ContentContexts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public static void SetupContexts(IInputContextContainer contexts)
human.AddFunction(ContentKeyFunctions.OpenCharacterMenu);
human.AddFunction(ContentKeyFunctions.ActivateItemInWorld);
human.AddFunction(ContentKeyFunctions.ThrowItemInHand);
human.AddFunction(ContentKeyFunctions.Slide);
human.AddFunction(ContentKeyFunctions.AltActivateItemInWorld);
human.AddFunction(ContentKeyFunctions.TryPullObject);
human.AddFunction(ContentKeyFunctions.MovePulledObject);
Expand Down
12 changes: 12 additions & 0 deletions Content.Client/Stamina/StaminaComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Content.Shared.Stamina;

namespace Content.Client.Stamina
{
[RegisterComponent]
[ComponentReference(typeof(SharedStaminaComponent))]
public sealed class StaminaComponent : SharedStaminaComponent
{

}

}
58 changes: 58 additions & 0 deletions Content.Client/Stamina/StaminaSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using Content.Shared.Stamina;
using Content.Shared.Movement.Components;
using Content.Shared.Input;
using Robust.Shared.Input.Binding;
using Robust.Shared.Map;
using Robust.Shared.Players;
using Robust.Shared.Timing;
using Content.Shared.Standing;
using Robust.Shared.GameStates;

namespace Content.Client.Stamina
{
public sealed class StaminaSystem : SharedStaminaSystem
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly StandingStateSystem _standing = default!;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SharedStaminaComponent, ComponentHandleState>(HandleCompState);
//UpdatesOutsidePrediction = false;

CommandBinds.Builder
.Bind(ContentKeyFunctions.Slide, new PointerInputCmdHandler(HandleSlideAttempt))
.Register<SharedStaminaSystem>();
}

private void HandleCompState(EntityUid uid, SharedStaminaComponent component, ref ComponentHandleState args)
{
if (args.Current is not StaminaComponentState state) return;
component.CurrentStamina = state.CurrentStamina;
component.CanSlide = state.CanSlide;
component.SlideCost = state.SlideCost;
component.ActualRegenRate = state.ActualRegenRate;
component.Stimulated = state.Stimulated;

}

public override bool HandleSlideAttempt(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
{
if (base.HandleSlideAttempt(session, coords, uid))
{
RaiseNetworkEvent(new StaminaSlideEvent(coords));
return true;
}
return false;
}

public override void Update(float frameTime)
{
// Can't predict this part since it unsynchronizes.
if (_timing.IsFirstTimePredicted)
base.Update(frameTime);

}
}
}
2 changes: 1 addition & 1 deletion Content.Server/CombatMode/CombatModeSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private float CalculateDisarmChance(EntityUid disarmer, EntityUid disarmed, Enti
}

float chance = (disarmerComp.BaseDisarmFailChance - healthMod - massMod);
if (HasComp<SlowedDownComponent>(disarmer)) // might need to revisit this part after stamina damage, right now this is basically "pre-stun"
if (HasComp<SlowedDownComponent>(disarmer)) // might need to revisit this part after Pain damage, right now this is basically "pre-stun"
chance += 0.35f;
if (HasComp<SlowedDownComponent>(disarmed))
chance -= 0.35f;
Expand Down
10 changes: 10 additions & 0 deletions Content.Server/Damage/Components/ActivePainComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Content.Server.Damage.Components;

/// <summary>
/// Tracks whether an entity has ANY Pain damage for update purposes only.
/// </summary>
[RegisterComponent]
public sealed class ActivePainComponent : Component
{

}
10 changes: 0 additions & 10 deletions Content.Server/Damage/Components/ActiveStaminaComponent.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,44 @@
namespace Content.Server.Damage.Components;

/// <summary>
/// Add to an entity to paralyze it whenever it reaches critical amounts of Stamina DamageType.
/// Add to an entity to paralyze it whenever it reaches critical amounts of Pain DamageType.
/// </summary>
[RegisterComponent]
public sealed class StaminaComponent : Component
public sealed class PainComponent : Component
{
/// <summary>
/// Have we reached peak stamina damage and been paralyzed?
/// Have we reached peak Pain damage and been paralyzed?
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("critical")]
public bool Critical;

/// <summary>
/// How much stamina reduces per second.
/// How much Pain reduces per second.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("decay")]
public float Decay = 3f;

/// <summary>
/// How much time after receiving damage until stamina starts decreasing.
/// How much time after receiving damage until Pain starts decreasing.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("cooldown")]
public float DecayCooldown = 5f;

/// <summary>
/// How much stamina damage this entity has taken.
/// How much Pain damage this entity has taken.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("staminaDamage")]
public float StaminaDamage;
[ViewVariables(VVAccess.ReadWrite), DataField("PainDamage")]
public float PainDamage;

/// <summary>
/// How much stamina damage is required to entire stam crit.
/// How much Pain damage is required to entire stam crit.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("excess")]
public float CritThreshold = 100f;

/// <summary>
/// Next time we're allowed to decrease stamina damage. Refreshes whenever the stam damage is changed.
/// Next time we're allowed to decrease Pain damage. Refreshes whenever the stam damage is changed.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("decayAccumulator")]
public float StaminaDecayAccumulator;
public float PainDecayAccumulator;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace Content.Server.Damage.Components;

/// <summary>
/// Applies stamina damage when colliding with an entity.
/// Applies Pain damage when colliding with an entity.
/// </summary>
[RegisterComponent]
public sealed class StaminaDamageOnCollideComponent : Component
public sealed class PainDamageOnCollideComponent : Component
{
[ViewVariables(VVAccess.ReadWrite), DataField("damage")]
public float Damage = 55f;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Content.Server.Damage.Components;

[RegisterComponent]
public sealed class StaminaDamageOnHitComponent : Component
public sealed class PainDamageOnHitComponent : Component
{
[ViewVariables(VVAccess.ReadWrite), DataField("damage")]
public float Damage = 30f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace Content.Server.Damage.Events;

/// <summary>
/// Attempting to apply stamina damage on a melee hit to an entity.
/// Attempting to apply Pain damage on a melee hit to an entity.
/// </summary>
[ByRefEvent]
public struct StaminaDamageOnHitAttemptEvent
public struct PainDamageOnHitAttemptEvent
{
public bool Cancelled;
public SoundSpecifier? HitSoundOverride;
Expand Down
Loading