mirror of
https://github.com/creazy231/cs2-css-flashlight.git
synced 2026-09-27 20:17:04 +02:00
🔦 Modernize flashlight for CSS/.NET 10
Bump to CounterStrikeSharp 1.0.371 and .NET 10, replace per-tick light spawns with a parented light_barn, add plugin config, real unit tests, and refresh CI plus docs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
081278a8ae
commit
a0ef6311ee
13 changed files with 847 additions and 434 deletions
101
Flashlight/FlashlightConfig.cs
Normal file
101
Flashlight/FlashlightConfig.cs
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
using System.Text.Json.Serialization;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
|
||||
namespace Flashlight;
|
||||
|
||||
public class FlashlightConfig : BasePluginConfig
|
||||
{
|
||||
[JsonPropertyName("Enabled")]
|
||||
public bool Enabled { get; set; } = true;
|
||||
|
||||
[JsonPropertyName("AllowUseKey")]
|
||||
public bool AllowUseKey { get; set; } = true;
|
||||
|
||||
[JsonPropertyName("ToggleCooldownSeconds")]
|
||||
public float ToggleCooldownSeconds { get; set; } = 0.25f;
|
||||
|
||||
[JsonPropertyName("Brightness")]
|
||||
public float Brightness { get; set; } = 1.0f;
|
||||
|
||||
[JsonPropertyName("Range")]
|
||||
public float Range { get; set; } = 2048f;
|
||||
|
||||
[JsonPropertyName("ColorR")]
|
||||
public byte ColorR { get; set; } = 255;
|
||||
|
||||
[JsonPropertyName("ColorG")]
|
||||
public byte ColorG { get; set; } = 255;
|
||||
|
||||
[JsonPropertyName("ColorB")]
|
||||
public byte ColorB { get; set; } = 255;
|
||||
|
||||
[JsonPropertyName("ColorTemperature")]
|
||||
public float ColorTemperature { get; set; } = 6500f;
|
||||
|
||||
[JsonPropertyName("CastShadows")]
|
||||
public bool CastShadows { get; set; } = true;
|
||||
|
||||
[JsonPropertyName("SoftX")]
|
||||
public float SoftX { get; set; } = 1.0f;
|
||||
|
||||
[JsonPropertyName("SoftY")]
|
||||
public float SoftY { get; set; } = 1.0f;
|
||||
|
||||
[JsonPropertyName("Skirt")]
|
||||
public float Skirt { get; set; } = 0.5f;
|
||||
|
||||
[JsonPropertyName("SkirtNear")]
|
||||
public float SkirtNear { get; set; } = 1.0f;
|
||||
|
||||
[JsonPropertyName("SizeX")]
|
||||
public float SizeX { get; set; } = 45f;
|
||||
|
||||
[JsonPropertyName("SizeY")]
|
||||
public float SizeY { get; set; } = 45f;
|
||||
|
||||
[JsonPropertyName("SizeZ")]
|
||||
public float SizeZ { get; set; } = 0.03f;
|
||||
|
||||
[JsonPropertyName("ForwardDistance")]
|
||||
public float ForwardDistance { get; set; } = 54f;
|
||||
|
||||
[JsonPropertyName("StandEyeOffsetZ")]
|
||||
public float StandEyeOffsetZ { get; set; } = 64f;
|
||||
|
||||
[JsonPropertyName("CrouchEyeOffsetZ")]
|
||||
public float CrouchEyeOffsetZ { get; set; } = 46f;
|
||||
|
||||
[JsonPropertyName("AttachmentName")]
|
||||
public string AttachmentName { get; set; } = "axis_of_intent";
|
||||
|
||||
[JsonPropertyName("LightCookie")]
|
||||
public string LightCookie { get; set; } = "materials/effects/lightcookies/flashlight.vtex";
|
||||
|
||||
public void Clamp()
|
||||
{
|
||||
ToggleCooldownSeconds = Math.Max(0f, ToggleCooldownSeconds);
|
||||
Brightness = Math.Max(0f, Brightness);
|
||||
Range = Math.Max(1f, Range);
|
||||
ColorTemperature = Math.Clamp(ColorTemperature, 1000f, 12000f);
|
||||
SoftX = Math.Max(0f, SoftX);
|
||||
SoftY = Math.Max(0f, SoftY);
|
||||
Skirt = Math.Max(0f, Skirt);
|
||||
SkirtNear = Math.Max(0f, SkirtNear);
|
||||
SizeX = Math.Max(0f, SizeX);
|
||||
SizeY = Math.Max(0f, SizeY);
|
||||
SizeZ = Math.Max(0f, SizeZ);
|
||||
ForwardDistance = Math.Max(0f, ForwardDistance);
|
||||
StandEyeOffsetZ = Math.Max(0f, StandEyeOffsetZ);
|
||||
CrouchEyeOffsetZ = Math.Max(0f, CrouchEyeOffsetZ);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(AttachmentName))
|
||||
{
|
||||
AttachmentName = "axis_of_intent";
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(LightCookie))
|
||||
{
|
||||
LightCookie = "materials/effects/lightcookies/flashlight.vtex";
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue