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

Update CarryingSystem And ContestsSystem #2074

Open
wants to merge 4 commits into
base: master
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@ public sealed partial class CarriableComponent : Component
/// Number of free hands required
/// to carry the entity
/// </summary>
[DataField("freeHandsRequired")]
[DataField]
public int FreeHandsRequired = 2;

public CancellationTokenSource? CancelToken;

/// <summary>
/// The base duration (In Seconds) of how long it should take to pick up this entity
/// before Contests are considered.
/// </summary>
[DataField]
public float PickupDuration = 3;
}
}

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2279,5 +2279,62 @@ public static readonly CVarDef<float>
/// </summary>
public static readonly CVarDef<bool> DebugPow3rDisableParallel =
CVarDef.Create("debug.pow3r_disable_parallel", true, CVar.SERVERONLY);

// Start EE Code
#region Contests System

/// <summary>
/// The MASTER TOGGLE for the entire Contests System.
/// ALL CONTESTS BELOW, regardless of type or setting will output 1f when false.
/// </summary>
public static readonly CVarDef<bool> DoContestsSystem =
CVarDef.Create("contests.do_contests_system", true, CVar.REPLICATED | CVar.SERVER);

/// <summary>
/// Contest functions normally include an optional override to bypass the clamp set by max_percentage.
/// This CVar disables the bypass when false, forcing all implementations to comply with max_percentage.
/// </summary>
public static readonly CVarDef<bool> AllowClampOverride =
CVarDef.Create("contests.allow_clamp_override", true, CVar.REPLICATED | CVar.SERVER);
/// <summary>
/// Toggles all MassContest functions. All mass contests output 1f when false
/// </summary>
public static readonly CVarDef<bool> DoMassContests =
CVarDef.Create("contests.do_mass_contests", true, CVar.REPLICATED | CVar.SERVER);

/// <summary>
/// Toggles all StaminaContest functions. All stamina contests output 1f when false
/// </summary>
public static readonly CVarDef<bool> DoStaminaContests =
CVarDef.Create("contests.do_stamina_contests", true, CVar.REPLICATED | CVar.SERVER);

/// <summary>
/// Toggles all HealthContest functions. All health contests output 1f when false
/// </summary>
public static readonly CVarDef<bool> DoHealthContests =
CVarDef.Create("contests.do_health_contests", true, CVar.REPLICATED | CVar.SERVER);

/// <summary>
/// Toggles all MindContest functions. All mind contests output 1f when false.
/// MindContests are not currently implemented, and are awaiting completion of the Psionic Refactor
/// </summary>
public static readonly CVarDef<bool> DoMindContests =
CVarDef.Create("contests.do_mind_contests", true, CVar.REPLICATED | CVar.SERVER);

/// <summary>
/// Toggles all MoodContest functions. All mood contests output 1f when false.
/// </summary>
public static readonly CVarDef<bool> DoMoodContests =
CVarDef.Create("contests.do_mood_contests", true, CVar.REPLICATED | CVar.SERVER);

/// <summary>
/// The maximum amount that Mass Contests can modify a physics multiplier, given as a +/- percentage
/// Default of 0.25f outputs between * 0.75f and 1.25f
/// </summary>
public static readonly CVarDef<float> MassContestsMaxPercentage =
CVarDef.Create("contests.max_percentage", 0.25f, CVar.REPLICATED | CVar.SERVER);

#endregion
// End EE Code
}
}
9 changes: 0 additions & 9 deletions Content.Shared/Nyanotrasen/Carrying/CarryDoAfterEvent.cs

This file was deleted.

12 changes: 0 additions & 12 deletions Content.Shared/Nyanotrasen/Carrying/CarryingDoAfterEvent.cs

This file was deleted.

8 changes: 8 additions & 0 deletions Content.Shared/_EE/Carrying/CarryingDoAfterEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Robust.Shared.Serialization;
using Content.Shared.DoAfter;

namespace Content.Shared.Carrying
{
[Serializable, NetSerializable]
public sealed partial class CarryDoAfterEvent : SimpleDoAfterEvent { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ namespace Content.Shared.Carrying

public sealed partial class CarryingSlowdownComponent : Component
{
[DataField("walkModifier", required: true)] [ViewVariables(VVAccess.ReadWrite)]
[DataField(required: true)]
public float WalkModifier = 1.0f;

[DataField("sprintModifier", required: true)] [ViewVariables(VVAccess.ReadWrite)]
[DataField(required: true)]
public float SprintModifier = 1.0f;
}

[Serializable, NetSerializable]
public sealed partial class CarryingSlowdownComponentState : ComponentState
public sealed class CarryingSlowdownComponentState : ComponentState
{
public float WalkModifier;
public float SprintModifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ private void OnGetState(EntityUid uid, CarryingSlowdownComponent component, ref

private void OnHandleState(EntityUid uid, CarryingSlowdownComponent component, ref ComponentHandleState args)
{
if (args.Current is CarryingSlowdownComponentState state)
{
component.WalkModifier = state.WalkModifier;
component.SprintModifier = state.SprintModifier;
if (args.Current is not CarryingSlowdownComponentState state)
return;

_movementSpeed.RefreshMovementSpeedModifiers(uid);
}
component.WalkModifier = state.WalkModifier;
component.SprintModifier = state.SprintModifier;
_movementSpeed.RefreshMovementSpeedModifiers(uid);
}
private void OnRefreshMoveSpeed(EntityUid uid, CarryingSlowdownComponent component, RefreshMovementSpeedModifiersEvent args)
{
Expand Down
Loading
Loading