Skip to content

Commit

Permalink
Merge branch 'Fansana:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
fenndragon authored Nov 3, 2024
2 parents 10fa00d + 912fc58 commit e54fb22
Show file tree
Hide file tree
Showing 50 changed files with 223,033 additions and 219,683 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: ${{ vars.CHANGELOG_BRANCH }}
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
80 changes: 76 additions & 4 deletions Content.Server/Cocoon/CocoonerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
using Content.Server.Speech.Components;
using Robust.Shared.Containers;
using Content.Shared.Mobs.Components;
using Content.Shared.Destructible;
using Robust.Shared.Random;
using Content.Shared.Nutrition.Components;
using Content.Shared.Storage;
using Robust.Shared.Utility;

namespace Content.Server.Cocoon
{
Expand All @@ -25,17 +30,26 @@ public sealed class CocooningSystem : EntitySystem
[Dependency] private readonly BlindableSystem _blindableSystem = default!;
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly SharedDestructibleSystem _destructibleSystem = default!;
[Dependency] private readonly IRobustRandom _robustRandom = default!;

private const string BodySlot = "body_slot";

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<CocoonerComponent, GetVerbsEvent<InnateVerb>>(AddCocoonVerb);
SubscribeLocalEvent<CocoonerComponent, GetVerbsEvent<InnateVerb>>(AddVerbs);
SubscribeLocalEvent<CocoonComponent, EntInsertedIntoContainerMessage>(OnCocEntInserted);
SubscribeLocalEvent<CocoonComponent, EntRemovedFromContainerMessage>(OnCocEntRemoved);
SubscribeLocalEvent<CocoonComponent, DamageChangedEvent>(OnDamageChanged);
SubscribeLocalEvent<CocoonerComponent, CocoonDoAfterEvent>(OnCocoonDoAfter);
SubscribeLocalEvent<CocoonerComponent, UnCocoonDoAfterEvent>(OnUnCocoonDoAfter);
}

private void AddVerbs(EntityUid uid, CocoonerComponent component, GetVerbsEvent<InnateVerb> args)
{
AddCocoonVerb(uid, component, args);
AddUnCocoonVerb(uid, component, args);
}

private void AddCocoonVerb(EntityUid uid, CocoonerComponent component, GetVerbsEvent<InnateVerb> args)
Expand All @@ -50,6 +64,25 @@ private void AddCocoonVerb(EntityUid uid, CocoonerComponent component, GetVerbsE
StartCocooning(uid, component, args.Target);
},
Text = Loc.GetString("cocoon"),
Icon = new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/Actions/web.png")),
Priority = 2
};
args.Verbs.Add(verb);
}

private void AddUnCocoonVerb(EntityUid uid, CocoonerComponent component, GetVerbsEvent<InnateVerb> args)
{
if (!args.CanAccess || !args.CanInteract || !HasComp<CocoonComponent>(args.Target))
return;

InnateVerb verb = new()
{
Act = () =>
{
StartUnCocooning(uid, component, args.Target);
},
Text = Loc.GetString("uncocoon"),
Icon = new SpriteSpecifier.Texture(new ResPath("/Textures/Interface/Actions/web.png")),
Priority = 2
};
args.Verbs.Add(verb);
Expand All @@ -71,9 +104,11 @@ private void OnCocEntInserted(EntityUid uid, CocoonComponent component, EntInser
private void OnCocEntRemoved(EntityUid uid, CocoonComponent component, EntRemovedFromContainerMessage args)
{
if (TryComp<ReplacementAccentComponent>(args.Entity, out var replacement))
replacement.Accent = component.OldAccent ?? replacement.Accent;
else
RemComp<ReplacementAccentComponent>(args.Entity);
if (component.OldAccent is not null)
replacement.Accent = component.OldAccent;
else
RemComp(args.Entity, replacement);


RemComp<StunnedComponent>(args.Entity);
_blindableSystem.UpdateIsBlind(args.Entity);
Expand Down Expand Up @@ -107,6 +142,22 @@ private void StartCocooning(EntityUid uid, CocoonerComponent component, EntityUi
_doAfter.TryStartDoAfter(args);
}

private void StartUnCocooning(EntityUid uid, CocoonerComponent component, EntityUid target)
{
_popupSystem.PopupEntity(Loc.GetString("uncocoon-start-third-person", ("target", target), ("spider", Identity.Entity(uid, EntityManager))), uid,
Shared.Popups.PopupType.MediumCaution);

var delay = component.CocoonDelay / 2;

var args = new DoAfterArgs(EntityManager, uid, delay, new UnCocoonDoAfterEvent(), uid, target: target)
{
BreakOnUserMove = true,
BreakOnTargetMove = true,
};

_doAfter.TryStartDoAfter(args);
}

private void OnCocoonDoAfter(EntityUid uid, CocoonerComponent component, CocoonDoAfterEvent args)
{
if (args.Handled || args.Cancelled || args.Args.Target == null)
Expand All @@ -128,5 +179,26 @@ private void OnCocoonDoAfter(EntityUid uid, CocoonerComponent component, CocoonD
_adminLogger.Add(LogType.Action, impact, $"{ToPrettyString(args.Args.User):player} cocooned {ToPrettyString(args.Args.Target.Value):target}");
args.Handled = true;
}

private void OnUnCocoonDoAfter(EntityUid uid, CocoonerComponent component, UnCocoonDoAfterEvent args)
{
if (args.Handled || args.Cancelled || args.Args.Target == null)
return;

if (TryComp<ButcherableComponent>(args.Args.Target.Value, out var butcher))
{
var spawnEntities = EntitySpawnCollection.GetSpawns(butcher.SpawnedEntities, _robustRandom);
var coords = Transform(args.Args.Target.Value).MapPosition;
EntityUid popupEnt = default!;
foreach (var proto in spawnEntities)
popupEnt = Spawn(proto, coords.Offset(_robustRandom.NextVector2(0.25f)));
}

_destructibleSystem.DestroyEntity(args.Args.Target.Value);

_adminLogger.Add(LogType.Action, LogImpact.Low
, $"{ToPrettyString(args.Args.User):player} uncocooned {ToPrettyString(args.Args.Target.Value):target}");
args.Handled = true;
}
}
}
Loading

0 comments on commit e54fb22

Please sign in to comment.