]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Wizard: Repulse Spell (#35377)
authorkeronshb <54602815+keronshb@users.noreply.github.com>
Sat, 22 Feb 2025 15:56:54 +0000 (10:56 -0500)
committerGitHub <noreply@github.com>
Sat, 22 Feb 2025 15:56:54 +0000 (10:56 -0500)
Content.Shared/RepulseAttract/Events/RepulseAttractActionEvent.cs [new file with mode: 0644]
Content.Shared/RepulseAttract/RepulseAttractSystem.cs
Resources/Locale/en-US/store/spellbook-catalog.ftl
Resources/Prototypes/Catalog/spellbook_catalog.yml
Resources/Prototypes/Magic/repulse_spell.yml [new file with mode: 0644]
Resources/Textures/Objects/Magic/magicactions.rsi/meta.json
Resources/Textures/Objects/Magic/magicactions.rsi/repulse.png [new file with mode: 0644]

diff --git a/Content.Shared/RepulseAttract/Events/RepulseAttractActionEvent.cs b/Content.Shared/RepulseAttract/Events/RepulseAttractActionEvent.cs
new file mode 100644 (file)
index 0000000..ac164d4
--- /dev/null
@@ -0,0 +1,8 @@
+using Content.Shared.Actions;
+
+namespace Content.Shared.RepulseAttract.Events;
+
+// Action event to repulse/attract
+// TODO: Give speech support later for wizard
+// TODO: When actions are refactored, give action targeting data (to change between single target, all around, etc)
+public sealed partial class RepulseAttractActionEvent : InstantActionEvent;
index 9363d7bbec56ded212e9d7740bd3060f448ebc14..f95a38d2eb8d77f35d06777970da7f1892cc69f0 100644 (file)
@@ -7,6 +7,7 @@ using Content.Shared.Wieldable;
 using Robust.Shared.Map;
 using Robust.Shared.Physics.Components;
 using System.Numerics;
+using Content.Shared.RepulseAttract.Events;
 using Content.Shared.Weapons.Melee;
 
 namespace Content.Shared.RepulseAttract;
@@ -28,7 +29,9 @@ public sealed class RepulseAttractSystem : EntitySystem
         _physicsQuery = GetEntityQuery<PhysicsComponent>();
 
         SubscribeLocalEvent<RepulseAttractComponent, MeleeHitEvent>(OnMeleeAttempt, before: [typeof(UseDelayOnMeleeHitSystem)], after: [typeof(SharedWieldableSystem)]);
+        SubscribeLocalEvent<RepulseAttractComponent, RepulseAttractActionEvent>(OnRepulseAttractAction);
     }
+
     private void OnMeleeAttempt(Entity<RepulseAttractComponent> ent, ref MeleeHitEvent args)
     {
         if (_delay.IsDelayed(ent.Owner))
@@ -37,6 +40,15 @@ public sealed class RepulseAttractSystem : EntitySystem
         TryRepulseAttract(ent, args.User);
     }
 
+    private void OnRepulseAttractAction(Entity<RepulseAttractComponent> ent, ref RepulseAttractActionEvent args)
+    {
+        if (args.Handled)
+            return;
+        
+        var position = _xForm.GetMapCoordinates(args.Performer);
+        args.Handled = TryRepulseAttract(position, args.Performer, ent.Comp.Speed, ent.Comp.Range, ent.Comp.Whitelist, ent.Comp.CollisionMask);
+    }
+
     public bool TryRepulseAttract(Entity<RepulseAttractComponent> ent, EntityUid user)
     {
         var position = _xForm.GetMapCoordinates(ent.Owner);
index 73d8118fc53fe4c459a319a46b0bc3a7266223db..982f0491ed69767d65c35e076e33052e96d98564 100644 (file)
@@ -9,9 +9,12 @@ spellbook-voidapplause-name = Void Applause
 spellbook-voidapplause-desc = Swap places with the target, doesn't it make you want to do the boogie?
 
 spellbook-force-wall-name = Force Wall
-spellbook-force-wall-desc = Make three walls of pure force that you can pass through, but other's can't.
+spellbook-force-wall-desc = Make three walls of pure force that you can pass through, but others can't.
 
-spellbook-polymoprh-spider-name = Spider Polymoprh
+spellbook-repulse-name = Repulse
+spellbook-repulse-desc = Tell people to GITTAH`WEIGH and push 'em away from you.
+
+spellbook-polymorph-spider-name = Spider Polymorph
 spellbook-polymorph-spider-desc = Transforms you into a spider, man!
 
 spellbook-polymorph-rod-name = Rod Polymorph
index 768475a03b4ab31143b3ea32e981e2078557062a..3fcddc4c7cd7bd6e0bb271d28ce21d7b3e8b4844 100644 (file)
     WizCoin: 3
   categories:
   - SpellbookDefensive
+  conditions:
+  - !type:ListingLimitedStockCondition
+    stock: 1
+
+- type: listing
+  id: SpellbookRepulse
+  name: spellbook-repulse-name
+  description: spellbook-repulse-desc
+  productAction: ActionRepulse
+  cost:
+    WizCoin: 2
+  categories:
+  - SpellbookDefensive
+  conditions:
+  - !type:ListingLimitedStockCondition
+    stock: 1
 
 # Utility
 - type: listing
   id: SpellbookPolymorphSpider
-  name: spellbook-polymoprh-spider-name
+  name: spellbook-polymorph-spider-name
   description: spellbook-polymorph-spider-desc
   productAction: ActionPolymorphWizardSpider
   cost:
diff --git a/Resources/Prototypes/Magic/repulse_spell.yml b/Resources/Prototypes/Magic/repulse_spell.yml
new file mode 100644 (file)
index 0000000..77f919e
--- /dev/null
@@ -0,0 +1,20 @@
+- type: entity
+  id: ActionRepulse
+  name: Repulse
+  description: Pushes entities away from the user.
+  components:
+  - type: RepulseAttract
+    speed: 10
+    range: 5
+    whitelist:
+      components:
+      - MobMover
+      - Item
+  - type: InstantAction
+    useDelay: 40
+    raiseOnAction: true
+    itemIconStyle: BigAction
+    icon:
+      sprite: Objects/Magic/magicactions.rsi
+      state: repulse
+    event: !type:RepulseAttractActionEvent
index a1112f0c6d6091a1a44951ecdd4bd39e959e2955..3868dbefa159312fc02b3c4c00a7caccb2a75578 100644 (file)
@@ -33,6 +33,9 @@
     },
     {
       "name": "item_recall"
+    },
+    {
+      "name": "repulse"
     }
   ]
 }
diff --git a/Resources/Textures/Objects/Magic/magicactions.rsi/repulse.png b/Resources/Textures/Objects/Magic/magicactions.rsi/repulse.png
new file mode 100644 (file)
index 0000000..6e51a48
Binary files /dev/null and b/Resources/Textures/Objects/Magic/magicactions.rsi/repulse.png differ