Interface GameObject<G extends GameObject<G,​A,​R>,​A extends MapArchObject<A>,​R extends Archetype<G,​A,​R>>

    • Field Detail

      • EDITOR_FOLDER_INTERN

        static final java.lang.String EDITOR_FOLDER_INTERN
        The editor folder name for server-internal archetypes. These archetypes are not available to users.
        See Also:
        Constant Field Values
    • Method Detail

      • removeAll

        void removeAll()
        Removes all GameObjects from this container.
        Fixme:
        this implementation does not take care of multi square objects.
      • addLast

        void addLast​(@NotNull
                     G gameObject)
        Add the given GameObject at the end of this Container.
        Parameters:
        gameObject - the free yet unlinked GameObject to be placed in the inventory
        Throws:
        java.lang.IllegalArgumentException - if gameObject already is inside another container
      • getLast

        @Nullable
        G getLast()
        Return the last GameObject contained in this container.
        Returns:
        first GameObject contained or null if isEmpty() returns true
      • addFirst

        void addFirst​(@NotNull
                      G gameObject)
        Add the given GameObject at the beginning of this Container.
        Parameters:
        gameObject - the free yet unlinked GameObject to be placed in the inventory
        Throws:
        java.lang.IllegalArgumentException - if gameObject already is inside another container
      • getFirst

        @Nullable
        G getFirst()
        Return the first GameObject contained in this container.
        Returns:
        first GameObject contained or null if isEmpty() returns true
      • propagateElevation

        void propagateElevation​(@NotNull
                                @NotNull BaseObject<?,​?,​?,​?> gameObject)
        If there is elevation data in the other game object, move it to here.
        Parameters:
        gameObject - the other game object
      • updateTileStretch

        void updateTileStretch​(int heightValue,
                               boolean isAbsolute,
                               @Nullable
                               @Nullable java.lang.Integer[] subLayers)
        Updates the tile stretching value of the selected object.
        Parameters:
        heightValue - height value
        isAbsolute - whether the height change value is absolute or relative
        subLayers - sub-layers to affect or null to affect all layers
      • applyMassChange

        void applyMassChange​(@NotNull
                             @NotNull java.lang.Integer[] layers,
                             @NotNull
                             @NotNull java.lang.Integer[] subLayers,
                             @NotNull
                             @NotNull java.lang.String changes)
        Applies mass changes to the specified object if all the match conditions are met.
        Parameters:
        layers - layers to match, can be empty
        subLayers - sub-layers to match, can be empty
        changes - changes to apply
      • iterator

        @NotNull
        @NotNull java.util.Iterator<G> iterator()
        The Iterator returned does not recurse, it only contains objects on the first level. The Iterator returned is transparent, that means modifying the iterator's collection actually modifies the underlying GameObjectContainer.
        Specified by:
        iterator in interface java.lang.Iterable<G extends GameObject<G,​A,​R>>
      • reverse

        @NotNull
        @NotNull java.lang.Iterable<G> reverse()
        Return an object that is the reverse representation. Invoke this method if you want to iterate over the contained GameObjects in reverse order.
        Returns:
        reverse representation
      • recursive

        @NotNull
        @NotNull java.lang.Iterable<G> recursive()
        Return an object that is a recursive representation. Invoke this method if you want to iterate over the contained GameObjects recursively.
        Returns:
        recursive representation
      • isScripted

        boolean isScripted()
        Returns whether this GameObject has one or more scripted events defined.
        Returns:
        true if this GameObject has one or more scripted events, otherwise false
      • isEmpty

        boolean isEmpty()
        Check whether this square is empty.
        Returns:
        true if this square is empty, otherwise false
      • remove

        void remove()
        Remove this GameObject from its container. Does nothing if the object has no container. This method also takes perfectly well care of multi-part GameObjects.
      • getContainer

        @Nullable
        @Nullable GameObjectContainer<G,​A,​R> getContainer()
        Returns container of this GameObject. There are two possibilities for the container:
        • Another GameObject, which means this object is in the inventory of that GameObject.
        • A MapSquare, which means that this GameObject is top level on that MapSquare (Crossfire returns null for this).
        Returns:
        the container of this game object
        See Also:
        getTopContainer()
      • isTop

        boolean isTop()
        Returns whether this game object is the top-most one. Returns true if it has no container.
        Returns:
        whether this game object is the top-most one
      • isBottom

        boolean isBottom()
        Returns whether this game object is the bottom-most one. Returns true if it has no container.
        Returns:
        whether this game object is the bottom-most one
      • moveTop

        void moveTop()
        Move this GameObject top. Does nothing if the object has no container.
      • moveUp

        void moveUp()
        Move this GameObject up. Does nothing if the object has no container.
      • moveDown

        void moveDown()
        Move this GameObject down. Does nothing if the object has no container.
      • moveBottom

        void moveBottom()
        Move this GameObject bottom. Does nothing if the object has no container.
      • insertBefore

        void insertBefore​(@NotNull
                          G node)
        Insert a GameObject before this GameObject.
        Parameters:
        node - GameObject to append
      • insertAfter

        void insertAfter​(@NotNull
                         G node)
        Insert a GameObject after this GameObject.
        Parameters:
        node - GameObject to append
      • getContainerGameObject

        @Nullable
        G getContainerGameObject()
        Returns the environment game object if this game object is in the inventory or null.
        Returns:
        the game object this game object is part of or null
      • getTopContainer

        @NotNull
        G getTopContainer()
        Get the topmost container of this GameObject (in Game sense, which means being in a MapSquare isn't, but being in an GameObject is).
        Returns:
        the topmost container but always GameObject, never a map square; if this object is topmost itself, it returns itself
        See Also:
        getContainer()
      • setContainer

        void setContainer​(@Nullable
                          @Nullable GameObjectContainer<G,​A,​R> container,
                          int mapX,
                          int mapY)
        Sets container of this GameObject. There are two possibilities for the container:
        • Another GameObject, which means this object is in the inventory of that GameObject.
        • A MapSquare, which means that this GameObject is top level on that MapSquare.
        Parameters:
        container - the container of this game object
        mapX - the x coordinate on the map or 0
        mapY - the y coordinate on the map or 0
        Throws:
        java.lang.IllegalStateException - in case this GameObject is an Archetype (Archetypes must not be added to a map).
      • isInContainer

        boolean isInContainer()
        Check whether this GameObject is in a Container (in Gridarta sense, which means being in a MapSquare isn't, but being in an GameObject is).
        Returns:
        true if this GameObject has a Container and the Container is an GameObject, otherwise (no Container or Container is not an GameObject) false
      • getMapSquare

        @Nullable
        @Nullable MapSquare<G,​A,​R> getMapSquare()
        Get the MapSquare of this GameObjectContainer.
        Returns:
        the map square of this container or null if this GameObjectContainer is not (yet?) connected to a map (a MapSquare would return itself)
      • getPrev

        @Nullable
        G getPrev()
        Returns the game object preceding this game object.
        Returns:
        the successor game object or null if no preceding game object exists.
      • getNext

        @Nullable
        G getNext()
        Returns the game object succeeding this game object.
        Returns:
        the preceding game object or null if no successor game object exists.
      • setArchetype

        void setArchetype​(@NotNull
                          R archetype)
        Set the Archetype of this GameObject.
        Parameters:
        archetype - new Archetype of this GameObject.
        See Also:
        BaseObject.getArchetype()
      • hasUndefinedArchetype

        boolean hasUndefinedArchetype()
        Return whether this instance references an undefined archetype.
        Returns:
        true if this instance references an undefined archetype
      • markModified

        void markModified()
        Marks this game object as "modified".
      • getLightRadius

        int getLightRadius()
        Returns the effective light radius of this game object.
        Returns:
        the effective light radius or 0 if this object does not emit light