various thingies

This commit is contained in:
2025-06-08 00:54:06 +02:00
parent 67e3d6ceaa
commit 326b99c464
18 changed files with 867 additions and 226 deletions
+69
View File
@@ -0,0 +1,69 @@
using HintServiceMeow.Core.Enum;
using HintServiceMeow.Core.Models.Hints;
using HintServiceMeow.Core.Utilities;
using LabApi.Features;
using LabApi.Loader.Features.Plugins;
using LabApi.Features.Wrappers;
using MEC;
namespace ModInfo
{
public class ModInfo : Plugin
{
public override string Name => "ModInfo";
public override string Author => "Code002Lover";
public override Version Version { get; } = new(1, 0, 0);
public override string Description => "Shows some extra info for moderators";
public override Version RequiredApiVersion { get; } = new(LabApiProperties.CompiledVersion);
private readonly Dictionary<Player, Hint> _spectatorHints = new();
public override void Enable()
{
Timing.RunCoroutine(GodmodeHintLoop());
}
public override void Disable()
{
}
private IEnumerator<float> GodmodeHintLoop()
{
while(true)
{
yield return Timing.WaitForSeconds(1);
UpdateHints();
}
// ReSharper disable once IteratorNeverReturns
}
private void UpdateHints()
{
foreach (var player in Player.ReadyList) UpdateHint(player);
}
private void UpdateHint(Player player)
{
var hint = _spectatorHints.TryGetValue(player, out var hintValue) ? hintValue : AddPlayerHint(player);
hint.Hide = !player.IsGodModeEnabled;
}
private Hint AddPlayerHint(Player player)
{
var hint = new Hint
{
Text = "<size=40><color=#50C878>GODMODE</color></size>",
Alignment = HintAlignment.Left,
YCoordinate = 800,
Hide = true
};
var playerDisplay = PlayerDisplay.Get(player);
playerDisplay.AddHint(hint);
_spectatorHints[player] = hint;
return hint;
}
}
}
+62
View File
@@ -0,0 +1,62 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<Optimize>true</Optimize>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<DebugType>full</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<Optimize>true</Optimize>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<DebugType>none</DebugType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Northwood.LabAPI" Version="1.0.2"/>
</ItemGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>..\dependencies\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\dependencies\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>..\dependencies\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="CommandSystem.Core">
<HintPath>..\dependencies\CommandSystem.Core.dll</HintPath>
</Reference>
<Reference Include="HintServiceMeow">
<HintPath>..\dependencies\HintServiceMeow-LabAPI.dll</HintPath>
</Reference>
<Reference Include="Mirror">
<HintPath>..\dependencies\Mirror.dll</HintPath>
</Reference>
<Reference Include="NorthwoodLib">
<HintPath>..\dependencies\NorthwoodLib.dll</HintPath>
</Reference>
<Reference Include="Pooling">
<HintPath>..\dependencies\Pooling.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\dependencies\UnityEngine.CoreModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Content Include=".template.config\template.json"/>
</ItemGroup>
</Project>