Fix fuse calculation and maybe exposure
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
35c37b9c06
Commit
4d26ba5166
@ -22,7 +22,9 @@ package de.steamwar.bausystem.features.simulator.preview;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.data.Waterlogged;
|
import org.bukkit.block.data.Waterlogged;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.HashSet;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class Explosion19 {
|
public class Explosion19 {
|
||||||
|
|
||||||
@ -141,7 +143,7 @@ public class Explosion19 {
|
|||||||
y /= aa;
|
y /= aa;
|
||||||
z /= aa;
|
z /= aa;
|
||||||
|
|
||||||
double ab = getExposure(simulatorData, this.x, this.y, this.z);
|
double ab = getExposure(simulatorData, currentTNT.getX(), currentTNT.getY(), currentTNT.getZ());
|
||||||
double ac = (1.0 - w) * ab;
|
double ac = (1.0 - w) * ab;
|
||||||
currentTNT.setVx(currentTNT.getVx() + x * ac);
|
currentTNT.setVx(currentTNT.getVx() + x * ac);
|
||||||
currentTNT.setVy(currentTNT.getVy() + y * ac);
|
currentTNT.setVy(currentTNT.getVy() + y * ac);
|
||||||
@ -160,18 +162,18 @@ public class Explosion19 {
|
|||||||
private static final double EXPOSURE_CONSTANT_1 = 1.0 / (SIZE * 2 + 1.0);
|
private static final double EXPOSURE_CONSTANT_1 = 1.0 / (SIZE * 2 + 1.0);
|
||||||
private static final double EXPOSURE_CONSTANT_2 = (1.0 - Math.floor(1.0 / EXPOSURE_CONSTANT_1) * EXPOSURE_CONSTANT_1) / 2.0;
|
private static final double EXPOSURE_CONSTANT_2 = (1.0 - Math.floor(1.0 / EXPOSURE_CONSTANT_1) * EXPOSURE_CONSTANT_1) / 2.0;
|
||||||
|
|
||||||
private static float getExposure(SimulatorData19 simulatorData, double x, double y, double z) {
|
private float getExposure(SimulatorData19 simulatorData, double x, double y, double z) {
|
||||||
float blockMisses = 0;
|
float blockMisses = 0;
|
||||||
float blockTotal = 0;
|
float blockTotal = 0;
|
||||||
|
|
||||||
for (double k = 0.0; k <= 1.0; k += EXPOSURE_CONSTANT_1) {
|
for (double k = 0.0; k <= 1.0; k += EXPOSURE_CONSTANT_1) {
|
||||||
for (double l = 0.0; l <= 1.0; l += EXPOSURE_CONSTANT_1) {
|
for (double l = 0.0; l <= 1.0; l += EXPOSURE_CONSTANT_1) {
|
||||||
for (double m = 0.0; m <= 1.0; m += EXPOSURE_CONSTANT_1) {
|
for (double m = 0.0; m <= 1.0; m += EXPOSURE_CONSTANT_1) {
|
||||||
double dx = lerp(k, MIN_POINT, MAX_POINT) + EXPOSURE_CONSTANT_2;
|
double dx = lerp(k, MIN_POINT, MAX_POINT) + EXPOSURE_CONSTANT_2 + x;
|
||||||
double dy = lerp(l, 0.0, SIZE);
|
double dy = lerp(l, 0.0, SIZE) + y;
|
||||||
double dz = lerp(m, MIN_POINT, MAX_POINT) + EXPOSURE_CONSTANT_2;
|
double dz = lerp(m, MIN_POINT, MAX_POINT) + EXPOSURE_CONSTANT_2 + z;
|
||||||
|
|
||||||
if (rayTrace(simulatorData, x, y, z, dx, dy, dz)) {
|
if (rayTrace(simulatorData, dx, dy, dz, this.x, this.y, this.z)) {
|
||||||
blockMisses++;
|
blockMisses++;
|
||||||
}
|
}
|
||||||
blockTotal++;
|
blockTotal++;
|
||||||
|
@ -79,8 +79,13 @@ public class TNT19 {
|
|||||||
this.vy *= 0.98;
|
this.vy *= 0.98;
|
||||||
this.vz *= 0.98;
|
this.vz *= 0.98;
|
||||||
|
|
||||||
this.fuse--;
|
if (onGround) {
|
||||||
if (this.fuse <= 0) {
|
this.vx *= 0.7;
|
||||||
|
this.vy *= -0.5;
|
||||||
|
this.vz *= 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.fuse-- <= 0) {
|
||||||
Explosion19 explosion = new Explosion19(this, x, y + 0.98 * 0.0625, z);
|
Explosion19 explosion = new Explosion19(this, x, y + 0.98 * 0.0625, z);
|
||||||
explosion.calculate(simulatorData);
|
explosion.calculate(simulatorData);
|
||||||
return true;
|
return true;
|
||||||
@ -103,7 +108,7 @@ public class TNT19 {
|
|||||||
// System.out.println(movement + " " + vec3d);
|
// System.out.println(movement + " " + vec3d);
|
||||||
double lengthSquared = vec3d.lengthSquared();
|
double lengthSquared = vec3d.lengthSquared();
|
||||||
if (lengthSquared > 1.0E-7) {
|
if (lengthSquared > 1.0E-7) {
|
||||||
if (fallDistance != 0.0F) {
|
if (fallDistance != 0.0F && lengthSquared >= 1.0) {
|
||||||
// TODO: This could be wrong
|
// TODO: This could be wrong
|
||||||
MovingObjectPosition movingObjectPosition = ((CraftWorld) Simulator19.WORLD).getHandle().a(new RayTrace(new Vec3D(x, y, z), new Vec3D(x + vec3d.getX(), y + vec3d.getY(), z + vec3d.getZ()), RayTrace.BlockCollisionOption.d, RayTrace.FluidCollisionOption.d, null));
|
MovingObjectPosition movingObjectPosition = ((CraftWorld) Simulator19.WORLD).getHandle().a(new RayTrace(new Vec3D(x, y, z), new Vec3D(x + vec3d.getX(), y + vec3d.getY(), z + vec3d.getZ()), RayTrace.BlockCollisionOption.d, RayTrace.FluidCollisionOption.d, null));
|
||||||
if (movingObjectPosition.c() != MovingObjectPosition.EnumMovingObjectType.a) {
|
if (movingObjectPosition.c() != MovingObjectPosition.EnumMovingObjectType.a) {
|
||||||
@ -205,6 +210,9 @@ public class TNT19 {
|
|||||||
|
|
||||||
private void fall(double heightDifference, boolean onGround) {
|
private void fall(double heightDifference, boolean onGround) {
|
||||||
if (onGround) {
|
if (onGround) {
|
||||||
|
if (fallDistance > 0.0F) {
|
||||||
|
// TODO: onLandedUpon
|
||||||
|
}
|
||||||
this.onLanding();
|
this.onLanding();
|
||||||
} else if (heightDifference < 0.0) {
|
} else if (heightDifference < 0.0) {
|
||||||
this.fallDistance -= (float)heightDifference;
|
this.fallDistance -= (float)heightDifference;
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren