Skip to content

Commit

Permalink
Bugfixes (#139)
Browse files Browse the repository at this point in the history
# Changelog

<!--
You can add an author after the `:cl:` to change the name that appears
in the changelog (ex: `:cl: Death`)
Leaving it blank will default to your GitHub display name
This includes all available types for the changelog
-->

:cl: Mnemotechnician
- tweak: Improved the footprints system to properly adhere to energy &
mass conservation principles.
- fix: Fixed leash length settings and added popups to them.
- fix: Fixed lying down near a table allowing to bypass barriers.
- fix: Deep fryer and music band UIs should now work correctly.
- fix: Fixed lingering color effects from stamina and damage.
- fix: Minor fixes: made table frames climbable, made ashtrays work
correctly, made welders require being lit in order to weld glass. See
the PR Fansana/floofstation1#452 for more
details.
  • Loading branch information
sleepyyapril authored Jan 8, 2025
2 parents faaf3b5 + 86d8e56 commit 1911b98
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 27 deletions.
13 changes: 8 additions & 5 deletions Content.Client/Effects/ColorFlashEffectSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ private void OnEffectAnimationCompleted(EntityUid uid, ColorFlashEffectComponent
sprite.Color = component.Color;
}

RemCompDeferred<ColorFlashEffectComponent>(uid);
// Floof - commented this out due to a race condition. It's quite complicated to explain;
// in short terms, don't do deferred component removal when dealing with concurrent tasks concerning the same component.
// RemCompDeferred<ColorFlashEffectComponent>(uid);
}

private Animation? GetDamageAnimation(EntityUid uid, Color color, SpriteComponent? sprite = null)
Expand Down Expand Up @@ -107,10 +109,11 @@ private void OnColorFlashEffect(ColorFlashEffectEvent ev)
continue;
}

if (TryComp<ColorFlashEffectComponent>(ent, out var effect))
{
sprite.Color = effect.Color;
}
// Floof - commented out. This is handled by the animation complete event.
// if (TryComp<ColorFlashEffectComponent>(ent, out var effect))
// {
// sprite.Color = effect.Color;
// }

var animation = GetDamageAnimation(ent, color, sprite);

Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Carrying/CarryingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ private void Carry(EntityUid carrier, EntityUid carried)
if (TryComp<PullableComponent>(carried, out var pullable))
_pullingSystem.TryStopPull(carried, pullable);

EnsureComp<KnockedDownComponent>(carried); // Floof - moved this statement up because some systems can break carrying in response to knockdown
_transform.AttachToGridOrMap(carrier);
_transform.AttachToGridOrMap(carried);
_transform.SetCoordinates(carried, Transform(carrier).Coordinates);
Expand All @@ -281,7 +282,6 @@ private void Carry(EntityUid carrier, EntityUid carried)
var carryingComp = EnsureComp<CarryingComponent>(carrier);
ApplyCarrySlowdown(carrier, carried);
var carriedComp = EnsureComp<BeingCarriedComponent>(carried);
EnsureComp<KnockedDownComponent>(carried);

carryingComp.Carried = carried;
carriedComp.Carrier = carrier;
Expand Down
1 change: 1 addition & 0 deletions Content.Server/FootPrint/PuddleFootPrintsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace Content.Server.FootPrint;

// Floof: this system has been effectively rewritten. DO NOT MERGE UPSTREAM CHANGES.
public sealed class PuddleFootPrintsSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _protoMan = default!;
Expand Down
3 changes: 2 additions & 1 deletion Content.Server/Instruments/InstrumentSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ private void OnBoundUIRequestBands(EntityUid uid, InstrumentComponent component,
// Maybe a bit expensive but oh well GetBands is queued and has a timer anyway.
// Make sure the instrument is visible, uses the Opaque collision group so this works across windows etc.
if (!_interactions.InRangeUnobstructed(uid, entity, MaxInstrumentBandRange,
CollisionGroup.Opaque, e => e == playerUid || e == originPlayer))
CollisionGroup.Opaque,
e => e == playerUid || e == originPlayer || !HasComp<OccluderComponent>(e))) // Floof - added the occluder check.
continue;

