mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-20 10:55:08 +01:00
Clean up entity regions
This commit is contained in:
@@ -15,7 +15,7 @@ public class EntityRegion extends GameEntity {
|
||||
private final Position position;
|
||||
private final Set<Integer> entities; // Ids of entities inside this region
|
||||
private final SceneRegion metaRegion;
|
||||
private boolean hasNewEntities;
|
||||
private boolean entityEnter;
|
||||
private boolean entityLeave;
|
||||
|
||||
public EntityRegion(Scene scene, SceneRegion region) {
|
||||
@@ -35,20 +35,18 @@ public class EntityRegion extends GameEntity {
|
||||
return this.metaRegion.config_id;
|
||||
}
|
||||
|
||||
public void resetNewEntities() {
|
||||
this.entityEnter = false;
|
||||
this.entityLeave = false;
|
||||
}
|
||||
|
||||
public void addEntity(GameEntity entity) {
|
||||
if (this.getEntities().contains(entity.getId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.getEntities().add(entity.getId());
|
||||
this.hasNewEntities = true;
|
||||
}
|
||||
|
||||
public boolean hasNewEntities() {
|
||||
return hasNewEntities;
|
||||
}
|
||||
|
||||
public void resetNewEntities() {
|
||||
hasNewEntities = false;
|
||||
this.entityEnter = true;
|
||||
}
|
||||
|
||||
public void removeEntity(int entityId) {
|
||||
@@ -57,18 +55,17 @@ public class EntityRegion extends GameEntity {
|
||||
}
|
||||
|
||||
public void removeEntity(GameEntity entity) {
|
||||
this.getEntities().remove(entity.getId());
|
||||
this.entityLeave = true;
|
||||
this.removeEntity(entity.getId());
|
||||
}
|
||||
|
||||
public boolean entityLeave() {
|
||||
public boolean entityHasEntered() {
|
||||
return this.entityEnter;
|
||||
}
|
||||
|
||||
public boolean entityHasLeft() {
|
||||
return this.entityLeave;
|
||||
}
|
||||
|
||||
public void resetEntityLeave() {
|
||||
this.entityLeave = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Int2FloatMap getFightProperties() {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user