Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into submarine
Browse files Browse the repository at this point in the history
  • Loading branch information
rosieposieeee committed Feb 13, 2024
2 parents 7b6b854 + 6687a31 commit 5099024
Show file tree
Hide file tree
Showing 192 changed files with 2,546 additions and 731 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-map-renderer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
build:
if: github.actor != 'PJBot' && github.event.pull_request.draft == false
if: github.actor != 'PJBot' && github.event.pull_request.draft == false && github.actor != 'DeltaV-Bot'
strategy:
matrix:
os: [ubuntu-latest]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
build:
if: github.actor != 'PJBot' && github.event.pull_request.draft == false
if: github.actor != 'PJBot' && github.event.pull_request.draft == false && github.actor != 'DeltaV-Bot'
strategy:
matrix:
os: [ubuntu-latest]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/conflict-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
Label:
if: github.actor != 'PJBot'
if: github.actor != 'PJBot' && github.actor != 'DeltaV-Bot'
runs-on: ubuntu-latest
steps:
- name: Check for Merge Conflicts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labeler-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
labeler:
if: github.actor != 'PJBot'
if: github.actor != 'PJBot' && github.actor != 'DeltaV-Bot'
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ on:
jobs:
build:
name: Test Packaging
if: github.actor != 'PJBot' && github.event.pull_request.draft == false
if: github.actor != 'PJBot' && github.event.pull_request.draft == false && github.actor != 'DeltaV-Bot'
runs-on: ubuntu-latest

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate-rgas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
yaml-schema-validation:
name: YAML RGA schema validator
if: github.actor != 'PJBot' && github.event.pull_request.draft == false
if: github.actor != 'PJBot' && github.event.pull_request.draft == false && github.actor != 'DeltaV-Bot'
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate_mapfiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
yaml-schema-validation:
name: YAML map schema validator
if: github.actor != 'PJBot' && github.event.pull_request.draft == false
if: github.actor != 'PJBot' && github.event.pull_request.draft == false && github.actor != 'DeltaV-Bot'
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/yaml-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
build:
name: YAML Linter
if: github.actor != 'PJBot' && github.event.pull_request.draft == false
if: github.actor != 'PJBot' && github.event.pull_request.draft == false && github.actor != 'DeltaV-Bot'
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
Expand Down
5 changes: 5 additions & 0 deletions Content.Client/DeltaV/Harpy/HarpyVisualsComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace Content.Client.DeltaV.Harpy;

[RegisterComponent]
public sealed partial class HarpyVisualsComponent : Component
{ }
44 changes: 44 additions & 0 deletions Content.Client/DeltaV/Overlays/UltraVisionOverlay.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Enums;
using Robust.Shared.Prototypes;
using Content.Shared.Abilities;

namespace Content.Client.DeltaV.Overlays;

public sealed partial class UltraVisionOverlay : Overlay
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] IEntityManager _entityManager = default!;


public override bool RequestScreenTexture => true;
public override OverlaySpace Space => OverlaySpace.WorldSpace;
private readonly ShaderInstance _ultraVisionShader;

public UltraVisionOverlay()
{
IoCManager.InjectDependencies(this);
_ultraVisionShader = _prototypeManager.Index<ShaderPrototype>("UltraVision").Instance().Duplicate();
}

protected override void Draw(in OverlayDrawArgs args)
{
if (ScreenTexture == null)
return;
if (_playerManager.LocalPlayer?.ControlledEntity is not {Valid: true} player)
return;
if (!_entityManager.HasComponent<UltraVisionComponent>(player))
return;

_ultraVisionShader?.SetParameter("SCREEN_TEXTURE", ScreenTexture);


var worldHandle = args.WorldHandle;
var viewport = args.WorldBounds;
worldHandle.SetTransform(Matrix3.Identity);
worldHandle.UseShader(_ultraVisionShader);
worldHandle.DrawRect(viewport, Color.White);
}
}
31 changes: 31 additions & 0 deletions Content.Client/DeltaV/Overlays/UltraVisionSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Content.Shared.Abilities;
using Robust.Client.Graphics;

namespace Content.Client.DeltaV.Overlays;

public sealed partial class UltraVisionSystem : EntitySystem
{
[Dependency] private readonly IOverlayManager _overlayMan = default!;

private UltraVisionOverlay _overlay = default!;

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

SubscribeLocalEvent<UltraVisionComponent, ComponentInit>(OnUltraVisionInit);
SubscribeLocalEvent<UltraVisionComponent, ComponentShutdown>(OnUltraVisionShutdown);

_overlay = new();
}

private void OnUltraVisionInit(EntityUid uid, UltraVisionComponent component, ComponentInit args)
{
_overlayMan.AddOverlay(_overlay);
}

private void OnUltraVisionShutdown(EntityUid uid, UltraVisionComponent component, ComponentShutdown args)
{
_overlayMan.RemoveOverlay(_overlay);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using Content.Shared.Nyanotrasen.Item.PseudoItem;

namespace Content.Client.Nyanotrasen.Item.PseudoItem;

public sealed class PseudoItemSystem : SharedPseudoItemSystem
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Content.Server.DeltaV.ParadoxAnomaly.Systems;
using Robust.Shared.Prototypes;

namespace Content.Server.DeltaV.ParadoxAnomaly.Components;

/// <summary>
/// Creates a random paradox anomaly and tranfers mind to it when taken by a player.
/// </summary>
[RegisterComponent, Access(typeof(ParadoxAnomalySystem))]
public sealed partial class ParadoxAnomalySpawnerComponent : Component
{
/// <summary>
/// Antag game rule to start for the paradox anomaly.
/// </summary>
[DataField]
public EntProtoId Rule = "ParadoxAnomaly";
}
164 changes: 164 additions & 0 deletions Content.Server/DeltaV/ParadoxAnomaly/Systems/ParadoxAnomalySystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
using Content.Server.DeltaV.ParadoxAnomaly.Components;
using Content.Server.DetailExaminable;
using Content.Server.GenericAntag;
using Content.Server.Ghost.Roles;
using Content.Server.Ghost.Roles.Components;
using Content.Server.Psionics;
using Content.Server.Spawners.Components;
using Content.Server.Station.Systems;
using Content.Server.Terminator.Systems;
using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Prototypes;
using Content.Shared.Mind;
using Content.Shared.Mind.Components;
using Content.Shared.Preferences;
using Content.Shared.Roles;
using Content.Shared.Roles.Jobs;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Utility;
using System.Diagnostics.CodeAnalysis;

namespace Content.Server.DeltaV.ParadoxAnomaly.Systems;

/// <summary>
/// 90% of the work is done by exterminator since its a reskin.
/// All the logic here is spawning since thats tricky.
/// </summary>
public sealed class ParadoxAnomalySystem : EntitySystem
{
[Dependency] private readonly GenericAntagSystem _genericAntag = default!;
[Dependency] private readonly GhostRoleSystem _ghostRole = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly PsionicsSystem _psionics = default!;
[Dependency] private readonly SharedHumanoidAppearanceSystem _humanoid = default!;
[Dependency] private readonly SharedMindSystem _mind = default!;
[Dependency] private readonly SharedRoleSystem _role = default!;
[Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly StationSpawningSystem _stationSpawning = default!;
[Dependency] private readonly TerminatorSystem _terminator = default!;

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

SubscribeLocalEvent<ParadoxAnomalySpawnerComponent, TakeGhostRoleEvent>(OnTakeGhostRole);
}

private void OnTakeGhostRole(Entity<ParadoxAnomalySpawnerComponent> ent, ref TakeGhostRoleEvent args)
{
Log.Info($"Using paradox anomaly spawner {ent}");
if (!TrySpawnParadoxAnomaly(ent.Comp.Rule, out var twin))
return;

Log.Info($"Created paradox anomaly {ToPrettyString(twin):twin}");
var role = Comp<GhostRoleComponent>(ent);
_ghostRole.GhostRoleInternalCreateMindAndTransfer(args.Player, ent, twin.Value, role);
_ghostRole.UnregisterGhostRole((ent.Owner, role));

args.TookRole = true;
QueueDel(ent);
}

private bool TrySpawnParadoxAnomaly(string rule, [NotNullWhen(true)] out EntityUid? twin)
{
twin = null;

// Get a list of potential candidates
var candidates = new List<(EntityUid, EntityUid, SpeciesPrototype, HumanoidCharacterProfile)>();
var query = EntityQueryEnumerator<MindContainerComponent, HumanoidAppearanceComponent>();
while (query.MoveNext(out var uid, out var mindContainer, out var humanoid))
{
if (humanoid.LastProfileLoaded is not {} profile)
continue;

if (!_proto.TryIndex<SpeciesPrototype>(humanoid.Species, out var species))
continue;

if (_mind.GetMind(uid, mindContainer) is not {} mindId || !HasComp<JobComponent>(mindId))
continue;

if (_role.MindIsAntagonist(mindId))
continue;

// TODO: when metempsychosis real skip whoever has Karma

candidates.Add((uid, mindId, species, profile));
}

twin = SpawnParadoxAnomaly(candidates, rule);
return twin != null;
}

private EntityUid? SpawnParadoxAnomaly(List<(EntityUid, EntityUid, SpeciesPrototype, HumanoidCharacterProfile)> candidates, string rule)
{
// Select a candidate.
if (candidates.Count == 0)
return null;

var (uid, mindId, species, profile) = _random.Pick(candidates);
var jobId = Comp<JobComponent>(mindId).Prototype;
var job = _proto.Index<JobPrototype>(jobId!);

// Find a suitable spawn point.
var station = _station.GetOwningStation(uid);
var latejoins = new List<EntityUid>();
var query = EntityQueryEnumerator<SpawnPointComponent>();
while (query.MoveNext(out var spawnUid, out var spawnPoint))
{
if (spawnPoint.SpawnType != SpawnPointType.LateJoin)
continue;

if (_station.GetOwningStation(spawnUid) == station)
latejoins.Add(spawnUid);
}

if (latejoins.Count == 0)
return null;

// Spawn the twin.
var destination = Transform(_random.Pick(latejoins)).Coordinates;
var spawned = Spawn(species.Prototype, destination);

// Set the kill target to the chosen player
_terminator.SetTarget(spawned, mindId);
_genericAntag.MakeAntag(spawned, rule);

//////////////////////////
// /!\ WARNING /!\ //
// MAJOR SHITCODE BELOW //
// /!\ WARNING /!\ //
//////////////////////////

// Copy the details.
_humanoid.LoadProfile(spawned, profile);
_metaData.SetEntityName(spawned, Name(uid));

if (TryComp<DetailExaminableComponent>(uid, out var detail))
{
var detailCopy = EnsureComp<DetailExaminableComponent>(spawned);
detailCopy.Content = detail.Content;
}

if (job.StartingGear != null && _proto.TryIndex<StartingGearPrototype>(job.StartingGear, out var gear))
{
_stationSpawning.EquipStartingGear(spawned, gear, profile);
_stationSpawning.EquipIdCard(spawned,
profile.Name,
job,
station);
}

foreach (var special in job.Special)
{
special.AfterEquip(spawned);
}

var psi = EnsureComp<PotentialPsionicComponent>(spawned);
_psionics.RollPsionics(spawned, psi, false, 100);

return spawned;
}
}
8 changes: 8 additions & 0 deletions Content.Server/GenericAntag/GenericAntagSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ public void MakeAntag(EntityUid uid, EntityUid mindId, GenericAntagComponent? co
_mind.TryAddObjective(mindId, mind, id);
}
}

/// <summary>
/// DeltaV - used by paradox anomaly
/// </summary>
public void MakeAntag(EntityUid uid, string rule)
{
AddComp<GenericAntagComponent>(uid).Rule = rule;
}
}

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions Content.Server/Humanoid/Systems/HumanoidAppearanceSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public void CloneAppearance(EntityUid source, EntityUid target, HumanoidAppearan
grammar.Gender = sourceHumanoid.Gender;
}

targetHumanoid.LastProfileLoaded = sourceHumanoid.LastProfileLoaded; // DeltaV - let paradox anomaly be cloned

Dirty(targetHumanoid);
}

Expand Down
Loading

0 comments on commit 5099024

Please sign in to comment.