if (!metadataQuery.TryGetComponent(playerUid, out var playerMetadata)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private void OnInteractUsing(EntityUid uid, DeepFryerComponent component, Intera

private void OnInsertItem(EntityUid uid, DeepFryerComponent component, DeepFryerInsertItemMessage args)
{
var user = EntityManager.GetEntity(args.Entity);
var user = args.Actor; // Floof - fix

if (!TryComp<HandsComponent>(user, out var handsComponent) ||
handsComponent.ActiveHandEntity == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ private void OnRemoveItem(EntityUid uid, DeepFryerComponent component, DeepFryer
if (!_containerSystem.Remove(removedItem, component.Storage))
return;

var user = EntityManager.GetEntity(args.Entity);
var user = args.Actor; // Floof - fix;

_handsSystem.TryPickupAnyHand(user, removedItem);

Expand Down Expand Up @@ -601,7 +601,7 @@ private bool TryGetActiveHandSolutionContainer(

private void OnScoopVat(EntityUid uid, DeepFryerComponent component, DeepFryerScoopVatMessage args)
{
var user = EntityManager.GetEntity(args.Entity);
var user = args.Actor; // Floof - fix

if (!TryGetActiveHandSolutionContainer(uid, user, out var heldItem, out var heldSolution,
out var transferAmount))
Expand All @@ -622,7 +622,7 @@ private void OnScoopVat(EntityUid uid, DeepFryerComponent component, DeepFryerSc

private void OnClearSlagStart(EntityUid uid, DeepFryerComponent component, DeepFryerClearSlagMessage args)
{
var user = EntityManager.GetEntity(args.Entity);
var user = args.Actor; // Floof - fix

if (!TryGetActiveHandSolutionContainer(uid, user, out var heldItem, out var heldSolution,
out var transferAmount))
Expand Down Expand Up @@ -662,7 +662,7 @@ private void OnRemoveAllItems(EntityUid uid, DeepFryerComponent component, DeepF

_containerSystem.EmptyContainer(component.Storage);

var user = EntityManager.GetEntity(args.Entity);
var user = args.Actor; // Floof - fix

_adminLogManager.Add(LogType.Action, LogImpact.Low,
$"{ToPrettyString(user)} removed all items from {ToPrettyString(uid)}.");
Expand Down
22 changes: 12 additions & 10 deletions Content.Shared/Floofstation/Leash/LeashSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Linq;
using Content.Shared.Clothing.Components;
using Content.Shared.DoAfter;
using Content.Shared.Examine;
using Content.Shared.Floofstation.Leash.Components;
using Content.Shared.Hands.Components;
using Content.Shared.Input;
Expand Down Expand Up @@ -50,6 +51,7 @@ public override void Initialize()
SubscribeLocalEvent<LeashedComponent, JointRemovedEvent>(OnJointRemoved, after: [typeof(SharedJointSystem)]);
SubscribeLocalEvent<LeashedComponent, GetVerbsEvent<InteractionVerb>>(OnGetLeashedVerbs);

SubscribeLocalEvent<LeashComponent, ExaminedEvent>(OnLeashExamined);
SubscribeLocalEvent<LeashComponent, EntGotInsertedIntoContainerMessage>(OnLeashInserted);
SubscribeLocalEvent<LeashComponent, EntGotRemovedFromContainerMessage>(OnLeashRemoved);
SubscribeLocalEvent<LeashComponent, GetVerbsEvent<AlternativeVerb>>(OnGetLeashVerbs);
Expand Down Expand Up @@ -185,7 +187,7 @@ private void OnGetLeashedVerbs(Entity<LeashedComponent> ent, ref GetVerbsEvent<I

private void OnGetLeashVerbs(Entity<LeashComponent> ent, ref GetVerbsEvent<AlternativeVerb> args)
{
if (ent.Comp.LengthConfigs is not { } configurations)
if (!args.CanAccess || !args.CanInteract || ent.Comp.LengthConfigs is not { } configurations)
return;

// Add a menu listing each length configuration
Expand Down Expand Up @@ -229,6 +231,12 @@ private void OnJointRemoved(Entity<LeashedComponent> ent, ref JointRemovedEvent
});
}

private void OnLeashExamined(Entity<LeashComponent> ent, ref ExaminedEvent args)
{
var length = ent.Comp.Length;
args.PushMarkup(Loc.GetString("leash-length-examine-text", ("length", length)));
}

private void OnLeashInserted(Entity<LeashComponent> ent, ref EntGotInsertedIntoContainerMessage args)
{
if (!_net.IsClient)
Expand Down Expand Up @@ -261,7 +269,8 @@ private void OnDetachDoAfter(Entity<LeashedComponent> ent, ref LeashDetachDoAfte

private bool OnRequestPullLeash(ICommonSession? session, EntityCoordinates targetCoords, EntityUid uid)
{
if (session?.AttachedEntity is not { } player
if (_net.IsClient
|| session?.AttachedEntity is not { } player
|| !player.IsValid()
|| !TryComp<HandsComponent>(player, out var hands)
|| hands.ActiveHandEntity is not {} leash
Expand Down Expand Up @@ -373,14 +382,6 @@ public bool TryLeash(Entity<LeashAnchorComponent> anchor, Entity<LeashComponent>
if (!CanLeash(anchor, leash) || !TryGetLeashTarget(anchor!, out var leashTarget))
return false;

// We reuse pulling attempt here because eugh it already exists
var attempt = new PullAttemptEvent(leash, anchor);
RaiseLocalEvent(anchor, attempt);
RaiseLocalEvent(leash, attempt);

if (attempt.Cancelled)
return false;

var doAfter = new DoAfterArgs(EntityManager, user, leash.Comp.AttachDelay, new LeashAttachDoAfterEvent(), anchor, leashTarget, leash)
{
BreakOnDamage = true,
Expand Down Expand Up @@ -509,6 +510,7 @@ public void SetLeashLength(Entity<LeashComponent> leash, float length)
{
leash.Comp.Length = length;
RefreshJoints(leash);
_popups.PopupPredicted(Loc.GetString("leash-set-length-popup", ("length", length)), leash.Owner, null);
}

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions Content.Shared/Footprint/FootPrintsComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace Content.Shared.FootPrint;

// Floof: this system has been effectively rewriteen. DO NOT MERGE UPSTREAM CHANGES.
[RegisterComponent]
public sealed partial class FootPrintsComponent : Component
{
Expand Down
1 change: 1 addition & 0 deletions Content.Shared/Footprint/PuddleFootPrintsComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Content.Shared.FootPrint;

// Floof: this system has been effectively rewriteen. DO NOT MERGE UPSTREAM CHANGES.
[RegisterComponent]
public sealed partial class PuddleFootPrintsComponent : Component
{
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Standing/StandingStateSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private void Climb(EntityUid uid)

var entityDistances = new Dictionary<EntityUid, float>();

foreach (var entity in _lookup.GetEntitiesInRange(uid, 0.3f))
foreach (var entity in _lookup.GetEntitiesIntersecting(uid)) // Floof - changed to GetEntitiesIntersecting to avoid climbing through walls
if (HasComp<ClimbableComponent>(entity))
entityDistances[entity] = (Transform(uid).Coordinates.Position - Transform(entity).Coordinates.Position).LengthSquared();

Expand Down
10 changes: 10 additions & 0 deletions Content.Shared/Tools/Systems/SharedToolSystem.Welder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ private void CanCancelWelderUse(Entity<WelderComponent> entity, EntityUid user,
}
}

// Floof - for some reason, wizden impl lacked this.
private void OnWelderUseAttempt(Entity<WelderComponent> entity, ref ToolUseAttemptEvent args)
{
if (ItemToggle.IsActivated(entity.Owner))
return;

_popup.PopupPredicted(Loc.GetString("welder-component-welder-not-lit-message"), entity, args.User);
args.Cancel();
}

private void OnWelderDoAfter(Entity<WelderComponent> ent, ref ToolDoAfterEvent args)
{
if (args.Cancelled)
Expand Down
3 changes: 3 additions & 0 deletions Resources/Locale/en-US/floofstation/leash/leash.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ leash-detaching-popup-others = {THE($user)} is trying to remove the leash {$isSe
}...
leash-snap-popup = {THE($leash)} snaps off!
leash-set-length-popup = Length set to {$length}m.
leash-length-examine-text = Its current length is {$length}m.
5 changes: 1 addition & 4 deletions Resources/Prototypes/Entities/Objects/Decoration/ashtray.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- type: entity
id: Ashtray
parent: BaseItem
parent: BaseStorageItem # Floof - reparented
name: ashtray
description: Proven by scientists to improve the smoking experience by 37%!
components:
Expand All @@ -22,9 +22,6 @@
maxItemSize: Tiny
grid:
- 0,0,9,0
- type: ContainerContainer
containers:
storagebase: !type:Container
- type: StorageFillVisualizer
fillBaseName: icon
maxFillLevels: 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
- type: Construction
graph: Table
node: TableFrame
- type: Climbable # Floof - making table frames climbable

- type: entity
id: CounterWoodFrame
Expand Down Expand Up @@ -109,6 +110,7 @@
- type: Construction
graph: Table
node: CounterWoodFrame
- type: Climbable # Floof - making table frames climbable

- type: entity
id: CounterMetalFrame
Expand Down

0 comments on commit 1911b98

Please sign in to comment.