diff --git a/Content.Server/Stunnable/StunOnCollideSystem.cs b/Content.Server/Stunnable/StunOnCollideSystem.cs index 9143c9b09b..b9c8f6230b 100644 --- a/Content.Server/Stunnable/StunOnCollideSystem.cs +++ b/Content.Server/Stunnable/StunOnCollideSystem.cs @@ -6,6 +6,7 @@ using JetBrains.Annotations; using Robust.Shared.GameObjects; using Robust.Shared.IoC; using Robust.Shared.Physics.Dynamics; +using Content.Shared.Throwing; namespace Content.Server.Stunnable { @@ -18,28 +19,37 @@ namespace Content.Server.Stunnable { base.Initialize(); SubscribeLocalEvent(HandleCollide); + SubscribeLocalEvent(HandleThrow); } - private void HandleCollide(EntityUid uid, StunOnCollideComponent component, StartCollideEvent args) + private void TryDoCollideStun(EntityUid uid, StunOnCollideComponent component, EntityUid target) { - var otherUid = args.OtherFixture.Body.Owner; - if (EntityManager.TryGetComponent(otherUid, out var status)) + if (EntityManager.TryGetComponent(target, out var status)) { StandingStateComponent? standingState = null; AppearanceComponent? appearance = null; // Let the actual methods log errors for these. - Resolve(otherUid, ref standingState, ref appearance, false); + Resolve(target, ref standingState, ref appearance, false); - _stunSystem.TryStun(otherUid, TimeSpan.FromSeconds(component.StunAmount), true, status); + _stunSystem.TryStun(target, TimeSpan.FromSeconds(component.StunAmount), true, status); - _stunSystem.TryKnockdown(otherUid, TimeSpan.FromSeconds(component.KnockdownAmount), true, + _stunSystem.TryKnockdown(target, TimeSpan.FromSeconds(component.KnockdownAmount), true, status); - _stunSystem.TrySlowdown(otherUid, TimeSpan.FromSeconds(component.SlowdownAmount), true, + _stunSystem.TrySlowdown(target, TimeSpan.FromSeconds(component.SlowdownAmount), true, component.WalkSpeedMultiplier, component.RunSpeedMultiplier, status); } } + private void HandleCollide(EntityUid uid, StunOnCollideComponent component, StartCollideEvent args) + { + TryDoCollideStun(uid, component, args.OtherFixture.Body.Owner); + } + + private void HandleThrow(EntityUid uid, StunOnCollideComponent component, ThrowDoHitEvent args) + { + TryDoCollideStun(uid, component, args.Target); + } } } diff --git a/Resources/Audio/Effects/snap.ogg b/Resources/Audio/Effects/snap.ogg new file mode 100644 index 0000000000..d8804bc6e9 Binary files /dev/null and b/Resources/Audio/Effects/snap.ogg differ diff --git a/Resources/Audio/Weapons/bolathrow.ogg b/Resources/Audio/Weapons/bolathrow.ogg new file mode 100644 index 0000000000..3834a0fa05 Binary files /dev/null and b/Resources/Audio/Weapons/bolathrow.ogg differ diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Throwable/bola.yml b/Resources/Prototypes/Entities/Objects/Weapons/Throwable/bola.yml new file mode 100644 index 0000000000..cfc5790086 --- /dev/null +++ b/Resources/Prototypes/Entities/Objects/Weapons/Throwable/bola.yml @@ -0,0 +1,21 @@ +- type: entity + name: bola + parent: BaseItem + id: Bola + description: Linked together with some spare cuffs and metal. + components: + - type: Item + size: 20 + - type: Sprite + sprite: Objects/Weapons/Throwable/bola.rsi + state: icon + - type: EmitSoundOnThrow + sound: /Audio/Weapons/bolathrow.ogg + - type: EmitSoundOnLand + sound: /Audio/Effects/snap.ogg + - type: StunOnCollide + stunAmount: 1 + knockdownAmount: 3 + - type: Construction + graph: bola + node: bola diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/weapons/bola.yml b/Resources/Prototypes/Recipes/Construction/Graphs/weapons/bola.yml new file mode 100644 index 0000000000..4f3fda405a --- /dev/null +++ b/Resources/Prototypes/Recipes/Construction/Graphs/weapons/bola.yml @@ -0,0 +1,20 @@ +- type: constructionGraph + id: bola + start: start + graph: + - node: start + edges: + - to: bola + steps: + - tag: Handcuffs + icon: + sprite: Objects/Misc/cablecuffs.rsi + state: cuff + color: red + name: cuffs + - material: Steel + amount: 6 + doAfter: 2 + + - node: bola + entity: Bola diff --git a/Resources/Prototypes/Recipes/Construction/weapons.yml b/Resources/Prototypes/Recipes/Construction/weapons.yml index 35a701155e..1c3c1d9113 100644 --- a/Resources/Prototypes/Recipes/Construction/weapons.yml +++ b/Resources/Prototypes/Recipes/Construction/weapons.yml @@ -1,4 +1,4 @@ -- type: construction +- type: construction name: crude spear id: spear graph: spear @@ -8,3 +8,14 @@ description: A crude spear for when you need to put holes in somebody. icon: Objects/Weapons/Melee/spear.rsi/spear.png objectType: Item + +- type: construction + name: makeshift bola + id: bola + graph: bola + startNode: start + targetNode: bola + category: Weapons + description: A simple weapon for tripping someone at a distance. + icon: Objects/Weapons/Throwable/bola.rsi/icon.png + objectType: Item diff --git a/Resources/Textures/Objects/Weapons/Throwable/bola.rsi/icon.png b/Resources/Textures/Objects/Weapons/Throwable/bola.rsi/icon.png new file mode 100644 index 0000000000..1be4dd4e35 Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Throwable/bola.rsi/icon.png differ diff --git a/Resources/Textures/Objects/Weapons/Throwable/bola.rsi/meta.json b/Resources/Textures/Objects/Weapons/Throwable/bola.rsi/meta.json new file mode 100644 index 0000000000..9efc29f585 --- /dev/null +++ b/Resources/Textures/Objects/Weapons/Throwable/bola.rsi/meta.json @@ -0,0 +1,14 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Taken from Citadel Station at https://github.com/Citadel-Station-13/Citadel-Station-13/commit/3cfea7eb92246d311de8b531347795bc76d6dab6", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "icon" + } + ] +}