This commit is contained in:
2025-12-14 21:08:19 +01:00
parent 3a7b81bfd7
commit 3124f82a2f
109 changed files with 16190 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
using KCM.Packets.Handlers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace KCM.Packets.Lobby
{
public class WorldSeed : Packet
{
public override ushort packetId => (int)Enums.Packets.WorldSeed;
public int Seed { get; set; }
public override void HandlePacketServer()
{
//SetWorldSeed();
}
public override void HandlePacketClient()
{
SetWorldSeed();
}
public void SetWorldSeed()
{
try
{
foreach (var player in Main.kCPlayers.Values)
player.inst.Reset();
World.inst.Generate(Seed);
Vector3 center = World.inst.GetCellData(World.inst.GridWidth / 2, World.inst.GridHeight / 2).Center;
Cam.inst.SetTrackingPos(center);
}
catch (Exception e)
{
Main.helper.Log("Set world seed packet error");
Main.helper.Log(e.Message);
Main.helper.Log(e.StackTrace);
Main.helper.Log(e.ToString());
}
}
}
}