Ejemplo n.º 1
0
        SleepingBag GetSleepingBag(string name, Vector3 pos)
        {
            List <SleepingBag> sleepingBags = new List <SleepingBag>();

            Vis.Components(pos, .1f, sleepingBags);
            return(sleepingBags.Count > 0 ? sleepingBags[0] : null);
        }
Ejemplo n.º 2
0
        private void CommandGetComponents(IPlayer player, string command, string[] args)
        {
            var basePlayer = player.Object as BasePlayer;

            if (basePlayer == null)
            {
                return;
            }

            float radius;

            if (args.Length < 1 || !float.TryParse(args[0], out radius))
            {
                radius = 5f;
            }

            var output = new List <Component>();

            Vis.Components(basePlayer.transform.position, radius, output);

            var table = new TextTable();

            table.AddColumns("name", "class");

            foreach (var entry in output)
            {
                table.AddRow(entry.name, entry.GetType().FullName);
            }

            basePlayer.ConsoleMessage(table.ToString());
        }
Ejemplo n.º 3
0
    public void DoReset()
    {
        int      i;
        IOEntity component = base.GetComponent <IOEntity>();

        if (component != null)
        {
            PuzzleReset.ResetIOEntRecursive(component, UnityEngine.Time.frameCount);
            component.MarkDirty();
        }
        else if (this.resetPositions != null)
        {
            Vector3[] vector3Array = this.resetPositions;
            for (i = 0; i < (int)vector3Array.Length; i++)
            {
                Vector3         vector3  = vector3Array[i];
                Vector3         vector31 = base.transform.TransformPoint(vector3);
                List <IOEntity> list     = Facepunch.Pool.GetList <IOEntity>();
                Vis.Entities <IOEntity>(vector31, 0.5f, list, 1235288065, QueryTriggerInteraction.Ignore);
                foreach (IOEntity oEntity in list)
                {
                    if (!oEntity.IsRootEntity() || !oEntity.isServer)
                    {
                        continue;
                    }
                    PuzzleReset.ResetIOEntRecursive(oEntity, UnityEngine.Time.frameCount);
                    oEntity.MarkDirty();
                }
                Facepunch.Pool.FreeList <IOEntity>(ref list);
            }
        }
        List <SpawnGroup> spawnGroups = Facepunch.Pool.GetList <SpawnGroup>();

        Vis.Components <SpawnGroup>(base.transform.position, 1f, spawnGroups, 262144, QueryTriggerInteraction.Collide);
        foreach (SpawnGroup spawnGroup in spawnGroups)
        {
            if (spawnGroup == null)
            {
                continue;
            }
            spawnGroup.Spawn();
        }
        Facepunch.Pool.FreeList <SpawnGroup>(ref spawnGroups);
        GameObject[] gameObjectArray = this.resetObjects;
        for (i = 0; i < (int)gameObjectArray.Length; i++)
        {
            GameObject gameObject = gameObjectArray[i];
            if (gameObject != null)
            {
                gameObject.SendMessage("OnPuzzleReset", SendMessageOptions.DontRequireReceiver);
            }
        }
    }
Ejemplo n.º 4
0
    public static float CalculateArtificialTemperature(Transform forTransform)
    {
        Vector3 position = forTransform.position;
        List <GrowableHeatSource> obj = Facepunch.Pool.GetList <GrowableHeatSource>();

        Vis.Components(position, ConVar.Server.artificialTemperatureGrowableRange, obj, 256);
        float num = 0f;

        foreach (GrowableHeatSource item in obj)
        {
            num = Mathf.Max(item.ApplyHeat(position), num);
        }
        Facepunch.Pool.FreeList(ref obj);
        return(num);
    }
Ejemplo n.º 5
0
        private bool IsValidForColliders(Vector3 position)
        {
            _listColliders.Clear();

            Vis.Components(position, _config.DistanceCollider, _listColliders);
            foreach (var collider in _listColliders)
            {
                var gameObject = collider.gameObject;
                if (gameObject.layer == _layerTerrain)
                {
                    continue;
                }

                return(false);
            }

            return(true);
        }
Ejemplo n.º 6
0
        private bool CheckBadCollider(Vector3 position)
        {
            var colliders = new List <Collider>();

            Vis.Components(position, _config.DistanceCollider, colliders);
            foreach (var collider in colliders)
            {
                var gameObject = collider.gameObject;
                if (gameObject.layer == _layerTerrain)
                {
                    continue;
                }

                return(true);
            }

            return(false);
        }
Ejemplo n.º 7
0
    public void DoReset()
    {
        IOEntity component = (IOEntity)((Component)this).GetComponent <IOEntity>();

        if (Object.op_Inequality((Object)component, (Object)null))
        {
            PuzzleReset.ResetIOEntRecursive(component, Time.get_frameCount());
            component.MarkDirty();
        }
        else if (this.resetPositions != null)
        {
            foreach (Vector3 resetPosition in this.resetPositions)
            {
                Vector3         position = ((Component)this).get_transform().TransformPoint(resetPosition);
                List <IOEntity> list1    = (List <IOEntity>)Pool.GetList <IOEntity>();
                List <IOEntity> list2    = list1;
                Vis.Entities <IOEntity>(position, 0.5f, list2, 1235288065, (QueryTriggerInteraction)1);
                foreach (IOEntity target in list1)
                {
                    if (target.IsRootEntity())
                    {
                        PuzzleReset.ResetIOEntRecursive(target, Time.get_frameCount());
                        target.MarkDirty();
                    }
                }
                // ISSUE: cast to a reference type
                Pool.FreeList <IOEntity>((List <M0>&) ref list1);
            }
        }
        List <SpawnGroup> list = (List <SpawnGroup>)Pool.GetList <SpawnGroup>();

        Vis.Components <SpawnGroup>(((Component)this).get_transform().get_position(), 1f, list, 262144, (QueryTriggerInteraction)2);
        foreach (SpawnGroup spawnGroup in list)
        {
            if (!Object.op_Equality((Object)spawnGroup, (Object)null))
            {
                spawnGroup.Spawn();
            }
        }
        // ISSUE: cast to a reference type
        Pool.FreeList <SpawnGroup>((List <M0>&) ref list);
    }