Skip to content

Commit

Permalink
Merge branch 'Fansana:unstable' into xenos
Browse files Browse the repository at this point in the history
  • Loading branch information
fenndragon authored Nov 3, 2024
2 parents b1ce3ae + 912fc58 commit 775bc11
Show file tree
Hide file tree
Showing 30 changed files with 613 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_TOKEN }}
ref: unstable # ${{ vars.CHANGELOG_BRANCH }} Floofstation
ref: ${{ vars.CHANGELOG_BRANCH }}

- name: Setup Git
run: |
Expand Down
35 changes: 35 additions & 0 deletions Content.Client/Floofstation/HypnotizedSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Content.Shared.Floofstation.Hypno;
using Content.Shared.StatusIcon;
using Content.Shared.StatusIcon.Components;
using Robust.Shared.Prototypes;
using Robust.Client.Player;
using Content.Client.Overlays;

namespace Content.Client.Floofstation;

public sealed class HypnotizedSystem : EquipmentHudSystem<HypnotizedComponent>
{
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<PsionicHypnoComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
}

private void OnGetStatusIconsEvent(EntityUid uid, PsionicHypnoComponent component, ref GetStatusIconsEvent args)
{
if (!IsActive || args.InContainer)
return;

if (_playerManager.LocalEntity is not { Valid: true } player
|| !TryComp<HypnotizedComponent>(player, out var hypnoComp)
|| hypnoComp.Master != uid)
return;

if (_prototype.TryIndex<StatusIconPrototype>(component.MasterIcon, out var iconPrototype))
args.StatusIcons.Add(iconPrototype);
}
}
35 changes: 35 additions & 0 deletions Content.Client/Floofstation/PsionicHypnoSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Content.Shared.Floofstation.Hypno;
using Content.Shared.StatusIcon;
using Content.Shared.StatusIcon.Components;
using Robust.Shared.Prototypes;
using Robust.Client.Player;
using Content.Client.Overlays;

namespace Content.Client.Floofstation;

public sealed class PsionicHypnoSystem : EquipmentHudSystem<PsionicHypnoComponent>
{
[Dependency] private readonly IPrototypeManager _prototype = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<HypnotizedComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
}

private void OnGetStatusIconsEvent(EntityUid uid, HypnotizedComponent component, ref GetStatusIconsEvent args)
{
if (!IsActive || args.InContainer)
return;

if (_playerManager.LocalEntity is not { Valid: true } player
|| !TryComp<PsionicHypnoComponent>(player, out var hypnoComp)
|| component.Master != player)
return;

if (_prototype.TryIndex<StatusIconPrototype>(hypnoComp.SubjectIcon, out var iconPrototype))
args.StatusIcons.Add(iconPrototype);
}
}
32 changes: 29 additions & 3 deletions Content.Server/Abilities/Psionics/Abilities/MindSwapPowerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
using Content.Server.GameTicking;
using Content.Shared.Mind;
using Content.Shared.Actions.Events;
using Content.Server.DoAfter;
using Content.Shared.DoAfter;

namespace Content.Server.Abilities.Psionics
{
Expand All @@ -23,11 +25,13 @@ public sealed class MindSwapPowerSystem : EntitySystem
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly MindSystem _mindSystem = default!;
[Dependency] private readonly MetaDataSystem _metaDataSystem = default!;
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<MindSwapPowerActionEvent>(OnPowerUsed);
SubscribeLocalEvent<MindSwapPowerComponent, MindSwapPowerActionEvent>(OnPowerUsed);
SubscribeLocalEvent<PsionicComponent, MindSwapPowerDoAfterEvent>(OnDoAfter);
SubscribeLocalEvent<MindSwappedComponent, MindSwapPowerReturnActionEvent>(OnPowerReturned);
SubscribeLocalEvent<MindSwappedComponent, DispelledEvent>(OnDispelled);
SubscribeLocalEvent<MindSwappedComponent, MobStateChangedEvent>(OnMobStateChanged);
Expand All @@ -36,18 +40,40 @@ public override void Initialize()
SubscribeLocalEvent<MindSwappedComponent, ComponentInit>(OnSwapInit);
}

private void OnPowerUsed(MindSwapPowerActionEvent args)
private void OnPowerUsed(EntityUid uid, MindSwapPowerComponent component, MindSwapPowerActionEvent args)
{
if (!_psionics.OnAttemptPowerUse(args.Performer, "mind swap")
|| !(TryComp<DamageableComponent>(args.Target, out var damageable) && damageable.DamageContainerID == "Biological"))
return;

Swap(args.Performer, args.Target);
_doAfterSystem.TryStartDoAfter(new DoAfterArgs(EntityManager, args.Performer, component.UseDelay, new MindSwapPowerDoAfterEvent(), args.Performer, target: args.Target)
{
Hidden = true,
BreakOnTargetMove = true,
BreakOnDamage = true,
BreakOnUserMove = true
}, out var doAfterId);

if (TryComp<PsionicComponent>(uid, out var magic))
magic.DoAfter = doAfterId;

_psionics.LogPowerUsed(args.Performer, "mind swap");
args.Handled = true;
}

private void OnDoAfter(EntityUid uid, PsionicComponent component, MindSwapPowerDoAfterEvent args)
{
if (component is null)
return;
component.DoAfter = null;

if (args.Target is null
|| args.Cancelled)
return;

Swap(uid, args.Target.Value);
}

private void OnPowerReturned(EntityUid uid, MindSwappedComponent component, MindSwapPowerReturnActionEvent args)
{
if (HasComp<PsionicInsulationComponent>(component.OriginalEntity) || HasComp<PsionicInsulationComponent>(uid))
Expand Down
Loading

0 comments on commit 775bc11

Please sign in to comment.