Skip to content

Commit

Permalink
Startup
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxxoTrystan committed Nov 9, 2024
1 parent a2b86bc commit 702bf07
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 133 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ private void OnPowerUsed(DarkSwapActionEvent args)

if (_psionics.OnAttemptPowerUse(args.Performer, "DarkSwap", args.ManaCost / 2, args.CheckInsulation))
{
SpawnAtPosition("ShadowkinShadow", Transform(args.Performer).Coordinates);
SpawnAtPosition("EffectFlashShadowkinDarkSwapOff", Transform(args.Performer).Coordinates);
RemComp(args.Performer, ethereal);
args.Handled = true;
}
Expand All @@ -50,7 +52,7 @@ private void OnPowerUsed(DarkSwapActionEvent args)
}

if (args.Handled)
_psionics.LogPowerUsed(args.Performer, "DarkSwap", 0, 0);
_psionics.LogPowerUsed(args.Performer, "DarkSwap");
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion Content.Server/Shadowkin/EtherealStunItemSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ private void OnUseInHand(EntityUid uid, EtherealStunItemComponent component, Use
{
foreach (var ent in _lookup.GetEntitiesInRange(uid, component.Radius))
{
if (!TryComp<EtherealComponent>(ent, out var ethereal))
if (!TryComp<EtherealComponent>(ent, out var ethereal)
|| !ethereal.CanBeStunned)
continue;

RemComp(ent, ethereal);
Expand Down
7 changes: 2 additions & 5 deletions Content.Server/Shadowkin/EtherealSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ public override void OnShutdown(EntityUid uid, EtherealComponent component, Comp
RemComp<RespiratorImmuneComponent>(uid);
RemComp<MovementIgnoreGravityComponent>(uid);

SpawnAtPosition("ShadowkinShadow", Transform(uid).Coordinates);
SpawnAtPosition("EffectFlashShadowkinDarkSwapOff", Transform(uid).Coordinates);

foreach (var light in component.DarkenedLights.ToArray())
{
if (!TryComp<PointLightComponent>(light, out var pointLight)
Expand Down Expand Up @@ -181,7 +178,7 @@ public override void Update(float frameTime)

if (etherealLight.AttachedEntity == uid
&& _random.Prob(0.03f))
etherealLight.AttachedEntity = EntityUid.Invalid;
etherealLight.AttachedEntity = EntityUid.Invalid;

if (!etherealLight.OldRadiusEdited)
{
Expand Down Expand Up @@ -213,4 +210,4 @@ public override void Update(float frameTime)
}
}
}
}
}
29 changes: 0 additions & 29 deletions Content.Server/Shadowkin/ShadowkinCuffSystem.cs

This file was deleted.

42 changes: 4 additions & 38 deletions Content.Server/Shadowkin/ShadowkinSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,19 @@ public override void Initialize()
SubscribeLocalEvent<ShadowkinComponent, ComponentStartup>(OnInit);
SubscribeLocalEvent<ShadowkinComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<ShadowkinComponent, OnMindbreakEvent>(OnMindbreak);
SubscribeLocalEvent<ShadowkinComponent, OnAttemptPowerUseEvent>(OnAttemptPowerUse);
SubscribeLocalEvent<ShadowkinComponent, OnManaUpdateEvent>(OnManaUpdate);
SubscribeLocalEvent<ShadowkinComponent, RejuvenateEvent>(OnRejuvenate);
SubscribeLocalEvent<ShadowkinComponent, EyeColorInitEvent>(OnEyeColorChange);
}

private void OnInit(EntityUid uid, ShadowkinComponent component, ComponentStartup args)
{
if (component.BlackeyeSpawn)
ApplyBlackEye(uid);

_actionsSystem.AddAction(uid, ref component.ShadowkinSleepAction, ShadowkinSleepActionId, uid);

UpdateShadowkinAlert(uid, component);
}

private void OnEyeColorChange(EntityUid uid, ShadowkinComponent component, EyeColorInitEvent args)
{
if (!TryComp<HumanoidAppearanceComponent>(uid, out var humanoid)
|| !component.BlackeyeSpawn
|| humanoid.EyeColor == component.OldEyeColor)
return;

Expand Down Expand Up @@ -95,12 +88,6 @@ public void UpdateShadowkinAlert(EntityUid uid, ShadowkinComponent component)
_alerts.ClearAlert(uid, AlertType.ShadowkinPower);
}

private void OnAttemptPowerUse(EntityUid uid, ShadowkinComponent component, OnAttemptPowerUseEvent args)
{
if (HasComp<ShadowkinCuffComponent>(uid))
args.Cancel();
}

private void OnManaUpdate(EntityUid uid, ShadowkinComponent component, ref OnManaUpdateEvent args)
{
if (!TryComp<PsionicComponent>(uid, out var magic))
Expand All @@ -112,26 +99,10 @@ private void OnManaUpdate(EntityUid uid, ShadowkinComponent component, ref OnMan
else
magic.ManaGainMultiplier = 1;

if (magic.Mana <= component.BlackEyeMana)
ApplyBlackEye(uid);

Dirty(magic); // Update Shadowkin Overlay.
UpdateShadowkinAlert(uid, component);
}

/// <summary>
/// Blackeye the Shadowkin, its just a function to mindbreak the shadowkin but making sure "Removable" is checked true during it.
/// </summary>
/// <param name="uid"></param>
public void ApplyBlackEye(EntityUid uid)
{
if (!TryComp<PsionicComponent>(uid, out var magic))
return;

magic.Removable = true;
_psionicAbilitiesSystem.MindBreak(uid);
}

private void OnMindbreak(EntityUid uid, ShadowkinComponent component, ref OnMindbreakEvent args)
{
if (TryComp<MindbrokenComponent>(uid, out var mindbreak))
Expand All @@ -144,17 +115,13 @@ private void OnMindbreak(EntityUid uid, ShadowkinComponent component, ref OnMind
Dirty(humanoid);
}

if (component.BlackeyeSpawn)
return;

if (TryComp<StaminaComponent>(uid, out var stamina))
_stamina.TakeStaminaDamage(uid, stamina.CritThreshold, stamina, uid);
}

private void OnRejuvenate(EntityUid uid, ShadowkinComponent component, RejuvenateEvent args)
{
if (component.BlackeyeSpawn
|| !HasComp<MindbrokenComponent>(uid))
if (!HasComp<MindbrokenComponent>(uid))
return;

RemComp<MindbrokenComponent>(uid);
Expand All @@ -166,12 +133,11 @@ private void OnRejuvenate(EntityUid uid, ShadowkinComponent component, Rejuvenat
}

EnsureComp<PsionicComponent>(uid, out var magic);
magic.Mana = 250;
magic.MaxMana = 250;
magic.Mana = 200;
magic.MaxMana = 200;
magic.ManaGain = 0.25f;
magic.BypassManaCheck = true;
magic.Removable = false;
magic.MindbreakingFeedback = "shadowkin-blackeye";
magic.NoMana = "shadowkin-tired";

if (_prototypeManager.TryIndex<PsionicPowerPrototype>("ShadowkinPowers", out var shadowkinPowers))
_psionicAbilitiesSystem.InitializePsionicPower(uid, shadowkinPowers);
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Psionics/PsionicComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public sealed partial class PsionicComponent : Component
/// Current Mana.
/// </summary>
[DataField, AutoNetworkedField]
public float Mana;
public float Mana = 50;

/// <summary>
/// Max Mana Possible.
Expand Down
5 changes: 4 additions & 1 deletion Content.Shared/Shadowkin/EtherealComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public sealed partial class EtherealComponent : Component
[DataField]
public float DarkenRate = 0.084f;

[DataField]
public bool CanBeStunned = true;

public List<EntityUid> DarkenedLights = new();

public float DarkenAccumulator;
Expand All @@ -33,4 +36,4 @@ public sealed partial class EtherealComponent : Component

public List<string> SuppressedFactions = new();
public bool HasDoorBumpTag;
}
}
14 changes: 1 addition & 13 deletions Content.Shared/Shadowkin/ShadowkinComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,6 @@ public sealed partial class ShadowkinComponent : Component
[DataField]
public float SleepManaRegenMultiplier = 4;

/// <summary>
/// On MapInitEvent, will Blackeye the Shadowkin.
/// </summary>
[DataField]
public bool BlackeyeSpawn;

/// <summary>
/// If mana is equal or lower then this value, blackeye the shadowkin.
/// </summary>
[DataField]
public float BlackEyeMana;

/// <summary>
/// Set the Black-Eye Color.
/// </summary>
Expand All @@ -39,4 +27,4 @@ public sealed partial class ShadowkinComponent : Component

[DataField]
public EntityUid? ShadowkinSleepAction;
}
}
4 changes: 0 additions & 4 deletions Content.Shared/Shadowkin/ShadowkinCuffComponent.cs

