Esempio n. 1
0
 public void OnSpawn(SpawningEventArgs ev)
 {
     if (Blackout.active && ev.Player.Role == RoleType.Scientist)
     {
         ev.Position = SpawnpointManager.GetRandomPosition(RoleType.Scp049).transform.position;
     }
 }
Esempio n. 2
0
        public System.Collections.IEnumerator SpawnLate(SpawnLateHelper h)
        {
            yield return(new WaitForSeconds(0.5f));

            h.ccm.SetClassID(h.rt);
            h.ccm.GetComponent <PlayerStats>().health = h.ccm.Classes.SafeGet(h.rt).maxHP;
            h.ccm.GetComponent <PlyMovementSync>().OnPlayerClassChange(SpawnpointManager.GetRandomPosition(h.rtspawn).transform.position, 0f);
        }
Esempio n. 3
0
    void Start()
    {
        // cacher referanser
        faseSkifte = GetComponent <FaseSkifte>();
        faseGUI    = GetComponent <FaseGUI>();
        //forberedelsesfase = GetComponent<Forberedelsesfase>();
        spawnpointManager = GameObject.Find("Spawnpoints").GetComponent <SpawnpointManager> ();

        // setter verdier
        spawnedeFiender = fiendeHolder.transform.childCount;

        antallFienderPerWave = 3;
        antallWave           = 1;
        antallFiender        = 0;

        ventMedGruppe = 2f;
        ventMedFiende = 3f;
    }
Esempio n. 4
0
        /// <summary>
        /// Gets a random spawn point of a <see cref="RoleType"/>.
        /// </summary>
        /// <param name="roleType">The <see cref="RoleType"/> to get the spawn point from.</param>
        /// <returns>Returns the spawn point <see cref="Vector3"/> and rotation <see cref="float"/>.</returns>
        public static Tuple <Vector3, float> GetRandomSpawnProperties(this RoleType roleType)
        {
            GameObject randomPosition = SpawnpointManager.GetRandomPosition(roleType);

            return(randomPosition == null ? new Tuple <Vector3, float>(Vector3.zero, 0f) : new Tuple <Vector3, float>(randomPosition.transform.position, randomPosition.transform.rotation.eulerAngles.y));
        }
Esempio n. 5
0
 // Use this for initialization
 void Start()
 {
     // cacher referanser
     faseGUI      = GetComponent <FaseGUI>();
     spawnManager = GameObject.Find("Spawnpoints").GetComponent <SpawnpointManager> ();
 }
