From 50ffb7de12baf34141dc7aa682dc3a439a44982e Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Wed, 12 Jan 2022 19:43:48 -0800 Subject: [PATCH] more work --- QSB/TriggerSync/TriggerManager.cs | 2 ++ .../WorldObjects/QSBCharacterTrigger.cs | 17 ++++++++++------- .../WorldObjects/QSBInflationTrigger.cs | 18 ++++++++++++++++++ .../WorldObjects/QSBMaskZoneTrigger.cs | 14 +++++++------- .../WorldObjects/QSBShrineTrigger.cs | 11 +++++++++++ .../WorldObjects/QSBSolanumTrigger.cs | 17 ++++++++++------- QSB/TriggerSync/WorldObjects/QSBTrigger.cs | 6 ++++++ .../WorldObjects/QSBVesselCageTrigger.cs | 13 +++++++------ 8 files changed, 71 insertions(+), 27 deletions(-) create mode 100644 QSB/TriggerSync/WorldObjects/QSBInflationTrigger.cs create mode 100644 QSB/TriggerSync/WorldObjects/QSBShrineTrigger.cs diff --git a/QSB/TriggerSync/TriggerManager.cs b/QSB/TriggerSync/TriggerManager.cs index c3875967..704d857c 100644 --- a/QSB/TriggerSync/TriggerManager.cs +++ b/QSB/TriggerSync/TriggerManager.cs @@ -12,7 +12,9 @@ namespace QSB.TriggerSync QSBWorldSync.Init(x => x.playerTrackingZone); QSBWorldSync.Init(x => x._watchPlayerVolume); QSBWorldSync.Init(x => x._cageTrigger); + QSBWorldSync.Init(x => x._triggerVolume); QSBWorldSync.Init(x => x._maskZoneTrigger); + QSBWorldSync.Init(x => x._smokeSphereTrigger); } } } diff --git a/QSB/TriggerSync/WorldObjects/QSBCharacterTrigger.cs b/QSB/TriggerSync/WorldObjects/QSBCharacterTrigger.cs index 7cf0e9a4..dccb0849 100644 --- a/QSB/TriggerSync/WorldObjects/QSBCharacterTrigger.cs +++ b/QSB/TriggerSync/WorldObjects/QSBCharacterTrigger.cs @@ -1,4 +1,8 @@ -namespace QSB.TriggerSync.WorldObjects +using QSB.Animation.NPC.WorldObjects; +using QSB.Player; +using QSB.WorldSync; + +namespace QSB.TriggerSync.WorldObjects { public class QSBCharacterTrigger : QSBTrigger { @@ -9,11 +13,10 @@ AttachedObject.OnExit -= TriggerOwner.OnZoneExit; } - public override void OnRemoval() - { - base.OnRemoval(); - AttachedObject.OnEntry += TriggerOwner.OnZoneEntry; - AttachedObject.OnExit += TriggerOwner.OnZoneExit; - } + protected override void OnEnter(PlayerInfo player) + => TriggerOwner.GetWorldObject().AddPlayerToHeadZone(player); + + protected override void OnExit(PlayerInfo player) + => TriggerOwner.GetWorldObject().RemovePlayerFromHeadZone(player); } } diff --git a/QSB/TriggerSync/WorldObjects/QSBInflationTrigger.cs b/QSB/TriggerSync/WorldObjects/QSBInflationTrigger.cs new file mode 100644 index 00000000..492d5c6f --- /dev/null +++ b/QSB/TriggerSync/WorldObjects/QSBInflationTrigger.cs @@ -0,0 +1,18 @@ +using QSB.EyeOfTheUniverse.CosmicInflation; +using QSB.Player; + +namespace QSB.TriggerSync.WorldObjects +{ + public class QSBInflationTrigger : QSBTrigger + { + public override void Init() + { + base.Init(); + AttachedObject.OnEntry -= TriggerOwner.OnEnterFogSphere; + } + + protected override void OnEnter(PlayerInfo player) => InflationManager.Instance.Enter(player); + + protected override void OnExit(PlayerInfo player) { } + } +} diff --git a/QSB/TriggerSync/WorldObjects/QSBMaskZoneTrigger.cs b/QSB/TriggerSync/WorldObjects/QSBMaskZoneTrigger.cs index 97802ee6..d27647a8 100644 --- a/QSB/TriggerSync/WorldObjects/QSBMaskZoneTrigger.cs +++ b/QSB/TriggerSync/WorldObjects/QSBMaskZoneTrigger.cs @@ -1,4 +1,7 @@ -namespace QSB.TriggerSync.WorldObjects +using QSB.EyeOfTheUniverse.MaskSync; +using QSB.Player; + +namespace QSB.TriggerSync.WorldObjects { public class QSBMaskZoneTrigger : QSBTrigger { @@ -9,11 +12,8 @@ AttachedObject.OnExit -= TriggerOwner.OnExitMaskZone; } - public override void OnRemoval() - { - base.OnRemoval(); - AttachedObject.OnEntry += TriggerOwner.OnEnterMaskZone; - AttachedObject.OnExit += TriggerOwner.OnExitMaskZone; - } + protected override void OnEnter(PlayerInfo player) => MaskManager.Instance.Enter(player); + + protected override void OnExit(PlayerInfo player) => MaskManager.Instance.Exit(player); } } diff --git a/QSB/TriggerSync/WorldObjects/QSBShrineTrigger.cs b/QSB/TriggerSync/WorldObjects/QSBShrineTrigger.cs new file mode 100644 index 00000000..61420721 --- /dev/null +++ b/QSB/TriggerSync/WorldObjects/QSBShrineTrigger.cs @@ -0,0 +1,11 @@ +using QSB.Player; + +namespace QSB.TriggerSync.WorldObjects +{ + public class QSBShrineTrigger : QSBTrigger + { + protected override void OnEnter(PlayerInfo player) => player.IsInShrine = true; + + protected override void OnExit(PlayerInfo player) => player.IsInShrine = false; + } +} diff --git a/QSB/TriggerSync/WorldObjects/QSBSolanumTrigger.cs b/QSB/TriggerSync/WorldObjects/QSBSolanumTrigger.cs index 90f49928..301b3642 100644 --- a/QSB/TriggerSync/WorldObjects/QSBSolanumTrigger.cs +++ b/QSB/TriggerSync/WorldObjects/QSBSolanumTrigger.cs @@ -1,4 +1,8 @@ -namespace QSB.TriggerSync.WorldObjects +using QSB.Animation.NPC.WorldObjects; +using QSB.Player; +using QSB.WorldSync; + +namespace QSB.TriggerSync.WorldObjects { public class QSBSolanumTrigger : QSBTrigger { @@ -9,11 +13,10 @@ AttachedObject.OnExit -= TriggerOwner.OnExitWatchVolume; } - public override void OnRemoval() - { - base.OnRemoval(); - AttachedObject.OnEntry += TriggerOwner.OnEnterWatchVolume; - AttachedObject.OnExit += TriggerOwner.OnExitWatchVolume; - } + protected override void OnEnter(PlayerInfo player) + => TriggerOwner.GetWorldObject().AddPlayerToHeadZone(player); + + protected override void OnExit(PlayerInfo player) + => TriggerOwner.GetWorldObject().RemovePlayerFromHeadZone(player); } } diff --git a/QSB/TriggerSync/WorldObjects/QSBTrigger.cs b/QSB/TriggerSync/WorldObjects/QSBTrigger.cs index 2d6aa97a..9dded159 100644 --- a/QSB/TriggerSync/WorldObjects/QSBTrigger.cs +++ b/QSB/TriggerSync/WorldObjects/QSBTrigger.cs @@ -85,6 +85,7 @@ namespace QSB.TriggerSync.WorldObjects } DebugLog.DebugWrite($"{LogName} + {player.PlayerId}"); + OnEnter(player); } public void Exit(PlayerInfo player) @@ -96,6 +97,11 @@ namespace QSB.TriggerSync.WorldObjects } DebugLog.DebugWrite($"{LogName} - {player.PlayerId}"); + OnExit(player); } + + protected virtual void OnEnter(PlayerInfo player) { } + + protected virtual void OnExit(PlayerInfo player) { } } } diff --git a/QSB/TriggerSync/WorldObjects/QSBVesselCageTrigger.cs b/QSB/TriggerSync/WorldObjects/QSBVesselCageTrigger.cs index ae53e048..8ae991c1 100644 --- a/QSB/TriggerSync/WorldObjects/QSBVesselCageTrigger.cs +++ b/QSB/TriggerSync/WorldObjects/QSBVesselCageTrigger.cs @@ -1,4 +1,7 @@ -namespace QSB.TriggerSync.WorldObjects +using QSB.EyeOfTheUniverse.VesselSync; +using QSB.Player; + +namespace QSB.TriggerSync.WorldObjects { public class QSBVesselCageTrigger : QSBTrigger { @@ -8,10 +11,8 @@ AttachedObject.OnExit -= TriggerOwner.OnExitCageTrigger; } - public override void OnRemoval() - { - base.OnRemoval(); - AttachedObject.OnExit += TriggerOwner.OnExitCageTrigger; - } + protected override void OnEnter(PlayerInfo player) => VesselManager.Instance.Enter(player); + + protected override void OnExit(PlayerInfo player) => VesselManager.Instance.Exit(player); } }