This commit is contained in:
MrOkiDoki 2023-08-23 01:19:18 +03:00
parent 4477d06a50
commit d6d2962250
5 changed files with 94 additions and 4 deletions

View File

@ -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;

View File

@ -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,
}
}

View File

@ -684,7 +684,6 @@ namespace BattleBitAPI.Server
{
Loadout = loadout,
Wearings = wearings,
RequestedPoint = PlayerSpawningPosition.Null,
SpawnPosition = position,
LookDirection = lookDirection,
SpawnStand = stand,

View File

@ -1,4 +1,6 @@
namespace BattleBitAPI.Server
using BattleBitAPI.Common;
namespace BattleBitAPI.Server
{
public class PlayerModifications<TPlayer> where TPlayer : Player<TPlayer>
{
@ -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;
}
}
}

View File

@ -1,4 +1,6 @@
namespace BattleBitAPI.Server
using System.Runtime.ConstrainedExecution;
namespace BattleBitAPI.Server
{
public class ServerSettings<TPlayer> where TPlayer : Player<TPlayer>
{
@ -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;
}
}
}