Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Added more API to CursedServer and CursedRound #8

Merged
merged 1 commit into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CursedMod/Features/Wrappers/Round/CursedRound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ public static int ZombiesConverted
set => RoundSummary.ChangedIntoZombies = value;
}

public static int RoundKills
{
get => RoundSummary.Kills;
set => RoundSummary.Kills = value;
}

public static int SurvivedScps
{
get => RoundSummary.SurvivingSCPs;
set => RoundSummary.SurvivingSCPs = value;
}

public static int UpTime => RoundRestart.UptimeRounds;

public static TimeSpan RoundTime => RoundStart.RoundLength;
Expand Down
32 changes: 31 additions & 1 deletion CursedMod/Features/Wrappers/Server/CursedServer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using CursedMod.Features.Wrappers.Player.Dummies;
using System;
using CursedMod.Features.Wrappers.Player.Dummies;
using Mirror.LiteNetLib4Mirror;
using UnityEngine;

namespace CursedMod.Features.Wrappers.Server;

Expand Down Expand Up @@ -44,4 +46,32 @@ public static bool HeavilyModded
get => CustomNetworkManager.HeavilyModded;
set => CustomNetworkManager.HeavilyModded = value;
}

public static bool IsFriendlyFireEnabled
{
get => ServerConsole.FriendlyFire;
set => ServerConsole.FriendlyFire = value;
}

public static bool IsWhitelistEnabled
{
get => ServerConsole.WhiteListEnabled;
set => ServerConsole.WhiteListEnabled = value;
}

public static string IpAddress => ServerConsole.Ip;

public static double Ticks => Math.Round(1f / Time.smoothDeltaTime);

public static double Frames => Math.Round(1f / Time.deltaTime);

public static bool IsBeta => GameCore.Version.PublicBeta || GameCore.Version.PrivateBeta;

public static bool IsDedicated => ServerStatic.IsDedicated;

public static void RefreshServerName() => ServerConsole.singleton.RefreshServerName();

public static void RefreshServerData() => ServerConsole.singleton.RefreshServerData();

public static void SendCommand(string command, CommandSender sender = null) => GameCore.Console.singleton.TypeCommand(command, sender ?? LocalPlayer.Sender);
}