mirror of
https://github.com/MSWS/TTT.git
synced 2025-12-07 23:06:33 -08:00
Compare commits
10 Commits
1.4.0-dev.
...
2.0.1-dev.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dfe86b0242 | ||
|
|
eff68897a0 | ||
|
|
63afe31e3b | ||
|
|
a7fa2afe15 | ||
|
|
7749deabd3 | ||
|
|
f8b67c5194 | ||
|
|
77281aa8c6 | ||
|
|
20497bbb4d | ||
|
|
133083003d | ||
|
|
ad3603c833 |
@@ -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}.");
|
||||
|
||||
@@ -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}");
|
||||
|
||||
@@ -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}"));
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user