1package com.osroyale.game.world.object;
3import com.osroyale.game.world.World;
4import com.osroyale.game.world.entity.mob.player.Player;
5import com.osroyale.game.world.pathfinding.TraversalMap;
6import com.osroyale.game.world.position.Position;
7import com.osroyale.game.world.region.Region;
8import com.osroyale.net.packet.out.SendAddObject;
9import com.osroyale.net.packet.out.SendRemoveObject;
10import com.osroyale.util.Utility;
11import com.osroyale.util.generic.GenericAttributes;
13import java.util.Objects;
15import static com.osroyale.game.world.object.ObjectDirection.*;
78 this.definition = definition;
79 this.position = position;
81 this.direction = direction;
86 if (genericAttributes ==
null) {
89 return genericAttributes;
104 if (direction == NORTH || direction == SOUTH) {
105 return definition.getLength();
107 return definition.getWidth();
112 if (direction == NORTH || direction == SOUTH) {
113 return definition.getWidth();
115 return definition.getLength();
119 public int distance() {
120 return definition.getDistance();
140 if (other.instance != getInstancedHeight())
142 if (
Utility.withinViewingDistance(
this, other,
Region.VIEW_DISTANCE)) {
157 if (other.instance != getInstancedHeight())
159 if (
Utility.withinViewingDistance(
this, other,
Region.VIEW_DISTANCE)) {
168 public void transform(
int id) {
175 public void rotate(ObjectDirection direction) {
177 this.direction = direction;
187 public int hashCode() {
188 return Objects.hash(definition.
getId(), position);
192 public boolean equals(Object obj) {
193 if (obj ==
this)
return true;
196 return definition == other.definition && position.equals(other.position);
202 public String toString() {
203 return String.format(
"StaticGameObject[id=%s, loc=%s, width=%s, len=%s, rot=%s, type=%s]",
getId(),
getPosition(),
width(),
length(),
getDirection(),
getObjectType());
static GameObjectDefinition forId(int id)
GameObjectDefinition getDefinition()
ObjectDirection getDirection()
ObjectType getObjectType()
GenericAttributes getGenericAttributes()
StaticGameObject(GameObjectDefinition definition, Position position, ObjectType type, ObjectDirection direction)
static void markObject(Region region, GameObject object, boolean add, boolean list)
boolean containsObject(int height, GameObject object)
Region[] getSurroundingRegions(Position position)