public static bool CheckCondition(BaseEntity ent)
    {
        if (ModelConditionTest_WallTriangleLeft.CheckSocketOccupied(ent, "wall/sockets/wall-female"))
        {
            return(false);
        }
        if (ModelConditionTest_WallTriangleLeft.CheckSocketOccupied(ent, "wall/sockets/floor-female/1"))
        {
            return(false);
        }
        if (ModelConditionTest_WallTriangleLeft.CheckSocketOccupied(ent, "wall/sockets/floor-female/2"))
        {
            return(false);
        }
        if (ModelConditionTest_WallTriangleLeft.CheckSocketOccupied(ent, "wall/sockets/stability/1"))
        {
            return(false);
        }
        EntityLink entityLink = ent.FindLink("wall/sockets/neighbour/1");

        if (entityLink == null)
        {
            return(false);
        }
        for (int i = 0; i < entityLink.connections.Count; i++)
        {
            BuildingBlock item = entityLink.connections[i].owner as BuildingBlock;
            if (!(item == null) && !(item.blockDefinition.info.name.token != "roof") && Vector3.Angle(ent.transform.forward, item.transform.forward) <= 10f)
            {
                return(true);
            }
        }
        return(false);
    }
Example #2
0
    public static bool CheckCondition(BaseEntity ent)
    {
        if (ModelConditionTest_WallTriangleLeft.CheckSocketOccupied(ent, "wall/sockets/wall-female") || ModelConditionTest_WallTriangleLeft.CheckSocketOccupied(ent, "wall/sockets/floor-female/1") || (ModelConditionTest_WallTriangleLeft.CheckSocketOccupied(ent, "wall/sockets/floor-female/2") || ModelConditionTest_WallTriangleLeft.CheckSocketOccupied(ent, "wall/sockets/stability/1")))
        {
            return(false);
        }
        EntityLink link = ent.FindLink("wall/sockets/neighbour/1");

        if (link == null)
        {
            return(false);
        }
        for (int index = 0; index < link.connections.Count; ++index)
        {
            BuildingBlock owner = link.connections[index].owner as BuildingBlock;
            if (!Object.op_Equality((Object)owner, (Object)null) && !(owner.blockDefinition.info.name.token != "roof") && (double)Vector3.Angle(((Component)ent).get_transform().get_forward(), ((Component)owner).get_transform().get_forward()) <= 10.0)
            {
                return(true);
            }
        }
        return(false);
    }