Compare commits

...

10 Commits

Author SHA1 Message Date
MSWS
dfe86b0242 fix: Round confliction logic 2025-11-10 15:02:40 -08:00
MSWS
eff68897a0 Merge branch 'dev' of github.com:MSWS/TTT into dev 2025-11-10 14:45:55 -08:00
MSWS
63afe31e3b fix: Vanilla round inverted +semver:patch 2025-11-10 14:45:48 -08:00
MSWS
a7fa2afe15 fix: Vanilla round invert 2025-11-10 14:45:34 -08:00
MSWS
7749deabd3 Force rebuild for new major 2.0.0 2025-11-10 14:36:18 -08:00
MSWS
f8b67c5194 Update getmulti params 2025-11-10 13:56:03 -08:00
MSWS
77281aa8c6 Fix lowgrav convar fetching 2025-11-10 12:56:43 -08:00
MSWS
20497bbb4d Synchronize special round 2025-11-10 12:48:59 -08:00
MSWS
133083003d Merge branch 'dev' of github.com:MSWS/TTT into dev 2025-11-10 12:45:05 -08:00
MSWS
ad3603c833 Allow testing rounds with whitespace in name 2025-11-10 12:44:27 -08:00
5 changed files with 9 additions and 9 deletions

View File

@@ -34,8 +34,9 @@ public class GiveItemCommand(IServiceProvider provider) : ICommand {
List<IOnlinePlayer> targets = [executor];
Server.NextWorldUpdateAsync(() => {
var name = executor.Name;
if (info.ArgCount == 3) targets = finder.GetMulti(info.Args[2], out name);
var name = executor.Name;
if (info.ArgCount == 3)
targets = finder.GetMulti(info.Args[2], out name, executor);
foreach (var player in targets) shop.GiveItem(player, item);
info.ReplySync($"Gave item '{item.Name}' to {name}.");

View File

@@ -24,16 +24,16 @@ public class SpecialRoundCommand(IServiceProvider provider) : ICommand {
}
if (info.ArgCount == 1) {
tracker.TryStartSpecialRound();
Server.NextWorldUpdate(() => tracker.TryStartSpecialRound());
info.ReplySync("Started a random special round.");
return Task.FromResult(CommandResult.SUCCESS);
}
var rounds = provider.GetServices<ITerrorModule>()
.OfType<AbstractSpecialRound>()
.ToDictionary(r => r.Name.ToLower(), r => r);
.ToDictionary(r => r.Name.ToLower().Replace(" ", ""), r => r);
var roundName = info.Args[1].ToLower();
var roundName = string.Join("", info.Args.Skip(1)).ToLower();
if (!rounds.TryGetValue(roundName, out var round)) {
info.ReplySync($"No special round found with name '{roundName}'.");
foreach (var name in rounds.Keys) info.ReplySync($"- {name}");

View File

@@ -28,7 +28,7 @@ public class LowGravRound(IServiceProvider provider)
var cvar = ConVar.Find("sv_gravity");
if (cvar == null) return;
originalGravity = cvar.GetPrimitiveValue<int>();
originalGravity = (int) Math.Round(cvar.GetPrimitiveValue<float>());
var newGravity = (int)(originalGravity * config.GravityMultiplier);
Server.NextWorldUpdate(()
=> Server.ExecuteCommand($"sv_gravity {newGravity}"));

View File

@@ -42,7 +42,7 @@ public class VanillaRound(IServiceProvider provider)
[UsedImplicitly]
[EventHandler(Priority = Priority.HIGH)]
public void OnPurchase(PlayerPurchaseItemEvent ev) {
if (Tracker.ActiveRounds.Contains(this)) return;
if (!Tracker.ActiveRounds.Contains(this)) return;
ev.IsCanceled = true;
messenger.Message(ev.Player, locale[RoundMsgs.VANILLA_ROUND_REMINDER]);

View File

@@ -86,8 +86,7 @@ public class SpecialRoundStarter(IServiceProvider provider)
var rounds = Provider.GetServices<ITerrorModule>()
.OfType<AbstractSpecialRound>()
.Where(r => r.Config.Weight > 0 && !exclude.Contains(r))
.Where(r
=> !exclude.Any(er => er.ConflictsWith(r) && !r.ConflictsWith(er)))
.Where(r => !exclude.Any(er => er.ConflictsWith(r) || r.ConflictsWith(er)))
.ToList();
if (rounds.Count == 0) return null;
var totalWeight = rounds.Sum(r => r.Config.Weight);