Class AbstractDeliverymanRequestable

java.lang.Object
com.minecolonies.api.colony.requestsystem.requestable.deliveryman.AbstractDeliverymanRequestable
All Implemented Interfaces:
IDeliverymanRequestable, IRequestable
Direct Known Subclasses:
Delivery, Pickup

public abstract class AbstractDeliverymanRequestable extends Object implements IDeliverymanRequestable
Abstract class for all deliveryman-requests
  • Field Details

  • Constructor Details

    • AbstractDeliverymanRequestable

      protected AbstractDeliverymanRequestable(int priority)
      Constructor for deliveryman requestables
      Parameters:
      priority - The priority of the request. Higher priority equals earlier delivery/pickup
  • Method Details

    • scaledPriority

      public static int scaledPriority(int priority)
      Scales the priority to the desired internal value. This is used so that the actual priorities are not just 1-10, but i.e. 1-100 (x^2) This will effectively make the aging-algorithm, which always increments by 1, slower. The function can be anything - a linear scaler, quadratic, exponential, whatever. Adapt over time to find the best solution.
    • getMaxBuildingPriority

      public static int getMaxBuildingPriority(boolean returnScaled)
      Gets the maximum priority allowed to be set in the building GUI. This is the "normal" setting available to players.
      Parameters:
      returnScaled - true if the value should be returned scaled
      Returns:
      the scaled/unscaled priority
    • getDefaultDeliveryPriority

      public static int getDefaultDeliveryPriority(boolean returnScaled)
      Gets the priority given to deliveries. This affects follow-up deliveries from crafters, and deliveries from the warehouse.
      Parameters:
      returnScaled - true if the value should be returned scaled
      Returns:
      the scaled/unscaled priority
    • getMaxAgingPriority

      public static int getMaxAgingPriority(boolean returnScaled)
      Gets the maximum priority the aging mechanism can assign. After that, priorities can not naturally increase.
      Parameters:
      returnScaled - true if the value should be returned scaled
      Returns:
      the scaled/unscaled priority
    • getPlayerActionPriority

      public static int getPlayerActionPriority(boolean returnScaled)
      Gets the priority given to the Request-Pickup-Now-feature TODO: Eventually, this should also affect the Postbox.
      Parameters:
      returnScaled - true if the value should be returned scaled
      Returns:
      the scaled/unscaled priority
    • getPriority

      public int getPriority()
      Description copied from interface: IDeliverymanRequestable
      Returns the priority of the Requestable. The higher the priority, the more urgent it is and the faster a deliveryman will handle it.
      Specified by:
      getPriority in interface IDeliverymanRequestable
      Returns:
      The current priority of the request
    • incrementPriorityDueToAging

      public void incrementPriorityDueToAging()
      Description copied from interface: IDeliverymanRequestable
      This will increment the priority due to the aging algorithm. This is important because it prevents starvation, making older requests successively more important.
      Specified by:
      incrementPriorityDueToAging in interface IDeliverymanRequestable
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object