This file was deleted.

34 changes: 0 additions & 34 deletions Resources/Prototypes/Actions/psionics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -291,40 +291,6 @@
maxThrowStrength: 5
spaceRange: 3

- type: entity
id: ActionShadowkinShadeskip
name: action-name-shadeskip
description: action-description-shadowkin-shadeskip
noSpawn: true
components:
- type: InstantAction
icon: { sprite: Interface/Actions/shadowkin_icons.rsi, state: shadeskip }
useDelay: 10
checkCanInteract: false
event: !type:AnomalyPowerActionEvent
settings:
powerName: "Shadowkin-Shadeskip"
manaCost: 25
checkInsulation: false
minGlimmer: 0
maxGlimmer: 0
doSupercritical: false
entitySpawnEntries:
- settings:
spawnOnPulse: true
minAmount: 5
maxAmount: 10
maxRange: 2.5
spawns:
- ShadowkinShadow
- settings:
spawnOnPulse: true
minAmount: 1
maxAmount: 1
maxRange: 0.5
spawns:
- EffectFlashShadowkinShadeskip

- type: entity
id: ActionDarkSwap
name: action-name-darkswap
Expand Down
7 changes: 3 additions & 4 deletions Resources/Prototypes/Entities/Mobs/Species/shadowkin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,9 @@
- type: Psionic
mindbreakingFeedback: shadowkin-blackeye
manaGain: 0.25
mana: 150
maxMana: 250
bypassManaCheck: true
removable: false
mana: 100
maxMana: 200
noMana: shadowkin-tired
- type: InnatePsionicPowers
powersToAdd:
- ShadowkinPowers
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Psionics/psionics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
name: Shadowkin Powers
description: shadowkin-powers-description
actions:
- ActionShadowkinShadeskip
- ActionShadeskip
- ActionDarkSwap
powerSlotCost: 1

Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Species/shadowkin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- type: species
id: Shadowkin
name: species-name-shadowkin
roundStart: false
roundStart: true
prototype: MobShadowkin
sprites: MobShadowkinSprites
defaultSkinTone: "#FFFFFF"
Expand Down

0 comments on commit 702bf07

Please sign in to comment.