Add govnocod

This commit is contained in:
Aviu00
2024-01-21 08:56:32 +03:00
parent 681b3dce36
commit 29f58aa28f
3 changed files with 25 additions and 9 deletions

View File

@@ -9,6 +9,7 @@ using Content.Shared.Damage.Systems;
using Content.Shared.Database; using Content.Shared.Database;
using Content.Shared.Effects; using Content.Shared.Effects;
using Content.Shared.Mobs.Components; using Content.Shared.Mobs.Components;
using Content.Shared.Projectiles;
using Content.Shared.Throwing; using Content.Shared.Throwing;
using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Components;
using Robust.Shared.Player; using Robust.Shared.Player;
@@ -62,7 +63,7 @@ namespace Content.Server.Damage.Systems
} }
// TODO: If more stuff touches this then handle it after. // TODO: If more stuff touches this then handle it after.
if (TryComp<PhysicsComponent>(uid, out var physics)) if (!HasComp<EmbeddableProjectileComponent>(uid) && TryComp<PhysicsComponent>(uid, out var physics)) // WD EDIT
{ {
_thrownItem.LandComponent(args.Thrown, args.Component, physics, false); _thrownItem.LandComponent(args.Thrown, args.Component, physics, false);
} }

View File

@@ -1,4 +1,5 @@
using System.Numerics; using System.Numerics;
using Content.Shared.Buckle;
using Content.Shared.CombatMode.Pacification; using Content.Shared.CombatMode.Pacification;
using Content.Shared.Damage; using Content.Shared.Damage;
using Content.Shared.DoAfter; using Content.Shared.DoAfter;
@@ -29,6 +30,7 @@ public abstract partial class SharedProjectileSystem : EntitySystem
[Dependency] private readonly SharedPhysicsSystem _physics = default!; [Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!; [Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly PenetratedSystem _penetratedSystem = default!; // WD [Dependency] private readonly PenetratedSystem _penetratedSystem = default!; // WD
[Dependency] private readonly SharedBuckleSystem _buckle = default!; // WD
public override void Initialize() public override void Initialize()
{ {
@@ -114,16 +116,20 @@ public abstract partial class SharedProjectileSystem : EntitySystem
if (component is {Penetrate: true, PenetratedUid: null} && if (component is {Penetrate: true, PenetratedUid: null} &&
TryComp(args.Target, out PenetratedComponent? penetrated) && TryComp(args.Target, out PenetratedComponent? penetrated) &&
penetrated is {ProjectileUid: null, IsPinned: false} && penetrated is {ProjectileUid: null, IsPinned: false} &&
TryComp(args.Target, out PhysicsComponent? physics)) TryComp(args.Target, out PhysicsComponent? physics) &&
TryComp(uid, out PhysicsComponent? body) && body.BodyStatus == BodyStatus.InAir)
{ {
component.PenetratedUid = args.Target; component.PenetratedUid = args.Target;
penetrated.ProjectileUid = uid; penetrated.ProjectileUid = uid;
_buckle.TryUnbuckle(args.Target, args.Target, true);
_physics.SetLinearVelocity(args.Target, Vector2.Zero, body: physics); _physics.SetLinearVelocity(args.Target, Vector2.Zero, body: physics);
_physics.SetBodyType(args.Target, BodyType.Static, body: physics); _physics.SetBodyType(args.Target, BodyType.Static, body: physics);
var xform = Transform(args.Target); var xform = Transform(args.Target);
_transform.AttachToGridOrMap(args.Target, xform);
_transform.SetLocalPosition(args.Target, Transform(uid).LocalPosition, xform);
_transform.SetParent(args.Target, xform, uid); _transform.SetParent(args.Target, xform, uid);
_transform.SetLocalPosition(args.Target, if (TryComp(uid, out PhysicsComponent? projPhysics))
xform.LocalPosition + Transform(uid).LocalRotation.RotateVec(new Vector2(0.5f, 0.5f)), xform); _physics.SetLinearVelocity(uid, projPhysics.LinearVelocity / 2, body: projPhysics);
Dirty(uid, component); Dirty(uid, component);
Dirty(args.Target, penetrated); Dirty(args.Target, penetrated);
return; return;
@@ -152,7 +158,7 @@ public abstract partial class SharedProjectileSystem : EntitySystem
private void Embed(EntityUid uid, EntityUid target, EmbeddableProjectileComponent component) private void Embed(EntityUid uid, EntityUid target, EmbeddableProjectileComponent component)
{ {
if (component.PreventEmbedding || component.PenetratedUid == target) // WD START if (component.PreventEmbedding || component.PenetratedUid == target || _netManager.IsClient) // WD START
return; return;
var ev = new EmbedStartEvent(component); var ev = new EmbedStartEvent(component);
@@ -255,11 +261,20 @@ public abstract partial class SharedProjectileSystem : EntitySystem
if (component.RemovalTime == null) if (component.RemovalTime == null)
return false; return false;
return _doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, user, component.RemovalTime.Value, if (!TryComp(uid, out TransformComponent? xform) || !TryComp(user, out TransformComponent? userXform) ||
!xform.Coordinates.InRange(EntityManager, _transform, userXform.Coordinates,
SharedInteractionSystem.InteractionRange + 1f) || !TryComp(user, out DoAfterComponent? doAfter))
{
return false;
}
_doAfter.TryStartDoAfter(new DoAfterArgs(EntityManager, user, component.RemovalTime.Value,
new RemoveEmbeddedProjectileEvent(), eventTarget: uid, target: uid) new RemoveEmbeddedProjectileEvent(), eventTarget: uid, target: uid)
{ {
DistanceThreshold = SharedInteractionSystem.InteractionRange, DistanceThreshold = SharedInteractionSystem.InteractionRange,
}); }, doAfter);
return true;
} }
// WD EDIT END // WD EDIT END
} }

View File

@@ -12,7 +12,7 @@
slots: slots:
- Back - Back
- type: Item - type: Item
size: 80 size: Huge
sprite: White/Objects/Weapons/crossbow.rsi sprite: White/Objects/Weapons/crossbow.rsi
- type: Gun - type: Gun
forceThrowingAngle: true forceThrowingAngle: true
@@ -68,7 +68,7 @@
sprite: White/Objects/Weapons/crossbow.rsi sprite: White/Objects/Weapons/crossbow.rsi
state: base state: base
- type: Item - type: Item
size: 80 size: Huge
sprite: White/Objects/Weapons/crossbow.rsi sprite: White/Objects/Weapons/crossbow.rsi
- type: Clothing - type: Clothing
quickEquip: false quickEquip: false