TODO: implement new fields
This commit is contained in:
parent
e373873a96
commit
164cf6b349
|
@ -1,4 +1,5 @@
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
using CommunityServerAPI.BattleBitAPI.Server;
|
||||||
|
|
||||||
namespace BattleBitAPI.Common
|
namespace BattleBitAPI.Common
|
||||||
{
|
{
|
||||||
|
|
|
@ -908,13 +908,14 @@ namespace BattleBitAPI.Server
|
||||||
{
|
{
|
||||||
public float DamageMultiplier = 1.0f;
|
public float DamageMultiplier = 1.0f;
|
||||||
public bool BleedingEnabled = true;
|
public bool BleedingEnabled = true;
|
||||||
public bool StamineEnabled = false;
|
public bool StaminaEnabled = false;
|
||||||
public bool FriendlyFireEnabled = false;
|
public bool FriendlyFireEnabled = false;
|
||||||
public bool HideMapVotes = true;
|
public bool HideMapVotes = true;
|
||||||
public bool OnlyWinnerTeamCanVote = false;
|
public bool OnlyWinnerTeamCanVote = false;
|
||||||
public bool HitMarkersEnabled = true;
|
public bool HitMarkersEnabled = true;
|
||||||
public bool PointLogEnabled = true;
|
public bool PointLogEnabled = true;
|
||||||
public bool SpectatorEnabled = true;
|
public bool SpectatorEnabled = true;
|
||||||
|
public float CaptureFlagSpeedMultiplier = 1f;
|
||||||
|
|
||||||
public byte MedicLimitPerSquad = 8;
|
public byte MedicLimitPerSquad = 8;
|
||||||
public byte EngineerLimitPerSquad = 8;
|
public byte EngineerLimitPerSquad = 8;
|
||||||
|
@ -925,13 +926,15 @@ namespace BattleBitAPI.Server
|
||||||
{
|
{
|
||||||
ser.Write(this.DamageMultiplier);
|
ser.Write(this.DamageMultiplier);
|
||||||
ser.Write(this.BleedingEnabled);
|
ser.Write(this.BleedingEnabled);
|
||||||
ser.Write(this.StamineEnabled);
|
ser.Write(this.StaminaEnabled);
|
||||||
ser.Write(this.FriendlyFireEnabled);
|
ser.Write(this.FriendlyFireEnabled);
|
||||||
ser.Write(this.HideMapVotes);
|
ser.Write(this.HideMapVotes);
|
||||||
ser.Write(this.OnlyWinnerTeamCanVote);
|
ser.Write(this.OnlyWinnerTeamCanVote);
|
||||||
ser.Write(this.HitMarkersEnabled);
|
ser.Write(this.HitMarkersEnabled);
|
||||||
ser.Write(this.PointLogEnabled);
|
ser.Write(this.PointLogEnabled);
|
||||||
ser.Write(this.SpectatorEnabled);
|
ser.Write(this.SpectatorEnabled);
|
||||||
|
ser.Write(this.CaptureFlagSpeedMultiplier);
|
||||||
|
|
||||||
ser.Write(this.MedicLimitPerSquad);
|
ser.Write(this.MedicLimitPerSquad);
|
||||||
ser.Write(this.EngineerLimitPerSquad);
|
ser.Write(this.EngineerLimitPerSquad);
|
||||||
ser.Write(this.SupportLimitPerSquad);
|
ser.Write(this.SupportLimitPerSquad);
|
||||||
|
@ -941,13 +944,14 @@ namespace BattleBitAPI.Server
|
||||||
{
|
{
|
||||||
this.DamageMultiplier = ser.ReadFloat();
|
this.DamageMultiplier = ser.ReadFloat();
|
||||||
this.BleedingEnabled = ser.ReadBool();
|
this.BleedingEnabled = ser.ReadBool();
|
||||||
this.StamineEnabled = ser.ReadBool();
|
this.StaminaEnabled = ser.ReadBool();
|
||||||
this.FriendlyFireEnabled = ser.ReadBool();
|
this.FriendlyFireEnabled = ser.ReadBool();
|
||||||
this.HideMapVotes = ser.ReadBool();
|
this.HideMapVotes = ser.ReadBool();
|
||||||
this.OnlyWinnerTeamCanVote = ser.ReadBool();
|
this.OnlyWinnerTeamCanVote = ser.ReadBool();
|
||||||
this.HitMarkersEnabled = ser.ReadBool();
|
this.HitMarkersEnabled = ser.ReadBool();
|
||||||
this.PointLogEnabled = ser.ReadBool();
|
this.PointLogEnabled = ser.ReadBool();
|
||||||
this.SpectatorEnabled = ser.ReadBool();
|
this.SpectatorEnabled = ser.ReadBool();
|
||||||
|
this.CaptureFlagSpeedMultiplier = ser.ReadFloat();
|
||||||
|
|
||||||
this.MedicLimitPerSquad = ser.ReadInt8();
|
this.MedicLimitPerSquad = ser.ReadInt8();
|
||||||
this.EngineerLimitPerSquad = ser.ReadInt8();
|
this.EngineerLimitPerSquad = ser.ReadInt8();
|
||||||
|
@ -958,7 +962,7 @@ namespace BattleBitAPI.Server
|
||||||
{
|
{
|
||||||
this.DamageMultiplier = 1.0f;
|
this.DamageMultiplier = 1.0f;
|
||||||
this.BleedingEnabled = true;
|
this.BleedingEnabled = true;
|
||||||
this.StamineEnabled = false;
|
this.StaminaEnabled = false;
|
||||||
this.FriendlyFireEnabled = false;
|
this.FriendlyFireEnabled = false;
|
||||||
this.HideMapVotes = true;
|
this.HideMapVotes = true;
|
||||||
this.OnlyWinnerTeamCanVote = false;
|
this.OnlyWinnerTeamCanVote = false;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using BattleBitAPI.Common;
|
using BattleBitAPI.Common;
|
||||||
|
using CommunityServerAPI.BattleBitAPI.Server;
|
||||||
|
|
||||||
namespace BattleBitAPI.Server
|
namespace BattleBitAPI.Server
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
namespace BattleBitAPI.Server
|
using CommunityServerAPI.BattleBitAPI.Server;
|
||||||
|
|
||||||
|
namespace BattleBitAPI.Server
|
||||||
{
|
{
|
||||||
public class MapRotation<TPlayer> where TPlayer : Player<TPlayer>
|
public class MapRotation<TPlayer> where TPlayer : Player<TPlayer>
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
namespace BattleBitAPI.Server
|
||||||
|
{
|
||||||
|
public class PlayerModifications<TPlayer> where TPlayer : Player<TPlayer>
|
||||||
|
{
|
||||||
|
private Player<TPlayer>.Internal @internal;
|
||||||
|
public PlayerModifications(Player<TPlayer>.Internal @internal)
|
||||||
|
{
|
||||||
|
this.@internal = @internal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float RunningSpeedMultiplier { get; set; }
|
||||||
|
public float ReceiveDamageMultiplier { get; set; }
|
||||||
|
public float GiveDamageMultiplier { get; set; }
|
||||||
|
public float JumpHeightMultiplier { get; set; }
|
||||||
|
public float FallDamageMultiplier { get; set; }
|
||||||
|
public float ReloadSpeedMultiplier { get; set; }
|
||||||
|
public bool CanUseNightVision { get; set; }
|
||||||
|
public bool HasCollision { get; set; }
|
||||||
|
public float DownTimeGiveUpTime { get; set; }
|
||||||
|
public bool AirStrafe { get; set; }
|
||||||
|
public bool CanSpawn { get; set; }
|
||||||
|
public bool CanSpectate { get; set; }
|
||||||
|
public bool IsTextChatMuted { get; set; }
|
||||||
|
public bool IsVoiceChatMuted { get; set; }
|
||||||
|
public float RespawnTime { get; set; }
|
||||||
|
public bool CanRespawn { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
using BattleBitAPI.Common;
|
using BattleBitAPI.Common;
|
||||||
|
using CommunityServerAPI.BattleBitAPI.Server;
|
||||||
|
|
||||||
namespace BattleBitAPI.Server
|
namespace BattleBitAPI.Server
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
namespace BattleBitAPI.Server
|
using CommunityServerAPI.BattleBitAPI.Server;
|
||||||
|
|
||||||
|
namespace BattleBitAPI.Server
|
||||||
{
|
{
|
||||||
public class ServerSettings<TPlayer> where TPlayer : Player<TPlayer>
|
public class ServerSettings<TPlayer> where TPlayer : Player<TPlayer>
|
||||||
{
|
{
|
||||||
|
@ -28,10 +30,10 @@
|
||||||
}
|
}
|
||||||
public bool StamineEnabled
|
public bool StamineEnabled
|
||||||
{
|
{
|
||||||
get => mResources._RoomSettings.StamineEnabled;
|
get => mResources._RoomSettings.StaminaEnabled;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
mResources._RoomSettings.StamineEnabled = value;
|
mResources._RoomSettings.StaminaEnabled = value;
|
||||||
mResources.IsDirtyRoomSettings = true;
|
mResources.IsDirtyRoomSettings = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
using BattleBitAPI.Common;
|
using BattleBitAPI.Common;
|
||||||
using BattleBitAPI.Networking;
|
|
||||||
using BattleBitAPI.Server;
|
using BattleBitAPI.Server;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Windows.Markup;
|
|
||||||
|
|
||||||
namespace BattleBitAPI
|
namespace BattleBitAPI
|
||||||
{
|
{
|
||||||
|
@ -69,6 +67,7 @@ namespace BattleBitAPI
|
||||||
public bool IsBleeding => mInternal.IsBleeding;
|
public bool IsBleeding => mInternal.IsBleeding;
|
||||||
public PlayerLoadout CurrentLoadout => mInternal.CurrentLoadout;
|
public PlayerLoadout CurrentLoadout => mInternal.CurrentLoadout;
|
||||||
public PlayerWearings CurrentWearings => mInternal.CurrentWearings;
|
public PlayerWearings CurrentWearings => mInternal.CurrentWearings;
|
||||||
|
public PlayerModifications<TPlayer> Modifications => mInternal.Modifications;
|
||||||
|
|
||||||
// ---- Events ----
|
// ---- Events ----
|
||||||
public virtual void OnCreated()
|
public virtual void OnCreated()
|
||||||
|
@ -128,51 +127,51 @@ namespace BattleBitAPI
|
||||||
// ---- Functions ----
|
// ---- Functions ----
|
||||||
public void Kick(string reason = "")
|
public void Kick(string reason = "")
|
||||||
{
|
{
|
||||||
this.GameServer.Kick(this, reason);
|
GameServer.Kick(this, reason);
|
||||||
}
|
}
|
||||||
public void Kill()
|
public void Kill()
|
||||||
{
|
{
|
||||||
this.GameServer.Kill(this);
|
GameServer.Kill(this);
|
||||||
}
|
}
|
||||||
public void ChangeTeam()
|
public void ChangeTeam()
|
||||||
{
|
{
|
||||||
this.GameServer.ChangeTeam(this);
|
GameServer.ChangeTeam(this);
|
||||||
}
|
}
|
||||||
public void ChangeTeam(Team team)
|
public void ChangeTeam(Team team)
|
||||||
{
|
{
|
||||||
this.GameServer.ChangeTeam(this, team);
|
GameServer.ChangeTeam(this, team);
|
||||||
}
|
}
|
||||||
public void KickFromSquad()
|
public void KickFromSquad()
|
||||||
{
|
{
|
||||||
this.GameServer.KickFromSquad(this);
|
GameServer.KickFromSquad(this);
|
||||||
}
|
}
|
||||||
public void JoinSquad(Squads targetSquad)
|
public void JoinSquad(Squads targetSquad)
|
||||||
{
|
{
|
||||||
this.GameServer.JoinSquad(this, targetSquad);
|
GameServer.JoinSquad(this, targetSquad);
|
||||||
}
|
}
|
||||||
public void DisbandTheSquad()
|
public void DisbandTheSquad()
|
||||||
{
|
{
|
||||||
this.GameServer.DisbandPlayerCurrentSquad(this);
|
GameServer.DisbandPlayerCurrentSquad(this);
|
||||||
}
|
}
|
||||||
public void PromoteToSquadLeader()
|
public void PromoteToSquadLeader()
|
||||||
{
|
{
|
||||||
this.GameServer.PromoteSquadLeader(this);
|
GameServer.PromoteSquadLeader(this);
|
||||||
}
|
}
|
||||||
public void WarnPlayer(string msg)
|
public void WarnPlayer(string msg)
|
||||||
{
|
{
|
||||||
this.GameServer.WarnPlayer(this, msg);
|
GameServer.WarnPlayer(this, msg);
|
||||||
}
|
}
|
||||||
public void Message(string msg)
|
public void Message(string msg)
|
||||||
{
|
{
|
||||||
this.GameServer.MessageToPlayer(this, msg);
|
GameServer.MessageToPlayer(this, msg);
|
||||||
}
|
}
|
||||||
public void Message(string msg, float fadeoutTime)
|
public void Message(string msg, float fadeoutTime)
|
||||||
{
|
{
|
||||||
this.GameServer.MessageToPlayer(this, msg, fadeoutTime);
|
GameServer.MessageToPlayer(this, msg, fadeoutTime);
|
||||||
}
|
}
|
||||||
public void SetNewRole(GameRole role)
|
public void SetNewRole(GameRole role)
|
||||||
{
|
{
|
||||||
this.GameServer.SetRoleTo(this, role);
|
GameServer.SetRoleTo(this, role);
|
||||||
}
|
}
|
||||||
public void Teleport(Vector3 target)
|
public void Teleport(Vector3 target)
|
||||||
{
|
{
|
||||||
|
@ -250,7 +249,7 @@ namespace BattleBitAPI
|
||||||
// ---- Overrides ----
|
// ---- Overrides ----
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return this.Name + " (" + this.SteamID + ")";
|
return Name + " (" + SteamID + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Internal ----
|
// ---- Internal ----
|
||||||
|
@ -276,18 +275,89 @@ namespace BattleBitAPI
|
||||||
public PlayerLoadout CurrentLoadout;
|
public PlayerLoadout CurrentLoadout;
|
||||||
public PlayerWearings CurrentWearings;
|
public PlayerWearings CurrentWearings;
|
||||||
|
|
||||||
|
public mPlayerModifications _Modifications;
|
||||||
|
public PlayerModifications<TPlayer> Modifications;
|
||||||
|
|
||||||
|
public Internal()
|
||||||
|
{
|
||||||
|
this.Modifications = new PlayerModifications<TPlayer>(this);
|
||||||
|
this._Modifications = new mPlayerModifications();
|
||||||
|
}
|
||||||
|
|
||||||
public void OnDie()
|
public void OnDie()
|
||||||
{
|
{
|
||||||
this.IsAlive = false;
|
IsAlive = false;
|
||||||
this.HP = -1f;
|
HP = -1f;
|
||||||
this.Position = default;
|
Position = default;
|
||||||
this.Standing = PlayerStand.Standing;
|
Standing = PlayerStand.Standing;
|
||||||
this.Leaning = LeaningSide.None;
|
Leaning = LeaningSide.None;
|
||||||
this.CurrentLoadoutIndex = LoadoutIndex.Primary;
|
CurrentLoadoutIndex = LoadoutIndex.Primary;
|
||||||
this.InVehicle = false;
|
InVehicle = false;
|
||||||
this.IsBleeding = false;
|
IsBleeding = false;
|
||||||
this.CurrentLoadout = new PlayerLoadout();
|
CurrentLoadout = new PlayerLoadout();
|
||||||
this.CurrentWearings = new PlayerWearings();
|
CurrentWearings = new PlayerWearings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class mPlayerModifications
|
||||||
|
{
|
||||||
|
public float RunningSpeedMultiplier = 1f;
|
||||||
|
public float ReceiveDamageMultiplier = 1f;
|
||||||
|
public float GiveDamageMultiplier = 1f;
|
||||||
|
public float JumpHeightMultiplier = 1f;
|
||||||
|
public float FallDamageMultiplier = 1f;
|
||||||
|
public float ReloadSpeedMultiplier = 1f;
|
||||||
|
public bool CanUseNightVision = true;
|
||||||
|
public bool HasCollision = false;
|
||||||
|
public float DownTimeGiveUpTime = 60f;
|
||||||
|
public bool AirStrafe = true;
|
||||||
|
public bool CanSpawn = true;
|
||||||
|
public bool CanSpectate = true;
|
||||||
|
public bool IsTextChatMuted = false;
|
||||||
|
public bool IsVoiceChatMuted = false;
|
||||||
|
public float RespawnTime = 10f;
|
||||||
|
public bool CanRespawn = true;
|
||||||
|
|
||||||
|
public bool IsDirtyFlag = false;
|
||||||
|
public void Write(BattleBitAPI.Common.Serialization.Stream ser)
|
||||||
|
{
|
||||||
|
ser.Write(this.RunningSpeedMultiplier);
|
||||||
|
ser.Write(this.ReceiveDamageMultiplier);
|
||||||
|
ser.Write(this.GiveDamageMultiplier);
|
||||||
|
ser.Write(this.JumpHeightMultiplier);
|
||||||
|
ser.Write(this.FallDamageMultiplier);
|
||||||
|
ser.Write(this.ReloadSpeedMultiplier);
|
||||||
|
ser.Write(this.CanUseNightVision);
|
||||||
|
ser.Write(this.HasCollision);
|
||||||
|
ser.Write(this.DownTimeGiveUpTime);
|
||||||
|
ser.Write(this.AirStrafe);
|
||||||
|
ser.Write(this.CanSpawn);
|
||||||
|
ser.Write(this.CanSpectate);
|
||||||
|
ser.Write(this.IsTextChatMuted);
|
||||||
|
ser.Write(this.IsVoiceChatMuted);
|
||||||
|
ser.Write(this.RespawnTime);
|
||||||
|
ser.Write(this.CanRespawn);
|
||||||
|
}
|
||||||
|
public void Read(BattleBitAPI.Common.Serialization.Stream ser)
|
||||||
|
{
|
||||||
|
this.RunningSpeedMultiplier = ser.ReadFloat();
|
||||||
|
if (this.RunningSpeedMultiplier <= 0f)
|
||||||
|
this.RunningSpeedMultiplier = 0.01f;
|
||||||
|
|
||||||
|
this.ReceiveDamageMultiplier = ser.ReadFloat();
|
||||||
|
this.GiveDamageMultiplier = ser.ReadFloat();
|
||||||
|
this.JumpHeightMultiplier = ser.ReadFloat();
|
||||||
|
this.FallDamageMultiplier = ser.ReadFloat();
|
||||||
|
this.ReloadSpeedMultiplier = ser.ReadFloat();
|
||||||
|
this.CanUseNightVision = ser.ReadBool();
|
||||||
|
this.HasCollision = ser.ReadBool();
|
||||||
|
this.DownTimeGiveUpTime = ser.ReadFloat();
|
||||||
|
this.AirStrafe = ser.ReadBool();
|
||||||
|
this.CanSpawn = ser.ReadBool();
|
||||||
|
this.CanSpectate = ser.ReadBool();
|
||||||
|
this.IsTextChatMuted = ser.ReadBool();
|
||||||
|
this.IsVoiceChatMuted = ser.ReadBool();
|
||||||
|
this.RespawnTime = ser.ReadFloat();
|
||||||
|
this.CanRespawn = ser.ReadBool();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,6 +9,7 @@ using BattleBitAPI.Common.Extentions;
|
||||||
using BattleBitAPI.Common.Serialization;
|
using BattleBitAPI.Common.Serialization;
|
||||||
using BattleBitAPI.Networking;
|
using BattleBitAPI.Networking;
|
||||||
using CommunityServerAPI.BattleBitAPI;
|
using CommunityServerAPI.BattleBitAPI;
|
||||||
|
using CommunityServerAPI.BattleBitAPI.Server;
|
||||||
|
|
||||||
namespace BattleBitAPI.Server
|
namespace BattleBitAPI.Server
|
||||||
{
|
{
|
||||||
|
|
10
Program.cs
10
Program.cs
|
@ -18,19 +18,23 @@ class Program
|
||||||
}
|
}
|
||||||
class MyPlayer : Player<MyPlayer>
|
class MyPlayer : Player<MyPlayer>
|
||||||
{
|
{
|
||||||
|
public override async Task OnConnected()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
class MyGameServer : GameServer<MyPlayer>
|
class MyGameServer : GameServer<MyPlayer>
|
||||||
{
|
{
|
||||||
public override async Task OnConnected()
|
public override async Task OnConnected()
|
||||||
{
|
{
|
||||||
ForceStartGame();
|
ForceStartGame();
|
||||||
|
|
||||||
|
ServerSettings.PointLogEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override async Task OnPlayerConnected(MyPlayer player)
|
public override async Task OnPlayerConnected(MyPlayer player)
|
||||||
{
|
{
|
||||||
await Console.Out.WriteLineAsync("Connected: "+player);
|
await Console.Out.WriteLineAsync("Connected: " + player);
|
||||||
}
|
}
|
||||||
public override async Task OnPlayerSpawned(MyPlayer player)
|
public override async Task OnPlayerSpawned(MyPlayer player)
|
||||||
{
|
{
|
||||||
|
@ -50,7 +54,7 @@ class MyGameServer : GameServer<MyPlayer>
|
||||||
}
|
}
|
||||||
public override async Task OnAPlayerRevivedAnotherPlayer(MyPlayer from, MyPlayer to)
|
public override async Task OnAPlayerRevivedAnotherPlayer(MyPlayer from, MyPlayer to)
|
||||||
{
|
{
|
||||||
await Console.Out.WriteLineAsync(from+" revived "+to);
|
await Console.Out.WriteLineAsync(from + " revived " + to);
|
||||||
}
|
}
|
||||||
public override async Task OnPlayerDisconnected(MyPlayer player)
|
public override async Task OnPlayerDisconnected(MyPlayer player)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue