diff --git a/Content.Server/Magic/Events/ProjectileSpellEvent.cs b/Content.Server/Magic/Events/ProjectileSpellEvent.cs new file mode 100644 index 0000000000..4867dc1407 --- /dev/null +++ b/Content.Server/Magic/Events/ProjectileSpellEvent.cs @@ -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 +{ + /// + /// What entity should be spawned. + /// + [DataField("prototype", required: true, customTypeSerializer: typeof(PrototypeIdSerializer))] + public string Prototype = default!; + + /// + /// Gets the targeted spawn positions; may lead to multiple entities being spawned. + /// + [DataField("posData")] public MagicSpawnData Pos = new TargetCasterPos(); +} diff --git a/Content.Server/Magic/MagicSystem.cs b/Content.Server/Magic/MagicSystem.cs index 6ee0f01dcf..bfb4127bf5 100644 --- a/Content.Server/Magic/MagicSystem.cs +++ b/Content.Server/Magic/MagicSystem.cs @@ -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(OnTeleportSpell); SubscribeLocalEvent(OnKnockSpell); SubscribeLocalEvent(OnWorldSpawn); - + SubscribeLocalEvent(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 GetSpawnPositions(TransformComponent casterXform, MagicSpawnData data) { switch (data) diff --git a/Content.Server/Weapon/Ranged/Systems/GunSystem.cs b/Content.Server/Weapon/Ranged/Systems/GunSystem.cs index 0e9f2efe6e..3d7cde1f99 100644 --- a/Content.Server/Weapon/Ranged/Systems/GunSystem.cs +++ b/Content.Server/Weapon/Ranged/Systems/GunSystem.cs @@ -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(uid); physics.BodyStatus = BodyStatus.InAir; diff --git a/Resources/Audio/Magic/fireball.ogg b/Resources/Audio/Magic/fireball.ogg new file mode 100644 index 0000000000..e6dbad210b Binary files /dev/null and b/Resources/Audio/Magic/fireball.ogg differ diff --git a/Resources/Audio/Magic/licenses.txt b/Resources/Audio/Magic/licenses.txt index d6cf718f20..90b77db0c7 100644 --- a/Resources/Audio/Magic/licenses.txt +++ b/Resources/Audio/Magic/licenses.txt @@ -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 \ No newline at end of file diff --git a/Resources/Locale/en-US/magic/spells-actions.ftl b/Resources/Locale/en-US/magic/spells-actions.ftl index 2c956b9664..50faf279c5 100644 --- a/Resources/Locale/en-US/magic/spells-actions.ftl +++ b/Resources/Locale/en-US/magic/spells-actions.ftl @@ -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! diff --git a/Resources/Prototypes/Entities/Objects/Magic/books.yml b/Resources/Prototypes/Entities/Objects/Magic/books.yml index 2a939f0942..0992c03c81 100644 --- a/Resources/Prototypes/Entities/Objects/Magic/books.yml +++ b/Resources/Prototypes/Entities/Objects/Magic/books.yml @@ -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 diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/magic.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/magic.yml new file mode 100644 index 0000000000..a76af85183 --- /dev/null +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/magic.yml @@ -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 diff --git a/Resources/Prototypes/Magic/projectile_spells.yml b/Resources/Prototypes/Magic/projectile_spells.yml new file mode 100644 index 0000000000..0a8924e76a --- /dev/null +++ b/Resources/Prototypes/Magic/projectile_spells.yml @@ -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 diff --git a/Resources/Textures/Objects/Magic/magicactions.rsi/fireball.png b/Resources/Textures/Objects/Magic/magicactions.rsi/fireball.png new file mode 100644 index 0000000000..b8b684b8b7 Binary files /dev/null and b/Resources/Textures/Objects/Magic/magicactions.rsi/fireball.png differ diff --git a/Resources/Textures/Objects/Magic/magicactions.rsi/gib.png b/Resources/Textures/Objects/Magic/magicactions.rsi/gib.png new file mode 100644 index 0000000000..d18136d8ae Binary files /dev/null and b/Resources/Textures/Objects/Magic/magicactions.rsi/gib.png differ diff --git a/Resources/Textures/Objects/Magic/magicactions.rsi/magicmissile.png b/Resources/Textures/Objects/Magic/magicactions.rsi/magicmissile.png new file mode 100644 index 0000000000..002a57714a Binary files /dev/null and b/Resources/Textures/Objects/Magic/magicactions.rsi/magicmissile.png differ diff --git a/Resources/Textures/Objects/Magic/magicactions.rsi/meta.json b/Resources/Textures/Objects/Magic/magicactions.rsi/meta.json index e8acf68246..9bf76bbe77 100644 --- a/Resources/Textures/Objects/Magic/magicactions.rsi/meta.json +++ b/Resources/Textures/Objects/Magic/magicactions.rsi/meta.json @@ -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" } ] } \ No newline at end of file diff --git a/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/arcane_barrage.png b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/arcane_barrage.png new file mode 100644 index 0000000000..01c0e4defd Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/arcane_barrage.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/blastwave.png b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/blastwave.png new file mode 100644 index 0000000000..1c5a61977d Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/blastwave.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/bluespace.png b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/bluespace.png new file mode 100644 index 0000000000..67118b1ae8 Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/bluespace.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/chronobolt.png b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/chronobolt.png new file mode 100644 index 0000000000..d01c2f4252 Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/chronobolt.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/cryoshot.png b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/cryoshot.png new file mode 100644 index 0000000000..fa0e71fca1 Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/cryoshot.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/declone.png b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/declone.png new file mode 100644 index 0000000000..a58e39c967 Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/declone.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/energy.png b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/energy.png new file mode 100644 index 0000000000..6e342dc484 Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/energy.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/energy2.png b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/energy2.png new file mode 100644 index 0000000000..7977e0fd11 Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/energy2.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/energy3.png b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/energy3.png new file mode 100644 index 0000000000..e9a739990f Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/energy3.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/fireball.png b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/fireball.png new file mode 100644 index 0000000000..4bc539cb0e Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/fireball.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/ice.png b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/ice.png new file mode 100644 index 0000000000..2bd8d15638 Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/ice.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/infernoshot.png b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/infernoshot.png new file mode 100644 index 0000000000..f98259a142 Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/infernoshot.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/magicm.png b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/magicm.png new file mode 100644 index 0000000000..6fc60958e7 Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/magicm.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/meta.json b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/meta.json new file mode 100644 index 0000000000..e0f5e8813b --- /dev/null +++ b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/meta.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/spell.png b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/spell.png new file mode 100644 index 0000000000..aff863515c Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/spell.png differ diff --git a/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/spellcard.png b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/spellcard.png new file mode 100644 index 0000000000..8e1c8c73e8 Binary files /dev/null and b/Resources/Textures/Objects/Weapons/Guns/Projectiles/magic.rsi/spellcard.png differ