mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-26 09:35:26 +00:00
move host check into ChangeAction
This commit is contained in:
parent
4a05e2d553
commit
11cacf8f9f
@ -305,11 +305,6 @@ internal class GhostBrainPatches : QSBPatch
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!QSBCore.IsHost)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
__instance.GetWorldObject<QSBGhostBrain>().EvaluateActions();
|
||||
return false;
|
||||
}
|
||||
|
@ -458,6 +458,16 @@ public class QSBGhostBrain : WorldObject<GhostBrain>, IGhostObject
|
||||
|
||||
public void ChangeAction(QSBGhostAction action, bool remote = false)
|
||||
{
|
||||
if (!remote)
|
||||
{
|
||||
if (!QSBCore.IsHost)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.SendMessage(new ChangeActionMessage(action?.GetName() ?? GhostAction.Name.None));
|
||||
}
|
||||
|
||||
DebugLog.DebugWrite($"{AttachedObject._name} Change action to {action?.GetName()}");
|
||||
|
||||
if (_currentAction != null)
|
||||
@ -477,11 +487,6 @@ public class QSBGhostBrain : WorldObject<GhostBrain>, IGhostObject
|
||||
_data.OnEnterAction(_currentAction.GetName());
|
||||
}
|
||||
ClearPendingAction();
|
||||
|
||||
if (!remote)
|
||||
{
|
||||
this.SendMessage(new ChangeActionMessage(_data.currentAction));
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearPendingAction()
|
||||
@ -546,11 +551,7 @@ public class QSBGhostBrain : WorldObject<GhostBrain>, IGhostObject
|
||||
{
|
||||
AttachedObject.enabled = false;
|
||||
AttachedObject._controller.GetDreamLanternController().enabled = false;
|
||||
if (QSBCore.IsHost)
|
||||
{
|
||||
ChangeAction(null);
|
||||
}
|
||||
|
||||
ChangeAction(null);
|
||||
_data.OnPlayerExitDreamWorld();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user