mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-03-12 04:14:08 +00:00
Merge branch 'dev' into eote-dreamworld-entry-exit
This commit is contained in:
commit
115c09d30b
@ -7,7 +7,6 @@ using QSB.Patches;
|
|||||||
using QSB.Player;
|
using QSB.Player;
|
||||||
using QSB.Utility;
|
using QSB.Utility;
|
||||||
using QSB.WorldSync;
|
using QSB.WorldSync;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace QSB.ConversationSync.Patches;
|
namespace QSB.ConversationSync.Patches;
|
||||||
|
|
||||||
@ -16,22 +15,10 @@ public class ConversationPatches : QSBPatch
|
|||||||
{
|
{
|
||||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||||
|
|
||||||
public static readonly string[] PersistentConditionsToSync =
|
|
||||||
{
|
|
||||||
"MET_SOLANUM",
|
|
||||||
"MET_PRISONER",
|
|
||||||
"TALKED_TO_GABBRO",
|
|
||||||
"GABBRO_MERGE_TRIGGERED",
|
|
||||||
"KNOWS_MEDITATION"
|
|
||||||
};
|
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(DialogueConditionManager), nameof(DialogueConditionManager.SetConditionState))]
|
[HarmonyPatch(typeof(DialogueConditionManager), nameof(DialogueConditionManager.SetConditionState))]
|
||||||
public static bool SetConditionState(string conditionName, bool conditionState)
|
public static void SetConditionState(string conditionName, bool conditionState) =>
|
||||||
{
|
|
||||||
new DialogueConditionMessage(conditionName, conditionState).Send();
|
new DialogueConditionMessage(conditionName, conditionState).Send();
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(CharacterDialogueTree), nameof(CharacterDialogueTree.StartConversation))]
|
[HarmonyPatch(typeof(CharacterDialogueTree), nameof(CharacterDialogueTree.StartConversation))]
|
||||||
@ -159,19 +146,11 @@ public class ConversationPatches : QSBPatch
|
|||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(GameSave), nameof(GameSave.SetPersistentCondition))]
|
[HarmonyPatch(typeof(GameSave), nameof(GameSave.SetPersistentCondition))]
|
||||||
public static void SetPersistentCondition(string condition, bool state)
|
public static void SetPersistentCondition(string condition, bool state) =>
|
||||||
{
|
new PersistentConditionMessage(condition, state).Send();
|
||||||
if (PersistentConditionsToSync.Contains(condition))
|
|
||||||
{
|
|
||||||
new PersistentConditionMessage(condition, state).Send();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(DialogueConditionManager), nameof(DialogueConditionManager.AddCondition))]
|
[HarmonyPatch(typeof(DialogueConditionManager), nameof(DialogueConditionManager.AddCondition))]
|
||||||
public static bool AddCondition(string conditionName, bool conditionState)
|
public static void AddCondition(string conditionName, bool conditionState) =>
|
||||||
{
|
|
||||||
new DialogueConditionMessage(conditionName, conditionState).Send();
|
new DialogueConditionMessage(conditionName, conditionState).Send();
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -17,6 +17,12 @@ internal class QSBLightSensor : WorldObject<SingleLightSensor>
|
|||||||
|
|
||||||
public void SetEnabled(bool enabled)
|
public void SetEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
|
if (AttachedObject._sector && AttachedObject._sector.ContainsAnyOccupants(DynamicOccupant.Player | DynamicOccupant.Probe))
|
||||||
|
{
|
||||||
|
// local player is in sector, do not disable lights
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (enabled && !AttachedObject.enabled)
|
if (enabled && !AttachedObject.enabled)
|
||||||
{
|
{
|
||||||
AttachedObject.enabled = true;
|
AttachedObject.enabled = true;
|
||||||
|
@ -146,7 +146,7 @@ internal class ItemRemotePatches : QSBPatch
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
__instance.SocketItem(socketTransform, sector);
|
base_SocketItem(__instance, socketTransform, sector);
|
||||||
__instance.enabled = false;
|
__instance.enabled = false;
|
||||||
if (__instance._lanternController != null)
|
if (__instance._lanternController != null)
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
using QSB.ConversationSync.Messages;
|
using QSB.ConversationSync.Messages;
|
||||||
using QSB.ConversationSync.Patches;
|
|
||||||
using QSB.Messaging;
|
using QSB.Messaging;
|
||||||
using QSB.Player;
|
using QSB.Player;
|
||||||
using QSB.Utility;
|
using QSB.Utility;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace QSB.SaveSync.Messages;
|
namespace QSB.SaveSync.Messages;
|
||||||
|
|
||||||
@ -33,8 +31,7 @@ internal class RequestGameStateMessage : QSBMessage
|
|||||||
}
|
}
|
||||||
|
|
||||||
var dictConditions = gameSave.dictConditions;
|
var dictConditions = gameSave.dictConditions;
|
||||||
var dictConditionsToSend = dictConditions.Where(x => ConversationPatches.PersistentConditionsToSync.Contains(x.Key));
|
foreach (var item in dictConditions)
|
||||||
foreach (var item in dictConditionsToSend)
|
|
||||||
{
|
{
|
||||||
new PersistentConditionMessage(item.Key, item.Value).Send();
|
new PersistentConditionMessage(item.Key, item.Value).Send();
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using Cysharp.Threading.Tasks;
|
using Cysharp.Threading.Tasks;
|
||||||
using MonoMod.Utils;
|
using MonoMod.Utils;
|
||||||
using OWML.Common;
|
using OWML.Common;
|
||||||
using QSB.ConversationSync.Patches;
|
|
||||||
using QSB.LogSync;
|
using QSB.LogSync;
|
||||||
using QSB.Messaging;
|
using QSB.Messaging;
|
||||||
using QSB.Player.TransformSync;
|
using QSB.Player.TransformSync;
|
||||||
@ -174,23 +173,11 @@ public static class QSBWorldSync
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugLog.DebugWrite($"DIALOGUE CONDITIONS :");
|
|
||||||
DialogueConditions.Clear();
|
DialogueConditions.Clear();
|
||||||
DialogueConditions.AddRange(DialogueConditionManager.SharedInstance._dictConditions);
|
DialogueConditions.AddRange(DialogueConditionManager.SharedInstance._dictConditions);
|
||||||
foreach (var item in DialogueConditions)
|
|
||||||
{
|
|
||||||
DebugLog.DebugWrite($"- {item.Key}, {item.Value}");
|
|
||||||
}
|
|
||||||
|
|
||||||
DebugLog.DebugWrite($"PERSISTENT CONDITIONS :");
|
|
||||||
var dictConditions = PlayerData._currentGameSave.dictConditions;
|
|
||||||
var syncedConditions = dictConditions.Where(x => ConversationPatches.PersistentConditionsToSync.Contains(x.Key));
|
|
||||||
PersistentConditions.Clear();
|
PersistentConditions.Clear();
|
||||||
PersistentConditions.AddRange(syncedConditions.ToDictionary(x => x.Key, x => x.Value));
|
PersistentConditions.AddRange(PlayerData._currentGameSave.dictConditions);
|
||||||
foreach (var item in PersistentConditions)
|
|
||||||
{
|
|
||||||
DebugLog.DebugWrite($"- {item.Key}, {item.Value}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void GameReset()
|
private static void GameReset()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user