various thingies
This commit is contained in:
+46
-18
@@ -1,4 +1,5 @@
|
||||
using HintServiceMeow.Core.Enum;
|
||||
using System.Drawing;
|
||||
using HintServiceMeow.Core.Enum;
|
||||
using HintServiceMeow.Core.Models.Hints;
|
||||
using HintServiceMeow.Core.Utilities;
|
||||
using LabApi.Events.Arguments.PlayerEvents;
|
||||
@@ -11,6 +12,8 @@ using PlayerRoles.PlayableScps.Scp079;
|
||||
using PlayerRoles.PlayableScps.Scp096;
|
||||
using PlayerRoles.PlayableScps.Scp3114;
|
||||
using Timer = System.Timers.Timer;
|
||||
using MEC;
|
||||
using PlayerRoles.PlayableScps.Scp049.Zombies;
|
||||
|
||||
namespace SCPTeamHint;
|
||||
|
||||
@@ -19,7 +22,6 @@ public class Plugin : LabApi.Loader.Features.Plugins.Plugin
|
||||
private readonly object _hintsLock = new();
|
||||
private readonly Dictionary<Player, Hint> _spectatorHints = new();
|
||||
|
||||
private Timer _timer;
|
||||
public override string Name => "SCPTeamHint";
|
||||
public override string Author => "HoherGeist, Code002Lover";
|
||||
public override Version Version { get; } = new(1, 0, 0);
|
||||
@@ -28,22 +30,33 @@ public class Plugin : LabApi.Loader.Features.Plugins.Plugin
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
Logger.Debug("Apple juice");
|
||||
PlayerEvents.Joined += OnJoin;
|
||||
PlayerEvents.Left += OnLeft;
|
||||
|
||||
_timer = new Timer(1000);
|
||||
_timer.Elapsed += (_, _) => UpdateHints();
|
||||
_timer.Start();
|
||||
Timing.RunCoroutine(ContinuouslyUpdateHints());
|
||||
}
|
||||
|
||||
private IEnumerator<float> ContinuouslyUpdateHints()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
yield return Timing.WaitForSeconds(1);
|
||||
try
|
||||
{
|
||||
UpdateHints();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error(e);
|
||||
}
|
||||
}
|
||||
// ReSharper disable once IteratorNeverReturns
|
||||
}
|
||||
|
||||
public override void Disable()
|
||||
{
|
||||
PlayerEvents.Joined -= OnJoin;
|
||||
PlayerEvents.Left -= OnLeft;
|
||||
_timer?.Stop();
|
||||
_timer?.Dispose();
|
||||
_timer = null;
|
||||
}
|
||||
|
||||
private void UpdateHints()
|
||||
@@ -52,11 +65,11 @@ public class Plugin : LabApi.Loader.Features.Plugins.Plugin
|
||||
|
||||
lock (_hintsLock)
|
||||
{
|
||||
foreach (var player in Player.ReadyList.Where(x => !x.IsHost && !x.IsDummy && x.IsSCP))
|
||||
foreach (var player in Player.ReadyList.Where(x => !x.IsHost && !x.IsDummy && (x.IsSCP || x.Role is RoleTypeId.Scp0492)))
|
||||
{
|
||||
var text =
|
||||
$" <size=25><color=red>{player.RoleBase.RoleName}</color> | <color=#6761cd>{player.HumeShield}</color> | <color=#da0101>{player.Health}</color> | <color=grey>{player.Zone}</color></size> ";
|
||||
|
||||
|
||||
switch (player.RoleBase)
|
||||
{
|
||||
case Scp096Role scp:
|
||||
@@ -66,17 +79,23 @@ public class Plugin : LabApi.Loader.Features.Plugins.Plugin
|
||||
|
||||
if (!tracker) break;
|
||||
|
||||
text += $"Targets: {tracker.Targets.Count}";
|
||||
var targetColor = tracker.Targets.Count > 0 ? "red" : "grey";
|
||||
text += $"<color=grey>Targets:</color> <color={targetColor}>{tracker.Targets.Count}</color>";
|
||||
break;
|
||||
case Scp3114Role scp3114:
|
||||
{
|
||||
text += "\n";
|
||||
|
||||
var stolenRole = scp3114.CurIdentity.StolenRole;
|
||||
|
||||
text += $" {stolenRole}";
|
||||
if (scp3114.Disguised)
|
||||
{
|
||||
text += $" {stolenRole}";
|
||||
}
|
||||
else
|
||||
{
|
||||
text += " None";
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Scp079Role scp079:
|
||||
text =
|
||||
$" <size=25><color=red>{player.RoleBase.RoleName}</color> | <color=grey>{scp079.CurrentCamera.Room.Zone}</color></size> ";
|
||||
@@ -88,7 +107,16 @@ public class Plugin : LabApi.Loader.Features.Plugins.Plugin
|
||||
if (!auxManager || !tierManager) break;
|
||||
|
||||
text +=
|
||||
$" <color=grey>AUX: {auxManager.CurrentAuxFloored} / {auxManager.MaxAux} | Level {tierManager.AccessTierLevel}</color>";
|
||||
$" <color=#FFEF00>AUX: {auxManager.CurrentAuxFloored}</color> / {auxManager.MaxAux} | <color=#FFD700>Level {tierManager.AccessTierLevel}</color>";
|
||||
break;
|
||||
case ZombieRole:
|
||||
var count = GrowingZombies.GrowingZombies.Instance.ZombieCorpseCount[player];
|
||||
|
||||
const string corpseColor = "E68A8A";
|
||||
|
||||
text += "\n";
|
||||
|
||||
text += $" <color=#{corpseColor}>Corpses eaten: {count}</color>";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -114,8 +142,8 @@ public class Plugin : LabApi.Loader.Features.Plugins.Plugin
|
||||
}
|
||||
|
||||
Logger.Debug(
|
||||
$"Player {player.Nickname} is on team {player.RoleBase.Team} | hide: {player.RoleBase.Team != Team.SCPs}");
|
||||
hint.Hide = player.RoleBase.Team != Team.SCPs;
|
||||
$"Player {player.Nickname} is on team {player.RoleBase.Team} with Role {player.Role} | hide: {player.RoleBase.Team != Team.SCPs}");
|
||||
hint.Hide = player.RoleBase.Team != Team.SCPs && player.Role != RoleTypeId.Scp0492 && player.Role != RoleTypeId.Overwatch;
|
||||
if (!hint.Hide) hint.Text = hintText;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,4 +45,9 @@
|
||||
<HintPath>..\dependencies\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\GrowingZombies\GrowingZombies.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user