Esempio n. 1
0
        public Room ClosestRoom(Vector3 yourpos)
        {
            float closestDist = 10000f;
            Room  room        = null;

            foreach (Room r in Spawner.rooms)
            {
                float curDist = Vector3.Distance(Spawner.Vec3ToVector3(yourpos), r.Position);
                if (curDist < closestDist)
                {
                    closestDist = curDist;
                    room        = r;
                }
            }
            return(room);
        }
Esempio n. 2
0
 public void OnCallCommand(PlayerCallCommandEvent ev)
 {
     if (ev.Command.StartsWith("newpos"))
     {
         if (!plugin.allowedranks.Contains(ev.Player.GetUserGroup().Name))
         {
             ev.ReturnMessage = "You can't use this command.";
             return;
         }
         var     scp049Component = ((GameObject)ev.Player.GetGameObject()).GetComponent <Scp049PlayerScript>();
         var     scp106Component = (ev.Player.GetGameObject() as GameObject).GetComponent <Scp106PlayerScript>();
         Vector3 plyRot          = scp049Component.plyCam.transform.forward;
         Physics.Raycast(scp049Component.plyCam.transform.position, plyRot, out RaycastHit where, 40f, scp106Component.teleportPlacementMask);
         if (where.point.Equals(Vector3.zero))
         {
             ev.ReturnMessage = "Failed to get the Vector3, and to spawn the coin. Try another place.";
         }
         else
         {
             Vector3 rotation = new Vector3(-plyRot.x, plyRot.y, -plyRot.z), position = Spawner.Vec3ToVector3(where.point) + (Vector3.Up * 0.1f);
             PluginManager.Manager.Server.Map.SpawnItem(ItemType.COIN, position, rotation);
             spawnedCoins.Add(new PosVector3Pair(position, rotation));
             Room room = ClosestRoom(where.point);
             ev.ReturnMessage = "Added " + where.point.ToString() + " to the list."
                                + "\nYou're probably (maybe not) looking for the RoomType: " + room.RoomType.ToString() + "\nIf that's not the room you're looking for, check ITS RL through the R.A. console";
         }
     }
 }