From c671d99ae6dc8cd6b4557652380727201cf47346 Mon Sep 17 00:00:00 2001 From: xNexus-ACS <83370388+xNexus-ACS@users.noreply.github.com> Date: Thu, 12 Jan 2023 14:49:00 +0100 Subject: [PATCH 1/3] CursedGenerator and more player api --- .../Wrappers/Facility/CursedFacility.cs | 8 +++++++ .../Wrappers/Facility/CursedGenerator.cs | 23 +++++++++++++++++++ .../Features/Wrappers/Player/CursedPlayer.cs | 16 +++++++++++-- 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 CursedMod/Features/Wrappers/Facility/CursedGenerator.cs diff --git a/CursedMod/Features/Wrappers/Facility/CursedFacility.cs b/CursedMod/Features/Wrappers/Facility/CursedFacility.cs index 832ee2dd..005923e6 100644 --- a/CursedMod/Features/Wrappers/Facility/CursedFacility.cs +++ b/CursedMod/Features/Wrappers/Facility/CursedFacility.cs @@ -17,6 +17,14 @@ public static void ShowBroadcast(string message, ushort duration = 5, Broadcast. } } + public static void ShowHint(string message, int duration = 5) + { + foreach (CursedPlayer player in CursedPlayer.Collection) + { + player.ShowHint(message, duration); + } + } + public static void ClearBroadcasts() { foreach (CursedPlayer player in CursedPlayer.Collection) diff --git a/CursedMod/Features/Wrappers/Facility/CursedGenerator.cs b/CursedMod/Features/Wrappers/Facility/CursedGenerator.cs new file mode 100644 index 00000000..e3687845 --- /dev/null +++ b/CursedMod/Features/Wrappers/Facility/CursedGenerator.cs @@ -0,0 +1,23 @@ +using MapGeneration.Distributors; + +namespace CursedMod.Features.Wrappers.Facility; + +public static class CursedGenerator +{ + public static Scp079Generator Base { get; private set; } + + public static bool IsEngaged + { + get => Base.Engaged; + set => Base.Engaged = value; + } + + public static bool IsActivating + { + get => Base.Activating; + set => Base.Activating = value; + } + + public static int RemainingTime => Base.RemainingTime; + public static float DropdownSpeed => Base.DropdownSpeed; +} \ No newline at end of file diff --git a/CursedMod/Features/Wrappers/Player/CursedPlayer.cs b/CursedMod/Features/Wrappers/Player/CursedPlayer.cs index a7b65f63..02ebcc74 100644 --- a/CursedMod/Features/Wrappers/Player/CursedPlayer.cs +++ b/CursedMod/Features/Wrappers/Player/CursedPlayer.cs @@ -101,9 +101,21 @@ public class CursedPlayer public bool IsDummy => this is CursedDummy; public bool IsDead => Role is RoleTypeId.Spectator or RoleTypeId.Overwatch or RoleTypeId.None; + + public bool IsAlive => !IsDead; + + public bool IsFoundationForce => RoleManager.CurrentRole.Team is Team.FoundationForces; + + public bool IsChaos => RoleManager.CurrentRole.Team is Team.ChaosInsurgency; + + public bool IsScp => RoleManager.CurrentRole.Team is Team.SCPs; + + public bool IsTutorial => Role is RoleTypeId.Tutorial; + + public bool IsHuman => !IsScp || !IsDead; public float TimeHoldingCurrentItem => Inventory.LastItemSwitch; - + public bool TryGetEffect(string effectName, out StatusEffectBase effect) => PlayerEffectsController.TryGetEffect(effectName, out effect); public bool TryGetEffect(out T effect) where T : StatusEffectBase => PlayerEffectsController.TryGetEffect(out effect); @@ -136,7 +148,7 @@ public T EnableEffect(float duration = 0f, bool addDuration = false) where T public void ShowTag(bool global) => CharacterClassManager.UserCode_CmdRequestShowTag(global); public void HideTag() => CharacterClassManager.UserCode_CmdRequestHideTag(); - + public void ShowHint(string content, int time = 5) => ShowHint(new TextHint(content, new HintParameter[] { new StringHintParameter(string.Empty) }, null, 2)); public void ShowHint(Hint hint) => HintDisplay.Show(hint); From 69d3e715be7b89ecfe38ef7bb270da9671c8dd3b Mon Sep 17 00:00:00 2001 From: xNexus-ACS <83370388+xNexus-ACS@users.noreply.github.com> Date: Thu, 12 Jan 2023 14:59:41 +0100 Subject: [PATCH 2/3] More Round API --- .../Features/Wrappers/Round/CursedRound.cs | 48 ++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/CursedMod/Features/Wrappers/Round/CursedRound.cs b/CursedMod/Features/Wrappers/Round/CursedRound.cs index 7a8b1452..eaea4979 100644 --- a/CursedMod/Features/Wrappers/Round/CursedRound.cs +++ b/CursedMod/Features/Wrappers/Round/CursedRound.cs @@ -1,6 +1,52 @@ -namespace CursedMod.Features.Wrappers.Round; +using System; +using GameCore; +using RoundRestarting; + +namespace CursedMod.Features.Wrappers.Round; public static class CursedRound { public static void ForceStart() => PluginAPI.Core.Round.Start(); + + public static void ForceEnd() => PluginAPI.Core.Round.End(); + + public static void ForceRestart(bool fastRestart) => PluginAPI.Core.Round.Restart(fastRestart); + + public static void RestartSilently() => PluginAPI.Core.Round.RestartSilently(); + + public static bool IsRoundStarted => RoundStart.RoundStarted; + + public static bool IsRoundLocked + { + get => PluginAPI.Core.Round.IsLocked; + set => PluginAPI.Core.Round.IsLocked = value; + } + + public static bool IsLobbyLocked + { + get => RoundStart.LobbyLock; + set => RoundStart.LobbyLock = value; + } + + public static int ClassDEscaped + { + get => RoundSummary.EscapedClassD; + set => RoundSummary.EscapedClassD = value; + } + + public static int ScientistEscaped + { + get => RoundSummary.EscapedScientists; + set => RoundSummary.EscapedScientists = value; + } + + public static int ZombiesConverted + { + get => RoundSummary.ChangedIntoZombies; + set => RoundSummary.ChangedIntoZombies = value; + } + + public static int UpTime => RoundRestart.UptimeRounds; + + public static TimeSpan RoundTime => RoundStart.RoundLength; } \ No newline at end of file From a10e0c58242a3ee34ad7b4fe5f8c9f77b7beb78f Mon Sep 17 00:00:00 2001 From: xNexus-ACS <83370388+xNexus-ACS@users.noreply.github.com> Date: Thu, 12 Jan 2023 15:00:38 +0100 Subject: [PATCH 3/3] csproj --- CursedMod/CursedMod.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/CursedMod/CursedMod.csproj b/CursedMod/CursedMod.csproj index 81ae3f72..ff26280c 100644 --- a/CursedMod/CursedMod.csproj +++ b/CursedMod/CursedMod.csproj @@ -63,6 +63,7 @@ +