Exemplo n.º 1
0
        public static bool Prefix(AlphaWarheadController __instance, GameObject disabler)
        {
            try
            {
                ServerLogs.AddLog(ServerLogs.Modules.Warhead, "Detonation cancelled.", ServerLogs.ServerLogType.GameEvent);

                if (!__instance.inProgress || __instance.timeToDetonation <= 10.0)
                {
                    return(false);
                }

                if (__instance.timeToDetonation <= 15.0 && disabler != null)
                {
                    __instance.GetComponent <PlayerStats>().TargetAchieve(disabler.GetComponent <NetworkIdentity>().connectionToClient, "thatwasclose");
                }

                bool allow = true;

                Events.InvokeWarheadCancel(disabler, ref allow);

                return(allow && !EventPlugin.WarheadLocked);
            }
            catch (Exception exception)
            {
                Log.Error($"WarheadCancelledEvent error: {exception}");
                return(true);
            }
        }
Exemplo n.º 2
0
        private static bool Prefix(AlphaWarheadController __instance, GameObject disabler)
        {
            ServerLogs.AddLog(ServerLogs.Modules.Warhead, "Detonation cancelled.", ServerLogs.ServerLogType.GameEvent);

            if (!__instance.inProgress || __instance.timeToDetonation <= 10.0)
            {
                return(false);
            }

            if (__instance.timeToDetonation <= 15.0 && disabler != null)
            {
                __instance.GetComponent <PlayerStats>().TargetAchieve(disabler.GetComponent <NetworkIdentity>().connectionToClient, "thatwasclose");
            }

            var ev = new StoppingEventArgs(API.Features.Player.Get(disabler) ?? API.Features.Server.Host);

            Warhead.OnStopping(ev);

            return(ev.IsAllowed && !API.Features.Warhead.IsWarheadLocked);
        }