コード例 #1
0
ファイル: PlayerEvents.cs プロジェクト: BuildBoy12/Scp457
 private static void OnShot(ShotEventArgs ev)
 {
     if (Scp457.Get(ev.Target) != null && ev.Hitbox._dmgMultiplier == HitboxIdentity.DamagePercent.Headshot)
     {
         ev.Damage /= 4;
     }
 }
コード例 #2
0
ファイル: PlayerEvents.cs プロジェクト: BuildBoy12/Scp457
        private static void OnSpawning(SpawningEventArgs ev)
        {
            if (!(Scp457.Get(ev.Player) is Scp457 scp457))
            {
                return;
            }

            if (ev.RoleType != RoleType.Scp0492)
            {
                scp457.Destroy();
                return;
            }

            Door door = Map.GetDoorByName(Plugin.Instance.Config.Scp457Settings.SpawnDoor);

            if (door == null)
            {
                Log.Error("Could not find the spawn door for Scp457!");
                return;
            }

            if (PlayerMovementSync.FindSafePosition(door.Base.transform.position, out Vector3 pos, true))
            {
                ev.Position = pos;
            }
        }
コード例 #3
0
        /// <inheritdoc />
        public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response)
        {
            if (!sender.CheckPermission(RequiredPermission))
            {
                response = $"Insufficient permission. Required: {RequiredPermission}";
                return(false);
            }

            Player player = Player.Get((sender as PlayerCommandSender)?.ReferenceHub);

            if (arguments.Count > 0)
            {
                if (!(Player.Get(arguments.At(0)) is Player ply))
                {
                    response = "Could not find the referenced user.";
                    return(false);
                }

                player = ply;
            }

            if (Scp457.Get(player) != null)
            {
                response = $"{player.Nickname} is already a Scp457!";
                return(false);
            }

            Scp457.Spawn(player);
            response = $"Spawned {player.Nickname} as a Scp457.";
            return(true);
        }
コード例 #4
0
ファイル: PlayerEvents.cs プロジェクト: BuildBoy12/Scp457
        private static void OnDied(DiedEventArgs ev)
        {
            if (BurningHandler.Get(ev.Target) is BurningHandler burningHandler)
            {
                burningHandler.BurnTime = 0f;
            }

            if (Scp457.Get(ev.Target) is Scp457 scp457)
            {
                scp457.Destroy();
            }
        }
コード例 #5
0
ファイル: PlayerEvents.cs プロジェクト: BuildBoy12/Scp457
        private static void OnDestroying(DestroyingEventArgs ev)
        {
            if (BurningHandler.Get(ev.Player) is BurningHandler burningHandler)
            {
                burningHandler.Destroy();
            }

            if (Scp457.Get(ev.Player) is Scp457 scp457)
            {
                scp457.Destroy();
            }
        }
コード例 #6
0
ファイル: CombustCommand.cs プロジェクト: BuildBoy12/Scp457
        /// <inheritdoc />
        public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response)
        {
            Player player = Player.Get((sender as PlayerCommandSender)?.SenderId);

            if (!(Scp457.Get(player) is Scp457 scp457))
            {
                response = "You must be Scp457 to use this command.";
                return(false);
            }

            Config config = Plugin.Instance.Config;

            if (scp457.CombustCooldown > 0f)
            {
                response = config.CombustSettings.CooldownMessage.Replace("%seconds%", scp457.CombustCooldown.ToString());
                return(false);
            }

            Methods.SpawnGrenade(player.Position);

            foreach (Player ply in Player.List)
            {
                if (ply.IsScp || ply.IsScp035() ||
                    ply.IsGhostSpectator() ||
                    ply.IsNpc())
                {
                    continue;
                }

                BurningHandler burningHandler = BurningHandler.Get(ply);
                if (burningHandler == null || !burningHandler.HasBurned)
                {
                    continue;
                }

                float burnTime = burningHandler.BurnTime + config.CombustSettings.BurnDuration;
                if (burnTime > config.BurnSettings.MaximumDuration)
                {
                    burnTime = config.BurnSettings.MaximumDuration;
                }

                burningHandler.LastAttacker = scp457;
                burningHandler.BurnTime     = burnTime;
                ply.Hurt(config.CombustSettings.Damage, DamageTypes.Asphyxiation, player.Nickname, player.Id);
                ply.EnableEffect <Flashed>(config.CombustSettings.FlashDuration);
            }

            scp457.CombustCooldown = config.CombustSettings.Cooldown;
            response = config.CombustSettings.UsedMessage;
            return(false);
        }