Simple Magic Spellbook System (#7823)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
42
Content.Server/Magic/Events/InstantSpawnSpellEvent.cs
Normal file
42
Content.Server/Magic/Events/InstantSpawnSpellEvent.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using Content.Shared.Actions;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Server.Magic.Events;
|
||||
|
||||
public sealed class InstantSpawnSpellEvent : InstantActionEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// What entity should be spawned.
|
||||
/// </summary>
|
||||
[DataField("prototype", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
public string Prototype = default!;
|
||||
|
||||
[ViewVariables, DataField("preventCollide")]
|
||||
public bool PreventCollideWithCaster = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the targeted spawn positons; may lead to multiple entities being spawned.
|
||||
/// </summary>
|
||||
[DataField("posData")] public MagicSpawnData Pos = new TargetCasterPos();
|
||||
}
|
||||
|
||||
[ImplicitDataDefinitionForInheritors]
|
||||
public abstract class MagicSpawnData
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Spawns 1 at the caster's feet.
|
||||
/// </summary>
|
||||
public sealed class TargetCasterPos : MagicSpawnData {}
|
||||
|
||||
/// <summary>
|
||||
/// Targets the 3 tiles in front of the caster.
|
||||
/// </summary>
|
||||
public sealed class TargetInFront : MagicSpawnData
|
||||
{
|
||||
[DataField("width")]
|
||||
public int Width = 3;
|
||||
}
|
||||
24
Content.Server/Magic/Events/KnockSpellEvent.cs
Normal file
24
Content.Server/Magic/Events/KnockSpellEvent.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Sound;
|
||||
|
||||
namespace Content.Server.Magic.Events;
|
||||
|
||||
public sealed class KnockSpellEvent : InstantActionEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// The range this spell opens doors in
|
||||
/// 4f is the default
|
||||
/// </summary>
|
||||
[DataField("range")]
|
||||
public float Range = 4f;
|
||||
|
||||
[DataField("knockSound")]
|
||||
public SoundSpecifier KnockSound = new SoundPathSpecifier("/Audio/Magic/knock.ogg");
|
||||
|
||||
/// <summary>
|
||||
/// Volume control for the spell.
|
||||
/// -6f is default because the base soundfile is really loud
|
||||
/// </summary>
|
||||
[DataField("knockVolume")]
|
||||
public float KnockVolume = -6f;
|
||||
}
|
||||
10
Content.Server/Magic/Events/TeleportSpellEvent.cs
Normal file
10
Content.Server/Magic/Events/TeleportSpellEvent.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Sound;
|
||||
|
||||
namespace Content.Server.Magic.Events;
|
||||
|
||||
public sealed class TeleportSpellEvent : WorldTargetActionEvent
|
||||
{
|
||||
[DataField("blinkSound")]
|
||||
public SoundSpecifier BlinkSound = new SoundPathSpecifier("/Audio/Magic/blink.ogg");
|
||||
}
|
||||
29
Content.Server/Magic/Events/WorldSpawnSpellEvent.cs
Normal file
29
Content.Server/Magic/Events/WorldSpawnSpellEvent.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Storage;
|
||||
|
||||
namespace Content.Server.Magic.Events;
|
||||
|
||||
public sealed class WorldSpawnSpellEvent : WorldTargetActionEvent
|
||||
{
|
||||
// TODO:This class needs combining with InstantSpawnSpellEvent
|
||||
|
||||
/// <summary>
|
||||
/// The list of prototypes this spell will spawn
|
||||
/// </summary>
|
||||
[DataField("prototypes")]
|
||||
public List<EntitySpawnEntry> Contents = new();
|
||||
|
||||
// TODO: This offset is liable for deprecation.
|
||||
/// <summary>
|
||||
/// The offset the prototypes will spawn in on relative to the one prior.
|
||||
/// Set to 0,0 to have them spawn on the same tile.
|
||||
/// </summary>
|
||||
[DataField("offset")]
|
||||
public Vector2 Offset;
|
||||
|
||||
/// <summary>
|
||||
/// Lifetime to set for the entities to self delete
|
||||
/// </summary>
|
||||
[DataField("lifetime")] public float? Lifetime;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user