TODO: implement new fields
This commit is contained in:
parent
e373873a96
commit
164cf6b349
|
@ -1,4 +1,5 @@
|
|||
using System.Numerics;
|
||||
using CommunityServerAPI.BattleBitAPI.Server;
|
||||
|
||||
namespace BattleBitAPI.Common
|
||||
{
|
||||
|
|
|
@ -908,13 +908,14 @@ namespace BattleBitAPI.Server
|
|||
{
|
||||
public float DamageMultiplier = 1.0f;
|
||||
public bool BleedingEnabled = true;
|
||||
public bool StamineEnabled = false;
|
||||
public bool StaminaEnabled = false;
|
||||
public bool FriendlyFireEnabled = false;
|
||||
public bool HideMapVotes = true;
|
||||
public bool OnlyWinnerTeamCanVote = false;
|
||||
public bool HitMarkersEnabled = true;
|
||||
public bool PointLogEnabled = true;
|
||||
public bool SpectatorEnabled = true;
|
||||
public float CaptureFlagSpeedMultiplier = 1f;
|
||||
|
||||
public byte MedicLimitPerSquad = 8;
|
||||
public byte EngineerLimitPerSquad = 8;
|
||||
|
@ -925,13 +926,15 @@ namespace BattleBitAPI.Server
|
|||
{
|
||||
ser.Write(this.DamageMultiplier);
|
||||
ser.Write(this.BleedingEnabled);
|
||||
ser.Write(this.StamineEnabled);
|
||||
ser.Write(this.StaminaEnabled);
|
||||
ser.Write(this.FriendlyFireEnabled);
|
||||
ser.Write(this.HideMapVotes);
|
||||
ser.Write(this.OnlyWinnerTeamCanVote);
|
||||
ser.Write(this.HitMarkersEnabled);
|
||||
ser.Write(this.PointLogEnabled);
|
||||
ser.Write(this.SpectatorEnabled);
|
||||
ser.Write(this.CaptureFlagSpeedMultiplier);
|
||||
|
||||
ser.Write(this.MedicLimitPerSquad);
|
||||
ser.Write(this.EngineerLimitPerSquad);
|
||||
ser.Write(this.SupportLimitPerSquad);
|
||||
|
@ -941,13 +944,14 @@ namespace BattleBitAPI.Server
|
|||
{
|
||||
this.DamageMultiplier = ser.ReadFloat();
|
||||
this.BleedingEnabled = ser.ReadBool();
|
||||
this.StamineEnabled = ser.ReadBool();
|
||||
this.StaminaEnabled = ser.ReadBool();
|
||||
this.FriendlyFireEnabled = ser.ReadBool();
|
||||
this.HideMapVotes = ser.ReadBool();
|
||||
this.OnlyWinnerTeamCanVote = ser.ReadBool();
|
||||
this.HitMarkersEnabled = ser.ReadBool();
|
||||
this.PointLogEnabled = ser.ReadBool();
|
||||
this.SpectatorEnabled = ser.ReadBool();
|
||||
this.CaptureFlagSpeedMultiplier = ser.ReadFloat();
|
||||
|
||||
this.MedicLimitPerSquad = ser.ReadInt8();
|
||||
this.EngineerLimitPerSquad = ser.ReadInt8();
|
||||
|
@ -958,7 +962,7 @@ namespace BattleBitAPI.Server
|
|||
{
|
||||
this.DamageMultiplier = 1.0f;
|
||||
this.BleedingEnabled = true;
|
||||
this.StamineEnabled = false;
|
||||
this.StaminaEnabled = false;
|
||||
this.FriendlyFireEnabled = false;
|
||||
this.HideMapVotes = true;
|
||||
this.OnlyWinnerTeamCanVote = false;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using BattleBitAPI.Common;
|
||||
using CommunityServerAPI.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>
|
||||
{
|
||||
|
|
|
@ -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 CommunityServerAPI.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>
|
||||
{
|
||||
|
@ -28,10 +30,10 @@
|
|||
}
|
||||
public bool StamineEnabled
|
||||
{
|
||||
get => mResources._RoomSettings.StamineEnabled;
|
||||
get => mResources._RoomSettings.StaminaEnabled;
|
||||
set
|
||||
{
|
||||
mResources._RoomSettings.StamineEnabled = value;
|
||||
mResources._RoomSettings.StaminaEnabled = value;
|
||||
mResources.IsDirtyRoomSettings = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
using BattleBitAPI.Common;
|
||||
using BattleBitAPI.Networking;
|
||||
using BattleBitAPI.Server;
|
||||
using System.Net;
|
||||
using System.Numerics;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace BattleBitAPI
|
||||
{
|
||||
|
@ -69,6 +67,7 @@ namespace BattleBitAPI
|
|||
public bool IsBleeding => mInternal.IsBleeding;
|
||||
public PlayerLoadout CurrentLoadout => mInternal.CurrentLoadout;
|
||||
public PlayerWearings CurrentWearings => mInternal.CurrentWearings;
|
||||
public PlayerModifications<TPlayer> Modifications => mInternal.Modifications;
|
||||
|
||||
// ---- Events ----
|
||||
public virtual void OnCreated()
|
||||
|
@ -128,51 +127,51 @@ namespace BattleBitAPI
|
|||
// ---- Functions ----
|
||||
public void Kick(string reason = "")
|
||||
{
|
||||
this.GameServer.Kick(this, reason);
|
||||
GameServer.Kick(this, reason);
|
||||
}
|
||||
public void Kill()
|
||||
{
|
||||
this.GameServer.Kill(this);
|
||||
GameServer.Kill(this);
|
||||
}
|
||||
public void ChangeTeam()
|
||||
{
|
||||
this.GameServer.ChangeTeam(this);
|
||||
GameServer.ChangeTeam(this);
|
||||
}
|
||||
public void ChangeTeam(Team team)
|
||||
{
|
||||
this.GameServer.ChangeTeam(this, team);
|
||||
GameServer.ChangeTeam(this, team);
|
||||
}
|
||||
public void KickFromSquad()
|
||||
{
|
||||
this.GameServer.KickFromSquad(this);
|
||||
GameServer.KickFromSquad(this);
|
||||
}
|
||||
public void JoinSquad(Squads targetSquad)
|
||||
{
|
||||
this.GameServer.JoinSquad(this, targetSquad);
|
||||
GameServer.JoinSquad(this, targetSquad);
|
||||
}
|
||||
public void DisbandTheSquad()
|
||||
{
|
||||
this.GameServer.DisbandPlayerCurrentSquad(this);
|
||||
GameServer.DisbandPlayerCurrentSquad(this);
|
||||
}
|
||||
public void PromoteToSquadLeader()
|
||||
{
|
||||
this.GameServer.PromoteSquadLeader(this);
|
||||
GameServer.PromoteSquadLeader(this);
|
||||
}
|
||||
public void WarnPlayer(string msg)
|
||||
{
|
||||
this.GameServer.WarnPlayer(this, msg);
|
||||
GameServer.WarnPlayer(this, msg);
|
||||
}
|
||||
public void Message(string msg)
|
||||
{
|
||||
this.GameServer.MessageToPlayer(this, msg);
|
||||
GameServer.MessageToPlayer(this, msg);
|
||||
}
|
||||
public void Message(string msg, float fadeoutTime)
|
||||
{
|
||||
this.GameServer.MessageToPlayer(this, msg, fadeoutTime);
|
||||
GameServer.MessageToPlayer(this, msg, fadeoutTime);
|
||||
}
|
||||
public void SetNewRole(GameRole role)
|
||||
{
|
||||
this.GameServer.SetRoleTo(this, role);
|
||||
GameServer.SetRoleTo(this, role);
|
||||
}
|
||||
public void Teleport(Vector3 target)
|
||||
{
|
||||
|
@ -250,7 +249,7 @@ namespace BattleBitAPI
|
|||
// ---- Overrides ----
|
||||
public override string ToString()
|
||||
{
|
||||
return this.Name + " (" + this.SteamID + ")";
|
||||
return Name + " (" + SteamID + ")";
|
||||
}
|
||||
|
||||
// ---- Internal ----
|
||||
|
@ -276,18 +275,89 @@ namespace BattleBitAPI
|
|||
public PlayerLoadout CurrentLoadout;
|
||||
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()
|
||||
{
|
||||
this.IsAlive = false;
|
||||
this.HP = -1f;
|
||||
this.Position = default;
|
||||
this.Standing = PlayerStand.Standing;
|
||||
this.Leaning = LeaningSide.None;
|
||||
this.CurrentLoadoutIndex = LoadoutIndex.Primary;
|
||||
this.InVehicle = false;
|
||||
this.IsBleeding = false;
|
||||
this.CurrentLoadout = new PlayerLoadout();
|
||||
this.CurrentWearings = new PlayerWearings();
|
||||
IsAlive = false;
|
||||
HP = -1f;
|
||||
Position = default;
|
||||
Standing = PlayerStand.Standing;
|
||||
Leaning = LeaningSide.None;
|
||||
CurrentLoadoutIndex = LoadoutIndex.Primary;
|
||||
InVehicle = false;
|
||||
IsBleeding = false;
|
||||
CurrentLoadout = new PlayerLoadout();
|
||||
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.Networking;
|
||||
using CommunityServerAPI.BattleBitAPI;
|
||||
using CommunityServerAPI.BattleBitAPI.Server;
|
||||
|
||||
namespace BattleBitAPI.Server
|
||||
{
|
||||
|
|
10
Program.cs
10
Program.cs
|
@ -18,19 +18,23 @@ class Program
|
|||
}
|
||||
class MyPlayer : Player<MyPlayer>
|
||||
{
|
||||
|
||||
public override async Task OnConnected()
|
||||
{
|
||||
}
|
||||
}
|
||||
class MyGameServer : GameServer<MyPlayer>
|
||||
{
|
||||
public override async Task OnConnected()
|
||||
{
|
||||
ForceStartGame();
|
||||
|
||||
ServerSettings.PointLogEnabled = false;
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -50,7 +54,7 @@ class MyGameServer : GameServer<MyPlayer>
|
|||
}
|
||||
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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue