Skip to content

Commit

Permalink
Merge pull request #393 from Mnemotechnician/floof/tweak/various-issues
Browse files Browse the repository at this point in the history
Small Fixes and Tweaks
  • Loading branch information
FoxxoTrystan authored Dec 5, 2024
2 parents 8390f72 + 1b9d287 commit 7b443cf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Content.Client/Jittering/JitteringSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ private void OnShutdown(EntityUid uid, JitteringComponent jittering, ComponentSh

private void OnAnimationCompleted(EntityUid uid, JitteringComponent jittering, AnimationCompletedEvent args)
{
if(args.Key != _jitterAnimationKey)
// FLoofstation - avoid restarting the jittering animation on entites that already stopped jittering
if(args.Key != _jitterAnimationKey || jittering.LifeStage >= ComponentLifeStage.Stopping)
return;

if (TryComp(uid, out AnimationPlayerComponent? animationPlayer)
Expand Down
15 changes: 11 additions & 4 deletions Content.Server/Carrying/CarryingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,17 @@ private void OnMobStateChanged(EntityUid uid, CarryingComponent component, MobSt
/// </summary>
private void OnInteractionAttempt(EntityUid uid, BeingCarriedComponent component, InteractionAttemptEvent args)
{
if (args.Target == null)
// Floofstation - function body reviewed
Predicate<TransformComponent> isChildOfCarrier = null!; // C# doesn't have local functions eugh
isChildOfCarrier = (childXForm) => childXForm.ParentUid == component.Carrier
|| (childXForm.ParentUid is {Valid: true} parent && isChildOfCarrier(Transform(parent)));

if (args.Target == null // Allow self-interacts
|| isChildOfCarrier(Transform(args.Target.Value))) // Allow interacting with everything on the carriee
return;

// Also check if the interacted-with entity is on the carrier and cancel the event if not
var targetParent = Transform(args.Target.Value).ParentUid;

if (args.Target.Value != component.Carrier && targetParent != component.Carrier && targetParent != uid)
args.Cancel();
}
Expand Down Expand Up @@ -201,8 +207,9 @@ private void OnStandAttempt(EntityUid uid, BeingCarriedComponent component, Stan

private void OnInteractedWith(EntityUid uid, BeingCarriedComponent component, GettingInteractedWithAttemptEvent args)
{
if (args.Uid != component.Carrier)
args.Cancel();
// Floofstation - why.
// if (args.Uid != component.Carrier)
// args.Cancel();
}

private void OnPullAttempt(EntityUid uid, BeingCarriedComponent component, PullAttemptEvent args)
Expand Down

0 comments on commit 7b443cf

Please sign in to comment.