Esempio n. 6
0
        public void OnWaiting()
        {
            //Спавн 096 в своей камере
            if (ScanMod.config.enableSmallFeatures)
            {
                float rot096 = 0;
                foreach (Room room in Map.Rooms)
                {
                    if (room.Name == "HCZ_457")
                    {
                        rot096 = room.Transform.rotation.eulerAngles.y;
                        break;
                    }
                }
                SpawnpointManager sm   = UnityEngine.Object.FindObjectOfType <SpawnpointManager>();
                GameObject        pos2 = sm.GetRandomPosition(RoleType.Scp096);
                if (rot096 == 0)
                {
                    pos2.transform.position += new Vector3(4f, 0f, 0f);
                }
                else if (rot096 == 90)
                {
                    pos2.transform.position -= new Vector3(0f, 0f, 4f);
                }
                else if (rot096 == 180)
                {
                    pos2.transform.position -= new Vector3(4f, 0f, 0f);
                }
                else if (rot096 == 270)
                {
                    pos2.transform.position += new Vector3(0f, 0f, 4f);
                }
            }
            //Инициализация для переработки 106
            if (ScanMod.config.enable106overhaul)
            {
                PocketProperties.teleports = UnityEngine.Object.FindObjectsOfType <PocketDimensionTeleport>();
            }
            //Появление новых предметов на карте
            if (ScanMod.config.enableNewItemSpawns)
            {
                Extensions.manager = UnityEngine.Object.FindObjectOfType <RagdollManager>();
                int  modX, modZ;
                bool swap;

                foreach (Room room in Map.Rooms)
                {
                    modX = 0;
                    modZ = 0;
                    swap = false;

                    float angle = room.Transform.rotation.eulerAngles.y;
                    if (angle < 10f && angle > -10f)
                    {
                        modX = 1;
                        modZ = 1;
                        swap = false;
                    }
                    else if (angle < 100f && angle > 80f)
                    {
                        modX = 1;
                        modZ = -1;
                        swap = true;
                    }
                    else if (angle < 190f && angle > 170f)
                    {
                        modX = -1;
                        modZ = -1;
                        swap = false;
                    }
                    else if (angle < 280f && angle > 260f)
                    {
                        modX = -1;
                        modZ = 1;
                        swap = true;
                    }
                    else
                    {
                        Log.Error("Wrong Room rotation");
                    }

                    switch (room.Name)
                    {
                    case "LCZ_173":
                    {
                        if (!swap)
                        {
                            RoleType.ClassD.SpawnRagdoll(new Vector3(room.Transform.position.x + 25 * modX, room.Transform.position.y + 20, room.Transform.position.z + 10 * modZ), Random.rotation, "MasterOfDmx", DamageTypes.Scp173);
                            ItemType.KeycardJanitor.SpawnItem(new Vector3(room.Transform.position.x + 21f * modX, room.Transform.position.y + 20, room.Transform.position.z + 11 * modZ), Vector3.zero);
                            ItemType.Painkillers.SpawnItem(new Vector3(room.Transform.position.x - 3.5f * modX, room.Transform.position.y + 18, room.Transform.position.z - 8f * modZ), Vector3.zero);
                            ItemType.Radio.SpawnItem(new Vector3(room.Transform.position.x - 3.5f * modX, room.Transform.position.y + 18, room.Transform.position.z - 7.5f * modZ), Vector3.zero);
                        }
                        else
                        {
                            RoleType.ClassD.SpawnRagdoll(new Vector3(room.Transform.position.x + 10f * modX, room.Transform.position.y + 20, room.Transform.position.z + 25f * modZ), Random.rotation, "MasterOfDmx", DamageTypes.Scp173);
                            ItemType.KeycardJanitor.SpawnItem(new Vector3(room.Transform.position.x + 11f * modX, room.Transform.position.y + 20, room.Transform.position.z + 21f * modZ), Vector3.zero);
                            ItemType.Painkillers.SpawnItem(new Vector3(room.Transform.position.x - 8f * modX, room.Transform.position.y + 18, room.Transform.position.z - 3.5f * modZ), Vector3.zero);
                            ItemType.Radio.SpawnItem(new Vector3(room.Transform.position.x - 7.5f * modX, room.Transform.position.y + 18, room.Transform.position.z - 3.5f * modZ), Vector3.zero);
                        }
                        break;
                    }

                    case "HCZ_457":
                    {
                        if (!swap)
                        {
                            RoleType.NtfLieutenant.SpawnRagdoll(new Vector3(room.Transform.position.x - 2 * modX, room.Transform.position.y + 2, room.Transform.position.z), Random.rotation, "Monsieur Mem", DamageTypes.Scp096);
                        }
                        else
                        {
                            RoleType.NtfLieutenant.SpawnRagdoll(new Vector3(room.Transform.position.x, room.Transform.position.y + 2, room.Transform.position.z - 2 * modZ), Random.rotation, "Monsieur Mem", DamageTypes.Scp096);
                        }
                        break;
                    }

                    case "EZ_Intercom":
                    {
                        if (!swap)
                        {
                            ItemType.Radio.SpawnItem(new Vector3(room.Transform.position.x - 3f * modX, room.Transform.position.y - 5, room.Transform.position.z + 6 * modZ), Vector3.zero);
                        }
                        else
                        {
                            ItemType.Radio.SpawnItem(new Vector3(room.Transform.position.x - 6f * modX, room.Transform.position.y - 5, room.Transform.position.z + 3f * modZ), Vector3.zero);
                        }

                        break;
                    }

                    case "LCZ_Toilets":
                    {
                        if (!swap)
                        {
                            ItemType.Adrenaline.SpawnItem(new Vector3(room.Transform.position.x - 1f * modX, room.Transform.position.y + 1f, room.Transform.position.z - 10.5f * modZ), Random.rotation.eulerAngles);
                        }
                        else
                        {
                            ItemType.Adrenaline.SpawnItem(new Vector3(room.Transform.position.x + 10.5f * modX, room.Transform.position.y + 1f, room.Transform.position.z + 1f * modZ), Random.rotation.eulerAngles);
                        }
                        break;
                    }

                    case "LCZ_914 (14)":
                    {
                        if (!swap)
                        {
                            ItemType.WeaponManagerTablet.SpawnItem(new Vector3(room.Transform.position.x, room.Transform.position.y + 1.5f, room.Transform.position.z - 10f * modZ), Vector3.zero);

                            ItemType.Radio.SpawnItem(new Vector3(room.Transform.position.x + 2f * modX, room.Transform.position.y + 2f, room.Transform.position.z - 10f * modZ), Vector3.zero);
                        }
                        else
                        {
                            ItemType.WeaponManagerTablet.SpawnItem(new Vector3(room.Transform.position.x + 10f * modX, room.Transform.position.y + 1.5f, room.Transform.position.z), Vector3.zero);

                            ItemType.Radio.SpawnItem(new Vector3(room.Transform.position.x - 10f * modX, room.Transform.position.y + 1.8f, room.Transform.position.z + 2f * modZ), Random.rotation.eulerAngles);
                        }
                        break;
                    }

                    case "HCZ_106":
                    {
                        if (!swap)
                        {
                            ItemType.GrenadeFlash.SpawnItem(new Vector3(room.Transform.position.x + 33.5f * modX, room.Transform.position.y + 1f, room.Transform.position.z - 6.15f * modZ), Vector3.zero);

                            ItemType.GrenadeFlash.SpawnItem(new Vector3(room.Transform.position.x + 33.5f * modX, room.Transform.position.y + 1.5f, room.Transform.position.z - 6.15f * modZ), Vector3.zero);

                            ItemType.GrenadeFlash.SpawnItem(new Vector3(room.Transform.position.x + 33.5f * modX, room.Transform.position.y + 2f, room.Transform.position.z - 6.15f * modZ), Vector3.zero);

                            ItemType.GrenadeFlash.SpawnItem(new Vector3(room.Transform.position.x + 33.5f * modX, room.Transform.position.y + 2.5f, room.Transform.position.z - 6.15f * modZ), Vector3.zero);

                            ItemType.GunUSP.SpawnItem(new Vector3(room.Transform.position.x + 33.5f * modX, room.Transform.position.y + 1f, room.Transform.position.z - 21.35f * modZ), Vector3.zero);
                        }
                        else
                        {
                            ItemType.GrenadeFlash.SpawnItem(new Vector3(room.Transform.position.x - 6.15f * modX, room.Transform.position.y + 1f, room.Transform.position.z + 33.5f * modZ), Vector3.zero);

                            ItemType.GrenadeFlash.SpawnItem(new Vector3(room.Transform.position.x - 6.15f * modX, room.Transform.position.y + 1.5f, room.Transform.position.z + 33.5f * modZ), Vector3.zero);

                            ItemType.GrenadeFlash.SpawnItem(new Vector3(room.Transform.position.x - 6.15f * modX, room.Transform.position.y + 2f, room.Transform.position.z + 33.5f * modZ), Vector3.zero);

                            ItemType.GrenadeFlash.SpawnItem(new Vector3(room.Transform.position.x - 6.15f * modX, room.Transform.position.y + 2.5f, room.Transform.position.z + 33.5f * modZ), Vector3.zero);

                            ItemType.GunUSP.SpawnItem(new Vector3(room.Transform.position.x - 21.35f * modX, room.Transform.position.y + 1f, room.Transform.position.z + 33.5f * modZ), Vector3.zero);
                        }
                        break;
                    }
                    }
                }
                ItemType.GunUSP.SpawnItem(new Vector3(37.5f, 990f, -34.5f), Vector3.zero);
                ItemType.Medkit.SpawnItem(new Vector3(37.5f, 990f, -33.5f), Vector3.zero);
            }
            //Инициализация для сканирования
            if (ScanMod.config.enableScanning)
            {
                ScanController.INSTANCE = new ScanController();
            }
            //Инициализация для протоколов и спец. команд
            if (ScanMod.config.enableProtocols || ScanMod.config.enableSuperCommands)
            {
                ProtocolController.INSTANCE = new ProtocolController();
            }
        }
