Compare commits
No commits in common. "main" and "v1.2.4.b3-panorama3" have entirely different histories.
main
...
v1.2.4.b3-
4 changed files with 23 additions and 39 deletions
|
|
@ -116,14 +116,14 @@ namespace src.command
|
||||||
|
|
||||||
if (command.ArgCount < 2)
|
if (command.ArgCount < 2)
|
||||||
{
|
{
|
||||||
Reply("Usage: css_setoverride <name, steamid64, @me, @all, @ct, @t, @random, ...>");
|
Reply("Usage: css_setoverride <name or steamid64>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// zio: same targets as css_setskill. Several targets are all set to one state:
|
var targetPlayer = Utilities.GetPlayers().FirstOrDefault(p => p != null && p.IsValid
|
||||||
// on if any of them is off, otherwise off.
|
&& (p.SteamID.ToString().Equals(command.GetArg(1), StringComparison.CurrentCultureIgnoreCase)
|
||||||
var targets = GetSetSkillTargets(player, command.GetArg(1), _ => true);
|
|| p.PlayerName.Equals(command.GetArg(1), StringComparison.OrdinalIgnoreCase)));
|
||||||
if (targets.Count == 0)
|
if (targetPlayer == null)
|
||||||
{
|
{
|
||||||
Reply(player == null
|
Reply(player == null
|
||||||
? Localization.GetTranslationWithoutIlliterate("player_not_found_setskill")
|
? Localization.GetTranslationWithoutIlliterate("player_not_found_setskill")
|
||||||
|
|
@ -131,12 +131,8 @@ namespace src.command
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool enabled = targets.Any(p => !CooldownOverride.IsSet(p));
|
bool enabled = CooldownOverride.Toggle(targetPlayer);
|
||||||
foreach (var targetPlayer in targets)
|
Reply($"Cooldown override {(enabled ? $"{ChatColors.Lime}ON" : $"{ChatColors.LightRed}OFF")}{ChatColors.Default} for {ChatColors.LightRed}\u202A{targetPlayer.PlayerName}\u202C");
|
||||||
CooldownOverride.Set(targetPlayer, enabled);
|
|
||||||
|
|
||||||
string who = targets.Count == 1 ? targets[0].PlayerName : $"{targets.Count} players";
|
|
||||||
Reply($"Cooldown override {(enabled ? $"{ChatColors.Lime}ON" : $"{ChatColors.LightRed}OFF")}{ChatColors.Default} for {ChatColors.LightRed}\u202A{who}\u202C");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Command_SetSkill(CCSPlayerController? player, CommandInfo command)
|
private static void Command_SetSkill(CCSPlayerController? player, CommandInfo command)
|
||||||
|
|
@ -228,15 +224,6 @@ namespace src.command
|
||||||
Reply("error_setskill");
|
Reply("error_setskill");
|
||||||
}
|
}
|
||||||
|
|
||||||
// zio: one player for commands that take a single target (css_setstaticskill, css_next): the
|
|
||||||
// css_setskill rules, so part of a name works, but only when it picks out one player.
|
|
||||||
private static CCSPlayerController? GetSinglePlayerTarget(CCSPlayerController? caller, string arg)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(arg)) return null;
|
|
||||||
var targets = GetSetSkillTargets(caller, arg, _ => true);
|
|
||||||
return targets.Count == 1 ? targets[0] : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// zio: css_setskill targets. An exact name or SteamID64 as before, CSS's own selectors
|
// zio: css_setskill targets. An exact name or SteamID64 as before, CSS's own selectors
|
||||||
// (@me, @all, @ct, @t, @alive, #userid, ...), or @random/@randomct/@randomt: one random
|
// (@me, @all, @ct, @t, @alive, #userid, ...), or @random/@randomct/@randomt: one random
|
||||||
// alive player, drawn only from players the skill's team restriction allows.
|
// alive player, drawn only from players the skill's team restriction allows.
|
||||||
|
|
@ -583,7 +570,9 @@ namespace src.command
|
||||||
{
|
{
|
||||||
Debug.WriteToDebug($"Player {player?.PlayerName} used the css_setstaticskill {command.ArgString} command.");
|
Debug.WriteToDebug($"Player {player?.PlayerName} used the css_setstaticskill {command.ArgString} command.");
|
||||||
if (!string.IsNullOrEmpty(config.NormalCommands.SetStaticSkillCommand.Permissions) && !AdminManager.PlayerHasPermissions(player, config.NormalCommands.SetStaticSkillCommand.Permissions)) return;
|
if (!string.IsNullOrEmpty(config.NormalCommands.SetStaticSkillCommand.Permissions) && !AdminManager.PlayerHasPermissions(player, config.NormalCommands.SetStaticSkillCommand.Permissions)) return;
|
||||||
var targetPlayer = GetSinglePlayerTarget(player, command.GetArg(1));
|
var targetPlayer = Utilities.GetPlayers().FirstOrDefault(p => p != null && p.IsValid
|
||||||
|
&& (p.SteamID.ToString().Equals(command.GetArg(1), StringComparison.CurrentCultureIgnoreCase)
|
||||||
|
|| p.PlayerName.Equals(command.GetArg(1), StringComparison.OrdinalIgnoreCase)));
|
||||||
|
|
||||||
if (command.ArgCount < 2)
|
if (command.ArgCount < 2)
|
||||||
{
|
{
|
||||||
|
|
@ -730,8 +719,10 @@ namespace src.command
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(playerString))
|
if (!string.IsNullOrEmpty(playerString))
|
||||||
{
|
{
|
||||||
targetPlayer = GetSinglePlayerTarget(player, playerString);
|
targetPlayer = Utilities.GetPlayers().FirstOrDefault(p => p != null && p.IsValid
|
||||||
|
&& (p.SteamID.ToString().Equals(playerString, StringComparison.CurrentCultureIgnoreCase)
|
||||||
|
|| p.PlayerName.Equals(playerString, StringComparison.OrdinalIgnoreCase)));
|
||||||
|
|
||||||
if (targetPlayer == null)
|
if (targetPlayer == null)
|
||||||
{
|
{
|
||||||
if (player == null)
|
if (player == null)
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ namespace src
|
||||||
public override string ModuleName => "[CS2] [ jRandomSkills ]";
|
public override string ModuleName => "[CS2] [ jRandomSkills ]";
|
||||||
public override string ModuleAuthor => "D3X (Original), Juzlus (Modifier), ByDexterTR (Contributor)";
|
public override string ModuleAuthor => "D3X (Original), Juzlus (Modifier), ByDexterTR (Contributor)";
|
||||||
public override string ModuleDescription => "Plugin adds random skills every round for CS2 by D3X. Modified by Juzlus.";
|
public override string ModuleDescription => "Plugin adds random skills every round for CS2 by D3X. Modified by Juzlus.";
|
||||||
public override string ModuleVersion => "1.2.4.b3-panorama5";
|
public override string ModuleVersion => "1.2.4.b3-panorama3";
|
||||||
|
|
||||||
public override void Load(bool hotReload)
|
public override void Load(bool hotReload)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -15,16 +15,14 @@ namespace src.utils
|
||||||
private static readonly HashSet<ulong> _players = [];
|
private static readonly HashSet<ulong> _players = [];
|
||||||
private static readonly ConcurrentDictionary<Type, FieldInfo[]> _stateFields = new();
|
private static readonly ConcurrentDictionary<Type, FieldInfo[]> _stateFields = new();
|
||||||
|
|
||||||
// Sets the override for one player.
|
// Toggles the override and returns the new state.
|
||||||
public static void Set(CCSPlayerController player, bool enabled)
|
public static bool Toggle(CCSPlayerController player)
|
||||||
{
|
{
|
||||||
if (enabled) _players.Add(Key(player));
|
if (_players.Remove(Key(player))) return false;
|
||||||
else _players.Remove(Key(player));
|
_players.Add(Key(player));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The player's own setting, without following a bot takeover like Has does.
|
|
||||||
public static bool IsSet(CCSPlayerController player) => _players.Contains(Key(player));
|
|
||||||
|
|
||||||
// A bot a human has taken over counts as that human, since skills run on the bot's controller.
|
// A bot a human has taken over counts as that human, since skills run on the bot's controller.
|
||||||
public static bool Has(CCSPlayerController? player)
|
public static bool Has(CCSPlayerController? player)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
11
release.sh
11
release.sh
|
|
@ -29,13 +29,8 @@ set -euo pipefail
|
||||||
FORGEJO_URL="https://git.zio.sh"
|
FORGEJO_URL="https://git.zio.sh"
|
||||||
OWNER="cs2"
|
OWNER="cs2"
|
||||||
REPO="jRandomSkills"
|
REPO="jRandomSkills"
|
||||||
# Needs write:repository. Only uploading needs it; downloading from the public repo doesn't. From the
|
# Placeholder - replace, or set FORGEJO_TOKEN in the environment instead. Needs write:repository.
|
||||||
# environment, or else from .forgejo-token in the cs2/ folder above every plugin (outside their
|
# Only uploading needs it; downloading from the public repo doesn't. Don't commit a real token.
|
||||||
# repos, mode 600). Don't commit a real token.
|
|
||||||
TOKEN_FILE="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/../../.forgejo-token"
|
|
||||||
if [[ -z "${FORGEJO_TOKEN:-}" && -r "$TOKEN_FILE" ]]; then
|
|
||||||
FORGEJO_TOKEN="$(tr -d '[:space:]' < "$TOKEN_FILE")"
|
|
||||||
fi
|
|
||||||
FORGEJO_TOKEN="${FORGEJO_TOKEN:-CHANGE_ME_FORGEJO_TOKEN}"
|
FORGEJO_TOKEN="${FORGEJO_TOKEN:-CHANGE_ME_FORGEJO_TOKEN}"
|
||||||
|
|
||||||
# CS2 client used to compile the Panorama layouts, and the Workshop Tools addon compiled into.
|
# CS2 client used to compile the Panorama layouts, and the Workshop Tools addon compiled into.
|
||||||
|
|
@ -65,7 +60,7 @@ if [[ -z "$TAG" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [[ "$FORGEJO_TOKEN" == "CHANGE_ME_FORGEJO_TOKEN" ]]; then
|
if [[ "$FORGEJO_TOKEN" == "CHANGE_ME_FORGEJO_TOKEN" ]]; then
|
||||||
echo "Set FORGEJO_TOKEN (export it, or put it in $TOKEN_FILE) first." >&2
|
echo "Set FORGEJO_TOKEN (edit release.sh or export it) first." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue