Merge pull request #394 from misternebula/eventnames-nameof

use nameof in EventNames
This commit is contained in:
_nebula 2021-12-04 16:19:57 +00:00 committed by GitHub
commit 4b3b8cd4a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 103 additions and 104 deletions

View File

@ -5,8 +5,8 @@ namespace QSB.ConversationSync.Events
{ {
public class DialogueConditionEvent : QSBEvent<DialogueConditionMessage> public class DialogueConditionEvent : QSBEvent<DialogueConditionMessage>
{ {
public override void SetupListener() => GlobalMessenger<string, bool>.AddListener(EventNames.DialogueCondition, Handler); public override void SetupListener() => GlobalMessenger<string, bool>.AddListener(EventNames.DialogueConditionChanged, Handler);
public override void CloseListener() => GlobalMessenger<string, bool>.RemoveListener(EventNames.DialogueCondition, Handler); public override void CloseListener() => GlobalMessenger<string, bool>.RemoveListener(EventNames.DialogueConditionChanged, Handler);
private void Handler(string name, bool state) => SendEvent(CreateMessage(name, state)); private void Handler(string name, bool state) => SendEvent(CreateMessage(name, state));

View File

@ -3,105 +3,104 @@
public static class EventNames public static class EventNames
{ {
// Built into Outer Wilds -- don't change unless they change in-game! // Built into Outer Wilds -- don't change unless they change in-game!
public static string TurnOnFlashlight = "TurnOnFlashlight"; public const string TurnOnFlashlight = nameof(TurnOnFlashlight);
public static string TurnOffFlashlight = "TurnOffFlashlight"; public const string TurnOffFlashlight = nameof(TurnOffFlashlight);
public static string ProbeLauncherEquipped = "ProbeLauncherEquipped"; public const string ProbeLauncherEquipped = nameof(ProbeLauncherEquipped);
public static string ProbeLauncherUnequipped = "ProbeLauncherUnequipped"; public const string ProbeLauncherUnequipped = nameof(ProbeLauncherUnequipped);
public static string EquipSignalscope = "EquipSignalscope"; public const string EquipSignalscope = nameof(EquipSignalscope);
public static string UnequipSignalscope = "UnequipSignalscope"; public const string UnequipSignalscope = nameof(UnequipSignalscope);
public static string SuitUp = "SuitUp"; public const string SuitUp = nameof(SuitUp);
public static string RemoveSuit = "RemoveSuit"; public const string RemoveSuit = nameof(RemoveSuit);
public static string EquipTranslator = "EquipTranslator"; public const string EquipTranslator = nameof(EquipTranslator);
public static string UnequipTranslator = "UnequipTranslator"; public const string UnequipTranslator = nameof(UnequipTranslator);
public static string RestartTimeLoop = "RestartTimeLoop"; public const string WakeUp = nameof(WakeUp);
public static string WakeUp = "WakeUp"; public const string DialogueConditionChanged = nameof(DialogueConditionChanged);
public static string DialogueCondition = "DialogueConditionChanged"; public const string PlayerEnterQuantumMoon = nameof(PlayerEnterQuantumMoon);
public static string EnterQuantumMoon = "PlayerEnterQuantumMoon"; public const string PlayerExitQuantumMoon = nameof(PlayerExitQuantumMoon);
public static string ExitQuantumMoon = "PlayerExitQuantumMoon"; public const string EnterRoastingMode = nameof(EnterRoastingMode);
public static string EnterRoastingMode = "EnterRoastingMode"; public const string ExitRoastingMode = nameof(ExitRoastingMode);
public static string ExitRoastingMode = "ExitRoastingMode"; public const string EnterFlightConsole = nameof(EnterFlightConsole);
public static string EnterFlightConsole = "EnterFlightConsole"; public const string ExitFlightConsole = nameof(ExitFlightConsole);
public static string ExitFlightConsole = "ExitFlightConsole"; public const string EnterShip = nameof(EnterShip);
public static string EnterShip = "EnterShip"; public const string ExitShip = nameof(ExitShip);
public static string ExitShip = "ExitShip";
// Custom event names -- change if you want! These can be anything, as long as both // 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. // sides of the GlobalMessenger (fireevent and addlistener) reference the same thing.
public static string QSBPlayerDeath = "QSBPlayerDeath"; public const string QSBPlayerDeath = nameof(QSBPlayerDeath);
public static string QSBPlayerJoin = "QSBPlayerJoin"; public const string QSBPlayerJoin = nameof(QSBPlayerJoin);
public static string QSBPlayerReady = "QSBPlayerReady"; public const string QSBPlayerReady = nameof(QSBPlayerReady);
public static string QSBRequestStateResync = "QSBPlayerStatesRequest"; public const string QSBRequestStateResync = nameof(QSBRequestStateResync);
public static string QSBServerTime = "QSBServerTime"; public const string QSBServerTime = nameof(QSBServerTime);
public static string QSBStartLift = "QSBStartLift"; public const string QSBStartLift = nameof(QSBStartLift);
public static string QSBGeyserState = "QSBGeyserState"; public const string QSBGeyserState = nameof(QSBGeyserState);
public static string QSBOrbSlot = "QSBOrbSlot"; public const string QSBOrbSlot = nameof(QSBOrbSlot);
public static string QSBOrbUser = "QSBOrbUser"; public const string QSBOrbUser = nameof(QSBOrbUser);
public static string QSBConversation = "QSBConversation"; public const string QSBConversation = nameof(QSBConversation);
public static string QSBConversationStartEnd = "QSBConversationStartEnd"; public const string QSBConversationStartEnd = nameof(QSBConversationStartEnd);
public static string QSBChangeAnimType = "QSBPlayInstrument"; public const string QSBChangeAnimType = nameof(QSBChangeAnimType);
public static string QSBPlayerInformation = "QSBServerSendPlayerStates"; public const string QSBPlayerInformation = nameof(QSBPlayerInformation);
public static string QSBRevealFact = "QSBRevealFact"; public const string QSBRevealFact = nameof(QSBRevealFact);
public static string QSBSocketStateChange = "QSBSocketStateChange"; public const string QSBSocketStateChange = nameof(QSBSocketStateChange);
public static string QSBMultiStateChange = "QSBMultiStateChange"; public const string QSBMultiStateChange = nameof(QSBMultiStateChange);
public static string QSBQuantumShuffle = "QSBQuantumShuffle"; public const string QSBQuantumShuffle = nameof(QSBQuantumShuffle);
public static string QSBQuantumAuthority = "QSBQuantumAuthority"; public const string QSBQuantumAuthority = nameof(QSBQuantumAuthority);
public static string QSBMoonStateChange = "QSBMoonStateChange"; public const string QSBMoonStateChange = nameof(QSBMoonStateChange);
public static string QSBIdentifyFrequency = "QSBIdentifyFrequency"; public const string QSBIdentifyFrequency = nameof(QSBIdentifyFrequency);
public static string QSBIdentifySignal = "QSBIdentifySignal"; public const string QSBIdentifySignal = nameof(QSBIdentifySignal);
public static string QSBTextTranslated = "QSBTextTranslated"; public const string QSBTextTranslated = nameof(QSBTextTranslated);
public static string QSBEnterShrine = "QSBEnterShrine"; public const string QSBEnterShrine = nameof(QSBEnterShrine);
public static string QSBExitShrine = "QSBExitShrine"; public const string QSBExitShrine = nameof(QSBExitShrine);
public static string QSBPlayerEntangle = "QSBPlayerEntangle"; public const string QSBPlayerEntangle = nameof(QSBPlayerEntangle);
public static string QSBDropItem = "QSBDropItem"; public const string QSBDropItem = nameof(QSBDropItem);
public static string QSBSocketItem = "QSBSocketItem"; public const string QSBSocketItem = nameof(QSBSocketItem);
public static string QSBMoveToCarry = "QSBMoveToCarry"; public const string QSBMoveToCarry = nameof(QSBMoveToCarry);
public static string QSBStartStatue = "QSBStartStatue"; public const string QSBStartStatue = nameof(QSBStartStatue);
public static string QSBPlayerKick = "QSBPlayerKick"; public const string QSBPlayerKick = nameof(QSBPlayerKick);
public static string QSBEnterPlatform = "QSBEnterPlatform"; public const string QSBEnterPlatform = nameof(QSBEnterPlatform);
public static string QSBExitPlatform = "QSBExitPlatform"; public const string QSBExitPlatform = nameof(QSBExitPlatform);
public static string QSBCampfireState = "QSBCampfireState"; public const string QSBCampfireState = nameof(QSBCampfireState);
public static string QSBMarshmallowEvent = "QSBMarshmallowEvent"; public const string QSBMarshmallowEvent = nameof(QSBMarshmallowEvent);
public static string QSBAnimTrigger = "QSBAnimTrigger"; public const string QSBAnimTrigger = nameof(QSBAnimTrigger);
public static string QSBEnterNonNomaiHeadZone = "QSBEnterNonNomaiHeadZone"; public const string QSBEnterNonNomaiHeadZone = nameof(QSBEnterNonNomaiHeadZone);
public static string QSBExitNonNomaiHeadZone = "QSBExitNonNomaiHeadZone"; public const string QSBExitNonNomaiHeadZone = nameof(QSBExitNonNomaiHeadZone);
public static string QSBNpcAnimEvent = "QSBNpcAnimEvent"; public const string QSBNpcAnimEvent = nameof(QSBNpcAnimEvent);
public static string QSBHatchState = "QSBHatchState"; public const string QSBHatchState = nameof(QSBHatchState);
public static string QSBEnableFunnel = "QSBEnableFunnel"; public const string QSBEnableFunnel = nameof(QSBEnableFunnel);
public static string QSBHullImpact = "QSBHullImpact"; public const string QSBHullImpact = nameof(QSBHullImpact);
public static string QSBHullDamaged = "QSBHullDamaged"; public const string QSBHullDamaged = nameof(QSBHullDamaged);
public static string QSBHullChangeIntegrity = "QSBHullChangeIntegrity"; public const string QSBHullChangeIntegrity = nameof(QSBHullChangeIntegrity);
public static string QSBHullRepaired = "QSBHullRepaired"; public const string QSBHullRepaired = nameof(QSBHullRepaired);
public static string QSBHullRepairTick = "QSBHullRepairTick"; public const string QSBHullRepairTick = nameof(QSBHullRepairTick);
public static string QSBComponentDamaged = "QSBComponentDamaged"; public const string QSBComponentDamaged = nameof(QSBComponentDamaged);
public static string QSBComponentRepaired = "QSBComponentRepaired"; public const string QSBComponentRepaired = nameof(QSBComponentRepaired);
public static string QSBComponentRepairTick = "QSBComponentRepairTick"; public const string QSBComponentRepairTick = nameof(QSBComponentRepairTick);
public static string QSBPlayerRespawn = "QSBPlayerRespawn"; public const string QSBPlayerRespawn = nameof(QSBPlayerRespawn);
public static string QSBProbeEvent = "QSBProbeEvent"; public const string QSBProbeEvent = nameof(QSBProbeEvent);
public static string QSBProbeStartRetrieve = "QSBProbeStartRetrieve"; public const string QSBProbeStartRetrieve = nameof(QSBProbeStartRetrieve);
public static string QSBRetrieveProbe = "QSBRetrieveProbe"; public const string QSBRetrieveProbe = nameof(QSBRetrieveProbe);
public static string QSBPlayerRetrieveProbe = "QSBPlayerRetrieveProbe"; public const string QSBPlayerRetrieveProbe = nameof(QSBPlayerRetrieveProbe);
public static string QSBLaunchProbe = "QSBLaunchProbe"; public const string QSBLaunchProbe = nameof(QSBLaunchProbe);
public static string QSBPlayerLaunchProbe = "QSBPlayerLaunchProbe"; public const string QSBPlayerLaunchProbe = nameof(QSBPlayerLaunchProbe);
public static string QSBEndLoop = "QSBEndLoop"; public const string QSBEndLoop = nameof(QSBEndLoop);
public static string QSBStartLoop = "QSBStartLoop"; public const string QSBStartLoop = nameof(QSBStartLoop);
public static string QSBServerState = "QSBServerState"; public const string QSBServerState = nameof(QSBServerState);
public static string QSBClientState = "QSBClientState"; public const string QSBClientState = nameof(QSBClientState);
public static string QSBDebugEvent = "QSBDebugEvent"; public const string QSBDebugEvent = nameof(QSBDebugEvent);
public static string QSBEnterNomaiHeadZone = "QSBEnterNomaiHeadZone"; public const string QSBEnterNomaiHeadZone = nameof(QSBEnterNomaiHeadZone);
public static string QSBExitNomaiHeadZone = "QSBExitNomaiHeadZone"; public const string QSBExitNomaiHeadZone = nameof(QSBExitNomaiHeadZone);
public static string QSBEnterSatelliteCamera = "QSBEnterSatelliteCamera"; public const string QSBEnterSatelliteCamera = nameof(QSBEnterSatelliteCamera);
public static string QSBExitSatelliteCamera = "QSBExitSatelliteCamera"; public const string QSBExitSatelliteCamera = nameof(QSBExitSatelliteCamera);
public static string QSBSatelliteSnapshot = "QSBSatelliteSnapshot"; public const string QSBSatelliteSnapshot = nameof(QSBSatelliteSnapshot);
public static string QSBAnglerChangeState = "QSBAnglerChangeState"; public const string QSBAnglerChangeState = nameof(QSBAnglerChangeState);
public static string QSBMeteorPreLaunch = "QSBMeteorPreLaunch"; public const string QSBMeteorPreLaunch = nameof(QSBMeteorPreLaunch);
public static string QSBMeteorLaunch = "QSBMeteorLaunch"; public const string QSBMeteorLaunch = nameof(QSBMeteorLaunch);
public static string QSBMeteorSpecialImpact = "QSBMeteorSpecialImpact"; public const string QSBMeteorSpecialImpact = nameof(QSBMeteorSpecialImpact);
public static string QSBFragmentDamage = "QSBFragmentDamage"; public const string QSBFragmentDamage = nameof(QSBFragmentDamage);
public static string QSBFragmentResync = "QSBFragmentResync"; public const string QSBFragmentResync = nameof(QSBFragmentResync);
public static string QSBLearnLaunchCodes = "QSBLearnLaunchCodes"; public const string QSBLearnLaunchCodes = nameof(QSBLearnLaunchCodes);
public static string QSBSatelliteRepairTick = "QSBSatelliteRepairTick"; public const string QSBSatelliteRepairTick = nameof(QSBSatelliteRepairTick);
public static string QSBSatelliteRepaired = "QSBSatelliteRepairTick"; public const string QSBSatelliteRepaired = nameof(QSBSatelliteRepairTick);
public static string QSBAuthorityQueue = "QSBAuthorityQueue"; public const string QSBAuthorityQueue = nameof(QSBAuthorityQueue);
public static string QSBJellyfishRising = "QSBJellyfishRising"; public const string QSBJellyfishRising = nameof(QSBJellyfishRising);
} }
} }

View File

@ -12,8 +12,8 @@ namespace QSB.Player.Events
{ {
public override void SetupListener() public override void SetupListener()
{ {
GlobalMessenger.AddListener(EventNames.EnterQuantumMoon, () => Handler(EnterLeaveType.EnterMoon)); GlobalMessenger.AddListener(EventNames.PlayerEnterQuantumMoon, () => Handler(EnterLeaveType.EnterMoon));
GlobalMessenger.AddListener(EventNames.ExitQuantumMoon, () => Handler(EnterLeaveType.ExitMoon)); GlobalMessenger.AddListener(EventNames.PlayerExitQuantumMoon, () => Handler(EnterLeaveType.ExitMoon));
GlobalMessenger.AddListener(EventNames.QSBEnterShrine, () => Handler(EnterLeaveType.EnterShrine)); GlobalMessenger.AddListener(EventNames.QSBEnterShrine, () => Handler(EnterLeaveType.EnterShrine));
GlobalMessenger.AddListener(EventNames.QSBExitShrine, () => Handler(EnterLeaveType.ExitShrine)); GlobalMessenger.AddListener(EventNames.QSBExitShrine, () => Handler(EnterLeaveType.ExitShrine));
GlobalMessenger<int>.AddListener(EventNames.QSBEnterPlatform, (int id) => Handler(EnterLeaveType.EnterPlatform, id)); GlobalMessenger<int>.AddListener(EventNames.QSBEnterPlatform, (int id) => Handler(EnterLeaveType.EnterPlatform, id));
@ -28,8 +28,8 @@ namespace QSB.Player.Events
public override void CloseListener() public override void CloseListener()
{ {
GlobalMessenger.RemoveListener(EventNames.EnterQuantumMoon, () => Handler(EnterLeaveType.EnterMoon)); GlobalMessenger.RemoveListener(EventNames.PlayerEnterQuantumMoon, () => Handler(EnterLeaveType.EnterMoon));
GlobalMessenger.RemoveListener(EventNames.ExitQuantumMoon, () => Handler(EnterLeaveType.ExitMoon)); GlobalMessenger.RemoveListener(EventNames.PlayerExitQuantumMoon, () => Handler(EnterLeaveType.ExitMoon));
GlobalMessenger.RemoveListener(EventNames.QSBEnterShrine, () => Handler(EnterLeaveType.EnterShrine)); GlobalMessenger.RemoveListener(EventNames.QSBEnterShrine, () => Handler(EnterLeaveType.EnterShrine));
GlobalMessenger.RemoveListener(EventNames.QSBExitShrine, () => Handler(EnterLeaveType.ExitShrine)); GlobalMessenger.RemoveListener(EventNames.QSBExitShrine, () => Handler(EnterLeaveType.ExitShrine));
GlobalMessenger<int>.RemoveListener(EventNames.QSBEnterPlatform, (int id) => Handler(EnterLeaveType.EnterPlatform, id)); GlobalMessenger<int>.RemoveListener(EventNames.QSBEnterPlatform, (int id) => Handler(EnterLeaveType.EnterPlatform, id));

View File

@ -47,7 +47,7 @@ namespace QSB.Player.Events
private void SendWorldObjectInfo() private void SendWorldObjectInfo()
{ {
QSBWorldSync.DialogueConditions.ForEach(condition QSBWorldSync.DialogueConditions.ForEach(condition
=> QSBEventManager.FireEvent(EventNames.DialogueCondition, condition.Key, condition.Value)); => QSBEventManager.FireEvent(EventNames.DialogueConditionChanged, condition.Key, condition.Value));
QSBWorldSync.ShipLogFacts.ForEach(fact QSBWorldSync.ShipLogFacts.ForEach(fact
=> QSBEventManager.FireEvent(EventNames.QSBRevealFact, fact.Id, fact.SaveGame, false)); => QSBEventManager.FireEvent(EventNames.QSBRevealFact, fact.Id, fact.SaveGame, false));