Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

CursedGenerator, More Player API, More Round API and ShowHint at CursedFacility #3

Merged
merged 3 commits into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CursedMod/CursedMod.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<Compile Include="Features\Wrappers\AdminToys\CursedPrimitiveObject.cs" />
<Compile Include="Features\Wrappers\CursedPrefabManager.cs" />
<Compile Include="Features\Wrappers\Facility\CursedFacility.cs" />
<Compile Include="Features\Wrappers\Facility\CursedGenerator.cs" />
<Compile Include="Features\Wrappers\Facility\CursedWarhead.cs" />
<Compile Include="Features\Wrappers\Facility\Props\CursedBreakableWindow.cs" />
<Compile Include="Features\Wrappers\Facility\Rooms\CursedLightningController.cs" />
Expand Down
8 changes: 8 additions & 0 deletions CursedMod/Features/Wrappers/Facility/CursedFacility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
23 changes: 23 additions & 0 deletions CursedMod/Features/Wrappers/Facility/CursedGenerator.cs
Original file line number Diff line number Diff line change
@@ -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;
}
16 changes: 14 additions & 2 deletions CursedMod/Features/Wrappers/Player/CursedPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>(out T effect) where T : StatusEffectBase => PlayerEffectsController.TryGetEffect(out effect);
Expand Down Expand Up @@ -136,7 +148,7 @@ public T EnableEffect<T>(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);
Expand Down
48 changes: 47 additions & 1 deletion CursedMod/Features/Wrappers/Round/CursedRound.cs
Original file line number Diff line number Diff line change
@@ -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;
}