Projectile spells + fireball spell (#9058)

* Projectile spells + fireball spell

* say it with some gumption
This commit is contained in:
Kara
2022-06-23 03:24:50 -07:00
committed by GitHub
parent d3233d90af
commit cc755a2051
29 changed files with 231 additions and 3 deletions

View 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();
}

View File

@@ -4,7 +4,9 @@ using Content.Server.Decals;
using Content.Server.DoAfter;
using Content.Server.Doors.Components;
using Content.Server.Magic.Events;
using Content.Server.Popups;
using Content.Server.Spawners.Components;
using Content.Server.Weapon.Ranged.Systems;
using Content.Shared.Actions;
using Content.Shared.Actions.ActionTypes;
using Content.Shared.Doors.Components;
@@ -33,6 +35,7 @@ public sealed class MagicSystem : EntitySystem
[Dependency] private readonly SharedDoorSystem _doorSystem = default!;
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
[Dependency] private readonly DoAfterSystem _doAfter = default!;
[Dependency] private readonly GunSystem _gunSystem = default!;
public override void Initialize()
{
@@ -47,7 +50,7 @@ public sealed class MagicSystem : EntitySystem
SubscribeLocalEvent<TeleportSpellEvent>(OnTeleportSpell);
SubscribeLocalEvent<KnockSpellEvent>(OnKnockSpell);
SubscribeLocalEvent<WorldSpawnSpellEvent>(OnWorldSpawn);
SubscribeLocalEvent<ProjectileSpellEvent>(OnProjectileSpell);
}
private void OnInit(EntityUid uid, SpellbookComponent component, ComponentInit args)
@@ -142,6 +145,20 @@ public sealed class MagicSystem : EntitySystem
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)
{
switch (data)

View File

@@ -154,7 +154,7 @@ public sealed partial class GunSystem : SharedGunSystem
}, 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);
physics.BodyStatus = BodyStatus.InAir;

Binary file not shown.

View 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/Knock.ogg
fireball.ogg taken from /tg/station at https://github.com/tgstation/tgstation/commit/906fb0682bab6a0975b45036001c54f021f58ae7
copyright: CC BY-SA 3.0

View File

@@ -15,3 +15,7 @@ action-description-spell-blink = Teleport to the clicked location.
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-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!

View File

@@ -63,3 +63,17 @@
- type: Spellbook
instantSpells:
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

View File

@@ -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

View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 B

View File

@@ -1,7 +1,7 @@
{
"version": 1,
"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": {
"x": 32,
"y": 32
@@ -18,6 +18,15 @@
},
{
"name": "blink"
},
{
"name": "fireball"
},
{
"name": "magicmissile"
},
{
"name": "gib"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 906 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 B

View File

@@ -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"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B