Plants without occupied spaces no longer crash server
This commit is contained in:
parent
c2cb8dd208
commit
934e8f8479
@ -148,22 +148,26 @@ class PlantPieceEntity() : DynamicEntity() {
|
||||
piecesInternal.add(Piece(piece))
|
||||
}
|
||||
|
||||
calculatedMetaBoundingBox = AABB.ofPoints(allSpaces)
|
||||
if (allSpaces.isNotEmpty()) {
|
||||
calculatedMetaBoundingBox = AABB.ofPoints(allSpaces)
|
||||
|
||||
if (pieces.any { it.isStructuralSegment } && stemSpaces.isNotEmpty()) {
|
||||
calculatedCollisionBox = AABB.ofPoints(stemSpaces)
|
||||
if (pieces.any { it.isStructuralSegment } && stemSpaces.isNotEmpty()) {
|
||||
calculatedCollisionBox = AABB.ofPoints(stemSpaces)
|
||||
|
||||
if (stemSpaces.size >= 2) {
|
||||
calculatedCollisionHull = Poly.quickhull(stemSpaces.map { it.toDoubleVector() })
|
||||
if (stemSpaces.size >= 2) {
|
||||
calculatedCollisionHull = Poly.quickhull(stemSpaces.map { it.toDoubleVector() })
|
||||
} else {
|
||||
calculatedCollisionHull = Poly(calculatedCollisionBox)
|
||||
}
|
||||
} else {
|
||||
calculatedCollisionHull = Poly(calculatedCollisionBox)
|
||||
calculatedCollisionBox = calculatedMetaBoundingBox
|
||||
calculatedCollisionHull = Poly(calculatedMetaBoundingBox)
|
||||
}
|
||||
} else {
|
||||
calculatedMetaBoundingBox = AABB.rectangle(Vector2d.ZERO, 0.1, 0.1)
|
||||
calculatedCollisionBox = calculatedMetaBoundingBox
|
||||
calculatedCollisionHull = Poly(calculatedMetaBoundingBox)
|
||||
}
|
||||
|
||||
//calculatedCollisionHull = calculatedCollisionHull * 0.5 + calculatedCollisionHull.aabb.centre * 0.5
|
||||
}
|
||||
|
||||
constructor(stream: DataInputStream, isLegacy: Boolean) : this() {
|
||||
|
Loading…
Reference in New Issue
Block a user