From c051b5745b4243a7362fd79fc07f321f3c9e666a Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Fri, 3 Dec 2021 19:39:01 -0800 Subject: [PATCH 1/2] use nameof in EventNames --- .../Events/DialogueConditionEvent.cs | 4 +- QSB/Events/EventNames.cs | 194 +++++++++--------- QSB/Player/Events/EnterLeaveEvent.cs | 8 +- QSB/Player/Events/RequestStateResyncEvent.cs | 2 +- 4 files changed, 104 insertions(+), 104 deletions(-) diff --git a/QSB/ConversationSync/Events/DialogueConditionEvent.cs b/QSB/ConversationSync/Events/DialogueConditionEvent.cs index f3ad7322..0143a378 100644 --- a/QSB/ConversationSync/Events/DialogueConditionEvent.cs +++ b/QSB/ConversationSync/Events/DialogueConditionEvent.cs @@ -5,8 +5,8 @@ namespace QSB.ConversationSync.Events { public class DialogueConditionEvent : QSBEvent { - public override void SetupListener() => GlobalMessenger.AddListener(EventNames.DialogueCondition, Handler); - public override void CloseListener() => GlobalMessenger.RemoveListener(EventNames.DialogueCondition, Handler); + public override void SetupListener() => GlobalMessenger.AddListener(EventNames.DialogueConditionChanged, Handler); + public override void CloseListener() => GlobalMessenger.RemoveListener(EventNames.DialogueConditionChanged, Handler); private void Handler(string name, bool state) => SendEvent(CreateMessage(name, state)); diff --git a/QSB/Events/EventNames.cs b/QSB/Events/EventNames.cs index 265b5e0f..b9e100e6 100644 --- a/QSB/Events/EventNames.cs +++ b/QSB/Events/EventNames.cs @@ -3,105 +3,105 @@ public static class EventNames { // Built into Outer Wilds -- don't change unless they change in-game! - public static string TurnOnFlashlight = "TurnOnFlashlight"; - public static string TurnOffFlashlight = "TurnOffFlashlight"; - public static string ProbeLauncherEquipped = "ProbeLauncherEquipped"; - public static string ProbeLauncherUnequipped = "ProbeLauncherUnequipped"; - public static string EquipSignalscope = "EquipSignalscope"; - public static string UnequipSignalscope = "UnequipSignalscope"; - public static string SuitUp = "SuitUp"; - public static string RemoveSuit = "RemoveSuit"; - public static string EquipTranslator = "EquipTranslator"; - public static string UnequipTranslator = "UnequipTranslator"; - public static string RestartTimeLoop = "RestartTimeLoop"; - public static string WakeUp = "WakeUp"; - public static string DialogueCondition = "DialogueConditionChanged"; - public static string EnterQuantumMoon = "PlayerEnterQuantumMoon"; - public static string ExitQuantumMoon = "PlayerExitQuantumMoon"; - public static string EnterRoastingMode = "EnterRoastingMode"; - public static string ExitRoastingMode = "ExitRoastingMode"; - public static string EnterFlightConsole = "EnterFlightConsole"; - public static string ExitFlightConsole = "ExitFlightConsole"; - public static string EnterShip = "EnterShip"; - public static string ExitShip = "ExitShip"; + public const string TurnOnFlashlight = nameof(TurnOnFlashlight); + public const string TurnOffFlashlight = nameof(TurnOffFlashlight); + public const string ProbeLauncherEquipped = nameof(ProbeLauncherEquipped); + public const string ProbeLauncherUnequipped = nameof(ProbeLauncherUnequipped); + public const string EquipSignalscope = nameof(EquipSignalscope); + public const string UnequipSignalscope = nameof(UnequipSignalscope); + public const string SuitUp = nameof(SuitUp); + public const string RemoveSuit = nameof(RemoveSuit); + public const string EquipTranslator = nameof(EquipTranslator); + public const string UnequipTranslator = nameof(UnequipTranslator); + public const string RestartTimeLoop = nameof(RestartTimeLoop); + public const string WakeUp = nameof(WakeUp); + public const string DialogueConditionChanged = nameof(DialogueConditionChanged); + public const string PlayerEnterQuantumMoon = nameof(PlayerEnterQuantumMoon); + public const string PlayerExitQuantumMoon = nameof(PlayerExitQuantumMoon); + public const string EnterRoastingMode = nameof(EnterRoastingMode); + public const string ExitRoastingMode = nameof(ExitRoastingMode); + public const string EnterFlightConsole = nameof(EnterFlightConsole); + public const string ExitFlightConsole = nameof(ExitFlightConsole); + public const string EnterShip = nameof(EnterShip); + public const string ExitShip = nameof(ExitShip); // Custom event names -- change if you want! These can be anything, as long as both // sides of the GlobalMessenger (fireevent and addlistener) reference the same thing. - public static string QSBPlayerDeath = "QSBPlayerDeath"; - public static string QSBPlayerJoin = "QSBPlayerJoin"; - public static string QSBPlayerReady = "QSBPlayerReady"; - public static string QSBRequestStateResync = "QSBPlayerStatesRequest"; - public static string QSBServerTime = "QSBServerTime"; - public static string QSBStartLift = "QSBStartLift"; - public static string QSBGeyserState = "QSBGeyserState"; - public static string QSBOrbSlot = "QSBOrbSlot"; - public static string QSBOrbUser = "QSBOrbUser"; - public static string QSBConversation = "QSBConversation"; - public static string QSBConversationStartEnd = "QSBConversationStartEnd"; - public static string QSBChangeAnimType = "QSBPlayInstrument"; - public static string QSBPlayerInformation = "QSBServerSendPlayerStates"; - public static string QSBRevealFact = "QSBRevealFact"; - public static string QSBSocketStateChange = "QSBSocketStateChange"; - public static string QSBMultiStateChange = "QSBMultiStateChange"; - public static string QSBQuantumShuffle = "QSBQuantumShuffle"; - public static string QSBQuantumAuthority = "QSBQuantumAuthority"; - public static string QSBMoonStateChange = "QSBMoonStateChange"; - public static string QSBIdentifyFrequency = "QSBIdentifyFrequency"; - public static string QSBIdentifySignal = "QSBIdentifySignal"; - public static string QSBTextTranslated = "QSBTextTranslated"; - public static string QSBEnterShrine = "QSBEnterShrine"; - public static string QSBExitShrine = "QSBExitShrine"; - public static string QSBPlayerEntangle = "QSBPlayerEntangle"; - public static string QSBDropItem = "QSBDropItem"; - public static string QSBSocketItem = "QSBSocketItem"; - public static string QSBMoveToCarry = "QSBMoveToCarry"; - public static string QSBStartStatue = "QSBStartStatue"; - public static string QSBPlayerKick = "QSBPlayerKick"; - public static string QSBEnterPlatform = "QSBEnterPlatform"; - public static string QSBExitPlatform = "QSBExitPlatform"; - public static string QSBCampfireState = "QSBCampfireState"; - public static string QSBMarshmallowEvent = "QSBMarshmallowEvent"; - public static string QSBAnimTrigger = "QSBAnimTrigger"; - public static string QSBEnterNonNomaiHeadZone = "QSBEnterNonNomaiHeadZone"; - public static string QSBExitNonNomaiHeadZone = "QSBExitNonNomaiHeadZone"; - public static string QSBNpcAnimEvent = "QSBNpcAnimEvent"; - public static string QSBHatchState = "QSBHatchState"; - public static string QSBEnableFunnel = "QSBEnableFunnel"; - public static string QSBHullImpact = "QSBHullImpact"; - public static string QSBHullDamaged = "QSBHullDamaged"; - public static string QSBHullChangeIntegrity = "QSBHullChangeIntegrity"; - public static string QSBHullRepaired = "QSBHullRepaired"; - public static string QSBHullRepairTick = "QSBHullRepairTick"; - public static string QSBComponentDamaged = "QSBComponentDamaged"; - public static string QSBComponentRepaired = "QSBComponentRepaired"; - public static string QSBComponentRepairTick = "QSBComponentRepairTick"; - public static string QSBPlayerRespawn = "QSBPlayerRespawn"; - public static string QSBProbeEvent = "QSBProbeEvent"; - public static string QSBProbeStartRetrieve = "QSBProbeStartRetrieve"; - public static string QSBRetrieveProbe = "QSBRetrieveProbe"; - public static string QSBPlayerRetrieveProbe = "QSBPlayerRetrieveProbe"; - public static string QSBLaunchProbe = "QSBLaunchProbe"; - public static string QSBPlayerLaunchProbe = "QSBPlayerLaunchProbe"; - public static string QSBEndLoop = "QSBEndLoop"; - public static string QSBStartLoop = "QSBStartLoop"; - public static string QSBServerState = "QSBServerState"; - public static string QSBClientState = "QSBClientState"; - public static string QSBDebugEvent = "QSBDebugEvent"; - public static string QSBEnterNomaiHeadZone = "QSBEnterNomaiHeadZone"; - public static string QSBExitNomaiHeadZone = "QSBExitNomaiHeadZone"; - public static string QSBEnterSatelliteCamera = "QSBEnterSatelliteCamera"; - public static string QSBExitSatelliteCamera = "QSBExitSatelliteCamera"; - public static string QSBSatelliteSnapshot = "QSBSatelliteSnapshot"; - public static string QSBAnglerChangeState = "QSBAnglerChangeState"; - public static string QSBMeteorPreLaunch = "QSBMeteorPreLaunch"; - public static string QSBMeteorLaunch = "QSBMeteorLaunch"; - public static string QSBMeteorSpecialImpact = "QSBMeteorSpecialImpact"; - public static string QSBFragmentDamage = "QSBFragmentDamage"; - public static string QSBFragmentResync = "QSBFragmentResync"; - public static string QSBLearnLaunchCodes = "QSBLearnLaunchCodes"; - public static string QSBSatelliteRepairTick = "QSBSatelliteRepairTick"; - public static string QSBSatelliteRepaired = "QSBSatelliteRepairTick"; - public static string QSBAuthorityQueue = "QSBAuthorityQueue"; - public static string QSBJellyfishRising = "QSBJellyfishRising"; + public const string QSBPlayerDeath = nameof(QSBPlayerDeath); + public const string QSBPlayerJoin = nameof(QSBPlayerJoin); + public const string QSBPlayerReady = nameof(QSBPlayerReady); + public const string QSBRequestStateResync = nameof(QSBRequestStateResync); + public const string QSBServerTime = nameof(QSBServerTime); + public const string QSBStartLift = nameof(QSBStartLift); + public const string QSBGeyserState = nameof(QSBGeyserState); + public const string QSBOrbSlot = nameof(QSBOrbSlot); + public const string QSBOrbUser = nameof(QSBOrbUser); + public const string QSBConversation = nameof(QSBConversation); + public const string QSBConversationStartEnd = nameof(QSBConversationStartEnd); + public const string QSBChangeAnimType = nameof(QSBChangeAnimType); + public const string QSBPlayerInformation = nameof(QSBPlayerInformation); + public const string QSBRevealFact = nameof(QSBRevealFact); + public const string QSBSocketStateChange = nameof(QSBSocketStateChange); + public const string QSBMultiStateChange = nameof(QSBMultiStateChange); + public const string QSBQuantumShuffle = nameof(QSBQuantumShuffle); + public const string QSBQuantumAuthority = nameof(QSBQuantumAuthority); + public const string QSBMoonStateChange = nameof(QSBMoonStateChange); + public const string QSBIdentifyFrequency = nameof(QSBIdentifyFrequency); + public const string QSBIdentifySignal = nameof(QSBIdentifySignal); + public const string QSBTextTranslated = nameof(QSBTextTranslated); + public const string QSBEnterShrine = nameof(QSBEnterShrine); + public const string QSBExitShrine = nameof(QSBExitShrine); + public const string QSBPlayerEntangle = nameof(QSBPlayerEntangle); + public const string QSBDropItem = nameof(QSBDropItem); + public const string QSBSocketItem = nameof(QSBSocketItem); + public const string QSBMoveToCarry = nameof(QSBMoveToCarry); + public const string QSBStartStatue = nameof(QSBStartStatue); + public const string QSBPlayerKick = nameof(QSBPlayerKick); + public const string QSBEnterPlatform = nameof(QSBEnterPlatform); + public const string QSBExitPlatform = nameof(QSBExitPlatform); + public const string QSBCampfireState = nameof(QSBCampfireState); + public const string QSBMarshmallowEvent = nameof(QSBMarshmallowEvent); + public const string QSBAnimTrigger = nameof(QSBAnimTrigger); + public const string QSBEnterNonNomaiHeadZone = nameof(QSBEnterNonNomaiHeadZone); + public const string QSBExitNonNomaiHeadZone = nameof(QSBExitNonNomaiHeadZone); + public const string QSBNpcAnimEvent = nameof(QSBNpcAnimEvent); + public const string QSBHatchState = nameof(QSBHatchState); + public const string QSBEnableFunnel = nameof(QSBEnableFunnel); + public const string QSBHullImpact = nameof(QSBHullImpact); + public const string QSBHullDamaged = nameof(QSBHullDamaged); + public const string QSBHullChangeIntegrity = nameof(QSBHullChangeIntegrity); + public const string QSBHullRepaired = nameof(QSBHullRepaired); + public const string QSBHullRepairTick = nameof(QSBHullRepairTick); + public const string QSBComponentDamaged = nameof(QSBComponentDamaged); + public const string QSBComponentRepaired = nameof(QSBComponentRepaired); + public const string QSBComponentRepairTick = nameof(QSBComponentRepairTick); + public const string QSBPlayerRespawn = nameof(QSBPlayerRespawn); + public const string QSBProbeEvent = nameof(QSBProbeEvent); + public const string QSBProbeStartRetrieve = nameof(QSBProbeStartRetrieve); + public const string QSBRetrieveProbe = nameof(QSBRetrieveProbe); + public const string QSBPlayerRetrieveProbe = nameof(QSBPlayerRetrieveProbe); + public const string QSBLaunchProbe = nameof(QSBLaunchProbe); + public const string QSBPlayerLaunchProbe = nameof(QSBPlayerLaunchProbe); + public const string QSBEndLoop = nameof(QSBEndLoop); + public const string QSBStartLoop = nameof(QSBStartLoop); + public const string QSBServerState = nameof(QSBServerState); + public const string QSBClientState = nameof(QSBClientState); + public const string QSBDebugEvent = nameof(QSBDebugEvent); + public const string QSBEnterNomaiHeadZone = nameof(QSBEnterNomaiHeadZone); + public const string QSBExitNomaiHeadZone = nameof(QSBExitNomaiHeadZone); + public const string QSBEnterSatelliteCamera = nameof(QSBEnterSatelliteCamera); + public const string QSBExitSatelliteCamera = nameof(QSBExitSatelliteCamera); + public const string QSBSatelliteSnapshot = nameof(QSBSatelliteSnapshot); + public const string QSBAnglerChangeState = nameof(QSBAnglerChangeState); + public const string QSBMeteorPreLaunch = nameof(QSBMeteorPreLaunch); + public const string QSBMeteorLaunch = nameof(QSBMeteorLaunch); + public const string QSBMeteorSpecialImpact = nameof(QSBMeteorSpecialImpact); + public const string QSBFragmentDamage = nameof(QSBFragmentDamage); + public const string QSBFragmentResync = nameof(QSBFragmentResync); + public const string QSBLearnLaunchCodes = nameof(QSBLearnLaunchCodes); + public const string QSBSatelliteRepairTick = nameof(QSBSatelliteRepairTick); + public const string QSBSatelliteRepaired = nameof(QSBSatelliteRepairTick); + public const string QSBAuthorityQueue = nameof(QSBAuthorityQueue); + public const string QSBJellyfishRising = nameof(QSBJellyfishRising); } } diff --git a/QSB/Player/Events/EnterLeaveEvent.cs b/QSB/Player/Events/EnterLeaveEvent.cs index e6d912e3..5af02a16 100644 --- a/QSB/Player/Events/EnterLeaveEvent.cs +++ b/QSB/Player/Events/EnterLeaveEvent.cs @@ -12,8 +12,8 @@ namespace QSB.Player.Events { public override void SetupListener() { - GlobalMessenger.AddListener(EventNames.EnterQuantumMoon, () => Handler(EnterLeaveType.EnterMoon)); - GlobalMessenger.AddListener(EventNames.ExitQuantumMoon, () => Handler(EnterLeaveType.ExitMoon)); + GlobalMessenger.AddListener(EventNames.PlayerEnterQuantumMoon, () => Handler(EnterLeaveType.EnterMoon)); + GlobalMessenger.AddListener(EventNames.PlayerExitQuantumMoon, () => Handler(EnterLeaveType.ExitMoon)); GlobalMessenger.AddListener(EventNames.QSBEnterShrine, () => Handler(EnterLeaveType.EnterShrine)); GlobalMessenger.AddListener(EventNames.QSBExitShrine, () => Handler(EnterLeaveType.ExitShrine)); GlobalMessenger.AddListener(EventNames.QSBEnterPlatform, (int id) => Handler(EnterLeaveType.EnterPlatform, id)); @@ -28,8 +28,8 @@ namespace QSB.Player.Events public override void CloseListener() { - GlobalMessenger.RemoveListener(EventNames.EnterQuantumMoon, () => Handler(EnterLeaveType.EnterMoon)); - GlobalMessenger.RemoveListener(EventNames.ExitQuantumMoon, () => Handler(EnterLeaveType.ExitMoon)); + GlobalMessenger.RemoveListener(EventNames.PlayerEnterQuantumMoon, () => Handler(EnterLeaveType.EnterMoon)); + GlobalMessenger.RemoveListener(EventNames.PlayerExitQuantumMoon, () => Handler(EnterLeaveType.ExitMoon)); GlobalMessenger.RemoveListener(EventNames.QSBEnterShrine, () => Handler(EnterLeaveType.EnterShrine)); GlobalMessenger.RemoveListener(EventNames.QSBExitShrine, () => Handler(EnterLeaveType.ExitShrine)); GlobalMessenger.RemoveListener(EventNames.QSBEnterPlatform, (int id) => Handler(EnterLeaveType.EnterPlatform, id)); diff --git a/QSB/Player/Events/RequestStateResyncEvent.cs b/QSB/Player/Events/RequestStateResyncEvent.cs index 8ee75c9e..e99423b0 100644 --- a/QSB/Player/Events/RequestStateResyncEvent.cs +++ b/QSB/Player/Events/RequestStateResyncEvent.cs @@ -47,7 +47,7 @@ namespace QSB.Player.Events private void SendWorldObjectInfo() { QSBWorldSync.DialogueConditions.ForEach(condition - => QSBEventManager.FireEvent(EventNames.DialogueCondition, condition.Key, condition.Value)); + => QSBEventManager.FireEvent(EventNames.DialogueConditionChanged, condition.Key, condition.Value)); QSBWorldSync.ShipLogFacts.ForEach(fact => QSBEventManager.FireEvent(EventNames.QSBRevealFact, fact.Id, fact.SaveGame, false)); From 66769029e9017301ea6ad8133663c88712bcc0ba Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Sat, 4 Dec 2021 02:30:18 -0800 Subject: [PATCH 2/2] RestartTimeLoop EventName was never used. rip --- QSB/Events/EventNames.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/QSB/Events/EventNames.cs b/QSB/Events/EventNames.cs index b9e100e6..b37d2b4e 100644 --- a/QSB/Events/EventNames.cs +++ b/QSB/Events/EventNames.cs @@ -13,7 +13,6 @@ public const string RemoveSuit = nameof(RemoveSuit); public const string EquipTranslator = nameof(EquipTranslator); public const string UnequipTranslator = nameof(UnequipTranslator); - public const string RestartTimeLoop = nameof(RestartTimeLoop); public const string WakeUp = nameof(WakeUp); public const string DialogueConditionChanged = nameof(DialogueConditionChanged); public const string PlayerEnterQuantumMoon = nameof(PlayerEnterQuantumMoon);