diff --git a/Content.Server/Hands/Systems/HandsSystem.cs b/Content.Server/Hands/Systems/HandsSystem.cs index 9d664d0f9a..ba4e6fde10 100644 --- a/Content.Server/Hands/Systems/HandsSystem.cs +++ b/Content.Server/Hands/Systems/HandsSystem.cs @@ -1,4 +1,5 @@ using System.Numerics; +using Content.Server._White.Other.ChangeThrowForceSystem; using Content.Server.Inventory; using Content.Server.Pulling; using Content.Server.Stack; @@ -206,6 +207,12 @@ namespace Content.Server.Hands.Systems var throwStrength = hands.ThrowForceMultiplier; + if (TryComp(throwEnt, out var thrownChangeForceComponent)) + { + var component = EnsureComp(player); + component.ThrowForce = thrownChangeForceComponent.ThrowForce; + } + // Let other systems change the thrown entity (useful for virtual items) // or the throw strength. var ev = new BeforeThrowEvent(throwEnt, direction, throwStrength, player); @@ -220,6 +227,8 @@ namespace Content.Server.Hands.Systems _throwingSystem.TryThrow(ev.ItemUid, ev.Direction, ev.ThrowStrength, ev.PlayerUid); + RemComp(player); + return true; } diff --git a/Content.Server/_White/Other/ChangeThrowForceSystem/ChangeThrowForceComponent.cs b/Content.Server/_White/Other/ChangeThrowForceSystem/ChangeThrowForceComponent.cs new file mode 100644 index 0000000000..5f5f78c5a2 --- /dev/null +++ b/Content.Server/_White/Other/ChangeThrowForceSystem/ChangeThrowForceComponent.cs @@ -0,0 +1,8 @@ +namespace Content.Server._White.Other.ChangeThrowForceSystem; + +[RegisterComponent] +public sealed partial class ChangeThrowForceComponent : Component +{ + [DataField, ViewVariables(VVAccess.ReadWrite)] + public float ThrowForce = 10f; +} diff --git a/Content.Server/_White/Other/ChangeThrowForceSystem/ChangeThrowForceSystem.cs b/Content.Server/_White/Other/ChangeThrowForceSystem/ChangeThrowForceSystem.cs new file mode 100644 index 0000000000..285c42ac14 --- /dev/null +++ b/Content.Server/_White/Other/ChangeThrowForceSystem/ChangeThrowForceSystem.cs @@ -0,0 +1,17 @@ +using Content.Shared.Throwing; + +namespace Content.Server._White.Other.ChangeThrowForceSystem; + +public sealed class ChangeThrowForceSystem : EntitySystem +{ + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(HandleThrow); + } + + private void HandleThrow(EntityUid uid, ChangeThrowForceComponent component, ref BeforeThrowEvent args) + { + args.ThrowStrength = component.ThrowForce; + } +} diff --git a/Content.Shared/_White/HardlightSpear/HardlightSpearSystem.cs b/Content.Shared/_White/HardlightSpear/HardlightSpearSystem.cs index eda42518a9..09deb9ddb6 100644 --- a/Content.Shared/_White/HardlightSpear/HardlightSpearSystem.cs +++ b/Content.Shared/_White/HardlightSpear/HardlightSpearSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using Content.Shared.Body.Components; using Content.Shared.Hands.EntitySystems; using Content.Shared.Implants.Components; using Content.Shared.Interaction.Events; @@ -7,6 +8,7 @@ using Content.Shared.Physics; using Content.Shared.Popups; using Content.Shared.Throwing; using Robust.Shared.Audio.Systems; +using Robust.Shared.Containers; using Robust.Shared.Physics; using Robust.Shared.Physics.Events; using Robust.Shared.Spawners; @@ -25,6 +27,7 @@ public sealed class HardlightSpearSystem : EntitySystem SubscribeLocalEvent(OnLand); SubscribeLocalEvent(OnDrop); + SubscribeLocalEvent(OnInsert); SubscribeLocalEvent(OnPickupAttempt); SubscribeLocalEvent(OnPreventCollision); SubscribeLocalEvent(OnImplantActivate); @@ -76,4 +79,10 @@ public sealed class HardlightSpearSystem : EntitySystem { EnsureComp(uid); } + + private void OnInsert(EntityUid uid, HardlightSpearComponent component, EntGotInsertedIntoContainerMessage args) + { + if (!HasComp(args.Container.Owner)) + EnsureComp(uid); + } } diff --git a/Resources/Prototypes/White/Actions/types.yml b/Resources/Prototypes/White/Actions/types.yml index 58a92d084a..25f9ce71b9 100644 --- a/Resources/Prototypes/White/Actions/types.yml +++ b/Resources/Prototypes/White/Actions/types.yml @@ -20,7 +20,7 @@ noSpawn: true components: - type: InstantAction - useDelay: 1.5 + useDelay: 2 itemIconStyle: BigAction priority: -20 icon: diff --git a/Resources/Prototypes/White/Entities/Objects/Weapons/hardlight_spear.yml b/Resources/Prototypes/White/Entities/Objects/Weapons/hardlight_spear.yml index e9eb44397e..56570149b5 100644 --- a/Resources/Prototypes/White/Entities/Objects/Weapons/hardlight_spear.yml +++ b/Resources/Prototypes/White/Entities/Objects/Weapons/hardlight_spear.yml @@ -42,3 +42,19 @@ radius: 1.5 energy: 2 color: yellow + - type: ChangeThrowForce + throwForce: 20 + - type: Fixtures + fixtures: + fix1: + shape: !type:PolygonShape + vertices: + - -0.20,-0.10 + - -0.10,-0.20 + - 0.40,0.30 + - 0.30,0.40 + density: 20 + mask: + - Opaque + restitution: 0.3 + friction: 0.2 diff --git a/Resources/Prototypes/_White/Entities/Cult/Items/forge_craft.yml b/Resources/Prototypes/_White/Entities/Cult/Items/forge_craft.yml index 1eb0b9dff5..f699037893 100644 --- a/Resources/Prototypes/_White/Entities/Cult/Items/forge_craft.yml +++ b/Resources/Prototypes/_White/Entities/Cult/Items/forge_craft.yml @@ -33,6 +33,8 @@ - Energy - type: ReturnItemOnThrow - type: CultItem + - type: ChangeThrowForce + throwForce: 6.5 - type: cultistFactoryProduction diff --git a/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/meta.json b/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/meta.json index 94fc8982f9..dafd46851a 100644 --- a/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/meta.json +++ b/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/meta.json @@ -1,7 +1,7 @@ { "version": 1, "license": "CC-BY-SA-3.0", - "copyright": "Taken from monkestation at https://github.com/Monkestation/MonkeStation/commit/c995c9bda2c23386614ac1cb00aca552f573ba9f, equipped and wielded sprites by Aviu", + "copyright": "Taken from monkestation at https://github.com/Monkestation/MonkeStation/commit/c995c9bda2c23386614ac1cb00aca552f573ba9f, equipped sprite by Aviu, wielded sprites by antohag", "size": { "x": 32, "y": 32 diff --git a/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/wielded-inhand-left.png b/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/wielded-inhand-left.png index 74cbb4eaf8..416a73d8ba 100644 Binary files a/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/wielded-inhand-left.png and b/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/wielded-inhand-left.png differ diff --git a/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/wielded-inhand-right.png b/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/wielded-inhand-right.png index 111f49782e..66d78ce7f2 100644 Binary files a/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/wielded-inhand-right.png and b/Resources/Textures/White/Objects/Weapons/hardlight_spear.rsi/wielded-inhand-right.png differ