Interface ColonyContext.View

Enclosing interface:
ColonyContext

public static interface ColonyContext.View
Read-only bounded colony access tied to its creating callback and thread. Every query rejects an expired scope or a different thread. Returned records and lists are detached values that may be retained; this view object itself cannot be used after the callback.
  • Method Details

    • day

      int day()
      Returns monotonic game calendar day, starting at one.
      Returns:
      monotonic game calendar day, starting at one
      Throws:
      IllegalStateException - outside the owning callback or thread
    • daysPerYear

      int daysPerYear()
      Returns days in the game's year.
      Returns:
      days in the game's year
      Throws:
      IllegalStateException - outside the owning callback or thread
    • daysPerSeason

      int daysPerSeason()
      Returns days in one season, the default month used by simulation mods.
      Returns:
      days in one season, the default month used by simulation mods
      Throws:
      IllegalStateException - outside the owning callback or thread
    • citizens

      Returns the captured roster, including any dead or deserting citizens still in the manager.
      Returns:
      immutable captured roster in stable identity order
      Throws:
      IllegalStateException - outside the owning callback or thread
    • citizen

      ColonyContext.Person citizen(int id)
      Looks up a citizen by stable identity.
      Parameters:
      id - citizen identity
      Returns:
      snapshot, or null when absent
      Throws:
      IllegalStateException - outside the owning callback or thread
    • homes

      Returns the captured catalog of supported residential zones.
      Returns:
      immutable home catalog in stable identity order
      Throws:
      IllegalStateException - outside the owning callback or thread
    • home

      ColonyContext.Home home(long id)
      Looks up a home by stable identity.
      Parameters:
      id - home identity
      Returns:
      home snapshot, or null when absent
      Throws:
      IllegalStateException - outside the owning callback or thread
    • homeOf

      ColonyContext.Home homeOf(int citizenId)
      Resolves a citizen's assigned home.
      Parameters:
      citizenId - citizen identity
      Returns:
      assigned home, or null when absent
      Throws:
      IllegalStateException - outside the owning callback or thread
    • nearby

      List<ColonyContext.Person> nearby(ColonyContext.Position position, int radius)
      Queries the shared spatial index using Chebyshev distance on the same level.
      Parameters:
      position - query origin within the world's tile-coordinate range, or null for no matches
      radius - tile radius between zero and 32
      Returns:
      immutable nearby living citizen snapshots in stable ID order
      Throws:
      IllegalArgumentException - if radius is outside its bounds
      IllegalStateException - outside the owning callback or thread