bugg ice shards and add it to loadouts (#899)

This commit is contained in:
Ed
2025-02-14 16:19:33 +03:00
committed by GitHub
parent c038c021f8
commit a2fa880820
7 changed files with 360 additions and 249 deletions

View File

@@ -0,0 +1,69 @@
using Content.Shared._CP14.MagicSpell.Components;
using Content.Shared._CP14.MagicSpell.Events;
using Content.Shared._CP14.MagicSpell.Spells;
namespace Content.Shared._CP14.MagicSpell;
public abstract partial class CP14SharedMagicSystem
{
private void InitializeInstantActions()
{
SubscribeLocalEvent<CP14InstantActionEvent>(OnMagicInstantAction);
SubscribeLocalEvent<CP14EntityWorldTargetActionEvent>(OnMagicEntityWorldTargetAction);
SubscribeLocalEvent<CP14EntityTargetActionEvent>(OnMagicEntityTargetAction);
}
private void OnMagicInstantAction(CP14InstantActionEvent args)
{
if (args.Handled)
return;
if (!TryComp<CP14MagicEffectComponent>(args.Action, out var magicEffect))
return;
if (!CanCastSpell((args.Action, magicEffect), args.Performer))
return;
var spellArgs =
new CP14SpellEffectBaseArgs(args.Performer, magicEffect.SpellStorage, args.Performer, Transform(args.Performer).Coordinates);
CastSpell((args.Action, magicEffect), spellArgs);
_action.CP14StartCustomDelay(args.Action, args.Cooldown);
}
private void OnMagicEntityWorldTargetAction(CP14EntityWorldTargetActionEvent args)
{
if (args.Handled)
return;
if (!TryComp<CP14MagicEffectComponent>(args.Action, out var magicEffect))
return;
if (!CanCastSpell((args.Action, magicEffect), args.Performer))
return;
var spellArgs =
new CP14SpellEffectBaseArgs(args.Performer, magicEffect.SpellStorage, args.Entity, args.Coords);
CastSpell((args.Action, magicEffect), spellArgs);
_action.CP14StartCustomDelay(args.Action, args.Cooldown);
}
private void OnMagicEntityTargetAction(CP14EntityTargetActionEvent args)
{
if (args.Handled)
return;
if (!TryComp<CP14MagicEffectComponent>(args.Action, out var magicEffect))
return;
if (!CanCastSpell((args.Action, magicEffect), args.Performer))
return;
var spellArgs =
new CP14SpellEffectBaseArgs(args.Performer, magicEffect.SpellStorage, args.Target, Transform(args.Target).Coordinates);
CastSpell((args.Action, magicEffect), spellArgs);
_action.CP14StartCustomDelay(args.Action, args.Cooldown);
}
}

View File

@@ -10,9 +10,9 @@ public abstract partial class CP14SharedMagicSystem
{
private void InitializeToggleableActions()
{
SubscribeLocalEvent<CP14ToggleableInstantActionEvent>(OnInstantAction);
SubscribeLocalEvent<CP14ToggleableEntityWorldTargetActionEvent>(OnEntityWorldTargetAction);
SubscribeLocalEvent<CP14ToggleableEntityTargetActionEvent>(OnEntityTargetAction);
SubscribeLocalEvent<CP14ToggleableInstantActionEvent>(OnToggleableInstantAction);
SubscribeLocalEvent<CP14ToggleableEntityWorldTargetActionEvent>(OnToggleableEntityWorldTargetAction);
SubscribeLocalEvent<CP14ToggleableEntityTargetActionEvent>(OnToggleableEntityTargetAction);
SubscribeLocalEvent<CP14MagicEffectComponent, CP14ToggleableInstantActionDoAfterEvent>(OnToggleableInstantActionDoAfterEvent);
SubscribeLocalEvent<CP14MagicEffectComponent, CP14ToggleableEntityWorldTargetActionDoAfterEvent>(OnToggleableEntityWorldTargetActionDoAfterEvent);
@@ -128,7 +128,7 @@ public abstract partial class CP14SharedMagicSystem
/// <summary>
/// Instant action used from hotkey event
/// </summary>
private void OnInstantAction(CP14ToggleableInstantActionEvent args)
private void OnToggleableInstantAction(CP14ToggleableInstantActionEvent args)
{
if (args.Handled)
return;
@@ -148,7 +148,7 @@ public abstract partial class CP14SharedMagicSystem
/// <summary>
/// Target action used from hotkey event
/// </summary>
private void OnEntityWorldTargetAction(CP14ToggleableEntityWorldTargetActionEvent args)
private void OnToggleableEntityWorldTargetAction(CP14ToggleableEntityWorldTargetActionEvent args)
{
if (args.Handled)
return;
@@ -171,7 +171,7 @@ public abstract partial class CP14SharedMagicSystem
/// <summary>
/// Entity target action used from hotkey event
/// </summary>
private void OnEntityTargetAction(CP14ToggleableEntityTargetActionEvent args)
private void OnToggleableEntityTargetAction(CP14ToggleableEntityTargetActionEvent args)
{
if (args.Handled)
return;

View File

@@ -43,6 +43,7 @@ public abstract partial class CP14SharedMagicSystem : EntitySystem
base.Initialize();
InitializeDelayedActions();
InitializeToggleableActions();
InitializeInstantActions();
InitializeChecks();
InitializeSlowdown();

View File

@@ -0,0 +1,27 @@
using Content.Shared.Actions;
namespace Content.Shared._CP14.MagicSpell.Events;
public interface ICP14MagicEffect
{
public TimeSpan Cooldown { get; }
}
public sealed partial class CP14EntityWorldTargetActionEvent : EntityWorldTargetActionEvent, ICP14MagicEffect
{
[DataField]
public TimeSpan Cooldown { get; private set; } = TimeSpan.FromSeconds(1f);
}
public sealed partial class CP14EntityTargetActionEvent : EntityTargetActionEvent, ICP14MagicEffect
{
[DataField]
public TimeSpan Cooldown { get; private set; } = TimeSpan.FromSeconds(1f);
}
public sealed partial class CP14InstantActionEvent : InstantActionEvent, ICP14MagicEffect
{
[DataField]
public TimeSpan Cooldown { get; private set; } = TimeSpan.FromSeconds(1f);
}

View File

@@ -15,6 +15,9 @@
effects:
- !type:CP14SpellProjectile
prototype: CP14IceShard
- !type:CP14SpellSpawnEntityOnUser
spawns:
- CP14ImpactEffectWaterCreation
- type: CP14MagicEffectVerbalAspect
endSpeech: "Glacies acus!"
- type: CP14MagicEffectCastingVisual
@@ -30,10 +33,8 @@
icon:
sprite: _CP14/Effects/Magic/spells_icons.rsi
state: ice_shards
event: !type:CP14DelayedEntityWorldTargetActionEvent
cooldown: 0.25
castDelay: 0.25
breakOnMove: false
event: !type:CP14EntityWorldTargetActionEvent
cooldown: 0.5
- type: entity
id: CP14RuneIceShards

View File

@@ -583,242 +583,3 @@
storage:
back:
- CP14KeyPersonalHouseAbstract
# Spells
- type: loadoutGroup
id: CP14GeneralSpells
name: cp14-loadout-general-spells
minLimit: 0
maxLimit: 3
loadouts:
- CP14ActionSpellFlameCreation
- CP14ActionSpellCureWounds
- CP14ActionSpellCureBurn
- CP14ActionSpellBloodPurification
- CP14ActionSpellPlantGrowth
- CP14ActionSpellSphereOfLight
- CP14ActionSpellManaConsume
- CP14ActionSpellManaGift
- CP14ActionSpellCounterSpell
- CP14ActionSpellShadowGrab
- CP14ActionSpellWaterCreation
- CP14ActionSpellFreeze
- CP14ActionSpellBeerCreation
- CP14ActionSpellSprint
- CP14ActionSpellKick
- type: loadout
id: CP14ActionSpellBase
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellFlameCreation
dummyEntity: CP14ActionSpellFlameCreation
actions:
- CP14ActionSpellFlameCreation
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellCureWounds
dummyEntity: CP14ActionSpellCureWounds
actions:
- CP14ActionSpellCureWounds
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellCureBurn
dummyEntity: CP14ActionSpellCureBurn
actions:
- CP14ActionSpellCureBurn
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellBloodPurification
dummyEntity: CP14ActionSpellBloodPurification
actions:
- CP14ActionSpellBloodPurification
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellPlantGrowth
dummyEntity: CP14ActionSpellPlantGrowth
actions:
- CP14ActionSpellPlantGrowth
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:SpeciesRequirement
species:
- CP14Silva
inverted: true # Silvas cannot take this spell, they have buffed version by default
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellSphereOfLight
dummyEntity: CP14ActionSpellSphereOfLight
actions:
- CP14ActionSpellSphereOfLight
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellManaConsume
dummyEntity: CP14ActionSpellManaConsume
actions:
- CP14ActionSpellManaConsume
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:SpeciesRequirement
species:
- CP14Elf
inverted: true # Elves cannot take this spell, they have buffed version by default
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellManaGift
dummyEntity: CP14ActionSpellManaGift
actions:
- CP14ActionSpellManaGift
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellShadowGrab
dummyEntity: CP14ActionSpellShadowGrab
actions:
- CP14ActionSpellShadowGrab
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellWaterCreation
dummyEntity: CP14ActionSpellWaterCreation
actions:
- CP14ActionSpellWaterCreation
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellFreeze
dummyEntity: CP14ActionSpellFreeze
actions:
- CP14ActionSpellFreeze
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellCounterSpell
dummyEntity: CP14ActionSpellCounterSpell
actions:
- CP14ActionSpellCounterSpell
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellBeerCreation
dummyEntity: CP14ActionSpellBeerCreation
actions:
- CP14ActionSpellBeerCreation
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:SpeciesRequirement
species:
- CP14Dwarf
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellSprint
dummyEntity: CP14ActionSpellSprint
actions:
- CP14ActionSpellSprint
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:SpeciesRequirement
species:
- CP14Goblin
inverted: true # Goblins cannot take this spell, they have buffed version by default
- type: loadout
id: CP14ActionSpellKick
dummyEntity: CP14ActionSpellKick
actions:
- CP14ActionSpellKick

View File

@@ -0,0 +1,252 @@
# Spells
- type: loadoutGroup
id: CP14GeneralSpells
name: cp14-loadout-general-spells
minLimit: 0
maxLimit: 3
loadouts:
- CP14ActionSpellFlameCreation
- CP14ActionSpellCureWounds
- CP14ActionSpellCureBurn
- CP14ActionSpellBloodPurification
- CP14ActionSpellPlantGrowth
- CP14ActionSpellSphereOfLight
- CP14ActionSpellManaConsume
- CP14ActionSpellManaGift
- CP14ActionSpellCounterSpell
- CP14ActionSpellShadowGrab
- CP14ActionSpellWaterCreation
- CP14ActionSpellIceShards
- CP14ActionSpellFreeze
- CP14ActionSpellBeerCreation
- CP14ActionSpellSprint
- CP14ActionSpellKick
- type: loadout
id: CP14ActionSpellBase
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellFlameCreation
dummyEntity: CP14ActionSpellFlameCreation
actions:
- CP14ActionSpellFlameCreation
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellCureWounds
dummyEntity: CP14ActionSpellCureWounds
actions:
- CP14ActionSpellCureWounds
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellCureBurn
dummyEntity: CP14ActionSpellCureBurn
actions:
- CP14ActionSpellCureBurn
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellBloodPurification
dummyEntity: CP14ActionSpellBloodPurification
actions:
- CP14ActionSpellBloodPurification
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellPlantGrowth
dummyEntity: CP14ActionSpellPlantGrowth
actions:
- CP14ActionSpellPlantGrowth
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:SpeciesRequirement
species:
- CP14Silva
inverted: true # Silvas cannot take this spell, they have buffed version by default
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellSphereOfLight
dummyEntity: CP14ActionSpellSphereOfLight
actions:
- CP14ActionSpellSphereOfLight
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellManaConsume
dummyEntity: CP14ActionSpellManaConsume
actions:
- CP14ActionSpellManaConsume
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:SpeciesRequirement
species:
- CP14Elf
inverted: true # Elves cannot take this spell, they have buffed version by default
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellManaGift
dummyEntity: CP14ActionSpellManaGift
actions:
- CP14ActionSpellManaGift
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellCounterSpell
dummyEntity: CP14ActionSpellCounterSpell
actions:
- CP14ActionSpellCounterSpell
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellShadowGrab
dummyEntity: CP14ActionSpellShadowGrab
actions:
- CP14ActionSpellShadowGrab
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellIceShards
dummyEntity: CP14ActionSpellIceShards
actions:
- CP14ActionSpellIceShards
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellWaterCreation
dummyEntity: CP14ActionSpellWaterCreation
actions:
- CP14ActionSpellWaterCreation
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellFreeze
dummyEntity: CP14ActionSpellFreeze
actions:
- CP14ActionSpellFreeze
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellBeerCreation
dummyEntity: CP14ActionSpellBeerCreation
actions:
- CP14ActionSpellBeerCreation
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:SpeciesRequirement
species:
- CP14Dwarf
- !type:JobRequirementLoadoutEffect
requirement:
!type:TraitsRequirement
inverted: true
traits:
- CP14ManaWasting
- type: loadout
id: CP14ActionSpellSprint
dummyEntity: CP14ActionSpellSprint
actions:
- CP14ActionSpellSprint
effects:
- !type:JobRequirementLoadoutEffect
requirement:
!type:SpeciesRequirement
species:
- CP14Goblin
inverted: true # Goblins cannot take this spell, they have buffed version by default
- type: loadout
id: CP14ActionSpellKick
dummyEntity: CP14ActionSpellKick
actions:
- CP14ActionSpellKick