Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
897388e
Update modinfo_stable.sbmi
ari-steas Jan 31, 2025
ab90fd4
Update CommandHandler.cs
ari-steas Jan 31, 2025
863a5e2
Update modinfo_stable.sbmi
ari-steas Jan 31, 2025
c0676fe
Unnerf Fusion Radiators (#1874)
ari-steas Jan 31, 2025
b8f8e3d
Remove unnecessary textures (#1875)
ari-steas Jan 31, 2025
70b6a04
Remove stable version of NHI (#1873)
ari-steas Jan 31, 2025
db8ce54
Update Aristeas NewUniversalUpload.yml
ari-steas Feb 1, 2025
bf82634
Merge branch 'stable' into main
ari-steas Feb 1, 2025
478662b
Unnerf Fusion Radiators, Cleanup Files, and Only Trigger Upload Workf…
ari-steas Feb 1, 2025
d47daf3
Update SUGMA Clearboard (#1879)
ari-steas Feb 4, 2025
447fd60
Revert mistaken fusion heat edits (#1882)
ari-steas Feb 6, 2025
a991323
KOTH go Brrrr
CommodoreChet Feb 7, 2025
b6c8e88
KOTH go Brrrr (#1884)
CommodoreChet Feb 7, 2025
cdfb4a5
Revert erroneous heat change (#1883)
ari-steas Feb 7, 2025
1eaf380
Hard-sync winning KOTH faction (#1885)
ari-steas Feb 7, 2025
82c6901
Dev (#1886)
ari-steas Feb 7, 2025
355f22b
shrink Indicator
CommodoreChet Feb 7, 2025
4fa23af
shrink Indicator (#1887)
CommodoreChet Feb 7, 2025
bb4ea65
Fix KOTH win condition display (#1888)
ari-steas Feb 7, 2025
54b1f8e
fix merge failure (#1890)
ari-steas Feb 7, 2025
c47a4bf
Misc. SUGMA changes (#1891)
ari-steas Feb 7, 2025
8398e4d
Tune up new fusion radiators (#1892)
ari-steas Feb 9, 2025
0a2b1cf
Mostly functional upgraded fusion hud (#1894)
ari-steas Feb 24, 2025
ea9dd58
modify fusion hud (#1895)
ari-steas Feb 27, 2025
2af5bdb
Update FusionWindow.cs
ari-steas Feb 28, 2025
ac8a26b
Re-exclude SRBs from grid integrity calcs (#1898)
ari-steas Mar 1, 2025
8ebc0ae
Emergency bounce zone fix (#1899)
ari-steas Mar 1, 2025
395c59b
Emergency bounce zone fix (#1899) (#1900)
ari-steas Mar 1, 2025
7ea15c9
Create AiRange_EntityComponents.sbc
ari-steas Mar 2, 2025
c030a70
Disable monowhip animation (#1896)
ari-steas Mar 2, 2025
25038c0
Merge branch 'stable' into main
ari-steas Mar 2, 2025
24c51c2
Configurable Minimum Siege Time
CommodoreChet Mar 2, 2025
5831e2d
Configurable Minimum Siege Time (#1902)
CommodoreChet Mar 2, 2025
5468952
Update and rename modinfo.sbmi to modinfo_main.sbmi
ari-steas Mar 2, 2025
67f87a4
Azimuth lock Charon to a 90 degree cone
ari-steas Mar 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,12 @@ public override void StopRound()
{
if (arg.StartsWith("win"))
{
Log.Info("Winner in arguments found: " + arg);
long factionId;
long.TryParse(arg.Remove(0, 3), out factionId);

_winningFaction = MyAPIGateway.Session.Factions.TryGetFactionById(factionId);
setWinnerFromArgs = true;
Log.Info($"Winner in arguments found: {factionId} ({_winningFaction?.Name})");
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ internal class elmHud_Window : HudElementBase
private bool _matchEnded;
private readonly MatchTimer _timer;

private readonly LabelBox _timerLabel;
internal readonly LabelBox _timerLabel;
internal LabelBox _winnerLabel;
public EliminationHud_TeamBanner[] Banners;

public elmHud_Window(HudParentBase parent, EliminationGamemode gamemode) : base(parent)
Expand Down Expand Up @@ -121,6 +122,7 @@ public void Update()

public void MatchEnded(IMyFaction winner)
{
Log.Info("EliminationHud.cs:125 MatchEnded (" + winner?.Name + ")");
_matchEnded = true;
var winnerPoints = 0;
foreach (var banner in Banners)
Expand All @@ -136,7 +138,7 @@ public void MatchEnded(IMyFaction winner)
if (_timerLabel == null)
return;

var winnerLabel = new LabelBox(_timerLabel)
_winnerLabel = new LabelBox(_timerLabel)
{
Text = winner != null
? $"A WINNER IS {winner.Name}. {winnerPoints} tickets remaining."
Expand All @@ -147,7 +149,7 @@ public void MatchEnded(IMyFaction winner)
Color = HudConstants.HudBackgroundColor
};

winnerLabel.TextBoard.SetFormatting(GlyphFormat.White.WithColor(Color.Red).WithSize(3)
_winnerLabel.TextBoard.SetFormatting(GlyphFormat.White.WithColor(Color.Red).WithSize(3)
.WithAlignment(TextAlignment.Center));
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using Sandbox.ModAPI;
using SC.SUGMA.GameModes.Elimination;
using SC.SUGMA.GameState;
using SC.SUGMA.Utilities;
using VRage.Game.ModAPI;
using VRageMath;

namespace SC.SUGMA.GameModes.KOTH
{
internal partial class KOTHGamemode : EliminationGamemode
{
public KOTHSphereZone ControlPoint;

private Vector3D _controlPointPosition = new Vector3D(0, 0, 0);
private float _controlPointRadius = 2500f;

private int ActivationTime = 300;
public int ActivationTimeCounter = 0;

private int WinTime = 120;

public override string ReadableName { get; internal set; } = "King Of The Hill";

public override string Description { get; internal set; } =
"Fight to Control the Capture Point. Either hold it uncontested, or eliminate the enemy team to win.";

public KOTHGamemode()
{
ArgumentParser += new ArgumentParser(
new ArgumentParser.ArgumentDefinition(
text => ActivationTime = int.Parse(text),
"at", "activation-time",
$"Delay before Center Zone is Capturable, in Seconds"
),
new ArgumentParser.ArgumentDefinition(
text => WinTime = int.Parse(text),
"wt", "win-time",
"How long a team has to hold the zone uncontested to win, in Seconds"
)
);
}

public override void StartRound(string[] arguments = null)
{
base.StartRound(arguments);

if (TrackedFactions.Count <= 1)
return;

ActivationTimeCounter = ActivationTime;
ControlPoint = null;

if (!MyAPIGateway.Utilities.IsDedicated)
SUGMA_SessionComponent.I.RegisterComponent("KOTHHud", new KOTHHud(this));
}

public override void StopRound()
{
_winningFaction = ControlPoint?._zoneOwner;
base.StopRound();

SUGMA_SessionComponent.I.GetComponent<KOTHHud>("KOTHHud")?.MatchEnded(_winningFaction);
SUGMA_SessionComponent.I.UnregisterComponent("KOTHHud");

ControlPoint = null;
SUGMA_SessionComponent.I.UnregisterComponent("KOTHZone");
}

internal override void DisplayWinMessage()
{
if (_winningFaction == null)
{
MyAPIGateway.Utilities.ShowNotification("YOU ARE ALL LOSERS.", 10000, "Red");
return;
}

MyAPIGateway.Utilities.ShowNotification($"A WINNER IS [{_winningFaction?.Name}]!", 10000);
}

public override void UpdateActive()
{
if (ActivationTimeCounter > 0)
{
if (_matchTimer.Ticks % 60 == 0)
{
ActivationTimeCounter--;

if (ActivationTimeCounter <= 0)
{
ControlPoint = new KOTHSphereZone(_controlPointPosition, _controlPointRadius, WinTime);
SUGMA_SessionComponent.I.RegisterComponent("KOTHZone", ControlPoint);
}
}
}

if (ControlPoint == null)
return;

if (ControlPoint.IsCaptured)
{
StopRound();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
using System;
using System.Collections.Generic;
using RichHudFramework;
using RichHudFramework.Client;
using RichHudFramework.UI;
using RichHudFramework.UI.Client;
using RichHudFramework.UI.Rendering;
using SC.SUGMA.GameModes.Elimination;
using SC.SUGMA.GameState;
using SC.SUGMA.Utilities;
using VRage.Game.ModAPI;
using VRage.Utils;
using VRageMath;

namespace SC.SUGMA.GameModes.KOTH
{
internal class KOTHHud : ComponentBase
{
private readonly KOTHGamemode _gamemode;
private KOTHHud_Window _window;

public KOTHHud(KOTHGamemode gamemode)
{
_gamemode = gamemode;
}

public override void Init(string id)
{
base.Init(id);

if (!RichHudClient.Registered)
throw new Exception("RichHudAPI was not initialized in time!");

_window = new KOTHHud_Window(HudMain.HighDpiRoot, _gamemode);
}

public override void Close()
{
HudMain.HighDpiRoot.RemoveChild(_window);
}

public override void UpdateTick()
{
if (SUGMA_SessionComponent.I.CurrentGamemode != null)
_window.Update();
}

public void MatchEnded(IMyFaction winner)
{
_window.MatchEnded(winner);
}
}

internal class KOTHHud_Window : WindowBase
{
private static readonly Material _circleMaterial =
new Material(MyStringId.GetOrCompute("SugmaCircle"), new Vector2(32, 32));

private readonly KOTHGamemode _gamemode;
private readonly elmHud_Window _windowBase;

private TexturedBox _captureIndicator;

private Label _captureLabel;

public KOTHHud_Window(HudParentBase parent, KOTHGamemode gamemode) : base(parent)
{
_gamemode = gamemode;
_windowBase = SUGMA_SessionComponent.I.GetComponent<EliminationHud>("elmHud").Window;

_captureIndicator = new TexturedBox(_windowBase)
{
Material = _circleMaterial,
ParentAlignment = ParentAlignments.Bottom | ParentAlignments.Center,
Size = Vector2.One * 32,
Offset = new Vector2(0, -10),
ZOffset = sbyte.MaxValue
};

_captureLabel = new Label(_captureIndicator)
{
ParentAlignment = ParentAlignments.Center,
Offset = new Vector2(0, -35),
Text = "Initializing KOTH..."
};

foreach (var banner in _windowBase.Banners)
{
banner.Visible = false;
}
}

public void Update()
{
if (_gamemode.ControlPoint == null)
{
int timeLeft = Math.Max(0, _gamemode.ActivationTimeCounter);
if (timeLeft > 0)
{
_captureIndicator.Color = Color.White;
_captureLabel.Text = $"Zone Locked: {timeLeft}s";
}
else
{
_captureIndicator.Color = Color.White;
_captureLabel.Text = "Waiting for zone creation...";
}
return;
}

var zone = _gamemode.ControlPoint;

bool isActivelyCapturing = zone.ActiveCapturingFaction != null && zone.CaptureTimeCurrent > 0f;
Color capturingColor = isActivelyCapturing
? zone.ActiveCapturingFaction.CustomColor.ColorMaskToRgb()
: Color.White;

_captureIndicator.Color = capturingColor.SetAlphaPct(0.5f);

float current = zone.CaptureTimeCurrent;
float total = zone.CaptureTime;

if (!isActivelyCapturing && current > 0f)
{
_captureIndicator.Color = Color.White.SetAlphaPct(0.5f);
}

_captureLabel.Text = $"Capturing: {current:0.0}s / {total:0.0}s";
}

public void MatchEnded(IMyFaction winner)
{
Log.Info("KOTHHud.cs:133 MatchEnded (" + winner?.Name + ")");
_captureIndicator.Visible = false;
_captureLabel.Visible = false;

_windowBase._winnerLabel.Visible = false;
_windowBase._winnerLabel = new LabelBox(_windowBase._timerLabel)
{
Text = winner != null
? $"A WINNER IS {winner.Name}"
: "YOU ARE ALL LOSERS",
ParentAlignment = ParentAlignments.Bottom,
Height = EliminationHud_TeamBanner.BaseHeight,
TextPadding = new Vector2(2.5f, 0),
Color = HudConstants.HudBackgroundColor
};
_windowBase._winnerLabel.Visible = true;

_windowBase._winnerLabel.TextBoard.SetFormatting(GlyphFormat.White.WithColor(Color.Red).WithSize(3)
.WithAlignment(TextAlignment.Center));
}
}
}
Loading