From d6d2962250b82c3a5170dc1338a1724ebd1c4b6b Mon Sep 17 00:00:00 2001 From: MrOkiDoki <0mrokidoki@gmail.com> Date: Wed, 23 Aug 2023 01:19:18 +0300 Subject: [PATCH] AAA --- .../Arguments/OnPlayerSpawnArguments.cs | 2 +- BattleBitAPI/Common/Enums/SpawningRule.cs | 22 ++++++++++ BattleBitAPI/Server/GameServer.cs | 1 - .../Server/Internal/PlayerModifications.cs | 33 ++++++++++++++- .../Server/Internal/ServerSettings.cs | 40 ++++++++++++++++++- 5 files changed, 94 insertions(+), 4 deletions(-) create mode 100644 BattleBitAPI/Common/Enums/SpawningRule.cs diff --git a/BattleBitAPI/Common/Arguments/OnPlayerSpawnArguments.cs b/BattleBitAPI/Common/Arguments/OnPlayerSpawnArguments.cs index bb2f6a8..1c49d1d 100644 --- a/BattleBitAPI/Common/Arguments/OnPlayerSpawnArguments.cs +++ b/BattleBitAPI/Common/Arguments/OnPlayerSpawnArguments.cs @@ -4,7 +4,7 @@ namespace BattleBitAPI.Common { public struct OnPlayerSpawnArguments { - public PlayerSpawningPosition RequestedPoint; + public PlayerSpawningPosition RequestedPoint { get; private set; } public PlayerLoadout Loadout; public PlayerWearings Wearings; public Vector3 SpawnPosition; diff --git a/BattleBitAPI/Common/Enums/SpawningRule.cs b/BattleBitAPI/Common/Enums/SpawningRule.cs new file mode 100644 index 0000000..a053200 --- /dev/null +++ b/BattleBitAPI/Common/Enums/SpawningRule.cs @@ -0,0 +1,22 @@ +namespace BattleBitAPI.Common +{ + [System.Flags] + public enum SpawningRule : ulong + { + None = 0, + + Flags = 1 << 0, + SquadMates = 1 << 1, + SquadCaptain = 1 << 2, + + Tanks = 1 << 3, + Transports = 1 << 4, + Boats = 1 << 5, + Helicopters = 1 << 6, + APCs = 1 << 7, + + RallyPoints = 1 << 8, + + All = ulong.MaxValue, + } +} diff --git a/BattleBitAPI/Server/GameServer.cs b/BattleBitAPI/Server/GameServer.cs index ff45b59..f1b4633 100644 --- a/BattleBitAPI/Server/GameServer.cs +++ b/BattleBitAPI/Server/GameServer.cs @@ -684,7 +684,6 @@ namespace BattleBitAPI.Server { Loadout = loadout, Wearings = wearings, - RequestedPoint = PlayerSpawningPosition.Null, SpawnPosition = position, LookDirection = lookDirection, SpawnStand = stand, diff --git a/BattleBitAPI/Server/Internal/PlayerModifications.cs b/BattleBitAPI/Server/Internal/PlayerModifications.cs index ff48e86..3c1b699 100644 --- a/BattleBitAPI/Server/Internal/PlayerModifications.cs +++ b/BattleBitAPI/Server/Internal/PlayerModifications.cs @@ -1,4 +1,6 @@ -namespace BattleBitAPI.Server +using BattleBitAPI.Common; + +namespace BattleBitAPI.Server { public class PlayerModifications where TPlayer : Player { @@ -279,6 +281,28 @@ @internal._Modifications.IsDirtyFlag = true; } } + public bool IsExposedOnMap + { + get => @internal._Modifications.IsExposedOnMap; + set + { + if (@internal._Modifications.IsExposedOnMap == value) + return; + @internal._Modifications.IsExposedOnMap = value; + @internal._Modifications.IsDirtyFlag = true; + } + } + public SpawningRule SpawningRule + { + get => @internal._Modifications.SpawningRule; + set + { + if (@internal._Modifications.SpawningRule == value) + return; + @internal._Modifications.SpawningRule = value; + @internal._Modifications.IsDirtyFlag = true; + } + } public void DisableBleeding() { @@ -318,6 +342,8 @@ public float CaptureFlagSpeedMultiplier = 1f; public bool PointLogHudEnabled = true; public bool KillFeed = false; + public bool IsExposedOnMap = false; + public SpawningRule SpawningRule; public bool IsDirtyFlag = false; public void Write(BattleBitAPI.Common.Serialization.Stream ser) @@ -347,6 +373,8 @@ ser.Write(this.CaptureFlagSpeedMultiplier); ser.Write(this.PointLogHudEnabled); ser.Write(this.KillFeed); + ser.Write(this.IsExposedOnMap); + ser.Write((ulong)this.SpawningRule); } public void Read(BattleBitAPI.Common.Serialization.Stream ser) { @@ -378,6 +406,8 @@ this.CaptureFlagSpeedMultiplier = ser.ReadFloat(); this.PointLogHudEnabled = ser.ReadBool(); this.KillFeed = ser.ReadBool(); + this.IsExposedOnMap = ser.ReadBool(); + this.SpawningRule = (SpawningRule)ser.ReadUInt64(); } public void Reset() { @@ -405,6 +435,7 @@ this.CaptureFlagSpeedMultiplier = 1f; this.PointLogHudEnabled = true; this.KillFeed = false; + this.SpawningRule = SpawningRule.All; } } } diff --git a/BattleBitAPI/Server/Internal/ServerSettings.cs b/BattleBitAPI/Server/Internal/ServerSettings.cs index 64eee73..e264346 100644 --- a/BattleBitAPI/Server/Internal/ServerSettings.cs +++ b/BattleBitAPI/Server/Internal/ServerSettings.cs @@ -1,4 +1,6 @@ -namespace BattleBitAPI.Server +using System.Runtime.ConstrainedExecution; + +namespace BattleBitAPI.Server { public class ServerSettings where TPlayer : Player { @@ -54,6 +56,29 @@ mResources.IsDirtyRoomSettings = true; } } + public bool CanVoteDay + { + get => mResources._RoomSettings.CanVoteDay; + set + { + if (mResources._RoomSettings.CanVoteDay == value) + return; + mResources._RoomSettings.CanVoteDay = value; + mResources.IsDirtyRoomSettings = true; + } + } + public bool CanVoteNight + { + get => mResources._RoomSettings.CanVoteNight; + set + { + if (mResources._RoomSettings.CanVoteNight == value) + return; + mResources._RoomSettings.CanVoteNight = value; + mResources.IsDirtyRoomSettings = true; + } + } + // ---- Reset ---- public void Reset() @@ -69,11 +94,15 @@ public bool HideMapVotes = true; public bool OnlyWinnerTeamCanVote = false; public bool PlayerCollision = false; + public byte MedicLimitPerSquad = 8; public byte EngineerLimitPerSquad = 8; public byte SupportLimitPerSquad = 8; public byte ReconLimitPerSquad = 8; + public bool CanVoteDay = true; + public bool CanVoteNight = true; + public void Write(Common.Serialization.Stream ser) { ser.Write(this.DamageMultiplier); @@ -86,6 +115,9 @@ ser.Write(this.EngineerLimitPerSquad); ser.Write(this.SupportLimitPerSquad); ser.Write(this.ReconLimitPerSquad); + + ser.Write(this.CanVoteDay); + ser.Write(this.CanVoteNight); } public void Read(Common.Serialization.Stream ser) { @@ -99,6 +131,9 @@ this.EngineerLimitPerSquad = ser.ReadInt8(); this.SupportLimitPerSquad = ser.ReadInt8(); this.ReconLimitPerSquad = ser.ReadInt8(); + + this.CanVoteDay = ser.ReadBool(); + this.CanVoteNight = ser.ReadBool(); } public void Reset() { @@ -112,6 +147,9 @@ this.EngineerLimitPerSquad = 8; this.SupportLimitPerSquad = 8; this.ReconLimitPerSquad = 8; + + this.CanVoteDay = true; + this.CanVoteNight = true; } } }