mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2026-05-20 03:29:55 +08:00
Fix region removal checking
This commit is contained in:
@@ -2,9 +2,10 @@ package emu.grasscutter.scripts.data;
|
||||
|
||||
import emu.grasscutter.scripts.constants.ScriptRegionShape;
|
||||
import emu.grasscutter.utils.Position;
|
||||
import java.util.List;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Setter
|
||||
public class SceneRegion {
|
||||
public int config_id;
|
||||
@@ -20,6 +21,13 @@ public class SceneRegion {
|
||||
|
||||
public transient SceneGroup group;
|
||||
|
||||
/**
|
||||
* @return The group ID for this region.
|
||||
*/
|
||||
public int getGroupId() {
|
||||
return this.group == null ? -1 : this.group.id;
|
||||
}
|
||||
|
||||
public boolean contains(Position position) {
|
||||
switch (shape) {
|
||||
case ScriptRegionShape.CUBIC:
|
||||
@@ -35,4 +43,21 @@ public class SceneRegion {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if two regions are the same.
|
||||
*
|
||||
* @param region The region to compare to.
|
||||
* @return True if the regions are the same, false otherwise.
|
||||
*/
|
||||
public boolean equals(SceneRegion region) {
|
||||
return this.config_id == region.config_id
|
||||
&& this.shape == region.shape
|
||||
&& this.pos.equals(region.pos)
|
||||
&& this.size.equals(region.size)
|
||||
&& this.radius == region.radius
|
||||
&& this.area_id == region.area_id
|
||||
&& this.height == region.height
|
||||
&& this.point_array.equals(region.point_array);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user