update prep

This commit is contained in:
DasIschBims 2023-08-17 23:08:44 +02:00
parent 8f9597831a
commit 51941ee3cb
No known key found for this signature in database
GPG Key ID: A01C65C4183A6610
2 changed files with 63 additions and 6 deletions

View File

@ -52,7 +52,7 @@ public class CommandHandler
}
case ActionType.Start:
{
if (player.GameServer.RoundSettings.State != GameState.WaitingForPlayers)
if (player.GameServer.RoundSettings.State != GameState.WaitingForPlayers && player.GameServer.RoundSettings.State != GameState.CountingDown)
{
player.Message("Round already started!");
break;

View File

@ -35,14 +35,62 @@ class MyGameServer : GameServer<MyPlayer>
private CommandHandler handler = new();
private async Task SetupServer()
{
ServerSettings.BleedingEnabled = false;
ServerSettings.SpectatorEnabled = false;
MapRotation.ClearRotation();
MapRotation.AddToRotation("Azagor");
GamemodeRotation.ClearRotation();
GamemodeRotation.AddToRotation("TDM");
if (RoundSettings.State == GameState.WaitingForPlayers)
ForceStartGame();
if (RoundSettings.State == GameState.CountingDown)
RoundSettings.SecondsLeft = 1;
if (RoundSettings.State == GameState.Playing)
AllPlayers.ToList().ForEach((player) =>
{
player.SetRunningSpeedMultiplier(1.25f);
player.SetJumpMultiplier(1.5f);
player.SetFallDamageMultiplier(0f);
});
}
public override async Task OnTick()
{
ServerSettings.JumpHeightMultiplier = 1.5f;
ServerSettings.RunningSpeedMultiplier = 1.25f;
ServerSettings.FallDamageMultiplier = 0f;
ServerSettings.CanSpectate = false;
ServerSettings.ReloadSpeedMultiplier = 1.25f;
ServerSettings.CanRespawn = false;
ServerSettings.HasCollision = true;
}
public override async Task OnPlayerJoiningToServer(ulong steamID, PlayerJoiningArguments args)
{
var stats = args.Stats;
stats.Progress.Rank = 200;
stats.Progress.Prestige = 10;
if (steamID == 76561198395073327)
stats.Roles = Roles.Admin;
if (RoundSettings.State == GameState.WaitingForPlayers)
ForceStartGame();
}
public override async Task OnConnected()
{
Console.WriteLine($"Gameserver connected! {this.GameIP}:{this.GamePort}");
ServerSettings.BleedingEnabled = false;
ServerSettings.SpectatorEnabled = false;
await SetupServer();
}
public override async Task OnDisconnected()
{
Console.WriteLine($"Gameserver disconnected! {this.GameIP}:{this.GamePort}");
@ -52,12 +100,19 @@ class MyGameServer : GameServer<MyPlayer>
{
Console.WriteLine($"Gameserver reconnected! {this.GameIP}:{this.GamePort}");
ServerSettings.BleedingEnabled = false;
ServerSettings.SpectatorEnabled = false;
await SetupServer();
}
public override async Task OnPlayerConnected(MyPlayer player)
{
SayToChat("<color=green>" + player.Name + " joined the game!</color>");
await Console.Out.WriteLineAsync("Connected: " + player);
}
public override async Task OnPlayerDisconnected(MyPlayer player)
{
SayToChat("<color=orange>" + player.Name + " left the game!</color>");
await Console.Out.WriteLineAsync("Disconnected: " + player);
}
@ -65,11 +120,13 @@ class MyGameServer : GameServer<MyPlayer>
{
if (args.Killer == args.Victim)
{
SayToChat("<color=red>" + args.Killer.Name + " killes themselves!</color>");
args.Victim.Kill();
args.Victim.Deaths++;
}
else
{
SayToChat("<color=red>" + args.Killer.Name + " killed " + args.Victim.Name + "!</color>");
args.Victim.Kill();
args.Killer.SetHP(100);
args.Killer.Kills++;