public override bool DoTest(BaseEntity ent)
    {
        BuildingBlock buildingBlock = ent as BuildingBlock;

        if (buildingBlock == null)
        {
            return(false);
        }
        EntityLink entityLink = ent.FindLink(stairs_sockets_female);

        if (entityLink == null)
        {
            return(false);
        }
        for (int i = 0; i < entityLink.connections.Count; i++)
        {
            BuildingBlock buildingBlock2 = entityLink.connections[i].owner as BuildingBlock;
            if (!(buildingBlock2 == null) && buildingBlock2.grade == buildingBlock.grade)
            {
                return(false);
            }
        }
        EntityLink entityLink2 = ent.FindLink(floor_sockets_female);

        if (entityLink2 == null)
        {
            return(true);
        }
        if (!entityLink2.IsEmpty())
        {
            return(false);
        }
        return(true);
    }
    private static bool CheckSocketOccupied(BaseEntity ent, string socket)
    {
        EntityLink entityLink = ent.FindLink(socket);

        if (entityLink == null)
        {
            return(false);
        }
        return(!entityLink.IsEmpty());
    }
Пример #3
0
    public override bool DoTest(BaseEntity ent)
    {
        EntityLink entityLink = ent.FindLink("ramp/sockets/block-male/1");

        if (entityLink == null)
        {
            return(false);
        }
        return(!entityLink.IsEmpty());
    }
Пример #4
0
    public bool HasFloorSocketConnection()
    {
        EntityLink entityLink = FindLink("elevator/sockets/block-male");

        if (entityLink != null && !entityLink.IsEmpty())
        {
            return(true);
        }
        return(false);
    }
    public override bool DoTest(BaseEntity ent)
    {
        EntityLink entityLink = ent.FindLink("roof/sockets/wall-female");

        if (entityLink == null)
        {
            return(true);
        }
        if (!entityLink.IsEmpty())
        {
            return(false);
        }
        return(true);
    }
Пример #6
0
    public Elevator GetElevatorInDirection(Direction dir)
    {
        EntityLink entityLink = FindLink((dir == Direction.Down) ? "elevator/sockets/elevator-male" : "elevator/sockets/elevator-female");

        if (entityLink != null && !entityLink.IsEmpty())
        {
            BaseEntity owner = entityLink.connections[0].owner;
            Elevator   elevator;
            if (owner != null && owner.isServer && (object)(elevator = owner as Elevator) != null && elevator != this)
            {
                return(elevator);
            }
        }
        return(null);
    }
    public override bool DoTest(BaseEntity ent)
    {
        BuildingBlock buildingBlock = ent as BuildingBlock;

        if (buildingBlock == null)
        {
            return(false);
        }
        EntityLink entityLink = ent.FindLink(sockets_right);

        if (entityLink == null)
        {
            return(false);
        }
        if (angle == AngleType.None)
        {
            for (int i = 0; i < entityLink.connections.Count; i++)
            {
                if (entityLink.connections[i].name.EndsWith("sockets/neighbour/4"))
                {
                    return(false);
                }
            }
            return(true);
        }
        if (entityLink.IsEmpty())
        {
            return(false);
        }
        bool result = false;

        for (int j = 0; j < entityLink.connections.Count; j++)
        {
            EntityLink entityLink2 = entityLink.connections[j];
            if (!entityLink2.name.EndsWith("sockets/neighbour/4") || (shape == ShapeType.Square && !entityLink2.name.StartsWith("roof/")) || (shape == ShapeType.Triangle && !entityLink2.name.StartsWith("roof.triangle/")))
            {
                continue;
            }
            BuildingBlock buildingBlock2 = entityLink2.owner as BuildingBlock;
            if (buildingBlock2 == null || buildingBlock2.grade != buildingBlock.grade)
            {
                continue;
            }
            int   num  = (int)angle;
            float num2 = 0f - Vector3.SignedAngle(ent.transform.forward, buildingBlock2.transform.forward, Vector3.up);
            if (num2 < (float)(num - 10))
            {
                if (IsConvex)
                {
                    return(false);
                }
            }
            else if (num2 > (float)(num + 10))
            {
                if (IsConvex)
                {
                    return(false);
                }
            }
            else
            {
                result = true;
            }
        }
        return(result);
    }