only allow host to change action

This commit is contained in:
Mister_Nebula 2022-04-10 14:12:29 +01:00
parent 50aba7746f
commit 955811c6de
4 changed files with 23 additions and 2 deletions

View File

@ -10,7 +10,13 @@ internal class ChangeActionMessage : QSBWorldObjectMessage<QSBGhostBrain, GhostA
public override void OnReceiveRemote()
{
if (QSBCore.IsHost)
{
DebugLog.ToConsole("Error - Received ChangeActionMessage on host. Something has gone horribly wrong!", OWML.Common.MessageType.Error);
return;
}
DebugLog.DebugWrite($"{WorldObject.AttachedObject._name} Change action to {Data}");
WorldObject.ChangeAction(WorldObject.GetAction(Data), true);
}
}
}

View File

@ -305,6 +305,11 @@ internal class GhostBrainPatches : QSBPatch
return true;
}
if (!QSBCore.IsHost)
{
return false;
}
__instance.GetWorldObject<QSBGhostBrain>().EvaluateActions();
return false;
}

View File

@ -546,7 +546,11 @@ public class QSBGhostBrain : WorldObject<GhostBrain>, IGhostObject
{
AttachedObject.enabled = false;
AttachedObject._controller.GetDreamLanternController().enabled = false;
ChangeAction(null);
if (QSBCore.IsHost)
{
ChangeAction(null);
}
_data.OnPlayerExitDreamWorld();
}
}

View File

@ -45,6 +45,12 @@ public class QSBGhostSensors : WorldObject<GhostSensors>, IGhostObject
foreach (var pair in _data.players)
{
var player = pair.Value;
if (player.player.AssignedSimulationLantern == null)
{
continue;
}
var lanternController = player.player.AssignedSimulationLantern.AttachedObject.GetLanternController();
var playerLightSensor = Locator.GetPlayerLightSensor();
player.sensor.isPlayerHoldingLantern = lanternController.IsHeldByPlayer();