예제 #1
0
        public static void Prefix(AbstractActor __instance)
        {
            Mod.Log.Trace?.Write("AA:OnAEnd - entered.");

            if (__instance != null)
            {
                // Disable night vision
                if (ModState.IsNightVisionMode)
                {
                    VfxHelper.DisableNightVisionEffect();
                }
            }
        }
예제 #2
0
        public static void Prefix(AbstractActor __instance, int stackItemID)
        {
            if (stackItemID == -1 || __instance == null || __instance.HasBegunActivation)
            {
                // For some bloody reason DoneWithActor() invokes OnActivationBegin, EVEN THOUGH IT DOES NOTHING. GAH!
                return;
            }

            // Draw stealth if applicable
            EWState actorState = new EWState(__instance);

            if (actorState.HasStealth())
            {
                Mod.Log.Debug?.Write($"-- Sending message to update stealth");
                StealthChangedMessage message = new StealthChangedMessage(__instance.GUID);
                __instance.Combat.MessageCenter.PublishMessage(message);
            }

            // If friendly, reset the map visibility
            if (__instance.TeamId != __instance.Combat.LocalPlayerTeamGuid &&
                __instance.Combat.HostilityMatrix.IsLocalPlayerFriendly(__instance.TeamId))
            {
                Mod.Log.Info?.Write($"{CombatantUtils.Label(__instance)} IS FRIENDLY, REBUILDING FOG OF WAR");

                if (actorState.HasNightVision() && ModState.GetMapConfig().isDark)
                {
                    Mod.Log.Info?.Write($"Enabling night vision mode.");
                    VfxHelper.EnableNightVisionEffect(__instance);
                }
                else
                {
                    // TODO: This is likely never triggered due to the patch below... remove?
                    if (ModState.IsNightVisionMode)
                    {
                        VfxHelper.DisableNightVisionEffect();
                    }
                }

                VfxHelper.RedrawFogOfWar(__instance);
            }
        }