Browse Source

shape

hull4
FatBoy-DOTC 1 year ago
parent
commit
7fe5f8b5ac
  1. 5
      src/engine/devcmd/cmds/RegionCmd.java
  2. 15
      src/engine/gameManager/BuildingManager.java
  3. 3
      src/engine/objects/Building.java

5
src/engine/devcmd/cmds/RegionCmd.java

@ -19,6 +19,7 @@ import engine.objects.*; @@ -19,6 +19,7 @@ import engine.objects.*;
import java.awt.*;
import java.awt.geom.Area;
import java.awt.geom.Path2D;
import java.lang.reflect.Field;
public class RegionCmd extends AbstractDevCmd {
@ -64,9 +65,9 @@ public class RegionCmd extends AbstractDevCmd { @@ -64,9 +65,9 @@ public class RegionCmd extends AbstractDevCmd {
//}
if( building != null){
boolean pointBlocked = false;
for(Area area : building.meshes){
for(Path2D.Float area : building.meshes){
Vector3fImmutable pos = ((AbstractCharacter)target).loc;
if(area.contains(new Point((int) pos.x, (int) pos.z))){
if(area.contains(pos.x, pos.z)){
pointBlocked = true;
}
}

15
src/engine/gameManager/BuildingManager.java

@ -984,16 +984,17 @@ public enum BuildingManager { @@ -984,16 +984,17 @@ public enum BuildingManager {
return;
}
if(building.meshUUID == 24000){
int i = 0;
}
for (ArrayList<Vector2f> meshEntry : convexHullList) {
Polygon poly = new Polygon();
Path2D.Float meshBound = new Path2D.Float();
Vector3fImmutable start = Vector3fImmutable.rotateAroundPoint(new Vector3fImmutable(meshEntry.get(0).x,building.loc.y,meshEntry.get(0).y),building.loc,building.getRot().getRotation());
meshBound.moveTo(start.x,start.z);
for (Vector2f vect : meshEntry) {
Vector3fImmutable rotationPoint = Vector3fImmutable.rotateAroundPoint(new Vector3fImmutable(vect.x + building.loc.x, 0, vect.y + building.loc.z), building.loc, building.getRot().getRotation());
poly.addPoint((int) rotationPoint.x, (int) rotationPoint.z);
Vector3fImmutable pos = Vector3fImmutable.rotateAroundPoint(new Vector3fImmutable(vect.x,building.loc.y,vect.y),building.loc,building.getRot().getRotation());
meshBound.lineTo(pos.x,pos.z);
}
building.meshes.add(new Area(poly));
meshBound.lineTo(start.x,start.z);
meshBound.closePath();
building.meshes.add(meshBound);
}
}
}

3
src/engine/objects/Building.java

@ -35,6 +35,7 @@ import engine.server.MBServerStatics; @@ -35,6 +35,7 @@ import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;
import java.awt.geom.Area;
import java.awt.geom.Path2D;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;
@ -100,7 +101,7 @@ public class Building extends AbstractWorldObject { @@ -100,7 +101,7 @@ public class Building extends AbstractWorldObject {
private ConcurrentHashMap<Integer, Condemned> condemned;
private ArrayList<Building> children = null;
public ArrayList<Area> meshes;
public ArrayList<Path2D.Float> meshes;
/**
* ResultSet Constructor

Loading…
Cancel
Save