20 package net.sf.gridarta.action;
22 import java.awt.Point;
30 import net.
sf.japi.swing.action.ActionMethod;
31 import org.jetbrains.annotations.NotNull;
32 import org.jetbrains.annotations.Nullable;
53 super(selectedSquareModel, mapManager);
66 protected boolean doAction(
final boolean performAction, @Nullable
final G gameObject) {
67 if (gameObject == null || !gameObject.isHead()) {
71 final G envGameObject = gameObject.getContainerGameObject();
72 if (envGameObject == null) {
77 if (mapSquare == null) {
83 if (!envGameObject.isInContainer() && gameObject.getArchetype().isMulti() && !mapModel.
isMultiArchFittingToMap(gameObject.getArchetype(), pos,
true)) {
90 mapModel.
moveEnv(gameObject, pos, envGameObject);
boolean isMultiArchFittingToMap(@NotNull Archetype< G, A, R > archetype, @NotNull Point pos, boolean allowDouble)
Checks whether an GameObject (multi-arch) would still fit on this map.
A MapModel reflects the data of a map.
A MapManager manages all opened maps.
Graphical User Interface of Gridarta.
MapModel< G, A, R > getMapModel()
Returns the MapModel this map square is part of.
void endTransaction()
End a transaction.
MapSquare< G, A, R > getSelectedMapSquare()
Returns the currently selected map square.
final SelectedSquareModel< G, A, R > selectedSquareModel
The SelectedSquareModel that is updated.
Base package of all Gridarta classes.
MapModel< G, A, R > mapModel
The currently active MapModel.
Abstract base class for actions that move the selected game object in the SelectedSquareModel.
void moveSquareEnv()
Action method that moves the selected game object to its environment.
Reflects a game object (object on a map).
GameObjects are the objects based on Archetypes found on maps.
Point getMapLocation()
Returns the coordinate on the map.
Displays the contents of the currently selected map square.
void moveEnv(@NotNull G gameObject, @NotNull Point pos, @NotNull G nextGameObject)
Moves a GameObject to its environment.
boolean doAction(final boolean performAction, @Nullable final G gameObject)
An net.sf.gridarta.utils.EditorAction that moves the selected game object in the SelectedSquareModel ...
void beginTransaction(@NotNull String name)
Starts a new transaction.
The model component of the selected square control.
Interface for MapArchObjects.
MoveSquareEnvAction(@NotNull final SelectedSquareModel< G, A, R > selectedSquareModel, @Nullable final MapManager< G, A, R > mapManager)
Creates a new instance.