Skip to content

Commit

Permalink
Set droneEnabled value for dedicated server and new client
Browse files Browse the repository at this point in the history
  • Loading branch information
starfi5h committed Jul 1, 2024
1 parent eb3292b commit 69ae317
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 3 additions & 1 deletion NebulaPatcher/Patches/Dynamic/Dedicated_Server_Patch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand All @@ -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)
Expand Down
13 changes: 6 additions & 7 deletions NebulaWorld/SimulatedWorld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NebulaAPI;
using NebulaAPI.DataStructures;
Expand All @@ -24,7 +23,6 @@
using UnityEngine;
using UnityEngine.UI;
using Object = UnityEngine.Object;
using Random = UnityEngine.Random;

#endregion

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -188,7 +187,7 @@ public void SetupInitialPlayerState()
}
// Finally we need add the local player components to the player character
localPlayerMovement = GameMain.mainPlayer.gameObject.AddComponentIfMissing<LocalPlayerMovement>();
// ChatManager should continuous exsit until the game is closed
// ChatManager should exist continuously until the game is closed
GameMain.mainPlayer.gameObject.AddComponentIfMissing<ChatManager>();
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 69ae317

Please sign in to comment.