Class ShapeDestination


  • public class ShapeDestination
    extends Destination
    A destination backed by a shape that is re-read on every query.

    The supplier indirection is what makes target tracking work: the planner asks for the shape again part-way through a movement, so a widget that scrolls or an outline that shifts is followed rather than clicked where it used to be.

    • Constructor Detail

      • ShapeDestination

        public ShapeDestination​(java.util.function.Supplier<java.awt.Shape> supplier,
                                java.lang.String label)
      • ShapeDestination

        public ShapeDestination​(java.util.function.Supplier<java.awt.Shape> supplier,
                                java.lang.String label,
                                boolean fixedOnScreen)
    • Method Detail

      • shape

        public java.awt.Shape shape()
        Description copied from class: Destination
        The raw clickable outline in canvas pixels, or null when the target has no projection at all.

        This is unclipped on purpose. The client projects actors and objects that are behind or beside the camera to coordinates far outside the canvas rather than returning null, so a non-null shape here is not a claim that anything is on screen. Use Destination.visibleShape() for that.

        Specified by:
        shape in class Destination
      • describe

        public java.lang.String describe()
        Description copied from class: Destination
        A short label for logging and the overlay.
        Specified by:
        describe in class Destination
      • cameraCanHelp

        public boolean cameraCanHelp()
        Interface furniture lives at fixed screen coordinates. Rotating the camera will never bring a hidden inventory slot into view, so say so rather than letting the backend waste a rotation discovering it.
        Overrides:
        cameraCanHelp in class Destination
      • needsCamera

        public boolean needsCamera()
        Description copied from class: Destination
        Whether reaching this destination needs the camera moved first. Targets that are simply off screen answer true; fixed screen furniture such as an inventory slot never does.
        Overrides:
        needsCamera in class Destination