Skip to content

Commit

Permalink
Merge branch 'master' into internal-affairs
Browse files Browse the repository at this point in the history
  • Loading branch information
EstKemran authored Aug 9, 2024
2 parents 399cd06 + a7af65d commit 8aafe7b
Show file tree
Hide file tree
Showing 110 changed files with 2,610 additions and 93 deletions.
7 changes: 6 additions & 1 deletion Content.Client/Movement/Systems/WaddleAnimationSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Numerics;
using System.Numerics;
using Content.Client.Buckle;
using Content.Client.Gravity;
using Content.Shared.ActionBlocker;
Expand Down Expand Up @@ -87,6 +87,11 @@ private void OnAnimationCompleted(Entity<WaddleAnimationComponent> entity, ref A
if (!TryComp<InputMoverComponent>(entity.Owner, out var mover))
return;

//SS220 Waddle in crit/death fix begin
if (_mobState.IsIncapacitated(entity.Owner))
return;
//SS220 Waddle in crit/death fix end

PlayWaddleAnimationUsing(
(entity.Owner, entity.Comp),
CalculateAnimationLength(entity.Comp, mover),
Expand Down
17 changes: 12 additions & 5 deletions Content.Server/Antag/AntagSelectionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,19 @@ public void MakeAntag(Entity<AntagSelectionComponent> ent, ICommonSession? sessi

if (session != null)
{
var curMind = _mind.CreateMind(session.UserId, Name(antagEnt.Value));
_mind.SetUserId(curMind, session.UserId);
// start 220 AntagSelectionFix
var curMind = session.GetMind();

_mind.TransferTo(curMind, antagEnt, ghostCheckOverride: true);
_role.MindAddRoles(curMind, def.MindComponents, null, true);
ent.Comp.SelectedMinds.Add((curMind, Name(player)));
if (curMind == null || session.AttachedEntity != antagEnt)
{
curMind = _mind.CreateMind(session.UserId, Name(antagEnt.Value));
_mind.SetUserId(curMind.Value, session.UserId);
}

_mind.TransferTo(curMind.Value, antagEnt, ghostCheckOverride: true);
_role.MindAddRoles(curMind.Value, def.MindComponents, null, true);
ent.Comp.SelectedMinds.Add((curMind.Value, Name(player)));
// end 220 AntagSelectionFix

SendBriefing(session, def.Briefing);
}
Expand Down
9 changes: 9 additions & 0 deletions Content.Server/Botany/Systems/MutationSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ public SeedData Cross(SeedData a, SeedData b)
CrossBool(ref result.TurnIntoKudzu, a.TurnIntoKudzu);
CrossBool(ref result.CanScream, a.CanScream);

CrossRepeatable(ref result.HarvestRepeat, ref a.HarvestRepeat); //SS220 CrossRepeatable

CrossGasses(ref result.ExudeGasses, a.ExudeGasses);
CrossGasses(ref result.ConsumeGasses, a.ConsumeGasses);

Expand Down Expand Up @@ -407,6 +409,13 @@ private void CrossBool(ref bool val, bool other)
val = Random(0.5f) ? val : other;
}

//SS220 CrossRepeatable start
private void CrossRepeatable(ref HarvestType val, ref HarvestType other)
{
val = Random(0.15f) ? val : other;
}
//SS220 CrossRepeatable end

private bool Random(float p)
{
return _robustRandom.Prob(p);
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Explosion/EntitySystems/TriggerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private void HandleExplodeTrigger(EntityUid uid, ExplodeOnTriggerComponent compo
private void HandleFlashTrigger(EntityUid uid, FlashOnTriggerComponent component, TriggerEvent args)
{
// TODO Make flash durations sane ffs.
_flashSystem.FlashArea(uid, args.User, component.Range, component.Duration * 1000f, probability: component.Probability);
_flashSystem.FlashArea(uid, args.User, component.Range, component.Duration * 1000f, probability: component.Probability, stun: component.Stun, stunDuration: component.StunDuration); // 220 flash grenade stun
args.Handled = true;
}

Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Flash/FlashSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public void Flash(EntityUid target,
}
}

public void FlashArea(Entity<FlashComponent?> source, EntityUid? user, float range, float duration, float slowTo = 0.8f, bool displayPopup = false, float probability = 1f, SoundSpecifier? sound = null)
public void FlashArea(Entity<FlashComponent?> source, EntityUid? user, float range, float duration, float slowTo = 0.8f, bool displayPopup = false, float probability = 1f, SoundSpecifier? sound = null, bool stun = false, float stunDuration = 1f) // 220 flash grenade stun
{
var transform = Transform(source);
var mapPosition = _transform.GetMapCoordinates(transform);
Expand All @@ -174,7 +174,7 @@ public void FlashArea(Entity<FlashComponent?> source, EntityUid? user, float ran
continue;

// They shouldn't have flash removed in between right?
Flash(entity, user, source, duration, slowTo, displayPopup);
Flash(entity, user, source, duration, slowTo, displayPopup, melee: stun, stunDuration: TimeSpan.FromSeconds(stunDuration)); // 220 flash grenade stun
}

_audio.PlayPvs(sound, source, AudioParams.Default.WithVolume(1f).WithMaxDistance(3f));
Expand Down
17 changes: 15 additions & 2 deletions Content.Shared/Clothing/EntitySystems/WaddleClothingSystem.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
using Content.Shared.Clothing;
using Content.Shared.Clothing;
using Content.Shared.Clothing.Components;
using Content.Shared.Movement.Components;
using Content.Shared.Inventory.Events;
using Content.Shared.SS220.Movement.Components;
using Content.Shared.SS220.Movement.Systems;

namespace Content.Shared.Clothing.EntitySystems;

public sealed class WaddleClothingSystem : EntitySystem
{
[Dependency] private readonly TemporaryWaddleSystem _temporaryWaddleSystem = default!; //SS220 Temporary waddle status effect

public override void Initialize()
{
base.Initialize();
Expand All @@ -27,6 +31,15 @@ private void OnGotEquipped(EntityUid entity, WaddleWhenWornComponent comp, Cloth

private void OnGotUnequipped(EntityUid entity, WaddleWhenWornComponent comp, ClothingGotUnequippedEvent args)
{
RemComp<WaddleAnimationComponent>(args.Wearer);
//RemComp<WaddleAnimationComponent>(args.Wearer) //SS220 convert to comment

//SS220 Temporary waddle status effect begin
if (HasComp<TemporaryWaddleComponent>(args.Wearer))
{
_temporaryWaddleSystem.SetAnimationValues(args.Wearer);
}
else
RemComp<WaddleAnimationComponent>(args.Wearer);
//SS220 Temporary waddle status effect end
}
}
4 changes: 4 additions & 0 deletions Content.Shared/Flash/Components/FlashOnTriggerComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ public sealed partial class FlashOnTriggerComponent : Component
[DataField] public float Range = 1.0f;
[DataField] public float Duration = 8.0f;
[DataField] public float Probability = 1.0f;
// start 220 flash grenade stun
[DataField] public bool Stun = false;
[DataField] public float StunDuration = 3.0f;
// end 220 flash grenade stun
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
using Robust.Shared.GameStates;
using System.Numerics;

namespace Content.Shared.SS220.Movement.Components;

/// <summary>
/// Exists for use as a status effect.
/// Entity with this component will be funny to waddle.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class TemporaryWaddleComponent : Component
{
///<summary>
/// How high should they hop during the waddle? Higher hop = more energy.
/// </summary>
[DataField, AutoNetworkedField]
public Vector2 HopIntensity = new(0, 0.125f);

/// <summary>
/// How far should they rock backward and forward during the waddle?
/// Each step will alternate between this being a positive and negative rotation. More rock = more scary.
/// </summary>
[DataField, AutoNetworkedField]
public float TumbleIntensity = 10.0f;

/// <summary>
/// How long should a complete step take? Less time = more chaos.
/// </summary>
[DataField, AutoNetworkedField]
public float AnimationLength = 0.66f;

/// <summary>
/// How much shorter should the animation be when running?
/// </summary>
[DataField, AutoNetworkedField]
public float RunAnimationLengthMultiplier = 0.568f;
}
58 changes: 58 additions & 0 deletions Content.Shared/SS220/Movement/Systems/TemporaryWaddleSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt
using Content.Shared.Clothing.Components;
using Content.Shared.Inventory;
using Content.Shared.Movement.Components;
using Content.Shared.SS220.Movement.Components;
using Content.Shared.StatusEffect;

namespace Content.Shared.SS220.Movement.Systems;

public sealed class TemporaryWaddleSystem : EntitySystem
{
[ValidatePrototypeId<StatusEffectPrototype>]
public const string WaddlingStatusEffect = "TemporaryWaddle";

[Dependency] private readonly InventorySystem _inventorySystem = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<TemporaryWaddleComponent, ComponentInit>(OnInit);
SubscribeLocalEvent<TemporaryWaddleComponent, ComponentRemove>(OnRemoved);
}

private void OnInit(EntityUid uid, TemporaryWaddleComponent component, ComponentInit args)
{
EnsureComp<WaddleAnimationComponent>(uid, out var waddleAnimComp);

//Set values from TemporaryWaddleComponent if entity hasn`t clown shoes or hasn`t shoes in that slot
if (!_inventorySystem.TryGetSlotEntity(uid, "shoes", out var shoesUid) || !HasComp<WaddleWhenWornComponent>(shoesUid))
{
SetAnimationValues(uid);
}
}

private void OnRemoved(EntityUid uid, TemporaryWaddleComponent component, ComponentRemove args)
{
// If uid has clown shoes, then the WaddleAnimation doesn`t removed
if (_inventorySystem.TryGetSlotEntity(uid, "shoes", out var shoesUid) && HasComp<WaddleWhenWornComponent>(shoesUid))
return;

RemComp<WaddleAnimationComponent>(uid);
}

public void SetAnimationValues(EntityUid uid, TemporaryWaddleComponent? component = null)
{
if (!Resolve(uid, ref component))
return;

if (!TryComp<WaddleAnimationComponent>(uid, out var waddleAnimComp))
return;

waddleAnimComp.AnimationLength = component.AnimationLength;
waddleAnimComp.HopIntensity = component.HopIntensity;
waddleAnimComp.RunAnimationLengthMultiplier = component.RunAnimationLengthMultiplier;
waddleAnimComp.TumbleIntensity = component.TumbleIntensity;
}
}
3 changes: 2 additions & 1 deletion Content.Shared/Wieldable/WieldableSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Content.Shared.Interaction.Events;
using Content.Shared.Inventory.VirtualItem;
using Content.Shared.Item;
using Content.Shared.Movement.Pulling.Components;
using Content.Shared.Movement.Pulling.Systems;
using Content.Shared.Popups;
using Content.Shared.Timing;
Expand Down Expand Up @@ -197,7 +198,7 @@ public bool CanWield(EntityUid uid, WieldableComponent component, EntityUid user
return false;
}
//ss220 weild fix begin
if (_pull.IsPulling(user))
if (TryComp<PullerComponent>(user, out var puller) && _pull.IsPulling(user, puller) && puller.NeedsHands)
return false;
//ss220 weild fix end

Expand Down
Loading

0 comments on commit 8aafe7b

Please sign in to comment.