Gridarta Editor
GameObject.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2023 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.model.gameobject;
21 
22 import java.util.Iterator;
28 import org.jetbrains.annotations.NotNull;
29 import org.jetbrains.annotations.Nullable;
30 
36 public interface GameObject<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends BaseObject<G, A, R, G> {
37 
42  String EDITOR_FOLDER_INTERN = "intern";
43 
48  void removeAll();
49 
57  void addLast(@NotNull G gameObject);
58 
64  @Nullable
65  G getLast();
66 
74  void addFirst(@NotNull G gameObject);
75 
81  @Nullable
82  G getFirst();
83 
88  void propagateElevation(@NotNull BaseObject<?, ?, ?, ?> gameObject);
89 
98  void updateTileStretch(int heightValue, boolean isAbsolute, @NotNull Integer @Nullable [] subLayers);
99 
107  void applyMassChange(@NotNull Integer @NotNull [] layers, @NotNull Integer @NotNull [] subLayers, @NotNull String changes);
108 
115  @NotNull
116  @Override
117  Iterator<G> iterator();
118 
124  @NotNull
125  Iterable<G> reverse();
126 
132  @NotNull
133  Iterable<G> recursive();
134 
140  boolean isScripted();
141 
146  boolean isEmpty();
147 
153  void remove();
154 
167  @Nullable
169 
175  boolean isTop();
176 
182  boolean isBottom();
183 
187  void moveTop();
188 
192  void moveUp();
193 
197  void moveDown();
198 
203  void moveBottom();
204 
209  void insertBefore(@NotNull G node);
210 
215  void insertAfter(@NotNull G node);
216 
222  @Nullable
224 
232  @NotNull
233  G getTopContainer();
234 
250  void setContainer(@Nullable GameObjectContainer<G, A, R> container, int mapX, int mapY);
251 
259  boolean isInContainer();
260 
266  @NotNull
268 
274  @Nullable
276 
282  @Nullable
283  G getPrev();
284 
290  @Nullable
291  G getNext();
292 
298  void setArchetype(@NotNull R archetype);
299 
304  boolean hasUndefinedArchetype();
305 
309  void markModified();
310 
316  int getLightRadius();
317 
318 }
net.sf.gridarta.model.gameobject.GameObject.moveTop
void moveTop()
Move this GameObject top.
net.sf.gridarta.model.gameobject.GameObject.updateTileStretch
void updateTileStretch(int heightValue, boolean isAbsolute, @NotNull Integer @Nullable[] subLayers)
Updates the tile stretching value of the selected object.
net.sf.gridarta
Base package of all Gridarta classes.
net.sf.gridarta.model.mapmodel.MapSquare
A single Map Square.
Definition: MapSquare.java:45
net.sf.gridarta.model.gameobject.GameObject.isInContainer
boolean isInContainer()
Check whether this GameObject is in a Container (in Gridarta sense, which means being in a MapSquare ...
net.sf
net.sf.gridarta.model.mapmodel
Definition: AboveFloorInsertionMode.java:20
net.sf.gridarta.model.gameobject.GameObject.moveBottom
void moveBottom()
Move this GameObject bottom.
net.sf.gridarta.model.gameobject.GameObject.getLightRadius
int getLightRadius()
Returns the effective light radius of this game object.
net.sf.gridarta.model.gameobject.GameObject.iterator
Iterator< G > iterator()
The Iterator returned does not recurse, it only contains objects on the first level.
net.sf.gridarta.model.gameobject.GameObject.moveUp
void moveUp()
Move this GameObject up.
net.sf.gridarta.model.archetype
Definition: AbstractArchetype.java:20
net.sf.gridarta.model.gameobject.GameObject
Reflects a game object (object on a map).
Definition: GameObject.java:36
net.sf.gridarta.model.gameobject.GameObject.isScripted
boolean isScripted()
Returns whether this GameObject has one or more scripted events defined.
net.sf.gridarta.model.gameobject.GameObject.getFirst
G getFirst()
Return the first GameObject contained in this container.
net.sf.gridarta.model.gameobject.GameObject.propagateElevation
void propagateElevation(@NotNull BaseObject<?, ?, ?, ?> gameObject)
If there is elevation data in the other game object, move it to here.
net
net.sf.gridarta.model.gameobject.GameObject.addFirst
void addFirst(@NotNull G gameObject)
Add the given GameObject at the beginning of this Container.
net.sf.gridarta.model.maparchobject.MapArchObject
Interface for MapArchObjects.
Definition: MapArchObject.java:40
net.sf.gridarta.model.gameobject.GameObject.hasUndefinedArchetype
boolean hasUndefinedArchetype()
Return whether this instance references an undefined archetype.
net.sf.gridarta.model.gameobject.GameObject.isTop
boolean isTop()
Returns whether this game object is the top-most one.
net.sf.gridarta.model.gameobject.GameObject.isBottom
boolean isBottom()
Returns whether this game object is the bottom-most one.
net.sf.gridarta.model.baseobject.BaseObject
Definition: BaseObject.java:34
net.sf.gridarta.model.gameobject.GameObject.getLast
G getLast()
Return the last GameObject contained in this container.
net.sf.gridarta.model.gameobject.GameObject.EDITOR_FOLDER_INTERN
String EDITOR_FOLDER_INTERN
The editor folder name for server-internal archetypes.
Definition: GameObject.java:42
net.sf.gridarta.model.gameobject.GameObject.markModified
void markModified()
Marks this game object as "modified".
net.sf.gridarta.model.gameobject.GameObject.getMapSquareOptional
MapSquare< G, A, R > getMapSquareOptional()
Returns the MapSquare this game object is part of.
net.sf.gridarta.model.gameobject.GameObject.addLast
void addLast(@NotNull G gameObject)
Add the given GameObject at the end of this Container.
net.sf.gridarta.model.gameobject.GameObject.getTopContainer
G getTopContainer()
Get the topmost container of this GameObject (in Game sense, which means being in a MapSquare isn't,...
net.sf.gridarta.model
net.sf.gridarta.model.archetype.Archetype
Reflects an Archetype.
Definition: Archetype.java:41
net.sf.gridarta.model.baseobject
Definition: AbstractBaseObject.java:20
net.sf.gridarta.model.gameobject.GameObject.applyMassChange
void applyMassChange(@NotNull Integer @NotNull[] layers, @NotNull Integer @NotNull[] subLayers, @NotNull String changes)
Applies mass changes to the specified object if all the match conditions are met.
net.sf.gridarta.model.gameobject.GameObject.isEmpty
boolean isEmpty()
Check whether this square is empty.
net.sf.gridarta.model.gameobject.GameObject.getMapSquare
MapSquare< G, A, R > getMapSquare()
Returns the MapSquare this game object is part of.
net.sf.gridarta.model.maparchobject
Definition: AbstractMapArchObject.java:20
net.sf.gridarta.model.gameobject.GameObject.setContainer
void setContainer(@Nullable GameObjectContainer< G, A, R > container, int mapX, int mapY)
Sets container of this GameObject.
net.sf.gridarta.model.gameobject.GameObject.recursive
Iterable< G > recursive()
Return an object that is a recursive representation.
net.sf.gridarta.model.gameobject.GameObject.getNext
G getNext()
Returns the game object succeeding this game object.
net.sf.gridarta.model.baseobject.GameObjectContainer
Base class for classes that contain GameObjects as children in the sense of containment.
Definition: GameObjectContainer.java:50
net.sf.gridarta.model.gameobject.GameObject.removeAll
void removeAll()
Removes all GameObjects from this container.
net.sf.gridarta.model.gameobject.GameObject.moveDown
void moveDown()
Move this GameObject down.
net.sf.gridarta.model.gameobject.GameObject.getPrev
G getPrev()
Returns the game object preceding this game object.
net.sf.gridarta.model.gameobject.GameObject.insertAfter
void insertAfter(@NotNull G node)
Insert a GameObject after this GameObject.
net.sf.gridarta.model.gameobject.GameObject.setArchetype
void setArchetype(@NotNull R archetype)
Set the Archetype of this GameObject.
net.sf.gridarta.model.gameobject.GameObject.insertBefore
void insertBefore(@NotNull G node)
Insert a GameObject before this GameObject.
net.sf.gridarta.model.gameobject.GameObject.reverse
Iterable< G > reverse()
Return an object that is the reverse representation.
net.sf.gridarta.model.gameobject.GameObject.getContainerGameObject
G getContainerGameObject()
Returns the environment game object if this game object is in the inventory or.
net.sf.gridarta.model.gameobject.GameObject.getContainer
GameObjectContainer< G, A, R > getContainer()
Returns container of this GameObject.