From 69ae31709396c80137e1c1a137fc4e761acc0406 Mon Sep 17 00:00:00 2001 From: starfish <50672801+starfi5h@users.noreply.github.com> Date: Tue, 25 Jun 2024 21:52:26 +0800 Subject: [PATCH] Set droneEnabled value for dedicated server and new client --- .../Patches/Dynamic/Dedicated_Server_Patch.cs | 4 +++- NebulaWorld/SimulatedWorld.cs | 13 ++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/NebulaPatcher/Patches/Dynamic/Dedicated_Server_Patch.cs b/NebulaPatcher/Patches/Dynamic/Dedicated_Server_Patch.cs index 71d34b552..7b4487384 100644 --- a/NebulaPatcher/Patches/Dynamic/Dedicated_Server_Patch.cs +++ b/NebulaPatcher/Patches/Dynamic/Dedicated_Server_Patch.cs @@ -41,6 +41,8 @@ public static void GameMainBegin_Postfix() { // Don't let the player of dedicated server to interact with enemies GameMain.mainPlayer.isAlive = false; + // Don't let the player of dedicated server send out construction drones + GameMain.mainPlayer.mecha.constructionModule.droneEnabled = false; } } @@ -64,7 +66,7 @@ public static bool OnLateUpdate() return false; } - // Destory gameObject so Update() won't execute + // Destroy gameObject so Update() won't execute [HarmonyPrefix] [HarmonyPatch(typeof(PlanetAtmoBlur), nameof(PlanetAtmoBlur.Start))] public static bool PlanetAtmoBlur_Start(PlanetAtmoBlur __instance) diff --git a/NebulaWorld/SimulatedWorld.cs b/NebulaWorld/SimulatedWorld.cs index e65ddfc89..aa889feed 100644 --- a/NebulaWorld/SimulatedWorld.cs +++ b/NebulaWorld/SimulatedWorld.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; -using System.IO; using System.Linq; using NebulaAPI; using NebulaAPI.DataStructures; @@ -24,7 +23,6 @@ using UnityEngine; using UnityEngine.UI; using Object = UnityEngine.Object; -using Random = UnityEngine.Random; #endregion @@ -127,6 +125,7 @@ public void SetupInitialPlayerState() GameMain.mainPlayer.mecha.coreEnergy = GameMain.mainPlayer.mecha.coreEnergyCap; GameMain.mainPlayer.mecha.energyShieldEnergy = GameMain.mainPlayer.mecha.energyShieldCapacity; GameMain.mainPlayer.mecha.hp = GameMain.mainPlayer.mecha.hpMaxApplied; + GameMain.mainPlayer.mecha.constructionModule.droneEnabled = true; if (GameMain.history.logisticShipWarpDrive) { // If warp has unlocked, give new client few warpers @@ -188,7 +187,7 @@ public void SetupInitialPlayerState() } // Finally we need add the local player components to the player character localPlayerMovement = GameMain.mainPlayer.gameObject.AddComponentIfMissing(); - // ChatManager should continuous exsit until the game is closed + // ChatManager should exist continuously until the game is closed GameMain.mainPlayer.gameObject.AddComponentIfMissing(); } @@ -234,7 +233,7 @@ public static void OnPlayerJoinedGame(INebulaPlayer player) { Multiplayer.Session.World.SpawnRemotePlayerModel(player.Data); - // Load overriden Planet and Star names + // Sync overrideName of planets and stars player.SendPacket(new NameInputPacket(GameMain.galaxy)); // add together player sand count and tell others if we are syncing soil @@ -316,10 +315,10 @@ public void SpawnRemotePlayerModel(IPlayerData playerData) model.Movement.localPlanetId = playerData.LocalPlanetId; remotePlayersModels.Add(playerData.PlayerId, model); - // Show conneted message - var planetname = GameMain.galaxy.PlanetById(playerData.LocalPlanetId)?.displayName ?? "In space"; + // Show connected message + var planetName = GameMain.galaxy.PlanetById(playerData.LocalPlanetId)?.displayName ?? "In space"; var message = string.Format("[{0:HH:mm}] {1} connected ({2})".Translate(), DateTime.Now, playerData.Username, - planetname); + planetName); ChatManager.Instance.SendChatMessage(message, ChatMessageType.SystemInfoMessage); } }