Skip to content

Commit

Permalink
Merge pull request Simple-Station#265 from FoxxoTrystan/true-kin
Browse files Browse the repository at this point in the history
Shadowkin, Anomaly and Whitelist!
  • Loading branch information
FoxxoTrystan authored Oct 19, 2024
2 parents 7dd3f31 + 7f5e29a commit 3b34e78
Show file tree
Hide file tree
Showing 57 changed files with 10,954 additions and 180 deletions.
4 changes: 4 additions & 0 deletions Content.Server/FloofStation/AnomalyJobComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespace Content.Server.FloofStation;

[RegisterComponent]
public sealed partial class AnomalyJobComponent : Component { }
23 changes: 23 additions & 0 deletions Content.Server/FloofStation/AnomalyJobSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Content.Shared.Shadowkin;
using Content.Shared.Rejuvenate;

namespace Content.Server.FloofStation;

public sealed class AnomalyJobSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<AnomalyJobComponent, ComponentStartup>(OnInit);
}

private void OnInit(EntityUid uid, AnomalyJobComponent component, ComponentStartup args)
{
if (!TryComp<ShadowkinComponent>(uid, out var shadowkin))
return;

shadowkin.BlackeyeSpawn = false;

RaiseLocalEvent(uid, new RejuvenateEvent());
}
}
4 changes: 4 additions & 0 deletions Content.Server/FloofStation/DarkHubComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespace Content.Server.FloofStation;

[RegisterComponent]
public sealed partial class DarkHubComponent : Component { }
4 changes: 4 additions & 0 deletions Content.Server/FloofStation/DarkPortalComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespace Content.Server.FloofStation;

[RegisterComponent]
public sealed partial class DarkPortalComponent : Component { }
21 changes: 21 additions & 0 deletions Content.Server/FloofStation/DarkPortalSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Content.Shared.Teleportation.Systems;

namespace Content.Server.FloofStation;

public sealed class DarkPortalSystem : EntitySystem
{
[Dependency] private readonly LinkedEntitySystem _link = default!;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<DarkPortalComponent, ComponentStartup>(OnInit);
}

private void OnInit(EntityUid uid, DarkPortalComponent component, ComponentStartup args)
{
var query = EntityQueryEnumerator<DarkHubComponent>();
while (query.MoveNext(out var target, out var portal))
_link.TryLink(uid, target);
}
}
39 changes: 39 additions & 0 deletions Content.Server/FloofStation/TheDarkSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Content.Server.GameTicking.Events;
using Content.Server.Shuttles.Components;
using Content.Shared.Shuttles.Components;
using Robust.Server.GameObjects;
using Robust.Shared.Map;

namespace Content.Server.FloofStation;

public sealed class TheDarkSystem : EntitySystem
{
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly MapLoaderSystem _loader = default!;

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

SubscribeLocalEvent<RoundStartingEvent>(SetupTheDark);
}

private void SetupTheDark(RoundStartingEvent ev)
{
var mapId = _mapManager.CreateMap();
_mapManager.AddUninitializedMap(mapId);

if (!_loader.TryLoad(mapId, "/Maps/Floof/hideout.yml", out var uids))
{
return;
}

foreach (var id in uids)
{
EnsureComp<ArrivalsSourceComponent>(id);
EnsureComp<PreventPilotComponent>(id);
}

_mapManager.DoMapInitialize(mapId);
}
}
50 changes: 49 additions & 1 deletion Content.Server/Shadowkin/ShadowkinSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
using Content.Shared.Actions;
using Robust.Shared.Prototypes;
using Content.Server.Abilities.Psionics;
using Content.Shared.Mobs; // Floofstation Edit
using Content.Server.FloofStation; // Floofstation Edit
using Content.Shared.Inventory; // Floofstation Edit
using Content.Shared.Teleportation.Components; // Floofstation Edit

namespace Content.Server.Shadowkin;

Expand All @@ -24,6 +28,8 @@ public sealed class ShadowkinSystem : EntitySystem
[Dependency] private readonly AlertsSystem _alerts = default!;
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!; // Floofstation Edit
[Dependency] private readonly InventorySystem _inventorySystem = default!; // Floofstation Edit

public const string ShadowkinSleepActionId = "ShadowkinActionSleep";
public override void Initialize()
Expand All @@ -36,6 +42,7 @@ public override void Initialize()
SubscribeLocalEvent<ShadowkinComponent, OnManaUpdateEvent>(OnManaUpdate);
SubscribeLocalEvent<ShadowkinComponent, RejuvenateEvent>(OnRejuvenate);
SubscribeLocalEvent<ShadowkinComponent, EyeColorInitEvent>(OnEyeColorChange);
SubscribeLocalEvent<ShadowkinComponent, MobStateChangedEvent>(OnMobStateChanged); // Floofstation Edit
}

