Example #1
0
        public static void spawnlootfrom(ConsoleSystem.Arg args)
        {
            BasePlayer basePlayer = args.Player();
            string     strPrefab  = args.GetString(0, string.Empty);
            int        num        = args.GetInt(1, 1);
            Vector3    vector3    = args.GetVector3(1, Object.op_Implicit((Object)basePlayer) ? basePlayer.CenterPoint() : Vector3.get_zero());

            if (string.IsNullOrEmpty(strPrefab))
            {
                return;
            }
            BaseEntity entity = GameManager.server.CreateEntity(strPrefab, vector3, (Quaternion)null, true);

            if (Object.op_Equality((Object)entity, (Object)null))
            {
                return;
            }
            entity.Spawn();
            basePlayer.ChatMessage("Contents of " + strPrefab + " spawned " + (object)num + " times");
            LootContainer component = (LootContainer)((Component)entity).GetComponent <LootContainer>();

            if (Object.op_Inequality((Object)component, (Object)null))
            {
                for (int index = 0; index < num * component.maxDefinitionsToSpawn; ++index)
                {
                    component.lootDefinition.SpawnIntoContainer(basePlayer.inventory.containerMain);
                }
            }
            entity.Kill(BaseNetworkable.DestroyMode.None);
        }
Example #2
0
        public static void spawnlootfrom(ConsoleSystem.Arg args)
        {
            BasePlayer basePlayer = args.Player();
            string     str        = args.GetString(0, string.Empty);
            int        num        = args.GetInt(1, 1);
            Vector3    vector3    = args.GetVector3(1, (basePlayer ? basePlayer.CenterPoint() : Vector3.zero));

            if (string.IsNullOrEmpty(str))
            {
                return;
            }
            GameManager gameManager = GameManager.server;
            Quaternion  quaternion  = new Quaternion();
            BaseEntity  baseEntity  = gameManager.CreateEntity(str, vector3, quaternion, true);

            if (baseEntity == null)
            {
                return;
            }
            baseEntity.Spawn();
            basePlayer.ChatMessage(string.Concat(new object[] { "Contents of ", str, " spawned ", num, " times" }));
            LootContainer component = baseEntity.GetComponent <LootContainer>();

            if (component != null)
            {
                for (int i = 0; i < num * component.maxDefinitionsToSpawn; i++)
                {
                    component.lootDefinition.SpawnIntoContainer(basePlayer.inventory.containerMain);
                }
            }
            baseEntity.Kill(BaseNetworkable.DestroyMode.None);
        }
Example #3
0
        public static void teleportpos(ConsoleSystem.Arg args)
        {
            BasePlayer basePlayer = args.Player();

            if (!Object.op_Implicit((Object)basePlayer) || !basePlayer.IsAlive())
            {
                return;
            }
            basePlayer.Teleport(args.GetVector3(0, Vector3.get_zero()));
        }
Example #4
0
        public static void teleportpos(ConsoleSystem.Arg args)
        {
            BasePlayer basePlayer = args.Player();

            if (!basePlayer)
            {
                return;
            }
            if (!basePlayer.IsAlive())
            {
                return;
            }
            basePlayer.Teleport(args.GetVector3(0, Vector3.zero));
        }