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
99
README.md
99
README.md
|
|
@ -1,68 +1,105 @@
|
|||
# 🔦 Flashlight
|
||||
# Flashlight
|
||||
|
||||
Flashlight is a plugin for Counter-Strike 2 that adds a flashlight feature for players. It is written in C# and uses the CounterStrikeSharp API. 🎮
|
||||
Flashlight is a Counter-Strike 2 server plugin written in C# with [CounterStrikeSharp](https://docs.cssharp.dev). It gives human players a toggleable flashlight using a parented `light_barn` entity.
|
||||
|
||||
## ⭐ Features
|
||||
## Features
|
||||
|
||||
- 💡 Players can toggle the flashlight on and off using `Use` key (the default key for this is `E`) or `/fl_toggle` in chat which could be bound to a different key.
|
||||
- 💀 The flashlight is automatically turned off when the player dies or respawns.
|
||||
- 🚫 The flashlight is only available to human players, not bots.
|
||||
- Toggle with the Use key (`E` by default) or `css_fl_toggle`
|
||||
- One `light_barn` per player, parented to the pawn attachment (no per-tick spawn/teleport)
|
||||
- Configurable brightness, range, color, shadows, offsets, and attachment
|
||||
- Automatically turns off on death, spawn, and team change
|
||||
- Bots ignored
|
||||
|
||||
## 🔧 Installation
|
||||
## Requirements
|
||||
|
||||
1. ⬇️ Download the latest release from the GitHub repository.
|
||||
2. 📁 Extract the ZIP file.
|
||||
3. 📂 Place the plugin in the `game/csgo/addons/counterstrikesharp/plugins/Flashlight` directory.
|
||||
- CounterStrikeSharp **1.0.371+** (API minimum version enforced)
|
||||
- .NET **10** runtime as provided by your CounterStrikeSharp install
|
||||
|
||||
## 💻 Usage
|
||||
## Installation
|
||||
|
||||
⌨️ Use the `Use` key to toggle the flashlight on and off. The default key for this is `E`. Or use the `/fl_toggle` command in chat which could then be bound to a different key.
|
||||
1. Download the latest release ZIP.
|
||||
2. Extract it.
|
||||
3. Place the plugin folder in `game/csgo/addons/counterstrikesharp/plugins/Flashlight`.
|
||||
|
||||
## Usage
|
||||
|
||||
- Press Use (`E`) to toggle, if enabled in config.
|
||||
- Or bind a key:
|
||||
|
||||
Example bind:
|
||||
```
|
||||
bind f "css_fl_toggle"
|
||||
```
|
||||
|
||||
## 🛠️ Development
|
||||
## Configuration
|
||||
|
||||
On first load, CounterStrikeSharp writes a JSON config for the plugin. Defaults:
|
||||
|
||||
| Key | Default | Description |
|
||||
| --- | --- | --- |
|
||||
| `Enabled` | `true` | Master switch |
|
||||
| `AllowUseKey` | `true` | Allow Use-key toggle |
|
||||
| `ToggleCooldownSeconds` | `0.25` | Toggle cooldown |
|
||||
| `Brightness` | `1.0` | Light brightness |
|
||||
| `Range` | `2048` | Light range |
|
||||
| `ColorR` / `ColorG` / `ColorB` | `255` | Light color |
|
||||
| `ColorTemperature` | `6500` | Kelvin temperature |
|
||||
| `CastShadows` | `true` | Cast dynamic shadows |
|
||||
| `SoftX` / `SoftY` | `1.0` | Softness |
|
||||
| `Skirt` / `SkirtNear` | `0.5` / `1.0` | Skirt falloff |
|
||||
| `SizeX` / `SizeY` / `SizeZ` | `45` / `45` / `0.03` | Beam size params |
|
||||
| `ForwardDistance` | `54` | Spawn offset along view forward |
|
||||
| `StandEyeOffsetZ` | `64` | Standing eye height offset |
|
||||
| `CrouchEyeOffsetZ` | `46` | Crouching eye height offset |
|
||||
| `AttachmentName` | `axis_of_intent` | Parent attachment |
|
||||
| `LightCookie` | `materials/effects/lightcookies/flashlight.vtex` | Flashlight cookie texture |
|
||||
|
||||
## Development
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- .NET 8.0 SDK
|
||||
- CounterStrikeSharp API v1.0.363+
|
||||
- .NET 10 SDK
|
||||
- CounterStrikeSharp.API 1.0.371+
|
||||
|
||||
### Building
|
||||
### Build
|
||||
|
||||
```bash
|
||||
dotnet restore
|
||||
dotnet build
|
||||
```
|
||||
|
||||
### Testing
|
||||
### Test
|
||||
|
||||
```bash
|
||||
dotnet test
|
||||
```
|
||||
|
||||
## 🤝 Contributing
|
||||
Unit tests cover toggle/cooldown logic, Use-key edge detection, origin math, create/destroy policy, and config clamping. Entity parenting requires a live CS2 server.
|
||||
|
||||
Contributions are welcome. Please open an issue or submit a pull request on GitHub. 🐙
|
||||
## Changelog
|
||||
|
||||
## 📋 Changelog
|
||||
### v0.1.0
|
||||
|
||||
### v0.0.6 (Latest)
|
||||
- ✅ Updated to .NET 8.0
|
||||
- ✅ Updated to CounterStrikeSharp.API v1.0.363
|
||||
- ✅ Added xUnit test project with core logic tests
|
||||
- ✅ Updated GitHub Actions workflow with testing
|
||||
- ✅ Improved code compatibility with latest CS2/CSS API
|
||||
- Updated to .NET 10 and CounterStrikeSharp.API 1.0.371
|
||||
- Replaced per-tick `light_omni2` spawn/teleport with parented `light_barn`
|
||||
- Added `IPluginConfig` settings for light and toggle behavior
|
||||
- Added focused xUnit tests for pure helpers
|
||||
- Updated GitHub Actions for .NET 10, PR tests, and tag releases
|
||||
- Switched logging to `BasePlugin.Logger`
|
||||
|
||||
### v0.0.6
|
||||
|
||||
- Updated to .NET 8.0 and CounterStrikeSharp.API v1.0.363
|
||||
- Added initial xUnit test project
|
||||
- Improved CSS API compatibility (`V_angle`, entity validity checks)
|
||||
|
||||
### v0.0.5
|
||||
|
||||
- Initial release
|
||||
|
||||
## 📃 License
|
||||
## License
|
||||
|
||||
This project is licensed under the GNU General Public License. ⚖️
|
||||
GNU General Public License. See `LICENSE`.
|
||||
|
||||
## ✏️ Author
|
||||
## Author
|
||||
|
||||
This project was created by [creazy.eth](https://github.com/creazy231)
|
||||
[creazy.eth](https://github.com/creazy231)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue