mirror of
https://github.com/MSWS/TTT.git
synced 2025-12-05 22:20:25 -08:00
Reformat & Cleanup, add README to Versioning
This commit is contained in:
@@ -10,11 +10,11 @@ using TTT.CS2.Extensions;
|
||||
namespace TTT.CS2.GameHandlers;
|
||||
|
||||
public class BodyHider(IServiceProvider provider) : IPluginModule {
|
||||
private readonly IMessenger msg = provider.GetRequiredService<IMessenger>();
|
||||
public void Dispose() { }
|
||||
public string Name => nameof(BodyHider);
|
||||
public string Version => GitVersionInformation.FullSemVer;
|
||||
public void Start() { }
|
||||
private readonly IMessenger msg = provider.GetRequiredService<IMessenger>();
|
||||
|
||||
[GameEventHandler]
|
||||
public HookResult OnDeath(EventPlayerDeath ev, GameEventInfo _) {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Core.Attributes.Registration;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
|
||||
using JetBrains.Annotations;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using TTT.API;
|
||||
@@ -14,18 +12,19 @@ using TTT.Game.Events.Player;
|
||||
namespace TTT.CS2.GameHandlers;
|
||||
|
||||
public class CombatHandler(IServiceProvider provider) : IPluginModule {
|
||||
public string Name => "CombatListeners";
|
||||
public string Version => GitVersionInformation.FullSemVer;
|
||||
private readonly IEventBus bus = provider.GetRequiredService<IEventBus>();
|
||||
|
||||
private readonly IPlayerConverter<CCSPlayerController> converter =
|
||||
provider.GetRequiredService<IPlayerConverter<CCSPlayerController>>();
|
||||
|
||||
private readonly IEventBus bus = provider.GetRequiredService<IEventBus>();
|
||||
|
||||
private readonly IMessenger msg = provider.GetRequiredService<IMessenger>();
|
||||
public string Name => "CombatListeners";
|
||||
public string Version => GitVersionInformation.FullSemVer;
|
||||
|
||||
public void Start() { }
|
||||
|
||||
public void Dispose() { }
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="ev"></param>
|
||||
@@ -79,6 +78,4 @@ public class CombatHandler(IServiceProvider provider) : IPluginModule {
|
||||
|
||||
return HookResult.Continue;
|
||||
}
|
||||
|
||||
public void Dispose() { }
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Drawing;
|
||||
using System.Numerics;
|
||||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Core.Attributes.Registration;
|
||||
using CounterStrikeSharp.API.Modules.Entities.Constants;
|
||||
@@ -14,17 +12,6 @@ using Vector = CounterStrikeSharp.API.Modules.Utils.Vector;
|
||||
namespace TTT.CS2.GameHandlers;
|
||||
|
||||
public class PropMover(IServiceProvider provider) : IPluginModule {
|
||||
public void Dispose() { }
|
||||
|
||||
public string Name => nameof(PropMover);
|
||||
public string Version => GitVersionInformation.FullSemVer;
|
||||
|
||||
private readonly Dictionary<CCSPlayerController, MovementInfo>
|
||||
playersPressingE = new();
|
||||
|
||||
private readonly HashSet<CBaseEntity> mapEntities = new();
|
||||
private readonly IMessenger msg = provider.GetRequiredService<IMessenger>();
|
||||
|
||||
private static readonly Vector ZERO_VECTOR = new(0, 0, 0);
|
||||
private static readonly QAngle ZERO_QANGLE = new(0, 0, 0);
|
||||
|
||||
@@ -32,6 +19,17 @@ public class PropMover(IServiceProvider provider) : IPluginModule {
|
||||
"prop_physics_multiplayer", "prop_ragdoll"
|
||||
];
|
||||
|
||||
private readonly HashSet<CBaseEntity> mapEntities = new();
|
||||
private readonly IMessenger msg = provider.GetRequiredService<IMessenger>();
|
||||
|
||||
private readonly Dictionary<CCSPlayerController, MovementInfo>
|
||||
playersPressingE = new();
|
||||
|
||||
public void Dispose() { }
|
||||
|
||||
public string Name => nameof(PropMover);
|
||||
public string Version => GitVersionInformation.FullSemVer;
|
||||
|
||||
public void Start() { }
|
||||
|
||||
public void Start(BasePlugin? plugin, bool hotReload) {
|
||||
|
||||
@@ -66,11 +66,6 @@ public static class RayTrace {
|
||||
return null;
|
||||
}
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private unsafe delegate bool TraceShapeDelegate(nint GameTraceManager,
|
||||
nint vecStart, nint vecEnd, nint skip, ulong mask, byte a6,
|
||||
GameTrace* pGameTrace);
|
||||
|
||||
public static Vector? FindRayTraceIntersection(CCSPlayerController player) {
|
||||
var camera = player.Pawn.Value?.CameraServices;
|
||||
if (camera == null || player.PlayerPawn.Value == null) return null;
|
||||
@@ -83,6 +78,11 @@ public static class RayTrace {
|
||||
new Vector(pawn.AbsOrigin.X, pawn.AbsOrigin.Y, pawn.AbsOrigin.Z),
|
||||
player.PlayerPawn.Value.EyeAngles, true);
|
||||
}
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
private unsafe delegate bool TraceShapeDelegate(nint GameTraceManager,
|
||||
nint vecStart, nint vecEnd, nint skip, ulong mask, byte a6,
|
||||
GameTrace* pGameTrace);
|
||||
}
|
||||
|
||||
internal static class Address {
|
||||
|
||||
@@ -1,41 +1,26 @@
|
||||
using System.Globalization;
|
||||
using CounterStrikeSharp.API;
|
||||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Entities.Constants;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using TTT.API;
|
||||
using TTT.API.Command;
|
||||
using TTT.API.Player;
|
||||
using Vector = CounterStrikeSharp.API.Modules.Utils.Vector;
|
||||
|
||||
namespace TTT.CS2;
|
||||
|
||||
public class TestCommand(IServiceProvider provider) : ICommand, IPluginModule {
|
||||
public void Dispose() { }
|
||||
|
||||
private readonly IPlayerConverter<CCSPlayerController> converter =
|
||||
provider.GetRequiredService<IPlayerConverter<CCSPlayerController>>();
|
||||
|
||||
private readonly IPlayerFinder finder =
|
||||
provider.GetRequiredService<IPlayerFinder>();
|
||||
|
||||
public void Dispose() { }
|
||||
|
||||
public string Name => "test";
|
||||
public string Version => GitVersionInformation.FullSemVer;
|
||||
public void Start() { }
|
||||
|
||||
public void Start(BasePlugin? plugin, bool hotReload) {
|
||||
plugin
|
||||
?.RegisterListener<CounterStrikeSharp.API.Core.Listeners.CheckTransmit>(
|
||||
checkTransmit);
|
||||
}
|
||||
|
||||
private void checkTransmit(CCheckTransmitInfoList infoList) {
|
||||
foreach (var (info, player) in infoList) {
|
||||
// info.TransmitEntities.Remove();
|
||||
}
|
||||
}
|
||||
|
||||
public Task<CommandResult>
|
||||
Execute(IOnlinePlayer? executor, ICommandInfo info) {
|
||||
if (executor == null) return Task.FromResult(CommandResult.PLAYER_ONLY);
|
||||
@@ -64,12 +49,10 @@ public class TestCommand(IServiceProvider provider) : ICommand, IPluginModule {
|
||||
|
||||
foreach (var gp in finder.GetOnline()
|
||||
.Select(p => converter.GetPlayer(p))
|
||||
.OfType<CCSPlayerController>()) {
|
||||
.OfType<CCSPlayerController>())
|
||||
gp.PawnIsAlive = false;
|
||||
// Utilities.SetStateChanged(gp, "CCSPlayerController",
|
||||
// "m_bPawnIsAlive");
|
||||
}
|
||||
|
||||
// Utilities.SetStateChanged(gp, "CCSPlayerController",
|
||||
// "m_bPawnIsAlive");
|
||||
break;
|
||||
case "gettarget":
|
||||
var target = gameExecutor?.PlayerPawn.Value?.Target;
|
||||
@@ -91,4 +74,15 @@ public class TestCommand(IServiceProvider provider) : ICommand, IPluginModule {
|
||||
return Task.FromResult(CommandResult.SUCCESS);
|
||||
}
|
||||
|
||||
public void Start(BasePlugin? plugin, bool hotReload) {
|
||||
plugin
|
||||
?.RegisterListener<CounterStrikeSharp.API.Core.Listeners.CheckTransmit>(
|
||||
checkTransmit);
|
||||
}
|
||||
|
||||
private void checkTransmit(CCheckTransmitInfoList infoList) {
|
||||
foreach (var (info, player) in infoList) {
|
||||
// info.TransmitEntities.Remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Versioning/README.md
Normal file
10
Versioning/README.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# Versioning
|
||||
|
||||
This project allows for manually generating a `GitVersionInformation.g.cs` on platforms where `MSBuild.GitVersion` is
|
||||
not available (e.g. NixOS). You likely do not need to use this project (GitHub Actions is able to use
|
||||
`MSBuild.GitVersion` by itself, and Windows similarly functions seamlessly).
|
||||
|
||||
## Usage
|
||||
|
||||
1. `dotnet build`
|
||||
2. `dotnet run --project Versioning/Versioning.csproj`
|
||||
Reference in New Issue
Block a user