New changes, don't use yet

This commit is contained in:
MrOkiDoki 2023-08-18 01:56:36 +03:00
parent 3b8a386f1d
commit 4fc6d311c7
3 changed files with 23 additions and 7 deletions

View file

@ -324,7 +324,7 @@ namespace BattleBitAPI.Server
{ {
} }
public virtual async Task<OnPlayerSpawnArguments> OnPlayerSpawning(TPlayer player, OnPlayerSpawnArguments request) public virtual async Task<OnPlayerSpawnArguments?> OnPlayerSpawning(TPlayer player, OnPlayerSpawnArguments request)
{ {
return request; return request;
} }
@ -542,7 +542,7 @@ namespace BattleBitAPI.Server
SpawnPosition = position, SpawnPosition = position,
LookDirection = lookDirection, LookDirection = lookDirection,
SpawnStand = stand, SpawnStand = stand,
SpawnProtection = spawnProtection SpawnProtection = spawnProtection,
}; };
//Respond back. //Respond back.

View file

@ -976,7 +976,7 @@ namespace BattleBitAPI.Server
{ {
ulong steamID = stream.ReadUInt64(); ulong steamID = stream.ReadUInt64();
var request = new OnPlayerSpawnArguments(); OnPlayerSpawnArguments request = new OnPlayerSpawnArguments();
request.Read(stream); request.Read(stream);
ushort vehicleID = stream.ReadUInt16(); ushort vehicleID = stream.ReadUInt16();
@ -984,15 +984,25 @@ namespace BattleBitAPI.Server
{ {
async Task mHandle() async Task mHandle()
{ {
request = await server.OnPlayerSpawning((TPlayer)client, request); var responseSpawn = await server.OnPlayerSpawning((TPlayer)client, request);
//Respond back. //Respond back.
using (var response = Common.Serialization.Stream.Get()) using (var response = Common.Serialization.Stream.Get())
{ {
response.Write((byte)NetworkCommuncation.SpawnPlayer); response.Write((byte)NetworkCommuncation.SpawnPlayer);
response.Write(steamID); response.Write(steamID);
request.Write(response);
response.Write(vehicleID); if (responseSpawn != null)
{
response.Write(true);
request.Write(response);
response.Write(vehicleID);
}
else
{
response.Write(false);
}
server.WriteToSocket(response); server.WriteToSocket(response);
} }
} }

View file

@ -56,9 +56,15 @@ class MyGameServer : GameServer<MyPlayer>
} }
public override async Task OnTick() public override async Task OnTick()
{ {
foreach (var item in AllPlayers)
{
item.GameServer.ForceStartGame();
}
} }
public override async Task<OnPlayerSpawnArguments> OnPlayerSpawning(MyPlayer player, OnPlayerSpawnArguments request) public override async Task<OnPlayerSpawnArguments?> OnPlayerSpawning(MyPlayer player, OnPlayerSpawnArguments request)
{ {
return null;
request.Wearings.Eye = "Eye_Zombie_01"; request.Wearings.Eye = "Eye_Zombie_01";
request.Wearings.Face = "Face_Zombie_01"; request.Wearings.Face = "Face_Zombie_01";
request.Wearings.Face = "Hair_Zombie_01"; request.Wearings.Face = "Hair_Zombie_01";