Skip to content

Commit

Permalink
Merge branch 'space-sunrise:master' into Swapper-bye
Browse files Browse the repository at this point in the history
  • Loading branch information
Esco-dev authored Jan 8, 2025
2 parents eed05ef + a1c800c commit 0f59e8e
Show file tree
Hide file tree
Showing 94 changed files with 1,159 additions and 505 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ await server.WaitAssertion(() =>
{
playerUid = serverPlayerManager.Sessions.Single().AttachedEntity.GetValueOrDefault();
#pragma warning disable NUnit2045 // Interdependent assertions.
Assert.That(playerUid, Is.Not.EqualTo(default));
Assert.That(playerUid, Is.Not.EqualTo(default(EntityUid)));
// Making sure it exists
Assert.That(entManager.HasComponent<AlertsComponent>(playerUid));
#pragma warning restore NUnit2045
Expand Down
28 changes: 19 additions & 9 deletions Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using Robust.Shared.Map.Components;
using Robust.Shared.Prototypes;
using Content.Shared.Station.Components;
using FastAccessors;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;

Expand All @@ -32,9 +31,7 @@ public sealed class PostMapInitTest
private static readonly string[] NoSpawnMaps =
{
"CentComm",
"Dart",
"SunriseCentComm",
"PlanetPrison",
"Dart"
};

private static readonly string[] Grids =
Expand All @@ -43,7 +40,6 @@ public sealed class PostMapInitTest
"/Maps/Shuttles/cargo.yml",
"/Maps/Shuttles/emergency.yml",
"/Maps/Shuttles/infiltrator.yml",
"/Maps/_Sunrise/Shuttles/infiltrator.yml",
};

private static readonly string[] GameMaps =
Expand All @@ -69,9 +65,22 @@ public sealed class PostMapInitTest
"Amber",
"Loop",
"Elkridge"


};

// Sunrise-Start
private static readonly string[] SunriseNoSpawnMaps =
{
"SunriseCentComm",
"PlanetPrison",
};

private static readonly string[] SunriseGrids =
{
"/Maps/_Sunrise/Shuttles/infiltrator.yml",
};

private static readonly string[] SunriseGameMaps =
{
"SunriseDev",
Expand All @@ -90,14 +99,16 @@ public sealed class PostMapInitTest
"SunriseMeta",
"SunriseOasis"
};
// Sunrise-End

private static readonly string[] TotalNoSpawnMaps = NoSpawnMaps.Concat(SunriseNoSpawnMaps).ToArray();
private static readonly string[] TotalGrids = Grids.Concat(SunriseGrids).ToArray();
private static readonly string[] TotalMaps = GameMaps.Concat(SunriseGameMaps).ToArray();
// Sunrise-End

/// <summary>
/// Asserts that specific files have been saved as grids and not maps.
/// </summary>
[Test, TestCaseSource(nameof(Grids))]
[Test, TestCaseSource(nameof(TotalGrids))] // Sunrise-Edit
public async Task GridsLoadableTest(string mapFile)
{
await using var pair = await PoolManager.GetServerClient();
Expand Down Expand Up @@ -262,7 +273,7 @@ await server.WaitPost(() =>
if (entManager.HasComponent<StationJobsComponent>(station))
{
// Test that the map has valid latejoin spawn points or container spawn points
if (!NoSpawnMaps.Contains(mapProto))
if (!TotalNoSpawnMaps.Contains(mapProto)) // Sunrise-Edit
{
var lateSpawns = 0;

Expand Down Expand Up @@ -347,7 +358,6 @@ public async Task AllMapsTested()

Assert.That(gameMaps.Remove(PoolManager.TestMap));


Assert.That(gameMaps, Is.EquivalentTo(TotalMaps.ToHashSet()), "Game map prototype missing from test cases."); // Sunrise-Edit

await pair.CleanReturnAsync();
Expand Down
8 changes: 5 additions & 3 deletions Content.Server/Access/Systems/AccessSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ public void Update(Entity<AccessReaderComponent> entity)
{
if (alerts.CurrentLevel.Contains(level.Key))
{
entity.Comp.AlertAccesses.TryGetValue(level.Value, out var value);
entity.Comp.Group = value;
break;
if (entity.Comp.AlertAccesses.TryGetValue(level.Value, out var value))
{
entity.Comp.Group = value;
break;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Server.RoundEnd;
using Content.Shared.Dataset;
using Content.Shared.FixedPoint;
using Content.Shared.NPC.Prototypes;
using Content.Shared.Roles;
using Robust.Shared.Audio;
Expand Down Expand Up @@ -63,11 +64,13 @@ public sealed partial class NukeopsRuleComponent : Component
/// This amount of TC will be given to each nukie
/// </summary>
[DataField]
public int WarTcAmountPerNukie = 40;
public FixedPoint2 WarTcAmountPerNukie = 40;

// Sunrise-Start
[DataField]
public int RoundstartOperatives;

public EntityUid? UplinkEnt;
// Sunrise-End

/// <summary>
Expand Down
64 changes: 23 additions & 41 deletions Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@
using Robust.Shared.Random;
using Robust.Shared.Utility;
using System.Linq;
using Content.Server.Antag.Components;
using Content.Server.Traitor.Uplink;
using Content.Shared.Mind;
using Content.Shared.FixedPoint;
using Content.Shared.Roles;
using Content.Shared.Store.Components;

Expand All @@ -42,7 +41,6 @@ public sealed class NukeopsRuleSystem : GameRuleSystem<NukeopsRuleComponent>
[Dependency] private readonly StoreSystem _store = default!;
[Dependency] private readonly TagSystem _tag = default!;
[Dependency] private readonly UplinkSystem _uplinkSystem = default!;
[Dependency] private readonly SharedRoleSystem _roles = default!;

[ValidatePrototypeId<CurrencyPrototype>]
private const string TelecrystalCurrencyPrototype = "Telecrystal";
Expand Down Expand Up @@ -75,7 +73,6 @@ public override void Initialize()
SubscribeLocalEvent<CommunicationConsoleCallShuttleAttemptEvent>(OnShuttleCallAttempt);

SubscribeLocalEvent<NukeopsRuleComponent, AfterAntagEntitySelectedEvent>(OnAfterAntagEntSelected);
SubscribeLocalEvent<NukeopsRuleComponent, AntagSelectionCompleteEvent>(OnAfterAntagSelectionComplete); // Sunrise-Edit
SubscribeLocalEvent<NukeopsRuleComponent, RuleLoadedGridsEvent>(OnRuleLoadedGrids);
}

Expand Down Expand Up @@ -497,51 +494,36 @@ private void OnAfterAntagEntSelected(Entity<NukeopsRuleComponent> ent, ref After
ent.Comp.GreetSoundNotification);

// Sunrise-Start
if (!args.GameRule.Comp.UseSpawners)
return;

ent.Comp.RoundstartOperatives = args.GameRule.Comp.SpawnersCount;
var commander = GetCommander(args.GameRule);
if (commander != null)
SetupUplink(commander.Value, ent.Comp);
// Sunrise-End
}
ent.Comp.RoundstartOperatives += 1;

// Sunrise-Start
private void OnAfterAntagSelectionComplete(Entity<NukeopsRuleComponent> ent, ref AntagSelectionCompleteEvent args)
{
ent.Comp.RoundstartOperatives = args.GameRule.Comp.SelectedMinds.Count;

var commander = GetCommander(args.GameRule);
if (commander != null)
SetupUplink(commander.Value, ent.Comp);
}

private EntityUid? GetCommander(Entity<AntagSelectionComponent> antagSelection)
{
EntityUid? commander = null;
foreach (var compSelectedMind in antagSelection.Comp.SelectedMinds)
if (args.Def.PrefRoles.Contains(CommanderAntagProto))
{
if (!TryComp<MindComponent>(compSelectedMind.Item1, out var mindComp))
continue;

foreach (var roleInfo in _roles.MindGetAllRoleInfo((compSelectedMind.Item1, mindComp)))
{
if (roleInfo.Prototype != CommanderAntagProto || mindComp.CurrentEntity == null)
continue;

commander = mindComp.CurrentEntity.Value;
}
var uplink = SetupUplink(args.EntityUid, ent.Comp);
ent.Comp.UplinkEnt = uplink;
}

return commander;
if (ent.Comp.UplinkEnt != null)
{
var giveTcCount = ent.Comp.WarTcAmountPerNukie;
if (ent.Comp.RoundstartOperatives > 1)
giveTcCount *= ent.Comp.RoundstartOperatives;
var store = EnsureComp<StoreComponent>(ent.Comp.UplinkEnt.Value);
_store.TryAddCurrency(new Dictionary<string, FixedPoint2> { { TelecrystalCurrencyPrototype, giveTcCount } },
ent.Comp.UplinkEnt.Value,
store);
}
// Sunrise-End
}

private void SetupUplink(EntityUid user, NukeopsRuleComponent nukeopsRule)
// Sunrise-Start
private EntityUid? SetupUplink(EntityUid user, NukeopsRuleComponent rule)
{
var uplink = _uplinkSystem.FindUplinkByTag(user, NukeOpsUplinkTagPrototype);
if (uplink != null)
_uplinkSystem.SetUplink(user, uplink.Value, nukeopsRule.WarTcAmountPerNukie * nukeopsRule.RoundstartOperatives, true);
if (uplink == null)
return null;

_uplinkSystem.SetUplink(user, uplink.Value, 0, true);
return uplink;
}
// Sunrise-End

Expand Down
7 changes: 7 additions & 0 deletions Content.Server/Speech/Components/BleatingAccentComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Content.Server.Speech.Components;

/// <summary>
/// Makes this entity speak like a sheep or a goat in all chat messages it sends.
/// </summary>
[RegisterComponent]
public sealed partial class BleatingAccentComponent : Component { }
28 changes: 28 additions & 0 deletions Content.Server/Speech/EntitySystems/BleatingAccentSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Text.RegularExpressions;
using Content.Server.Speech.Components;

namespace Content.Server.Speech.EntitySystems;

public sealed partial class BleatingAccentSystem : EntitySystem
{
private static readonly Regex BleatRegex = new("([mbdlpwhrkcnytfo])([aiu])", RegexOptions.IgnoreCase);

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

SubscribeLocalEvent<BleatingAccentComponent, AccentGetEvent>(OnAccentGet);
}

private void OnAccentGet(Entity<BleatingAccentComponent> entity, ref AccentGetEvent args)
{
args.Message = Accentuate(args.Message);
}

public static string Accentuate(string message)
{
// Repeats the vowel in certain consonant-vowel pairs
// So you taaaalk liiiike thiiiis
return BleatRegex.Replace(message, "$1$2$2$2$2");
}
}
31 changes: 20 additions & 11 deletions Content.Server/Supermatter/EntitySystems/SupermatterSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Supermatter.Components;
using Content.Shared.Atmos;
using Content.Server.Lightning;
Expand Down Expand Up @@ -103,6 +103,7 @@ public void Cycle(EntityUid uid, SupermatterComponent sm)
SupermatterAlert(uid, Loc.GetString($"supermatter-announcement-{loc}", ("integrity", (int)(sm.DelaminationPoint - sm.Damage))));
}
}
sm.DamageArchive = sm.Damage;

if (sm.AreWeDelaming)
DelamCountdown(uid, sm);
Expand Down Expand Up @@ -217,18 +218,17 @@ private void ProcessDamage(EntityUid uid, SupermatterComponent sm)
damageHealHeat = Math.Clamp((sm.AbsorbedGasMix.TotalMoles - sm.TempLimit) / 6000, -.1f, 0);

var totalDamage = damageHeat + damagePower + damageMoles + damageHealHeat;

var oldDamage = sm.Damage;
sm.Damage += Math.Max(totalDamage, 0);

if (sm.Damage > sm.DelaminationPoint)
sm.AreWeDelaming = true;

if (sm.Damage > sm.DamageDangerPoint)
if (sm.Damage >= sm.DelaminationPoint && !sm.AreWeDelaming)
{
if (_random.Prob(.0001f))
GenerateAnomaly(uid);
return;
sm.AreWeDelaming = true;
SupermatterAlert(uid, Loc.GetString("supermatter-announcement-delam"));
}

if (sm.Damage > sm.DamageDangerPoint && _random.Prob(.0001f))
GenerateAnomaly(uid);
}
/// <summary>
/// Process waste, release hot plasma and oxygen.
Expand Down Expand Up @@ -439,8 +439,14 @@ private void OnClick(EntityUid uid, SupermatterComponent sm, InteractUsingEvent
{
if (HasComp<SharpComponent>(args.Used))
{
if (sm.Damage >= 100)
{
_popup.PopupEntity(Loc.GetString("supermatter-tamper-fail"), args.User, args.User);
return;
}

_adminLogger.Add(LogType.Action, LogImpact.High, $"{EntityManager.ToPrettyString(args.User):player} is trying to extract a sliver from the supermatter crystal.");
_popup.PopupClient(Loc.GetString("supermatter-tamper-begin"), args.User, args.User);
_popup.PopupEntity(Loc.GetString("supermatter-tamper-begin"), args.User, args.User);

var doAfterArgs = new DoAfterArgs(EntityManager, args.User, 30, new SupermatterDoAfterEvent(), uid, target: uid, used: args.Used)
{
Expand All @@ -457,11 +463,14 @@ private void OnClick(EntityUid uid, SupermatterComponent sm, InteractUsingEvent

private void OnGetSliver(EntityUid uid, SupermatterComponent sm, SupermatterDoAfterEvent args)
{
if (args.Cancelled)
return;

sm.Damage += 10; // your criminal actions will not go unnoticed
SupermatterAlert(uid, Loc.GetString("supermatter-announcement-tamper", ("integrity", (int)(100 - sm.Damage))));

Spawn(sm.SliverPrototype, _transform.GetMapCoordinates(args.User));
_popup.PopupClient(Loc.GetString("supermatter-tamper-end"), args.User);
_popup.PopupEntity(Loc.GetString("supermatter-tamper-end"), args.User, args.User);
}

private void OnGetHit(EntityUid uid, SupermatterComponent sm, DamageChangedEvent args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ public sealed partial class AssaultOpsRuleComponent : Component
[DataField]
public int TCAmountPerOperative = 50;

[DataField]
public int RoundstartOperatives;

public EntityUid? UplinkEnt;

[DataField("greetingSound", customTypeSerializer: typeof(SoundSpecifierTypeSerializer))]
public SoundSpecifier? GreetSoundNotification = new SoundPathSpecifier("/Audio/_Sunrise/AssaultOperatives/assault_operatives_greet.ogg",
AudioParams.Default.WithVolume(-6f));
Expand Down
Loading

0 comments on commit 0f59e8e

Please sign in to comment.