调整部件受损方式,添加轮子/履带受损
This commit is contained in:
parent
fae9ddcb1c
commit
02a396a6e4
10 changed files with 217 additions and 56 deletions
|
@ -48,7 +48,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||||
import static com.atsuishio.superbwarfare.client.RenderHelper.preciseBlit;
|
import static com.atsuishio.superbwarfare.client.RenderHelper.preciseBlit;
|
||||||
import static com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay.*;
|
import static com.atsuishio.superbwarfare.client.overlay.CrossHairOverlay.*;
|
||||||
import static com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity.DECOY_COUNT;
|
import static com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity.DECOY_COUNT;
|
||||||
import static com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity.TURRET_DAMAGED_TIME;
|
import static com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity.*;
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class VehicleHudOverlay implements LayeredDraw.Layer {
|
public class VehicleHudOverlay implements LayeredDraw.Layer {
|
||||||
|
@ -207,10 +207,20 @@ public class VehicleHudOverlay implements LayeredDraw.Layer {
|
||||||
}
|
}
|
||||||
//左轮
|
//左轮
|
||||||
ResourceLocation left_wheel;
|
ResourceLocation left_wheel;
|
||||||
|
if (mobileVehicle.getEntityData().get(L_WHEEL_DAMAGED)) {
|
||||||
|
left_wheel = Mod.loc("textures/screens/land/left_wheel_damaged.png");
|
||||||
|
} else {
|
||||||
left_wheel = Mod.loc("textures/screens/land/left_wheel.png");
|
left_wheel = Mod.loc("textures/screens/land/left_wheel.png");
|
||||||
|
}
|
||||||
|
|
||||||
//右轮
|
//右轮
|
||||||
ResourceLocation right_wheel;
|
ResourceLocation right_wheel;
|
||||||
|
if (mobileVehicle.getEntityData().get(R_WHEEL_DAMAGED)) {
|
||||||
|
right_wheel = Mod.loc("textures/screens/land/right_wheel_damaged.png");
|
||||||
|
} else {
|
||||||
right_wheel = Mod.loc("textures/screens/land/right_wheel.png");
|
right_wheel = Mod.loc("textures/screens/land/right_wheel.png");
|
||||||
|
}
|
||||||
|
|
||||||
//引擎
|
//引擎
|
||||||
ResourceLocation engine;
|
ResourceLocation engine;
|
||||||
engine = Mod.loc("textures/screens/land/engine.png");
|
engine = Mod.loc("textures/screens/land/engine.png");
|
||||||
|
@ -226,7 +236,7 @@ public class VehicleHudOverlay implements LayeredDraw.Layer {
|
||||||
|
|
||||||
// 炮塔损伤
|
// 炮塔损伤
|
||||||
ResourceLocation barrel;
|
ResourceLocation barrel;
|
||||||
if (mobileVehicle.getEntityData().get(TURRET_DAMAGED_TIME) > 0) {
|
if (mobileVehicle.getEntityData().get(TURRET_DAMAGED)) {
|
||||||
barrel = Mod.loc("textures/screens/land/line_damaged.png");
|
barrel = Mod.loc("textures/screens/land/line_damaged.png");
|
||||||
} else {
|
} else {
|
||||||
barrel = Mod.loc("textures/screens/land/line.png");
|
barrel = Mod.loc("textures/screens/land/line.png");
|
||||||
|
|
|
@ -188,9 +188,9 @@ public class JavelinMissileEntity extends FastThrowableProjectile implements Geo
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity instanceof Monster monster) {
|
if (entity instanceof Monster monster) {
|
||||||
monster.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), (entityData.get(TOP) ? 1.3f : 1f) * this.damage * damageMultiplier);
|
monster.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), (entityData.get(TOP) ? 1.25f : 1f) * this.damage * damageMultiplier);
|
||||||
} else {
|
} else {
|
||||||
entity.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), (entityData.get(TOP) ? 1.3f : 1f) * this.damage);
|
entity.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), (entityData.get(TOP) ? 1.25f : 1f) * this.damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity instanceof LivingEntity) {
|
if (entity instanceof LivingEntity) {
|
||||||
|
|
|
@ -82,8 +82,8 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
||||||
super(type, world);
|
super(type, world);
|
||||||
this.obb = new OBB(this.position().toVector3f(), new Vector3f(2.1875f, 0.875f, 3.90625f), new Quaternionf(), OBB.Part.BODY);
|
this.obb = new OBB(this.position().toVector3f(), new Vector3f(2.1875f, 0.875f, 3.90625f), new Quaternionf(), OBB.Part.BODY);
|
||||||
this.obb2 = new OBB(this.position().toVector3f(), new Vector3f(2.1875f, 0.5f, 0.65625f), new Quaternionf(), OBB.Part.BODY);
|
this.obb2 = new OBB(this.position().toVector3f(), new Vector3f(2.1875f, 0.5f, 0.65625f), new Quaternionf(), OBB.Part.BODY);
|
||||||
this.obb3 = new OBB(this.position().toVector3f(), new Vector3f(0.375f, 0.78125f, 3.46875f), new Quaternionf(), OBB.Part.BODY);
|
this.obb3 = new OBB(this.position().toVector3f(), new Vector3f(0.375f, 0.78125f, 3.46875f), new Quaternionf(), OBB.Part.WHEEL_LEFT);
|
||||||
this.obb4 = new OBB(this.position().toVector3f(), new Vector3f(0.375f, 0.78125f, 3.46875f), new Quaternionf(), OBB.Part.BODY);
|
this.obb4 = new OBB(this.position().toVector3f(), new Vector3f(0.375f, 0.78125f, 3.46875f), new Quaternionf(), OBB.Part.WHEEL_RIGHT);
|
||||||
this.obbTurret = new OBB(this.position().toVector3f(), new Vector3f(1.5f, 0.34375f, 1.5f), new Quaternionf(), OBB.Part.TURRET);
|
this.obbTurret = new OBB(this.position().toVector3f(), new Vector3f(1.5f, 0.34375f, 1.5f), new Quaternionf(), OBB.Part.TURRET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,7 +444,22 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
||||||
setLeftTrack((float) ((getLeftTrack() - 1.9 * Math.PI * s0) + Mth.clamp(0.4f * Math.PI * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
setLeftTrack((float) ((getLeftTrack() - 1.9 * Math.PI * s0) + Mth.clamp(0.4f * Math.PI * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
||||||
setRightTrack((float) ((getRightTrack() - 1.9 * Math.PI * s0) - Mth.clamp(0.4f * Math.PI * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
setRightTrack((float) ((getRightTrack() - 1.9 * Math.PI * s0) - Mth.clamp(0.4f * Math.PI * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
||||||
|
|
||||||
this.setYRot((float) (this.getYRot() - (isInWater() && !onGround() ? 2.5 : 6) * entityData.get(DELTA_ROT)));
|
int i;
|
||||||
|
|
||||||
|
if (entityData.get(L_WHEEL_DAMAGED) && entityData.get(R_WHEEL_DAMAGED)) {
|
||||||
|
this.entityData.set(POWER, this.entityData.get(POWER) * 0.93f);
|
||||||
|
i = 0;
|
||||||
|
} else if (entityData.get(L_WHEEL_DAMAGED)) {
|
||||||
|
this.entityData.set(POWER, this.entityData.get(POWER) * 0.975f);
|
||||||
|
i = 3;
|
||||||
|
} else if (entityData.get(R_WHEEL_DAMAGED)) {
|
||||||
|
this.entityData.set(POWER, this.entityData.get(POWER) * 0.975f);
|
||||||
|
i = -3;
|
||||||
|
} else {
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setYRot((float) (this.getYRot() - (isInWater() && !onGround() ? 2.5 : 6) * entityData.get(DELTA_ROT) - i * s0));
|
||||||
if (this.isInWater() || onGround()) {
|
if (this.isInWater() || onGround()) {
|
||||||
float power = this.entityData.get(POWER) * Mth.clamp(1 + (s0 > 0 ? 1 : -1) * getXRot() / 35, 0, 2);
|
float power = this.entityData.get(POWER) * Mth.clamp(1 + (s0 > 0 ? 1 : -1) * getXRot() / 35, 0, 2);
|
||||||
this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale((!isInWater() && !onGround() ? 0.13f : (isInWater() && !onGround() ? 2 : 2.4f)) * power)));
|
this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale((!isInWater() && !onGround() ? 0.13f : (isInWater() && !onGround() ? 2 : 2.4f)) * power)));
|
||||||
|
|
|
@ -69,10 +69,10 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
||||||
|
|
||||||
public Lav150Entity(EntityType<Lav150Entity> type, Level world) {
|
public Lav150Entity(EntityType<Lav150Entity> type, Level world) {
|
||||||
super(type, world);
|
super(type, world);
|
||||||
this.obb = new OBB(this.position().toVector3f(), new Vector3f(0.25f, 0.75f, 0.75f), new Quaternionf(), OBB.Part.BODY);
|
this.obb = new OBB(this.position().toVector3f(), new Vector3f(0.3f, 0.75f, 0.75f), new Quaternionf(), OBB.Part.WHEEL_RIGHT);
|
||||||
this.obb2 = new OBB(this.position().toVector3f(), new Vector3f(0.25f, 0.75f, 0.75f), new Quaternionf(), OBB.Part.BODY);
|
this.obb2 = new OBB(this.position().toVector3f(), new Vector3f(0.3f, 0.75f, 0.75f), new Quaternionf(), OBB.Part.WHEEL_LEFT);
|
||||||
this.obb3 = new OBB(this.position().toVector3f(), new Vector3f(0.25f, 0.75f, 0.75f), new Quaternionf(), OBB.Part.BODY);
|
this.obb3 = new OBB(this.position().toVector3f(), new Vector3f(0.3f, 0.75f, 0.75f), new Quaternionf(), OBB.Part.WHEEL_LEFT);
|
||||||
this.obb4 = new OBB(this.position().toVector3f(), new Vector3f(0.25f, 0.75f, 0.75f), new Quaternionf(), OBB.Part.BODY);
|
this.obb4 = new OBB(this.position().toVector3f(), new Vector3f(0.3f, 0.75f, 0.75f), new Quaternionf(), OBB.Part.WHEEL_RIGHT);
|
||||||
this.obb5 = new OBB(this.position().toVector3f(), new Vector3f(1.3125f, 0.90625f, 2.4375f), new Quaternionf(), OBB.Part.BODY);
|
this.obb5 = new OBB(this.position().toVector3f(), new Vector3f(1.3125f, 0.90625f, 2.4375f), new Quaternionf(), OBB.Part.BODY);
|
||||||
this.obb6 = new OBB(this.position().toVector3f(), new Vector3f(1.3125f, 0.53125f, 0.34375f), new Quaternionf(), OBB.Part.BODY);
|
this.obb6 = new OBB(this.position().toVector3f(), new Vector3f(1.3125f, 0.53125f, 0.34375f), new Quaternionf(), OBB.Part.BODY);
|
||||||
this.obb7 = new OBB(this.position().toVector3f(), new Vector3f(1.3125f, 0.625f, 0.53125f), new Quaternionf(), OBB.Part.BODY);
|
this.obb7 = new OBB(this.position().toVector3f(), new Vector3f(1.3125f, 0.625f, 0.53125f), new Quaternionf(), OBB.Part.BODY);
|
||||||
|
@ -326,7 +326,22 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
||||||
|
|
||||||
this.setRudderRot(Mth.clamp(this.getRudderRot() - this.entityData.get(DELTA_ROT), -0.8f, 0.8f) * 0.75f);
|
this.setRudderRot(Mth.clamp(this.getRudderRot() - this.entityData.get(DELTA_ROT), -0.8f, 0.8f) * 0.75f);
|
||||||
|
|
||||||
this.setYRot((float) (this.getYRot() - Math.max((isInWater() && !onGround() ? 5 : 10) * this.getDeltaMovement().horizontalDistance(), 0) * this.getRudderRot() * (this.entityData.get(POWER) > 0 ? 1 : -1)));
|
int i;
|
||||||
|
|
||||||
|
if (entityData.get(L_WHEEL_DAMAGED) && entityData.get(R_WHEEL_DAMAGED)) {
|
||||||
|
this.entityData.set(POWER, this.entityData.get(POWER) * 0.93f);
|
||||||
|
i = 0;
|
||||||
|
} else if (entityData.get(L_WHEEL_DAMAGED)) {
|
||||||
|
this.entityData.set(POWER, this.entityData.get(POWER) * 0.975f);
|
||||||
|
i = 3;
|
||||||
|
} else if (entityData.get(R_WHEEL_DAMAGED)) {
|
||||||
|
this.entityData.set(POWER, this.entityData.get(POWER) * 0.975f);
|
||||||
|
i = -3;
|
||||||
|
} else {
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setYRot((float) (this.getYRot() - Math.max((isInWater() && !onGround() ? 5 : 10) * this.getDeltaMovement().horizontalDistance(), 0) * this.getRudderRot() * (this.entityData.get(POWER) > 0 ? 1 : -1) - i * s0));
|
||||||
if (this.isInWater() || onGround()) {
|
if (this.isInWater() || onGround()) {
|
||||||
float power = this.entityData.get(POWER) * Mth.clamp(1 + (s0 > 0 ? 1 : -1) * getXRot() / 35, 0, 2);
|
float power = this.entityData.get(POWER) * Mth.clamp(1 + (s0 > 0 ? 1 : -1) * getXRot() / 35, 0, 2);
|
||||||
this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale((!isInWater() && !onGround() ? 0.05f : (isInWater() && !onGround() ? 0.3f : 1)) * power)));
|
this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale((!isInWater() && !onGround() ? 0.05f : (isInWater() && !onGround() ? 0.3f : 1)) * power)));
|
||||||
|
|
|
@ -91,8 +91,8 @@ public class PrismTankEntity extends ContainerMobileVehicleEntity implements Geo
|
||||||
this.noCulling = true;
|
this.noCulling = true;
|
||||||
this.obb = new OBB(this.position().toVector3f(), new Vector3f(2.5f, 0.8125f, 3.96875f), new Quaternionf(), OBB.Part.BODY);
|
this.obb = new OBB(this.position().toVector3f(), new Vector3f(2.5f, 0.8125f, 3.96875f), new Quaternionf(), OBB.Part.BODY);
|
||||||
this.obb2 = new OBB(this.position().toVector3f(), new Vector3f(2.5f, 0.5f, 0.375f), new Quaternionf(), OBB.Part.BODY);
|
this.obb2 = new OBB(this.position().toVector3f(), new Vector3f(2.5f, 0.5f, 0.375f), new Quaternionf(), OBB.Part.BODY);
|
||||||
this.obb3 = new OBB(this.position().toVector3f(), new Vector3f(0.46875f, 0.78125f, 3.3125f), new Quaternionf(), OBB.Part.BODY);
|
this.obb3 = new OBB(this.position().toVector3f(), new Vector3f(0.46875f, 0.78125f, 3.3125f), new Quaternionf(), OBB.Part.WHEEL_LEFT);
|
||||||
this.obb4 = new OBB(this.position().toVector3f(), new Vector3f(0.46875f, 0.78125f, 3.3125f), new Quaternionf(), OBB.Part.BODY);
|
this.obb4 = new OBB(this.position().toVector3f(), new Vector3f(0.46875f, 0.78125f, 3.3125f), new Quaternionf(), OBB.Part.WHEEL_RIGHT);
|
||||||
this.obb5 = new OBB(this.position().toVector3f(), new Vector3f(1.375f, 0.28125f, 1.375f), new Quaternionf(), OBB.Part.BODY);
|
this.obb5 = new OBB(this.position().toVector3f(), new Vector3f(1.375f, 0.28125f, 1.375f), new Quaternionf(), OBB.Part.BODY);
|
||||||
this.obbTurret = new OBB(this.position().toVector3f(), new Vector3f(0.4375f, 0.90625f, 1.21875f), new Quaternionf(), OBB.Part.TURRET);
|
this.obbTurret = new OBB(this.position().toVector3f(), new Vector3f(0.4375f, 0.90625f, 1.21875f), new Quaternionf(), OBB.Part.TURRET);
|
||||||
}
|
}
|
||||||
|
@ -508,7 +508,23 @@ public class PrismTankEntity extends ContainerMobileVehicleEntity implements Geo
|
||||||
setLeftTrack((float) ((getLeftTrack() - 1.9 * Math.PI * s0) + Mth.clamp(0.4f * Math.PI * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
setLeftTrack((float) ((getLeftTrack() - 1.9 * Math.PI * s0) + Mth.clamp(0.4f * Math.PI * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
||||||
setRightTrack((float) ((getRightTrack() - 1.9 * Math.PI * s0) - Mth.clamp(0.4f * Math.PI * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
setRightTrack((float) ((getRightTrack() - 1.9 * Math.PI * s0) - Mth.clamp(0.4f * Math.PI * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
||||||
|
|
||||||
this.setYRot((float) (this.getYRot() - (isInWater() && !onGround() ? 2.5 : 6) * entityData.get(DELTA_ROT)));
|
int i;
|
||||||
|
|
||||||
|
if (entityData.get(L_WHEEL_DAMAGED) && entityData.get(R_WHEEL_DAMAGED)) {
|
||||||
|
this.entityData.set(POWER, this.entityData.get(POWER) * 0.93f);
|
||||||
|
i = 0;
|
||||||
|
} else if (entityData.get(L_WHEEL_DAMAGED)) {
|
||||||
|
this.entityData.set(POWER, this.entityData.get(POWER) * 0.975f);
|
||||||
|
i = 3;
|
||||||
|
} else if (entityData.get(R_WHEEL_DAMAGED)) {
|
||||||
|
this.entityData.set(POWER, this.entityData.get(POWER) * 0.975f);
|
||||||
|
i = -3;
|
||||||
|
} else {
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setYRot((float) (this.getYRot() - (isInWater() && !onGround() ? 2.5 : 6) * entityData.get(DELTA_ROT) - i * s0));
|
||||||
|
|
||||||
if (this.isInWater() || onGround()) {
|
if (this.isInWater() || onGround()) {
|
||||||
float power = this.entityData.get(POWER) * Mth.clamp(1 + (s0 > 0 ? 1 : -1) * getXRot() / 35, 0, 2);
|
float power = this.entityData.get(POWER) * Mth.clamp(1 + (s0 > 0 ? 1 : -1) * getXRot() / 35, 0, 2);
|
||||||
this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale((!isInWater() && !onGround() ? 0.13f : (isInWater() && !onGround() ? 2 : 2.4f)) * power)));
|
this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale((!isInWater() && !onGround() ? 0.13f : (isInWater() && !onGround() ? 2 : 2.4f)) * power)));
|
||||||
|
|
|
@ -96,8 +96,8 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
super(type, world);
|
super(type, world);
|
||||||
this.obb = new OBB(this.position().toVector3f(), new Vector3f(2.375f, 0.71875f, 4f), new Quaternionf(), OBB.Part.BODY);
|
this.obb = new OBB(this.position().toVector3f(), new Vector3f(2.375f, 0.71875f, 4f), new Quaternionf(), OBB.Part.BODY);
|
||||||
this.obb2 = new OBB(this.position().toVector3f(), new Vector3f(2.375f, 0.59375f, 0.65625f), new Quaternionf(), OBB.Part.BODY);
|
this.obb2 = new OBB(this.position().toVector3f(), new Vector3f(2.375f, 0.59375f, 0.65625f), new Quaternionf(), OBB.Part.BODY);
|
||||||
this.obb3 = new OBB(this.position().toVector3f(), new Vector3f(0.625f, 0.84375f, 3.875f), new Quaternionf(), OBB.Part.BODY);
|
this.obb3 = new OBB(this.position().toVector3f(), new Vector3f(0.625f, 0.84375f, 3.875f), new Quaternionf(), OBB.Part.WHEEL_LEFT);
|
||||||
this.obb4 = new OBB(this.position().toVector3f(), new Vector3f(0.625f, 0.84375f, 3.875f), new Quaternionf(), OBB.Part.BODY);
|
this.obb4 = new OBB(this.position().toVector3f(), new Vector3f(0.625f, 0.84375f, 3.875f), new Quaternionf(), OBB.Part.WHEEL_RIGHT);
|
||||||
this.obbTurret = new OBB(this.position().toVector3f(), new Vector3f(2.375f, 0.5625f, 2.1875f), new Quaternionf(), OBB.Part.TURRET);
|
this.obbTurret = new OBB(this.position().toVector3f(), new Vector3f(2.375f, 0.5625f, 2.1875f), new Quaternionf(), OBB.Part.TURRET);
|
||||||
this.obbTurret2 = new OBB(this.position().toVector3f(), new Vector3f(1.625f, 0.40625f, 0.59375f), new Quaternionf(), OBB.Part.TURRET);
|
this.obbTurret2 = new OBB(this.position().toVector3f(), new Vector3f(1.625f, 0.40625f, 0.59375f), new Quaternionf(), OBB.Part.TURRET);
|
||||||
}
|
}
|
||||||
|
@ -331,6 +331,34 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
this.refreshDimensions();
|
this.refreshDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void partDamaged() {
|
||||||
|
if (entityData.get(TURRET_HEALTH) < 0) {
|
||||||
|
entityData.set(TURRET_DAMAGED, true);
|
||||||
|
}
|
||||||
|
if (entityData.get(TURRET_HEALTH) > 80) {
|
||||||
|
entityData.set(TURRET_DAMAGED, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entityData.get(L_WHEEL_HEALTH) < 0) {
|
||||||
|
entityData.set(L_WHEEL_DAMAGED, true);
|
||||||
|
}
|
||||||
|
if (entityData.get(L_WHEEL_HEALTH) > 80) {
|
||||||
|
entityData.set(L_WHEEL_DAMAGED, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entityData.get(R_WHEEL_HEALTH) < 0) {
|
||||||
|
entityData.set(R_WHEEL_DAMAGED, true);
|
||||||
|
}
|
||||||
|
if (entityData.get(R_WHEEL_HEALTH) > 80) {
|
||||||
|
entityData.set(R_WHEEL_DAMAGED, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
entityData.set(TURRET_HEALTH, Math.min(entityData.get(TURRET_HEALTH) + 0.5f, 100));
|
||||||
|
entityData.set(L_WHEEL_HEALTH, Math.min(entityData.get(L_WHEEL_HEALTH) + 0.5f, 100));
|
||||||
|
entityData.set(R_WHEEL_HEALTH, Math.min(entityData.get(R_WHEEL_HEALTH) + 0.5f, 100));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void terrainCompact(float w, float l) {
|
public void terrainCompact(float w, float l) {
|
||||||
if (onGround()) {
|
if (onGround()) {
|
||||||
|
@ -721,7 +749,22 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
setLeftTrack((float) ((getLeftTrack() - 1.5 * Math.PI * s0) + Mth.clamp(0.4f * Math.PI * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
setLeftTrack((float) ((getLeftTrack() - 1.5 * Math.PI * s0) + Mth.clamp(0.4f * Math.PI * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
||||||
setRightTrack((float) ((getRightTrack() - 1.5 * Math.PI * s0) - Mth.clamp(0.4f * Math.PI * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
setRightTrack((float) ((getRightTrack() - 1.5 * Math.PI * s0) - Mth.clamp(0.4f * Math.PI * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
||||||
|
|
||||||
this.setYRot((float) (this.getYRot() - (isInWater() && !onGround() ? 2.5 : 6) * entityData.get(DELTA_ROT)));
|
int i;
|
||||||
|
|
||||||
|
if (entityData.get(L_WHEEL_DAMAGED) && entityData.get(R_WHEEL_DAMAGED)) {
|
||||||
|
this.entityData.set(POWER, this.entityData.get(POWER) * 0.93f);
|
||||||
|
i = 0;
|
||||||
|
} else if (entityData.get(L_WHEEL_DAMAGED)) {
|
||||||
|
this.entityData.set(POWER, this.entityData.get(POWER) * 0.975f);
|
||||||
|
i = 3;
|
||||||
|
} else if (entityData.get(R_WHEEL_DAMAGED)) {
|
||||||
|
this.entityData.set(POWER, this.entityData.get(POWER) * 0.975f);
|
||||||
|
i = -3;
|
||||||
|
} else {
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setYRot((float) (this.getYRot() - (isInWater() && !onGround() ? 2.5 : 6) * entityData.get(DELTA_ROT) - i * s0));
|
||||||
if (this.isInWater() || onGround()) {
|
if (this.isInWater() || onGround()) {
|
||||||
float power = this.entityData.get(POWER) * Mth.clamp(1 + (s0 > 0 ? 1 : -1) * getXRot() / 35, 0, 2);
|
float power = this.entityData.get(POWER) * Mth.clamp(1 + (s0 > 0 ? 1 : -1) * getXRot() / 35, 0, 2);
|
||||||
this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale((!isInWater() && !onGround() ? 0.13f : (isInWater() && !onGround() ? 2 : 2.4f)) * power)));
|
this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale((!isInWater() && !onGround() ? 0.13f : (isInWater() && !onGround() ? 2 : 2.4f)) * power)));
|
||||||
|
@ -1285,14 +1328,16 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
return Mod.loc("textures/gui/vehicle/type/land.png");
|
return Mod.loc("textures/gui/vehicle/type/land.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public float getTurretMaxHealth() {
|
||||||
public float turretDamagedMin() {
|
return 100;
|
||||||
return 75;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public float getLeftWheelMaxHealth() {
|
||||||
public float turretDamagedMultiply() {
|
return 100;
|
||||||
return 2;
|
}
|
||||||
|
|
||||||
|
public float getRightWheelMaxHealth() {
|
||||||
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -89,9 +89,14 @@ public abstract class VehicleEntity extends Entity {
|
||||||
public static final EntityDataAccessor<Float> MOUSE_SPEED_Y = SynchedEntityData.defineId(VehicleEntity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> MOUSE_SPEED_Y = SynchedEntityData.defineId(VehicleEntity.class, EntityDataSerializers.FLOAT);
|
||||||
public static final EntityDataAccessor<List<Integer>> SELECTED_WEAPON = SynchedEntityData.defineId(VehicleEntity.class, ModSerializers.INT_LIST_SERIALIZER.get());
|
public static final EntityDataAccessor<List<Integer>> SELECTED_WEAPON = SynchedEntityData.defineId(VehicleEntity.class, ModSerializers.INT_LIST_SERIALIZER.get());
|
||||||
public static final EntityDataAccessor<Integer> HEAT = SynchedEntityData.defineId(VehicleEntity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> HEAT = SynchedEntityData.defineId(VehicleEntity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Integer> TURRET_DAMAGED_TIME = SynchedEntityData.defineId(VehicleEntity.class, EntityDataSerializers.INT);
|
|
||||||
public static final EntityDataAccessor<Integer> L_WHEEL_DAMAGED_TIME = SynchedEntityData.defineId(VehicleEntity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Float> TURRET_HEALTH = SynchedEntityData.defineId(VehicleEntity.class, EntityDataSerializers.FLOAT);
|
||||||
public static final EntityDataAccessor<Integer> R_WHEEL_DAMAGED_TIME = SynchedEntityData.defineId(VehicleEntity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Float> L_WHEEL_HEALTH = SynchedEntityData.defineId(VehicleEntity.class, EntityDataSerializers.FLOAT);
|
||||||
|
public static final EntityDataAccessor<Float> R_WHEEL_HEALTH = SynchedEntityData.defineId(VehicleEntity.class, EntityDataSerializers.FLOAT);
|
||||||
|
|
||||||
|
public static final EntityDataAccessor<Boolean> TURRET_DAMAGED = SynchedEntityData.defineId(VehicleEntity.class, EntityDataSerializers.BOOLEAN);
|
||||||
|
public static final EntityDataAccessor<Boolean> L_WHEEL_DAMAGED = SynchedEntityData.defineId(VehicleEntity.class, EntityDataSerializers.BOOLEAN);
|
||||||
|
public static final EntityDataAccessor<Boolean> R_WHEEL_DAMAGED = SynchedEntityData.defineId(VehicleEntity.class, EntityDataSerializers.BOOLEAN);
|
||||||
|
|
||||||
public VehicleWeapon[][] availableWeapons;
|
public VehicleWeapon[][] availableWeapons;
|
||||||
|
|
||||||
|
@ -303,9 +308,12 @@ public abstract class VehicleEntity extends Entity {
|
||||||
.define(MOUSE_SPEED_X, 0f)
|
.define(MOUSE_SPEED_X, 0f)
|
||||||
.define(MOUSE_SPEED_Y, 0f)
|
.define(MOUSE_SPEED_Y, 0f)
|
||||||
.define(HEAT, 0)
|
.define(HEAT, 0)
|
||||||
.define(TURRET_DAMAGED_TIME, 0)
|
.define(TURRET_HEALTH, getTurretMaxHealth())
|
||||||
.define(L_WHEEL_DAMAGED_TIME, 0)
|
.define(L_WHEEL_HEALTH, getLeftWheelMaxHealth())
|
||||||
.define(R_WHEEL_DAMAGED_TIME, 0)
|
.define(R_WHEEL_HEALTH, getRightWheelMaxHealth())
|
||||||
|
.define(TURRET_DAMAGED, false)
|
||||||
|
.define(L_WHEEL_DAMAGED, false)
|
||||||
|
.define(R_WHEEL_DAMAGED, false)
|
||||||
.define(SELECTED_WEAPON, IntList.of(new int[this.getMaxPassengers()]));
|
.define(SELECTED_WEAPON, IntList.of(new int[this.getMaxPassengers()]));
|
||||||
// 怎么还不给玩动态注册了(恼)
|
// 怎么还不给玩动态注册了(恼)
|
||||||
}
|
}
|
||||||
|
@ -327,9 +335,14 @@ public abstract class VehicleEntity extends Entity {
|
||||||
this.entityData.set(LAST_ATTACKER_UUID, compound.getString("LastAttacker"));
|
this.entityData.set(LAST_ATTACKER_UUID, compound.getString("LastAttacker"));
|
||||||
this.entityData.set(LAST_DRIVER_UUID, compound.getString("LastDriver"));
|
this.entityData.set(LAST_DRIVER_UUID, compound.getString("LastDriver"));
|
||||||
this.entityData.set(HEALTH, compound.getFloat("Health"));
|
this.entityData.set(HEALTH, compound.getFloat("Health"));
|
||||||
this.entityData.set(TURRET_DAMAGED_TIME, compound.getInt("TurretDamagedTime"));
|
|
||||||
this.entityData.set(L_WHEEL_DAMAGED_TIME, compound.getInt("LWheelDamagedTime"));
|
this.entityData.set(TURRET_HEALTH, compound.getFloat("TurretHealth"));
|
||||||
this.entityData.set(R_WHEEL_DAMAGED_TIME, compound.getInt("RWheelDamagedTime"));
|
this.entityData.set(L_WHEEL_HEALTH, compound.getFloat("LeftWheelHealth"));
|
||||||
|
this.entityData.set(R_WHEEL_HEALTH, compound.getFloat("RightWheelHealth"));
|
||||||
|
|
||||||
|
this.entityData.set(TURRET_DAMAGED, compound.getBoolean("TurretDamaged"));
|
||||||
|
this.entityData.set(L_WHEEL_DAMAGED, compound.getBoolean("LeftDamaged"));
|
||||||
|
this.entityData.set(R_WHEEL_DAMAGED, compound.getBoolean("RightDamaged"));
|
||||||
|
|
||||||
if (this instanceof WeaponVehicleEntity weaponVehicle && weaponVehicle.getAllWeapons().length > 0) {
|
if (this instanceof WeaponVehicleEntity weaponVehicle && weaponVehicle.getAllWeapons().length > 0) {
|
||||||
var selected = compound.getIntArray("SelectedWeapon");
|
var selected = compound.getIntArray("SelectedWeapon");
|
||||||
|
@ -348,9 +361,14 @@ public abstract class VehicleEntity extends Entity {
|
||||||
compound.putFloat("Health", this.entityData.get(HEALTH));
|
compound.putFloat("Health", this.entityData.get(HEALTH));
|
||||||
compound.putString("LastAttacker", this.entityData.get(LAST_ATTACKER_UUID));
|
compound.putString("LastAttacker", this.entityData.get(LAST_ATTACKER_UUID));
|
||||||
compound.putString("LastDriver", this.entityData.get(LAST_DRIVER_UUID));
|
compound.putString("LastDriver", this.entityData.get(LAST_DRIVER_UUID));
|
||||||
compound.putInt("TurretDamagedTime", this.entityData.get(TURRET_DAMAGED_TIME));
|
|
||||||
compound.putInt("LWheelDamagedTime", this.entityData.get(L_WHEEL_DAMAGED_TIME));
|
compound.putFloat("TurretHealth", this.entityData.get(TURRET_HEALTH));
|
||||||
compound.putInt("RWheelDamagedTime", this.entityData.get(R_WHEEL_DAMAGED_TIME));
|
compound.putFloat("LeftWheelHealth", this.entityData.get(L_WHEEL_HEALTH));
|
||||||
|
compound.putFloat("RightWheelHealth", this.entityData.get(R_WHEEL_HEALTH));
|
||||||
|
|
||||||
|
compound.putBoolean("TurretDamaged", this.entityData.get(TURRET_DAMAGED));
|
||||||
|
compound.putBoolean("LeftWheelDamaged", this.entityData.get(L_WHEEL_DAMAGED));
|
||||||
|
compound.putBoolean("RightWheelDamaged", this.entityData.get(R_WHEEL_DAMAGED));
|
||||||
|
|
||||||
if (this instanceof WeaponVehicleEntity weaponVehicle && weaponVehicle.getAllWeapons().length > 0) {
|
if (this instanceof WeaponVehicleEntity weaponVehicle && weaponVehicle.getAllWeapons().length > 0) {
|
||||||
compound.putIntArray("SelectedWeapon", this.entityData.get(SELECTED_WEAPON));
|
compound.putIntArray("SelectedWeapon", this.entityData.get(SELECTED_WEAPON));
|
||||||
|
@ -450,8 +468,16 @@ public abstract class VehicleEntity extends Entity {
|
||||||
if (source.getDirectEntity() instanceof Projectile projectile) {
|
if (source.getDirectEntity() instanceof Projectile projectile) {
|
||||||
OBBHitter accessor = OBBHitter.getInstance(projectile);
|
OBBHitter accessor = OBBHitter.getInstance(projectile);
|
||||||
//炮塔损伤
|
//炮塔损伤
|
||||||
if (this instanceof OBBEntity obbEntity && accessor.sbw$getCurrentHitPart() == OBB.Part.TURRET && computedAmount > turretDamagedMin()) {
|
if (this instanceof OBBEntity && accessor.sbw$getCurrentHitPart() == OBB.Part.TURRET) {
|
||||||
entityData.set(TURRET_DAMAGED_TIME, (int) (entityData.get(TURRET_DAMAGED_TIME) + computedAmount * turretDamagedMultiply()));
|
entityData.set(TURRET_HEALTH, entityData.get(TURRET_HEALTH) - computedAmount);
|
||||||
|
}
|
||||||
|
//左轮损伤
|
||||||
|
if (this instanceof OBBEntity && accessor.sbw$getCurrentHitPart() == OBB.Part.WHEEL_LEFT) {
|
||||||
|
entityData.set(L_WHEEL_HEALTH, entityData.get(L_WHEEL_HEALTH) - computedAmount);
|
||||||
|
}
|
||||||
|
//右轮损伤
|
||||||
|
if (this instanceof OBBEntity && accessor.sbw$getCurrentHitPart() == OBB.Part.WHEEL_RIGHT) {
|
||||||
|
entityData.set(R_WHEEL_HEALTH, entityData.get(R_WHEEL_HEALTH) - computedAmount);
|
||||||
}
|
}
|
||||||
// System.out.println(accessor.sbw$getCurrentHitPart());
|
// System.out.println(accessor.sbw$getCurrentHitPart());
|
||||||
}
|
}
|
||||||
|
@ -521,6 +547,18 @@ public abstract class VehicleEntity extends Entity {
|
||||||
return data().maxHealth();
|
return data().maxHealth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getTurretMaxHealth() {
|
||||||
|
return 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getLeftWheelMaxHealth() {
|
||||||
|
return 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getRightWheelMaxHealth() {
|
||||||
|
return 50;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBeCollidedWith() {
|
public boolean canBeCollidedWith() {
|
||||||
return true;
|
return true;
|
||||||
|
@ -655,13 +693,44 @@ public abstract class VehicleEntity extends Entity {
|
||||||
|
|
||||||
clearArrow();
|
clearArrow();
|
||||||
|
|
||||||
|
// 炮塔损毁特效
|
||||||
|
turretDamagedEffect();
|
||||||
|
|
||||||
|
//部件血量
|
||||||
partDamaged();
|
partDamaged();
|
||||||
|
|
||||||
this.refreshDimensions();
|
this.refreshDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void partDamaged() {
|
public void partDamaged() {
|
||||||
// 炮塔损毁特效
|
if (entityData.get(TURRET_HEALTH) < 0) {
|
||||||
if (entityData.get(TURRET_DAMAGED_TIME) > 0) {
|
entityData.set(TURRET_DAMAGED, true);
|
||||||
|
}
|
||||||
|
if (entityData.get(TURRET_HEALTH) > 40) {
|
||||||
|
entityData.set(TURRET_DAMAGED, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entityData.get(L_WHEEL_HEALTH) < 0) {
|
||||||
|
entityData.set(L_WHEEL_DAMAGED, true);
|
||||||
|
}
|
||||||
|
if (entityData.get(L_WHEEL_HEALTH) > 40) {
|
||||||
|
entityData.set(L_WHEEL_DAMAGED, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entityData.get(R_WHEEL_HEALTH) < 0) {
|
||||||
|
entityData.set(R_WHEEL_DAMAGED, true);
|
||||||
|
}
|
||||||
|
if (entityData.get(R_WHEEL_HEALTH) > 40) {
|
||||||
|
entityData.set(R_WHEEL_DAMAGED, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
entityData.set(TURRET_HEALTH, Math.min(entityData.get(TURRET_HEALTH) + 0.25f, 50));
|
||||||
|
entityData.set(L_WHEEL_HEALTH, Math.min(entityData.get(L_WHEEL_HEALTH) + 0.25f, 50));
|
||||||
|
entityData.set(R_WHEEL_HEALTH, Math.min(entityData.get(R_WHEEL_HEALTH) + 0.25f, 50));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void turretDamagedEffect() {
|
||||||
|
if (entityData.get(TURRET_DAMAGED)) {
|
||||||
List<Entity> entities = getPlayer(level());
|
List<Entity> entities = getPlayer(level());
|
||||||
for (var e : entities) {
|
for (var e : entities) {
|
||||||
if (e instanceof ServerPlayer player) {
|
if (e instanceof ServerPlayer player) {
|
||||||
|
@ -673,7 +742,6 @@ public abstract class VehicleEntity extends Entity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
entityData.set(TURRET_DAMAGED_TIME, entityData.get(TURRET_DAMAGED_TIME) - 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -738,7 +806,7 @@ public abstract class VehicleEntity extends Entity {
|
||||||
|
|
||||||
this.turretTurnSound(diffX, diffY, 0.95f);
|
this.turretTurnSound(diffX, diffY, 0.95f);
|
||||||
|
|
||||||
if (entityData.get(TURRET_DAMAGED_TIME) > 0) {
|
if (entityData.get(TURRET_DAMAGED)) {
|
||||||
ySpeed *= 0.2f;
|
ySpeed *= 0.2f;
|
||||||
xSpeed *= 0.2f;
|
xSpeed *= 0.2f;
|
||||||
}
|
}
|
||||||
|
@ -1083,14 +1151,6 @@ public abstract class VehicleEntity extends Entity {
|
||||||
super.addDeltaMovement(pAddend);
|
super.addDeltaMovement(pAddend);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float turretDamagedMin() {
|
|
||||||
return 30;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float turretDamagedMultiply() {
|
|
||||||
return 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 玩家在载具上的灵敏度调整
|
* 玩家在载具上的灵敏度调整
|
||||||
*
|
*
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"Magazine": 1,
|
"Magazine": 1,
|
||||||
"Weight": 10,
|
"Weight": 10,
|
||||||
"EmptyReloadTime": 78,
|
"EmptyReloadTime": 78,
|
||||||
"Damage": 700,
|
"Damage": 500,
|
||||||
"ExplosionDamage": 120,
|
"ExplosionDamage": 120,
|
||||||
"ExplosionRadius": 9,
|
"ExplosionRadius": 9,
|
||||||
"AmmoType": "superbwarfare:javelin_missile",
|
"AmmoType": "superbwarfare:javelin_missile",
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Type": "Multiply",
|
"Type": "Multiply",
|
||||||
"Value": 1.5,
|
"Value": 1.35,
|
||||||
"Source": "superbwarfare:cannon_fire"
|
"Source": "superbwarfare:cannon_fire"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"ID": "superbwarfare:lav_150",
|
"ID": "superbwarfare:lav_150",
|
||||||
"MaxHealth": 250,
|
"MaxHealth": 270,
|
||||||
"MaxEnergy": 5000000,
|
"MaxEnergy": 5000000,
|
||||||
"UpStep": 1.5,
|
"UpStep": 1.5,
|
||||||
"Mass": 13.6,
|
"Mass": 13.6,
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Type": "Multiply",
|
"Type": "Multiply",
|
||||||
"Value": 1.5,
|
"Value": 1.4,
|
||||||
"Source": "superbwarfare:cannon_fire"
|
"Source": "superbwarfare:cannon_fire"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue