Ejemplo n.º 1
0
    private bool OnGround()
    {
        bool       flag;
        BaseEntity component = base.GetComponent <BaseEntity>();

        if (component)
        {
            Construction construction = PrefabAttribute.server.Find <Construction>(component.prefabID);
            if (construction)
            {
                Socket_Base[] socketBaseArray = construction.allSockets;
                for (int i = 0; i < (int)socketBaseArray.Length; i++)
                {
                    SocketMod[] socketModArray = socketBaseArray[i].socketMods;
                    for (int j = 0; j < (int)socketModArray.Length; j++)
                    {
                        SocketMod_AreaCheck socketModAreaCheck = socketModArray[j] as SocketMod_AreaCheck;
                        if (socketModAreaCheck && socketModAreaCheck.wantsInside && !socketModAreaCheck.DoCheck(component.transform.position, component.transform.rotation))
                        {
                            return(false);
                        }
                    }
                }
            }
        }
        List <Collider> list = Pool.GetList <Collider>();

        Vis.Colliders <Collider>(base.transform.TransformPoint(this.groundPosition), this.radius, list, this.layers, QueryTriggerInteraction.Collide);
        List <Collider> .Enumerator enumerator = list.GetEnumerator();
        try
        {
            while (enumerator.MoveNext())
            {
                BaseEntity baseEntity = enumerator.Current.gameObject.ToBaseEntity();
                if (baseEntity && (baseEntity == component || baseEntity.IsDestroyed || baseEntity.isClient))
                {
                    continue;
                }
                Pool.FreeList <Collider>(ref list);
                flag = true;
                return(flag);
            }
            Pool.FreeList <Collider>(ref list);
            return(false);
        }
        finally
        {
            ((IDisposable)enumerator).Dispose();
        }
        return(flag);
    }
Ejemplo n.º 2
0
    private bool OnGround()
    {
        BaseEntity component = (BaseEntity)((Component)this).GetComponent <BaseEntity>();

        if (Object.op_Implicit((Object)component))
        {
            Construction construction = PrefabAttribute.server.Find <Construction>(component.prefabID);
            if ((bool)((PrefabAttribute)construction))
            {
                foreach (Socket_Base allSocket in construction.allSockets)
                {
                    foreach (SocketMod socketMod in allSocket.socketMods)
                    {
                        SocketMod_AreaCheck socketModAreaCheck = socketMod as SocketMod_AreaCheck;
                        if ((bool)((PrefabAttribute)socketModAreaCheck) && socketModAreaCheck.wantsInside && !socketModAreaCheck.DoCheck(((Component)component).get_transform().get_position(), ((Component)component).get_transform().get_rotation()))
                        {
                            return(false);
                        }
                    }
                }
            }
        }
        List <Collider> list = (List <Collider>)Pool.GetList <Collider>();

        Vis.Colliders <Collider>(((Component)this).get_transform().TransformPoint(this.groundPosition), this.radius, list, LayerMask.op_Implicit(this.layers), (QueryTriggerInteraction)2);
        using (List <Collider> .Enumerator enumerator = list.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                BaseEntity baseEntity = ((Component)enumerator.Current).get_gameObject().ToBaseEntity();
                if (!Object.op_Implicit((Object)baseEntity) || !Object.op_Equality((Object)baseEntity, (Object)component) && !baseEntity.IsDestroyed && !baseEntity.isClient)
                {
                    // ISSUE: cast to a reference type
                    Pool.FreeList <Collider>((List <M0>&) ref list);
                    return(true);
                }
            }
        }
        // ISSUE: cast to a reference type
        Pool.FreeList <Collider>((List <M0>&) ref list);
        return(false);
    }
Ejemplo n.º 3
0
    private bool OnGround()
    {
        BaseEntity component = GetComponent <BaseEntity>();

        if ((bool)component)
        {
            Construction construction = PrefabAttribute.server.Find <Construction>(component.prefabID);
            if ((bool)construction)
            {
                Socket_Base[] allSockets = construction.allSockets;
                for (int i = 0; i < allSockets.Length; i++)
                {
                    SocketMod[] socketMods = allSockets[i].socketMods;
                    for (int j = 0; j < socketMods.Length; j++)
                    {
                        SocketMod_AreaCheck socketMod_AreaCheck = socketMods[j] as SocketMod_AreaCheck;
                        if ((bool)socketMod_AreaCheck && socketMod_AreaCheck.wantsInside && !socketMod_AreaCheck.DoCheck(component.transform.position, component.transform.rotation))
                        {
                            if (ConVar.Physics.groundwatchdebug)
                            {
                                Debug.Log("GroundWatch failed: " + socketMod_AreaCheck.hierachyName);
                            }
                            return(false);
                        }
                    }
                }
            }
        }
        List <Collider> obj = Facepunch.Pool.GetList <Collider>();

        Vis.Colliders(base.transform.TransformPoint(groundPosition), radius, obj, layers);
        foreach (Collider item in obj)
        {
            BaseEntity baseEntity = GameObjectEx.ToBaseEntity(item.gameObject);
            if (!baseEntity || (!(baseEntity == component) && !baseEntity.IsDestroyed && !baseEntity.isClient))
            {
                DecayEntity decayEntity  = component as DecayEntity;
                DecayEntity decayEntity2 = baseEntity as DecayEntity;
                if (!decayEntity || decayEntity.buildingID == 0 || !decayEntity2 || decayEntity2.buildingID == 0 || decayEntity.buildingID == decayEntity2.buildingID)
                {
                    Facepunch.Pool.FreeList(ref obj);
                    return(true);
                }
            }
        }
        if (ConVar.Physics.groundwatchdebug)
        {
            Debug.Log("GroundWatch failed: Legacy radius check");
        }
        Facepunch.Pool.FreeList(ref obj);
        return(false);
    }