1.0.4c-zio1: CSS 1.0.375 / net10.0, fixes, SimpleAdmin ranks

- Target net10.0 and CounterStrikeSharp 1.0.375 (compile-only reference),
  System.Text.Json instead of Newtonsoft.Json.
- Config moves to configs/plugins/CS2-Tags/tags.json, defaulting to our
  #rank/... SimpleAdmin groups. Comments and trailing commas allowed; a bad
  file is logged and the previous tags kept.
- Scoreboard tags call SetStateChanged on m_szClan, only when changed.
- Colour tags are expanded only in config strings, not in players' names or
  messages. Empty nick_color means team colour.
- A tag with no prefix or colours leaves chat to the game; drop team_chat.
- css_tags_reload works for @css/root too and reapplies scoreboard tags;
  hot reload tags connected players. Timers stop on map change. No dead
  icon for spectators.
- Remove css_tag_mute/unmute and "@" team admin chat: CS2-SimpleAdmin does
  both, and its catch-all command listener runs before these.
- Add release.sh, drop the .sln and GitHub workflow, README for the fork.
This commit is contained in:
Astra 2026-09-27 16:23:45 +01:00
parent 0d5c8ec061
commit cd90d1bf82
7 changed files with 361 additions and 553 deletions

121
README.md
View file

