Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Spatison committed Dec 7, 2024
1 parent e354a1c commit b2add16
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 63 deletions.
4 changes: 3 additions & 1 deletion Content.Client/Chat/UI/EmotesMenu.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Numerics;
using System.Linq;
using System.Numerics;
using Content.Client.UserInterface.Controls;
using Content.Shared.Chat.Prototypes;
using Content.Shared.Speech;
Expand Down Expand Up @@ -89,6 +90,7 @@ public EmotesMenu()
if (child is not RadialContainer container)
continue;
AddEmoteClickAction(container);
container.Radius = 64f + 32f * MathF.Log(container.Children.Count());
}
}

Expand Down
3 changes: 2 additions & 1 deletion Content.Server/Fluids/EntitySystems/AbsorbentSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Content.Server.Popups;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Coordinates;
using Content.Shared.FixedPoint;
using Content.Shared.Fluids;
using Content.Shared.Fluids.Components;
Expand Down Expand Up @@ -99,7 +100,7 @@ private void OnActivateInWorld(EntityUid uid, AbsorbentComponent component, User
if (args.Handled)
return;

Mop(uid, uid, component, args.ClickLocation, args.Target); // WD EDIT
Mop(uid, uid, component, args.Target.ToCoordinates(), args.Target); // WD EDIT
args.Handled = true;
}

Expand Down
2 changes: 1 addition & 1 deletion Content.Server/IoC/ServerContentIoC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ internal static class ServerContentIoC
public static void Register()
{
IoCManager.Register<IChatManager, ChatManager>();
IoCManager.Register<ISharedChatManager, ChatManager>();
IoCManager.Register<IChatSanitizationManager, ChatSanitizationManager>();
IoCManager.Register<IMoMMILink, MoMMILink>();
IoCManager.Register<IServerPreferencesManager, ServerPreferencesManager>();
Expand Down Expand Up @@ -66,7 +67,6 @@ public static void Register()
IoCManager.Register<PoissonDiskSampler>();
IoCManager.Register<DiscordWebhook>();
IoCManager.Register<ServerDbEntryManager>();
IoCManager.Register<JobWhitelistManager>();
IoCManager.Register<JoinQueueManager>();
IoCManager.Register<DiscordAuthManager>();
IoCManager.Register<ISharedPlaytimeManager, PlayTimeTrackingManager>();
Expand Down
61 changes: 1 addition & 60 deletions Content.Server/Projectiles/ProjectileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,13 @@ public sealed class ProjectileSystem : SharedProjectileSystem
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly GunSystem _guns = default!;
[Dependency] private readonly SharedCameraRecoilSystem _sharedCameraRecoil = default!;
// WD EDIT START
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly HandsSystem _hands = default!;
[Dependency] private readonly PhysicsSystem _physics = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly PenetratedSystem _penetrated = default!;
// WD EDIT END

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ProjectileComponent, StartCollideEvent>(OnStartCollide);
// WD EDIT START
SubscribeLocalEvent<EmbeddableProjectileComponent, EmbedEvent>(OnEmbed);
SubscribeLocalEvent<EmbeddableProjectileComponent, RemoveEmbeddedProjectileEvent>(OnEmbedRemove);
// WD EDIT END
}

Expand Down Expand Up @@ -100,60 +92,9 @@ private void OnStartCollide(EntityUid uid, ProjectileComponent component, ref St
// WD EDIT START
private void OnEmbed(EntityUid uid, EmbeddableProjectileComponent component, ref EmbedEvent args)
{
var dmg = _damageable.TryChangeDamage(args.Embedded, component.Damage, origin: args.Shooter);
var dmg = _damageableSystem.TryChangeDamage(args.Embedded, component.Damage, origin: args.Shooter);
if (dmg is { Empty: false })
_color.RaiseEffect(Color.Red, new List<EntityUid>() { args.Embedded }, Filter.Pvs(args.Embedded, entityManager: EntityManager));
}

private void OnEmbedRemove(EntityUid uid, EmbeddableProjectileComponent component, RemoveEmbeddedProjectileEvent args)
{
// Whacky prediction issues.
if (args.Cancelled)
return;

if (component.DeleteOnRemove)
{
QueueDel(uid);
FreePenetrated(uid);
return;
}

if (!TryComp<PhysicsComponent>(uid, out var physics))
{
FreePenetrated(uid);
return;
}

var xform = Transform(uid);
_physics.SetBodyType(uid, BodyType.Dynamic, body: physics, xform: xform);
_transform.AttachToGridOrMap(uid, xform);

// Reset whether the projectile has damaged anything if it successfully was removed
if (TryComp<ProjectileComponent>(uid, out var projectile))
{
projectile.Shooter = null;
projectile.Weapon = null;
projectile.DamagedEntity = false;
}

FreePenetrated(uid);

// Land it just coz uhhh yeah
var landEv = new LandEvent(args.User, true);
RaiseLocalEvent(uid, ref landEv);
_physics.WakeBody(uid, body: physics);

// try place it in the user's hand
_hands.TryPickupAnyHand(args.User, uid);
}

private void FreePenetrated(EntityUid uid, PenetratedProjectileComponent? penetratedProjectile = null)
{
if (!Resolve(uid, ref penetratedProjectile)
|| !penetratedProjectile.PenetratedUid.HasValue)
return;

_penetrated.FreePenetrated(penetratedProjectile.PenetratedUid.Value);
}
// WD EDIT END
}
13 changes: 13 additions & 0 deletions Content.Shared/Projectiles/SharedProjectileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public abstract partial class SharedProjectileSystem : EntitySystem
[Dependency] private readonly SharedHandsSystem _hands = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!; // WD EDIT
[Dependency] private readonly PenetratedSystem _penetrated = default!; // WD EDIT

public override void Initialize()
{
Expand All @@ -54,6 +55,7 @@ private void OnEmbedRemove(EntityUid uid, EmbeddableProjectileComponent componen
if (component.DeleteOnRemove)
{
QueueDel(uid);
FreePenetrated(uid); // WD EDIT
return;
}

Expand All @@ -70,6 +72,8 @@ private void OnEmbedRemove(EntityUid uid, EmbeddableProjectileComponent componen
projectile.DamagedEntity = false;
}

FreePenetrated(uid); // WD EDIT

// Land it just coz uhhh yeah
var landEv = new LandEvent(args.User, true);
RaiseLocalEvent(uid, ref landEv);
Expand Down Expand Up @@ -204,6 +208,15 @@ private bool AttemptEmbedRemove(EntityUid uid, EntityUid user, EmbeddableProject

return true;
}

private void FreePenetrated(EntityUid uid, PenetratedProjectileComponent? penetratedProjectile = null)
{
if (!Resolve(uid, ref penetratedProjectile)
|| !penetratedProjectile.PenetratedUid.HasValue)
return;

_penetrated.FreePenetrated(penetratedProjectile.PenetratedUid.Value);
}
// WD EDIT END
}

Expand Down

0 comments on commit b2add16

Please sign in to comment.