Projectile spells + fireball spell (#9058)
* Projectile spells + fireball spell * say it with some gumption
20
Content.Server/Magic/Events/ProjectileSpellEvent.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using Content.Shared.Actions;
|
||||||
|
using Content.Shared.Sound;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
|
|
||||||
|
namespace Content.Server.Magic.Events;
|
||||||
|
|
||||||
|
public sealed class ProjectileSpellEvent : WorldTargetActionEvent
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// What entity should be spawned.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("prototype", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||||
|
public string Prototype = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the targeted spawn positions; may lead to multiple entities being spawned.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("posData")] public MagicSpawnData Pos = new TargetCasterPos();
|
||||||
|
}
|
||||||
@@ -4,7 +4,9 @@ using Content.Server.Decals;
|
|||||||
using Content.Server.DoAfter;
|
using Content.Server.DoAfter;
|
||||||
using Content.Server.Doors.Components;
|
using Content.Server.Doors.Components;
|
||||||
using Content.Server.Magic.Events;
|
using Content.Server.Magic.Events;
|
||||||
|
using Content.Server.Popups;
|
||||||
using Content.Server.Spawners.Components;
|
using Content.Server.Spawners.Components;
|
||||||
|
using Content.Server.Weapon.Ranged.Systems;
|
||||||
using Content.Shared.Actions;
|
using Content.Shared.Actions;
|
||||||
using Content.Shared.Actions.ActionTypes;
|
using Content.Shared.Actions.ActionTypes;
|
||||||
using Content.Shared.Doors.Components;
|
using Content.Shared.Doors.Components;
|
||||||
@@ -33,6 +35,7 @@ public sealed class MagicSystem : EntitySystem
|
|||||||
[Dependency] private readonly SharedDoorSystem _doorSystem = default!;
|
[Dependency] private readonly SharedDoorSystem _doorSystem = default!;
|
||||||
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
|
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
|
||||||
[Dependency] private readonly DoAfterSystem _doAfter = default!;
|
[Dependency] private readonly DoAfterSystem _doAfter = default!;
|
||||||
|
[Dependency] private readonly GunSystem _gunSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -47,7 +50,7 @@ public sealed class MagicSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<TeleportSpellEvent>(OnTeleportSpell);
|
SubscribeLocalEvent<TeleportSpellEvent>(OnTeleportSpell);
|
||||||
SubscribeLocalEvent<KnockSpellEvent>(OnKnockSpell);
|
SubscribeLocalEvent<KnockSpellEvent>(OnKnockSpell);
|
||||||
SubscribeLocalEvent<WorldSpawnSpellEvent>(OnWorldSpawn);
|
SubscribeLocalEvent<WorldSpawnSpellEvent>(OnWorldSpawn);
|
||||||
|
SubscribeLocalEvent<ProjectileSpellEvent>(OnProjectileSpell);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInit(EntityUid uid, SpellbookComponent component, ComponentInit args)
|
private void OnInit(EntityUid uid, SpellbookComponent component, ComponentInit args)
|
||||||
@@ -142,6 +145,20 @@ public sealed class MagicSystem : EntitySystem
|
|||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnProjectileSpell(ProjectileSpellEvent ev)
|
||||||
|
{
|
||||||
|
if (ev.Handled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var xform = Transform(ev.Performer);
|
||||||
|
|
||||||
|
foreach (var pos in GetSpawnPositions(xform, ev.Pos))
|
||||||
|
{
|
||||||
|
var ent = Spawn(ev.Prototype, pos.SnapToGrid(EntityManager, _mapManager));
|
||||||
|
_gunSystem.ShootProjectile(ent,ev.Target.Position - Transform(ent).MapPosition.Position, ev.Performer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private List<EntityCoordinates> GetSpawnPositions(TransformComponent casterXform, MagicSpawnData data)
|
private List<EntityCoordinates> GetSpawnPositions(TransformComponent casterXform, MagicSpawnData data)
|
||||||
{
|
{
|
||||||
switch (data)
|
switch (data)
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ public sealed partial class GunSystem : SharedGunSystem
|
|||||||
}, false);
|
}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShootProjectile(EntityUid uid, Vector2 direction, EntityUid? user = null)
|
public void ShootProjectile(EntityUid uid, Vector2 direction, EntityUid? user = null)
|
||||||
{
|
{
|
||||||
var physics = EnsureComp<PhysicsComponent>(uid);
|
var physics = EnsureComp<PhysicsComponent>(uid);
|
||||||
physics.BodyStatus = BodyStatus.InAir;
|
physics.BodyStatus = BodyStatus.InAir;
|
||||||
|
|||||||
BIN
Resources/Audio/Magic/fireball.ogg
Normal file
@@ -2,4 +2,6 @@ https://github.com/Citadel-Station-13/Citadel-Station-13/blob/master/sound/magic
|
|||||||
https://github.com/Citadel-Station-13/Citadel-Station-13/blob/master/sound/magic/blink.ogg
|
https://github.com/Citadel-Station-13/Citadel-Station-13/blob/master/sound/magic/blink.ogg
|
||||||
https://github.com/Citadel-Station-13/Citadel-Station-13/blob/master/sound/magic/Knock.ogg
|
https://github.com/Citadel-Station-13/Citadel-Station-13/blob/master/sound/magic/Knock.ogg
|
||||||
|
|
||||||
|
fireball.ogg taken from /tg/station at https://github.com/tgstation/tgstation/commit/906fb0682bab6a0975b45036001c54f021f58ae7
|
||||||
|
|
||||||
copyright: CC BY-SA 3.0
|
copyright: CC BY-SA 3.0
|
||||||
@@ -15,3 +15,7 @@ action-description-spell-blink = Teleport to the clicked location.
|
|||||||
action-name-spell-summon-magicarp = Summon Magicarp
|
action-name-spell-summon-magicarp = Summon Magicarp
|
||||||
action-description-spell-summon-magicarp = This spell summons three Magi-Carp to your aid! May or may not turn on user.
|
action-description-spell-summon-magicarp = This spell summons three Magi-Carp to your aid! May or may not turn on user.
|
||||||
action-speech-spell-summon-magicarp = AIE KHUSE EU
|
action-speech-spell-summon-magicarp = AIE KHUSE EU
|
||||||
|
|
||||||
|
action-name-spell-fireball = Fireball
|
||||||
|
action-description-spell-fireball = Fires an explosive fireball towards the clicked location.
|
||||||
|
action-speech-spell-fireball = ONI'SOMA!
|
||||||
|
|||||||
@@ -63,3 +63,17 @@
|
|||||||
- type: Spellbook
|
- type: Spellbook
|
||||||
instantSpells:
|
instantSpells:
|
||||||
Knock: -1
|
Knock: -1
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
id: FireballSpellbook
|
||||||
|
name: fireball spellbook
|
||||||
|
parent: BaseSpellbook
|
||||||
|
components:
|
||||||
|
- type: Sprite
|
||||||
|
netsync: false
|
||||||
|
sprite: Objects/Magic/spellbooks.rsi
|
||||||
|
layers:
|
||||||
|
- state: bookfireball
|
||||||
|
- type: Spellbook
|
||||||
|
worldSpells:
|
||||||
|
Fireball: -1
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
- type: entity
|
||||||
|
id: ProjectileFireball
|
||||||
|
name: fireball
|
||||||
|
description: You better GITTAH WEIGH.
|
||||||
|
parent: BulletRocket
|
||||||
|
noSpawn: true
|
||||||
|
components:
|
||||||
|
- type: Sprite
|
||||||
|
sprite: Objects/Weapons/Guns/Projectiles/magic.rsi
|
||||||
|
layers:
|
||||||
|
- state: fireball
|
||||||
|
- type: Explosive
|
||||||
|
explosionType: Default
|
||||||
|
maxIntensity: 40
|
||||||
|
intensitySlope: 6
|
||||||
|
totalIntensity: 200
|
||||||
|
maxTileBreak: 0
|
||||||
17
Resources/Prototypes/Magic/projectile_spells.yml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
- type: worldTargetAction
|
||||||
|
id: Fireball
|
||||||
|
name: action-name-spell-fireball
|
||||||
|
description: action-description-spell-fireball
|
||||||
|
useDelay: 30
|
||||||
|
speech: action-speech-spell-fireball
|
||||||
|
itemIconStyle: BigAction
|
||||||
|
checkCanAccess: false
|
||||||
|
range: 60
|
||||||
|
sound: !type:SoundPathSpecifier
|
||||||
|
path: /Audio/Magic/fireball.ogg
|
||||||
|
icon:
|
||||||
|
sprite: Objects/Magic/magicactions.rsi
|
||||||
|
state: fireball
|
||||||
|
serverEvent: !type:ProjectileSpellEvent
|
||||||
|
prototype: ProjectileFireball
|
||||||
|
posData: !type:TargetCasterPos
|
||||||
BIN
Resources/Textures/Objects/Magic/magicactions.rsi/fireball.png
Normal file
|
After Width: | Height: | Size: 533 B |
BIN
Resources/Textures/Objects/Magic/magicactions.rsi/gib.png
Normal file
|
After Width: | Height: | Size: 988 B |
|
After Width: | Height: | Size: 364 B |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"version": 1,
|
"version": 1,
|
||||||
"license": "CC-BY-SA-3.0",
|
"license": "CC-BY-SA-3.0",
|
||||||
"copyright": "https://github.com/Citadel-Station-13/Citadel-Station-13/commit/78db6bd5c2b2b3d1f5cd8fd75be3a39d5d929943",
|
"copyright": "https://github.com/Citadel-Station-13/Citadel-Station-13/commit/78db6bd5c2b2b3d1f5cd8fd75be3a39d5d929943 andhttps://github.com/tgstation/tgstation/commit/906fb0682bab6a0975b45036001c54f021f58ae7 ",
|
||||||
"size": {
|
"size": {
|
||||||
"x": 32,
|
"x": 32,
|
||||||
"y": 32
|
"y": 32
|
||||||
@@ -18,6 +18,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "blink"
|
"name": "blink"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fireball"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "magicmissile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "gib"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
After Width: | Height: | Size: 356 B |
|
After Width: | Height: | Size: 906 B |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 320 B |
|
After Width: | Height: | Size: 249 B |
|
After Width: | Height: | Size: 325 B |
|
After Width: | Height: | Size: 384 B |
|
After Width: | Height: | Size: 395 B |
|
After Width: | Height: | Size: 417 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 334 B |
|
After Width: | Height: | Size: 468 B |
|
After Width: | Height: | Size: 488 B |
@@ -0,0 +1,128 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"license": "CC-BY-SA-3.0",
|
||||||
|
"copyright": "Tgstation at https://github.com/tgstation/tgstation/commit/906fb0682bab6a0975b45036001c54f021f58ae7",
|
||||||
|
"size": {
|
||||||
|
"x": 32,
|
||||||
|
"y": 32
|
||||||
|
},
|
||||||
|
"states": [
|
||||||
|
{
|
||||||
|
"name": "energy",
|
||||||
|
"delays": [
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "magicm",
|
||||||
|
"delays": [
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "spell",
|
||||||
|
"delays": [
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ice"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "declone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "bluespace",
|
||||||
|
"delays": [
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "energy2",
|
||||||
|
"delays": [
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "energy3",
|
||||||
|
"delays": [
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "chronobolt"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "arcane_barrage"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fireball",
|
||||||
|
"delays": [
|
||||||
|
[
|
||||||
|
0.095,
|
||||||
|
0.095,
|
||||||
|
0.095,
|
||||||
|
0.095,
|
||||||
|
0.095
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "spellcard"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "blastwave",
|
||||||
|
"delays": [
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "infernoshot",
|
||||||
|
"delays": [
|
||||||
|
[
|
||||||
|
0.1,
|
||||||
|
0.1,
|
||||||
|
0.1
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "cryoshot"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 352 B |
|
After Width: | Height: | Size: 371 B |