Esempio n. 7
0
        private static bool OnSetClass(ref RoleType classid, GameObject ply, CharacterClassManager.SpawnReason spawnReason)
        {
            try
            {
                var player = ply.GetPlayer();

                if (player.Hub.isDedicatedServer || !player.Hub.Ready)
                {
                    return(false);
                }

                //Initialise eventargs
                var eventargs = new PlayerSetClassEventArgs
                {
                    Allow       = true,
                    Player      = player,
                    Role        = classid,
                    SpawnReason = spawnReason,
                    EscapeItems = new List <SynapseItem>(),
                    Position    = Vector3.zero,
                    Rotation    = 0f,
                    Items       = new List <SynapseItem>(),
                    Ammo        = new Dictionary <AmmoType, ushort>(),
                };

                //Set EscapeItems if the Player is escaping
                if (eventargs.IsEscaping)
                {
                    eventargs.EscapeItems = player.Inventory.Items;
                }

                //Find the Position and Rotation if the player becomes a living Role
                if (classid != RoleType.Spectator && classid != RoleType.None)
                {
                    var randomPosition = SpawnpointManager.GetRandomPosition(classid);
                    if (Map.Get.RespawnPoint != Vector3.zero)
                    {
                        eventargs.Position = Map.Get.RespawnPoint;
                    }
                    else if (randomPosition != null)
                    {
                        eventargs.Position = randomPosition.transform.position;
                        eventargs.Rotation = randomPosition.transform.rotation.eulerAngles.y;
                    }
                    else
                    {
                        eventargs.Position = player.ClassManager.DeathPosition;
                    }
                }

                //Find and create the Items that the Player should spawn with
                if (InventorySystem.Configs.StartingInventories.DefinedInventories.TryGetValue(classid, out var roleitems))
                {
                    foreach (var ammo in roleitems.Ammo)
                    {
                        eventargs.Ammo[(AmmoType)ammo.Key] = ammo.Value;
                    }

                    foreach (var itemtype in roleitems.Items)
                    {
                        eventargs.Items.Add(new SynapseItem(itemtype));
                    }
                }

                Server.Get.Events.Player.InvokeSetClassEvent(eventargs);

                classid = eventargs.Role;

                if (eventargs.Allow)
                {
                    player.setClassEventArgs = eventargs;
                }

                return(eventargs.Allow);
            }
            catch (Exception e)
            {
                Logger.Get.Error($"Synapse-Event: PlayerSetClass(SetPlayersClass) failed!!\n{e}");
                return(true);
            }
        }