@ -1,78 +1,75 @@
# CS2-Tags
### Do you appreciate what I do? Buy me a cup of tea ❤️
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/Y8Y4THKXG)
Our fork of [daffyyyy/CS2-Tags](https://github.com/daffyyyy/CS2-Tags): chat prefixes, name/message
colours and scoreboard (clan) tags, assigned by SteamID64, admin group or permission. Built for
CounterStrikeSharp 1.0.375 (net10.0) and meant to run alongside CS2-SimpleAdmin.
![image](https://github.com/daffyyyy/CS2-Tags/assets/41084667/25dd3f2b-0604-41a2-b2bd-9be230db71e1)
![image](https://github.com/daffyyyy/CS2-Tags/assets/41084667/663a0de1-b875-48fc-bda5-56add5a4833b)
## Changes from upstream 1.0.4c
### Description
Adds tags to the server that can be easily edited, tags can be assigned via permission or steamid64
- Targets net10.0 / CSS 1.0.375. Uses System.Text.Json, so Newtonsoft.Json no longer ships with it.
- Config moved to `configs/plugins/CS2-Tags/tags.json`. The default file uses our SimpleAdmin rank
groups. Comments and trailing commas are allowed. A broken file is logged and the previous
tags stay in use.
- Scoreboard tags call `SetStateChanged` on `m_szClan` so clients are told about the change.
- Colour tags like `{RED}` are only expanded in the config's strings. Players can no longer colour
their own chat by typing them.
- An empty `nick_color` means the team colour (like normal chat), not whatever colour the prefix
ended on.
- A tag with an empty `prefix`, `nick_color` and `message_color` leaves that player's chat alone
(the game prints it), in both all and team chat. The old `team_chat` key is gone.
- `css_tags_reload` works from the server console and for `@css/root` admins, and reapplies
scoreboard tags straight away. Hot reload applies tags to players already connected.
- Removed `css_tag_mute`/`css_tag_unmute` and the `@` team-chat admin chat. CS2-SimpleAdmin
already does both, and its catch-all command listener runs first. CSS always runs those before
per-command listeners, so gagged players' messages never reach this plugin.
### Commands
- css_tags_reload - Reload tags config
## Configuration
### Configuration
```
`addons/counterstrikesharp/configs/plugins/CS2-Tags/tags.json`, written with defaults on first load:
```jsonc
{
"tags": {
"#css/admin": { // Group
"prefix": "{GREEN}[ADMIN]", // Chat prefix
"nick_color": "{RED}", // Nick color
"message_color": "{GOLD}", // Message nick color
"scoreboard": "[ADMIN]" // Scoreboard tag
},
"@css/chat": { // Permission
"prefix": "{GREEN}[ADMIN]", // Chat prefix
"nick_color": "{RED}", // Nick color
"message_color": "{GOLD}", // Message nick color
"scoreboard": "[ADMIN]" // Scoreboard tag
},
"76561198202892670": { // SteamID64
"prefix": "{GREEN}[ADMIN]",
"nick_color": "{RED}",
"message_color": "{GOLD}",
"scoreboard": "[ADMIN]"
},
"everyone": { // Tag for everyone, bots excluded
"prefix": "",
"nick_color": "",
"message_color": "",
"scoreboard": "[Player]"
}
"76561198000000000": { "prefix": "{Magenta}[Dev]", "nick_color": "", "message_color": "", "scoreboard": "[Dev]" },
"#rank/owner": { "prefix": "{DarkRed}[Owner]", "nick_color": "{LightRed}", "message_color": "", "scoreboard": "[Owner]" },
"#rank/admin": { "prefix": "{Red}[Admin]", "nick_color": "{LightRed}", "message_color": "", "scoreboard": "[Admin]" },
"@css/vip": { "prefix": "{Gold}[VIP]", "nick_color": "", "message_color": "", "scoreboard": "[VIP]" },
"everyone": { "prefix": "", "nick_color": "", "message_color": "", "scoreboard": "" }
}
}
```
In addons/counterstrikesharp/plugins/CS2-Tags/tags.json
### Requirments
[CounterStrikeSharp](https://github.com/roflmuffin/CounterStrikeSharp/) **tested on v142**
Each player gets exactly one tag, picked in this order:
1. A SteamID64 key matching the player.
2. The first `#group` or `@permission` key the player matches, **in file order**. Put higher
ranks first. `@css/root` passes every `@css/...` check, so owners match any permission key.
3. `everyone`, if present.
Fields (all optional, empty means "not set"):
- `prefix` - shown before the name in chat.
- `nick_color` / `message_color` - colour tags; empty means team colour / default.
- `scoreboard` - clan tag on the scoreboard; empty leaves the player's own clan tag.
Colours: any `ChatColors` field name in braces, case-insensitive, e.g. `{Red}`, `{LightBlue}`,
`{Gold}`, `{Grey}`, plus `{TEAMCOLOR}`.
Group membership comes from CS2-SimpleAdmin (`css_addadmin ... -g`, `css_addgroup`, then
`css_reloadadmins`). After changing ranks or `tags.json`, run `css_tags_reload` to reapply
scoreboard tags without waiting for a respawn.
## Commands
- `css_tags_reload` (`@css/root` or server console) - reload `tags.json` and reapply scoreboard tags.
## Building and releasing
### Colors
```
public static char Default = '\x01';
public static char White = '\x01';
public static char Darkred = '\x02';
public static char Green = '\x04';
public static char LightYellow = '\x03';
public static char LightBlue = '\x03';
public static char Olive = '\x05';
public static char Lime = '\x06';
public static char Red = '\x07';
public static char Purple = '\x03';
public static char Grey = '\x08';
public static char Yellow = '\x09';
public static char Gold = '\x10';
public static char Silver = '\x0A';
public static char Blue = '\x0B';
public static char DarkBlue = '\x0C';
public static char BlueGrey = '\x0D';
public static char Magenta = '\x0E';
public static char LightRed = '\x0F';
cd plugins/CS2-Tags && ../../build.sh # output in compiled/CS2-Tags/
FORGEJO_TOKEN=... ./release.sh v<ModuleVersion>
```
```{TEAMCOLOR} - Team color```
Use color name for e.g. {LightRed}
### TODO
- Thinking about better fix for commands handling
`release.sh` rebuilds from the committed source and publishes `CS2-Tags-<tag>.tar.gz`, laid out
like `game/csgo/`, to https://git.zio.sh/cs2/CS2-Tags. The tag must equal `v<ModuleVersion>`
(`v1.0.4c-zio1` now).