Sprint loadout action (#698)

* SpellStorage restruct

* Update CP14SpellStorageSystem.cs

* Sprint
This commit is contained in:
Ed
2025-01-05 17:46:54 +03:00
committed by GitHub
parent be3064b99c
commit 9f798b4f6c
17 changed files with 144 additions and 73 deletions

View File

@@ -265,7 +265,7 @@ public sealed partial class StaminaSystem : EntitySystem
if (oldDamage < slowdownThreshold &&
component.StaminaDamage > slowdownThreshold)
{
_stunSystem.TrySlowdown(uid, TimeSpan.FromSeconds(3), true, 0.8f, 0.8f);
//_stunSystem.TrySlowdown(uid, TimeSpan.FromSeconds(3), true, 0.8f, 0.8f); //CP14 remove stamina slowdown
}
SetStaminaAlert(uid, component);

View File

@@ -1,6 +1,7 @@
using Content.Shared._CP14.MagicRitual.Prototypes;
using Content.Shared._CP14.MagicSpell.Spells;
using Content.Shared._CP14.MagicSpellStorage;
using Content.Shared._CP14.MagicSpellStorage.Components;
using Content.Shared.DoAfter;
using Robust.Shared.Prototypes;

View File

@@ -13,7 +13,7 @@ public sealed partial class CP14SpellSpawnEntityOnTarget : CP14SpellEffect
EntityCoordinates? targetPoint = null;
if (args.Position is not null)
targetPoint = args.Position.Value;
else if (args.Target is not null && entManager.TryGetComponent<TransformComponent>(args.Target.Value, out var transformComponent))
if (args.Target is not null && entManager.TryGetComponent<TransformComponent>(args.Target.Value, out var transformComponent))
targetPoint = transformComponent.Coordinates;
if (targetPoint is null)

View File

@@ -0,0 +1,73 @@
using Content.Shared._CP14.MagicAttuning;
using Content.Shared._CP14.MagicSpellStorage.Components;
using Content.Shared.Clothing;
using Content.Shared.Clothing.Components;
using Content.Shared.Hands;
namespace Content.Shared._CP14.MagicSpellStorage;
public sealed partial class CP14SpellStorageSystem
{
private void InitializeAccess()
{
SubscribeLocalEvent<CP14SpellStorageAccessHoldingComponent, GotEquippedHandEvent>(OnEquippedHand);
SubscribeLocalEvent<CP14SpellStorageAccessHoldingComponent, AddedAttuneToMindEvent>(OnHandAddedAttune);
SubscribeLocalEvent<CP14SpellStorageAccessWearingComponent, AddedAttuneToMindEvent>(OnClothingAddedAttune);
SubscribeLocalEvent<CP14SpellStorageAccessWearingComponent, ClothingGotEquippedEvent>(OnClothingEquipped);
SubscribeLocalEvent<CP14SpellStorageAccessWearingComponent, ClothingGotUnequippedEvent>(OnClothingUnequipped);
}
private void OnEquippedHand(Entity<CP14SpellStorageAccessHoldingComponent> ent, ref GotEquippedHandEvent args)
{
if (!TryComp<CP14SpellStorageComponent>(ent, out var spellStorage))
return;
TryGrantAccess((ent, spellStorage), args.User);
}
private void OnHandAddedAttune(Entity<CP14SpellStorageAccessHoldingComponent> ent, ref AddedAttuneToMindEvent args)
{
if (!TryComp<CP14SpellStorageComponent>(ent, out var spellStorage))
return;
if (args.User is null)
return;
if (!_hands.IsHolding(args.User.Value, ent))
return;
TryGrantAccess((ent, spellStorage), args.User.Value);
}
private void OnClothingAddedAttune(Entity<CP14SpellStorageAccessWearingComponent> ent, ref AddedAttuneToMindEvent args)
{
if (!TryComp<CP14SpellStorageComponent>(ent, out var spellStorage))
return;
if (args.User is null)
return;
if (!TryComp<ClothingComponent>(ent, out var clothing))
return;
if (clothing.InSlot is null || Transform(ent).ParentUid != args.User)
return;
TryGrantAccess((ent, spellStorage), args.User.Value);
}
private void OnClothingEquipped(Entity<CP14SpellStorageAccessWearingComponent> ent, ref ClothingGotEquippedEvent args)
{
if (!TryComp<CP14SpellStorageComponent>(ent, out var spellStorage))
return;
TryGrantAccess((ent, spellStorage), args.Wearer);
}
private void OnClothingUnequipped(Entity<CP14SpellStorageAccessWearingComponent> ent, ref ClothingGotUnequippedEvent args)
{
_actions.RemoveProvidedActions(args.Wearer, ent);
}
}

View File

@@ -1,11 +1,9 @@
using Content.Shared._CP14.MagicAttuning;
using Content.Shared._CP14.MagicSpell.Components;
using Content.Shared._CP14.MagicSpell.Events;
using Content.Shared._CP14.MagicSpellStorage.Components;
using Content.Shared.Actions;
using Content.Shared.Clothing;
using Content.Shared.Clothing.Components;
using Content.Shared.Damage;
using Content.Shared.Hands;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Mind;
using Robust.Shared.Network;
@@ -27,18 +25,12 @@ public sealed partial class CP14SpellStorageSystem : EntitySystem
public override void Initialize()
{
InitializeAccess();
SubscribeLocalEvent<CP14SpellStorageComponent, MapInitEvent>(OnMagicStorageInit);
SubscribeLocalEvent<CP14SpellStorageComponent, ComponentShutdown>(OnMagicStorageShutdown);
SubscribeLocalEvent<CP14SpellStorageUseDamageComponent, CP14SpellFromSpellStorageUsedEvent>(OnSpellUsed);
SubscribeLocalEvent<CP14SpellStorageAccessHoldingComponent, GotEquippedHandEvent>(OnEquippedHand);
SubscribeLocalEvent<CP14SpellStorageAccessHoldingComponent, AddedAttuneToMindEvent>(OnHandAddedAttune);
SubscribeLocalEvent<CP14SpellStorageAccessWearingComponent, AddedAttuneToMindEvent>(OnClothingAddedAttune);
SubscribeLocalEvent<CP14SpellStorageAccessWearingComponent, ClothingGotEquippedEvent>(OnClothingEquipped);
SubscribeLocalEvent<CP14SpellStorageAccessWearingComponent, ClothingGotUnequippedEvent>(OnClothingUnequipped);
SubscribeLocalEvent<CP14SpellStorageRequireAttuneComponent, RemovedAttuneFromMindEvent>(OnRemovedAttune);
}
@@ -79,58 +71,6 @@ public sealed partial class CP14SpellStorageSystem : EntitySystem
}
}
private void OnEquippedHand(Entity<CP14SpellStorageAccessHoldingComponent> ent, ref GotEquippedHandEvent args)
{
if (!TryComp<CP14SpellStorageComponent>(ent, out var spellStorage))
return;
TryGrantAccess((ent, spellStorage), args.User);
}
private void OnHandAddedAttune(Entity<CP14SpellStorageAccessHoldingComponent> ent, ref AddedAttuneToMindEvent args)
{
if (!TryComp<CP14SpellStorageComponent>(ent, out var spellStorage))
return;
if (args.User is null)
return;
if (!_hands.IsHolding(args.User.Value, ent))
return;
TryGrantAccess((ent, spellStorage), args.User.Value);
}
private void OnClothingAddedAttune(Entity<CP14SpellStorageAccessWearingComponent> ent, ref AddedAttuneToMindEvent args)
{
if (!TryComp<CP14SpellStorageComponent>(ent, out var spellStorage))
return;
if (args.User is null)
return;
if (!TryComp<ClothingComponent>(ent, out var clothing))
return;
if (clothing.InSlot is null || Transform(ent).ParentUid != args.User)
return;
TryGrantAccess((ent, spellStorage), args.User.Value);
}
private void OnClothingEquipped(Entity<CP14SpellStorageAccessWearingComponent> ent, ref ClothingGotEquippedEvent args)
{
if (!TryComp<CP14SpellStorageComponent>(ent, out var spellStorage))
return;
TryGrantAccess((ent, spellStorage), args.Wearer);
}
private void OnClothingUnequipped(Entity<CP14SpellStorageAccessWearingComponent> ent, ref ClothingGotUnequippedEvent args)
{
_actions.RemoveProvidedActions(args.Wearer, ent);
}
private bool TryGrantAccess(Entity<CP14SpellStorageComponent> storage, EntityUid user)
{
if (!_mind.TryGetMind(user, out var mindId, out var mind))

View File

@@ -1,4 +1,4 @@
namespace Content.Shared._CP14.MagicSpellStorage;
namespace Content.Shared._CP14.MagicSpellStorage.Components;
/// <summary>
/// Denotes that this item's spells can be accessed while holding it in your hand

View File

@@ -1,4 +1,4 @@
namespace Content.Shared._CP14.MagicSpellStorage;
namespace Content.Shared._CP14.MagicSpellStorage.Components;
/// <summary>
/// Denotes that this item's spells can be accessed while wearing it on your body

View File

@@ -1,6 +1,6 @@
using Robust.Shared.Prototypes;
namespace Content.Shared._CP14.MagicSpellStorage;
namespace Content.Shared._CP14.MagicSpellStorage.Components;
/// <summary>
/// A component that allows you to store spells in items

View File

@@ -0,0 +1,14 @@
namespace Content.Shared._CP14.MagicSpellStorage.Components;
/// <summary>
/// The component allows you to use actions nested in an object not through hotbar, but through direct interaction with the object.
/// </summary>
[RegisterComponent, Access(typeof(CP14SpellStorageSystem))]
public sealed partial class CP14SpellStorageInteractionComponent : Component
{
/// <summary>
/// The selected action will automatically attempt to be used when interacting with the item.
/// </summary>
[DataField]
public int SelectedAction;
}

View File

@@ -1,4 +1,4 @@
namespace Content.Shared._CP14.MagicSpellStorage;
namespace Content.Shared._CP14.MagicSpellStorage.Components;
/// <summary>
/// The ability to access spellcasting is limited by the attuning requirement

View File

@@ -1,6 +1,6 @@
using Content.Shared.Damage;
namespace Content.Shared._CP14.MagicSpellStorage;
namespace Content.Shared._CP14.MagicSpellStorage.Components;
/// <summary>
/// Causes damage to the Spell storage when spells from it are used

View File

@@ -119,6 +119,8 @@
contents:
- id: CP14Rope
- id: CP14Rope
- id: Bola
- id: Bola
- id: CP14ModularGuardHalberd
- id: CP14BaseShield
- id: CP14ModularGripIronLongGuard
@@ -142,6 +144,8 @@
contents:
- id: CP14Rope
- id: CP14Rope
- id: Bola
- id: Bola
- id: CP14ModularGuardHalberd
- id: CP14BaseShield
- id: CP14ModularGripIronLongGuard

View File

@@ -0,0 +1,29 @@
- type: entity
id: CP14ActionSpellSprint
name: Sprint
description: At the cost of heavy stamina expenditure, you accelerate significantly in movement.
components:
- type: Sprite
sprite: _CP14/Effects/Magic/spells_icons.rsi
state: sprint
- type: CP14MagicEffectCastSlowdown
speedMultiplier: 1.6
- type: CP14MagicEffectStaminaCost
stamina: 3
- type: CP14MagicEffect
effects:
- !type:CP14SpellSpawnEntityOnTarget
spawns:
- CP14DustEffect
- type: InstantAction
itemIconStyle: BigAction
sound: !type:SoundPathSpecifier
path: /Audio/Magic/rumble.ogg
icon:
sprite: _CP14/Effects/Magic/spells_icons.rsi
state: sprint
event: !type:CP14ToggleableInstantActionEvent
effectFrequency: 0.2
cooldown: 10
castTime: 10
hidden: true

View File

@@ -44,7 +44,7 @@
- type: TimedDespawn
lifetime: 0.4
- type: Sprite
drawdepth: Effects
drawdepth: Items
sprite: _CP14/Effects/dust.rsi
state: dust
- type: EffectVisuals

View File

@@ -437,6 +437,7 @@
- CP14ActionSpellShadowGrab
- CP14ActionSpellWaterCreation
- CP14ActionSpellBeerCreation
- CP14ActionSpellSprint
- type: loadout
id: CP14ActionSpellFlameCreation
@@ -507,4 +508,10 @@
requirement:
!type:RoleTimeRequirement
role: CP14JobInnkeeper
time: 7200 # 2 hour
time: 7200 # 2 hour
- type: loadout
id: CP14ActionSpellSprint
dummyEntity: CP14ActionSpellSprint
actions:
- CP14ActionSpellSprint

View File

@@ -5,7 +5,7 @@
"y": 32
},
"license": "CLA",
"copyright": "Created by .kreks., cure_poison, cure_burn, mana_gift, water creation, beer creation and resurrection by TheShuEd",
"copyright": "Created by .kreks., cure_poison, cure_burn, mana_gift, water creation, beer creation, sprint and resurrection by TheShuEd",
"states": [
{
"name": "beer_creation"
@@ -55,6 +55,9 @@
{
"name": "sphere_of_light"
},
{
"name": "sprint"
},
{
"name": "water_creation"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B