private void OnInit(EntityUid uid, ShadowkinComponent component, ComponentStartup args)
Expand Down Expand Up @@ -117,6 +124,9 @@ private void OnManaUpdate(EntityUid uid, ShadowkinComponent component, ref OnMan
if (magic.Mana <= component.BlackEyeMana)
ApplyBlackEye(uid);

if (magic.Mana >= magic.MaxMana)
RemComp<ForcedSleepingComponent>(uid);

Dirty(magic); // Update Shadowkin Overlay.
UpdateShadowkinAlert(uid, component);
}
Expand Down Expand Up @@ -171,7 +181,7 @@ private void OnRejuvenate(EntityUid uid, ShadowkinComponent component, Rejuvenat
magic.Mana = 250;
magic.MaxMana = 250;
magic.ManaGain = 0.25f;
magic.BypassManaCheck = true;
magic.NoMana = "shadowkin-tired"; // FloofStation Edit
magic.Removable = false;
magic.MindbreakingFeedback = "shadowkin-blackeye";

Expand All @@ -180,4 +190,42 @@ private void OnRejuvenate(EntityUid uid, ShadowkinComponent component, Rejuvenat

UpdateShadowkinAlert(uid, component);
}

// FloofStation Edit
private void OnMobStateChanged(EntityUid uid, ShadowkinComponent component, MobStateChangedEvent args)
{
if (HasComp<MindbrokenComponent>(uid) || HasComp<ShadowkinCuffComponent>(uid))
return;

if (args.NewMobState == MobState.Critical || args.NewMobState == MobState.Dead)
{
if (TryComp<InventoryComponent>(uid, out var inventoryComponent) && _inventorySystem.TryGetSlots(uid, out var slots))
foreach (var slot in slots)
_inventorySystem.TryUnequip(uid, slot.Name, true, true, false, inventoryComponent);

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

var query = EntityQueryEnumerator<DarkHubComponent>();
while (query.MoveNext(out var target, out var portal))
{
var timeout = EnsureComp<PortalTimeoutComponent>(uid);
timeout.EnteredPortal = target;
Dirty(uid, timeout);

_transform.SetCoordinates(uid, Transform(target).Coordinates);
continue;
}

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

RaiseLocalEvent(uid, new RejuvenateEvent());
if (TryComp<PsionicComponent>(uid, out var magic))
{
magic.Mana = 0;
EnsureComp<ForcedSleepingComponent>(uid);
}
}
}
}
2 changes: 2 additions & 0 deletions Content.Shared/Psionics/PsionicComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ private set
public string AlreadyCasting = "already-casting";

/// Popup to play if there no Mana left for a power to execute.

[DataField]
public string NoMana = "no-mana";
}
}
13 changes: 8 additions & 5 deletions Content.Shared/Teleportation/Systems/SharedPortalSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Content.Shared.Movement.Pulling.Systems;
using Content.Shared.Popups;
using Content.Shared.Projectiles;
using Content.Shared.Shadowkin;
using Content.Shared.Teleportation.Components;
using Content.Shared.Verbs;
using Robust.Shared.Audio;
Expand Down Expand Up @@ -48,9 +49,11 @@ public override void Initialize()

private void OnGetVerbs(EntityUid uid, PortalComponent component, GetVerbsEvent<AlternativeVerb> args)
{
// Traversal altverb for ghosts to use that bypasses normal functionality
if (!args.CanAccess || !HasComp<GhostComponent>(args.User))
return;

if (!HasComp<EtherealComponent>(uid) && !HasComp<EtherealComponent>(args.User)) // FloofStation Edit
// Traversal altverb for ghosts to use that bypasses normal functionality
if (!args.CanAccess || !HasComp<GhostComponent>(args.User))
return;

// Don't use the verb with unlinked or with multi-output portals
// (this is only intended to be useful for ghosts to see where a linked portal leads)
Expand Down Expand Up @@ -152,7 +155,7 @@ private void OnCollide(EntityUid uid, PortalComponent component, ref StartCollid

private void OnEndCollide(EntityUid uid, PortalComponent component, ref EndCollideEvent args)
{
if (!ShouldCollide(args.OurFixtureId, args.OtherFixtureId,args.OurFixture, args.OtherFixture))
if (!ShouldCollide(args.OurFixtureId, args.OtherFixtureId, args.OurFixture, args.OtherFixture))
return;

var subject = args.OtherEntity;
Expand All @@ -164,7 +167,7 @@ private void OnEndCollide(EntityUid uid, PortalComponent component, ref EndColli
}
}

private void TeleportEntity(EntityUid portal, EntityUid subject, EntityCoordinates target, EntityUid? targetEntity=null, bool playSound=true,
private void TeleportEntity(EntityUid portal, EntityUid subject, EntityCoordinates target, EntityUid? targetEntity = null, bool playSound = true,
PortalComponent? portalComponent = null)
{
if (!Resolve(portal, ref portalComponent))
Expand Down
1 change: 1 addition & 0 deletions Resources/Locale/en-US/Floof/job/job-description.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
job-description-anomaly = What are you?
1 change: 1 addition & 0 deletions Resources/Locale/en-US/Floof/job/job-names.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
job-name-anomaly = Anomaly
1 change: 1 addition & 0 deletions Resources/Locale/en-US/Floof/shadowkin.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shadowkin-tired = "Im too tired!"
Loading

0 comments on commit 3b34e78

Please sign in to comment.