mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-03-12 13:13:32 +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.Utility;
|
||||
using QSB.WorldSync;
|
||||
using System.Linq;
|
||||
|
||||
namespace QSB.ConversationSync.Patches;
|
||||
|
||||
@ -16,22 +15,10 @@ public class ConversationPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public static readonly string[] PersistentConditionsToSync =
|
||||
{
|
||||
"MET_SOLANUM",
|
||||
"MET_PRISONER",
|
||||
"TALKED_TO_GABBRO",
|
||||
"GABBRO_MERGE_TRIGGERED",
|
||||
"KNOWS_MEDITATION"
|
||||
};
|
||||
|
||||
[HarmonyPrefix]
|
||||
[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();
|
||||
return true;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(CharacterDialogueTree), nameof(CharacterDialogueTree.StartConversation))]
|
||||
@ -159,19 +146,11 @@ public class ConversationPatches : QSBPatch
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(GameSave), nameof(GameSave.SetPersistentCondition))]
|
||||
public static void SetPersistentCondition(string condition, bool state)
|
||||
{
|
||||
if (PersistentConditionsToSync.Contains(condition))
|
||||
{
|
||||
public static void SetPersistentCondition(string condition, bool state) =>
|
||||
new PersistentConditionMessage(condition, state).Send();
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[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();
|
||||
return true;
|
||||
}
|
||||
}
|
@ -17,6 +17,12 @@ internal class QSBLightSensor : WorldObject<SingleLightSensor>
|
||||
|
||||
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)
|
||||
{
|
||||
AttachedObject.enabled = true;
|
||||
|
@ -146,7 +146,7 @@ internal class ItemRemotePatches : QSBPatch
|
||||
return true;
|
||||
}
|
||||
|
||||
__instance.SocketItem(socketTransform, sector);
|
||||
base_SocketItem(__instance, socketTransform, sector);
|
||||
__instance.enabled = false;
|
||||
if (__instance._lanternController != null)
|
||||
{
|
||||
|
@ -1,9 +1,7 @@
|
||||
using QSB.ConversationSync.Messages;
|
||||
using QSB.ConversationSync.Patches;
|
||||
using QSB.Messaging;
|
||||
using QSB.Player;
|
||||
using QSB.Utility;
|
||||
using System.Linq;
|
||||
|
||||
namespace QSB.SaveSync.Messages;
|
||||
|
||||
@ -33,8 +31,7 @@ internal class RequestGameStateMessage : QSBMessage
|
||||
}
|
||||
|
||||
var dictConditions = gameSave.dictConditions;
|
||||
var dictConditionsToSend = dictConditions.Where(x => ConversationPatches.PersistentConditionsToSync.Contains(x.Key));
|
||||
foreach (var item in dictConditionsToSend)
|
||||
foreach (var item in dictConditions)
|
||||
{
|
||||
new PersistentConditionMessage(item.Key, item.Value).Send();
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using MonoMod.Utils;
|
||||
using OWML.Common;
|
||||
using QSB.ConversationSync.Patches;
|
||||
using QSB.LogSync;
|
||||
using QSB.Messaging;
|
||||
using QSB.Player.TransformSync;
|
||||
@ -174,23 +173,11 @@ public static class QSBWorldSync
|
||||
return;
|
||||
}
|
||||
|
||||
DebugLog.DebugWrite($"DIALOGUE CONDITIONS :");
|
||||
DialogueConditions.Clear();
|
||||
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.AddRange(syncedConditions.ToDictionary(x => x.Key, x => x.Value));
|
||||
foreach (var item in PersistentConditions)
|
||||
{
|
||||
DebugLog.DebugWrite($"- {item.Key}, {item.Value}");
|
||||
}
|
||||
PersistentConditions.AddRange(PlayerData._currentGameSave.dictConditions);
|
||||
}
|
||||
|
||||
private static void GameReset()
|
||||
|
Loading…
x
Reference in New Issue
Block a user