削弱载具爬坡能力,添加载具质量设定
This commit is contained in:
parent
8145f027c5
commit
9a461e5b38
26 changed files with 84 additions and 36 deletions
|
@ -178,7 +178,8 @@ public class VehicleHudOverlay implements LayeredDraw.Layer {
|
|||
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
|
||||
scopeScale = Mth.lerp(deltaTracker.getGameTimeDeltaPartialTick(true), scopeScale, 1F);
|
||||
float partialTick = deltaTracker.getGameTimeDeltaPartialTick(true);
|
||||
scopeScale = Mth.lerp(partialTick, scopeScale, 1F);
|
||||
float scale = scopeScale;
|
||||
|
||||
if (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON || ClientEventHandler.zoomVehicle) {
|
||||
|
@ -194,12 +195,12 @@ public class VehicleHudOverlay implements LayeredDraw.Layer {
|
|||
|
||||
// 炮塔方向
|
||||
poseStack.pushPose();
|
||||
poseStack.rotateAround(Axis.ZP.rotationDegrees(Mth.lerp(deltaTracker.getGameTimeDeltaPartialTick(true), iLand.turretYRotO(), iLand.turretYRot())), w / 2f + 112, h - 56, 0);
|
||||
poseStack.rotateAround(Axis.ZP.rotationDegrees(Mth.lerp(partialTick, iLand.turretYRotO(), iLand.turretYRot())), w / 2f + 112, h - 56, 0);
|
||||
preciseBlit(guiGraphics, Mod.loc("textures/screens/land/body.png"), w / 2f + 96, h - 72, 0, 0.0F, 32, 32, 32, 32);
|
||||
poseStack.popPose();
|
||||
|
||||
// 时速
|
||||
guiGraphics.drawString(mc.font, Component.literal(FormatTool.format0D(mobileVehicle.getDeltaMovement().length() * 72, " km/h")),
|
||||
guiGraphics.drawString(mc.font, Component.literal(FormatTool.format0D(mobileVehicle.getDeltaMovement().dot(mobileVehicle.getViewVector(partialTick)) * 72, " km/h")),
|
||||
w / 2 + 160, h / 2 - 48, 0x66FF00, false);
|
||||
|
||||
// 低电量警告
|
||||
|
@ -253,7 +254,7 @@ public class VehicleHudOverlay implements LayeredDraw.Layer {
|
|||
|
||||
renderKillIndicator(guiGraphics, w, h);
|
||||
} else if (Minecraft.getInstance().options.getCameraType() == CameraType.THIRD_PERSON_BACK && !ClientEventHandler.zoomVehicle) {
|
||||
Vec3 p = RenderHelper.worldToScreen(new Vec3(Mth.lerp(deltaTracker.getGameTimeDeltaPartialTick(true), player.xo, player.getX()), Mth.lerp(deltaTracker.getGameTimeDeltaPartialTick(true), player.yo + player.getEyeHeight(), player.getEyeY()), Mth.lerp(deltaTracker.getGameTimeDeltaPartialTick(true), player.zo, player.getZ())).add(iLand.getBarrelVec(deltaTracker.getGameTimeDeltaPartialTick(true)).scale(192)), cameraPos);
|
||||
Vec3 p = RenderHelper.worldToScreen(new Vec3(Mth.lerp(partialTick, player.xo, player.getX()), Mth.lerp(partialTick, player.yo + player.getEyeHeight(), player.getEyeY()), Mth.lerp(partialTick, player.zo, player.getZ())).add(iLand.getBarrelVec(partialTick).scale(192)), cameraPos);
|
||||
// 第三人称准星
|
||||
if (p != null) {
|
||||
poseStack.pushPose();
|
||||
|
|
|
@ -33,4 +33,7 @@ public class DefaultVehicleData {
|
|||
|
||||
@SerializedName("DamageModifiers")
|
||||
public List<DamageModify> damageModifiers = List.of();
|
||||
|
||||
@SerializedName("Mass")
|
||||
public float mass = 1;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,10 @@ public class VehicleData {
|
|||
return data.allowFreeCam;
|
||||
}
|
||||
|
||||
public float mass() {
|
||||
return data.mass;
|
||||
}
|
||||
|
||||
public DamageModifier damageModifier() {
|
||||
var modifier = new DamageModifier();
|
||||
|
||||
|
|
|
@ -452,7 +452,8 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
|||
|
||||
this.setYRot((float) (this.getYRot() - (isInWater() && !onGround() ? 2.5 : 6) * entityData.get(DELTA_ROT)));
|
||||
if (this.isInWater() || onGround()) {
|
||||
this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale((!isInWater() && !onGround() ? 0.13f : (isInWater() && !onGround() ? 2 : 2.4f)) * this.entityData.get(POWER))));
|
||||
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)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -340,7 +340,8 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
|||
|
||||
this.setYRot((float) (this.getYRot() - Math.max((isInWater() && !onGround() ? 5 : 10) * this.getDeltaMovement().horizontalDistance(), 0) * this.getRudderRot() * (this.entityData.get(POWER) > 0 ? 1 : -1)));
|
||||
if (this.isInWater() || onGround()) {
|
||||
this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale((!isInWater() && !onGround() ? 0.05f : (isInWater() && !onGround() ? 0.3f : 1)) * this.entityData.get(POWER))));
|
||||
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)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -501,7 +501,8 @@ public class PrismTankEntity extends ContainerMobileVehicleEntity implements Geo
|
|||
|
||||
this.setYRot((float) (this.getYRot() - (isInWater() && !onGround() ? 2.5 : 6) * entityData.get(DELTA_ROT)));
|
||||
if (this.isInWater() || onGround()) {
|
||||
this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale((!isInWater() && !onGround() ? 0.13f : (isInWater() && !onGround() ? 2 : 2.4f)) * this.entityData.get(POWER))));
|
||||
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)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,8 @@ public class WheelChairEntity extends MobileVehicleEntity implements GeoEntity {
|
|||
this.setLeftWheelRot((float) (this.getLeftWheelRot() - 1.25 * s0) - 0.015f * Mth.clamp(0.4f * diffY, -5f, 5f));
|
||||
this.setRightWheelRot((float) (this.getRightWheelRot() - 1.25 * s0) + 0.015f * Mth.clamp(0.4f * diffY, -5f, 5f));
|
||||
|
||||
this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale((this.onGround() ? 1 : 0.1) * this.entityData.get(POWER))));
|
||||
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((this.onGround() ? 1 : 0.1) * power)));
|
||||
}
|
||||
|
||||
public void moveWithOutPower(Player player, boolean forward) {
|
||||
|
|
|
@ -287,9 +287,9 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
|||
if (this.onGround()) {
|
||||
float f0 = 0.54f + 0.25f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90;
|
||||
this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).normalize().scale(0.05 * getDeltaMovement().dot(getViewVector(1)))));
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(f0, 0.85, f0));
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(f0, 0.99, f0));
|
||||
} else {
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(0.98, 0.95, 0.98));
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(0.98, 0.99, 0.98));
|
||||
}
|
||||
|
||||
if (this.isInWater()) {
|
||||
|
@ -729,7 +729,8 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
|||
|
||||
this.setYRot((float) (this.getYRot() - (isInWater() && !onGround() ? 2.5 : 6) * entityData.get(DELTA_ROT)));
|
||||
if (this.isInWater() || onGround()) {
|
||||
this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale((!isInWater() && !onGround() ? 0.13f : (isInWater() && !onGround() ? 2 : 2.4f)) * this.entityData.get(POWER))));
|
||||
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)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -650,8 +650,7 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
|
|||
if (!this.canCrushEntities()) return;
|
||||
if (velocity.horizontalDistance() < 0.25) return;
|
||||
if (isRemoved()) return;
|
||||
var frontBox = getBoundingBox().move(velocity.scale(0.6));
|
||||
var velAdd = velocity.add(0, 0, 0).scale(0.9);
|
||||
var frontBox = getBoundingBox().move(velocity);
|
||||
|
||||
var entities = level().getEntities(EntityTypeTest.forClass(Entity.class), frontBox,
|
||||
entity -> entity != this && entity != getFirstPassenger() && entity.getVehicle() == null)
|
||||
|
@ -668,17 +667,37 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
|
|||
.toList();
|
||||
|
||||
for (var entity : entities) {
|
||||
double entitySize = entity.getBbWidth() * entity.getBbHeight();
|
||||
double thisSize = this.getBbWidth() * this.getBbHeight();
|
||||
double f = Math.min(entitySize / thisSize, 2) * 0.5;
|
||||
double f1 = Math.min(thisSize / entitySize, 4) * 2;
|
||||
double entitySize = entity.getBoundingBox().getSize();
|
||||
double thisSize = this.getBoundingBox().getSize();
|
||||
double f;
|
||||
double f1;
|
||||
|
||||
if (velocity.length() > 0.3 && getBoundingBox().distanceToSqr(entity.getBoundingBox().getCenter()) < 1) {
|
||||
// TODO 给非载具实体也设置质量
|
||||
|
||||
if (entity instanceof VehicleEntity vehicle) {
|
||||
f = Mth.clamp(vehicle.getMass() / getMass(), 0.25, 4);
|
||||
f1 = Mth.clamp(getMass() / vehicle.getMass(), 0.25, 4);
|
||||
} else {
|
||||
f = Mth.clamp(entitySize / thisSize, 0.25, 4);
|
||||
f1 = Mth.clamp(thisSize / entitySize, 0.25, 4);
|
||||
|
||||
}
|
||||
|
||||
float v = (float) velocity.dot(position().vectorTo(entity.position()));
|
||||
var velAdd = position().vectorTo(entity.position()).normalize().scale(0.1 * v);
|
||||
|
||||
if (Mth.abs(v) > 0.1) {
|
||||
if (!this.level().isClientSide) {
|
||||
this.level().playSound(null, this, ModSounds.VEHICLE_STRIKE.get(), this.getSoundSource(), 1, 1);
|
||||
}
|
||||
|
||||
entity.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), this, this.getFirstPassenger() == null ? this : this.getFirstPassenger()), (float) (f1 * 8 * (Mth.abs(v) - 0.2)));
|
||||
if (entity instanceof VehicleEntity) {
|
||||
this.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), entity, entity.getFirstPassenger() == null ? entity : entity.getFirstPassenger()), (float) (f * 8 * (Mth.abs(v) - 0.2)));
|
||||
}
|
||||
|
||||
if (!(entity instanceof TargetEntity)) {
|
||||
this.pushNew(-f * velAdd.x, -f * velAdd.y, -f * velAdd.z);
|
||||
this.pushNew(-0.3f * f * velAdd.x, -0.3f * f * velAdd.y, -0.3f * f * velAdd.z);
|
||||
}
|
||||
|
||||
if (entity instanceof MobileVehicleEntity mobileVehicle) {
|
||||
|
@ -686,11 +705,6 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
|
|||
} else {
|
||||
entity.push(f1 * velAdd.x, f1 * velAdd.y, f1 * velAdd.z);
|
||||
}
|
||||
|
||||
entity.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), this, this.getFirstPassenger() == null ? this : this.getFirstPassenger()), (float) (thisSize * 20 * ((velocity.length() - 0.3) * (velocity.length() - 0.3))));
|
||||
if (entities instanceof VehicleEntity) {
|
||||
this.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), entity, entity.getFirstPassenger() == null ? entity : entity.getFirstPassenger()), (float) (entitySize * 10 * ((velocity.length() - 0.3) * (velocity.length() - 0.3))));
|
||||
}
|
||||
} else {
|
||||
entity.push(0.3 * f1 * velAdd.x, 0.3 * f1 * velAdd.y, 0.3 * f1 * velAdd.z);
|
||||
}
|
||||
|
|
|
@ -978,6 +978,10 @@ public abstract class VehicleEntity extends Entity {
|
|||
return getEyePosition();
|
||||
}
|
||||
|
||||
public float getMass() {
|
||||
return data().mass();
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家在载具上的灵敏度调整
|
||||
*
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"MaxHealth": 350,
|
||||
"MaxEnergy": 10000000,
|
||||
"UpStep": 0.5,
|
||||
"Mass": 11.4,
|
||||
"AllowFreeCam": true,
|
||||
"DamageModifiers": [
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"MaxHealth": 250,
|
||||
"MaxEnergy": 5000000,
|
||||
"UpStep": 1.1,
|
||||
"Mass": 1.2,
|
||||
"AllowFreeCam": true,
|
||||
"DamageModifiers": [
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"ID": "superbwarfare:annihilator",
|
||||
"MaxHealth": 1200,
|
||||
"MaxEnergy": 20000000,
|
||||
"Mass": 2774,
|
||||
"DamageModifiers": [
|
||||
{
|
||||
"Type": "Multiply",
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"MaxHealth": 300,
|
||||
"MaxEnergy": 5000000,
|
||||
"UpStep": 2.25,
|
||||
"Mass": 14.6,
|
||||
"DamageModifiers": [
|
||||
{
|
||||
"Type": "Multiply",
|
||||
|
@ -85,7 +86,7 @@
|
|||
},
|
||||
{
|
||||
"Type": "Multiply",
|
||||
"Value": 8.5,
|
||||
"Value": 10,
|
||||
"Source": "#superbwarfare:vehicle_strike"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:drone",
|
||||
"MaxHealth": 5
|
||||
"MaxHealth": 5,
|
||||
"Mass": 0.0005
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
"ID": "superbwarfare:hpj_11",
|
||||
"MaxHealth": 350,
|
||||
"MaxEnergy": 5000000,
|
||||
"Mass": 30,
|
||||
"DamageModifiers": [
|
||||
{
|
||||
"Type": "Multiply",
|
||||
|
@ -79,7 +80,7 @@
|
|||
},
|
||||
{
|
||||
"Type": "Multiply",
|
||||
"Value": 10,
|
||||
"Value": 5,
|
||||
"Source": "superbwarfare:vehicle_strike"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"ID": "superbwarfare:laser_tower",
|
||||
"MaxHealth": 100,
|
||||
"MaxEnergy": 500000,
|
||||
"Mass": 0.5,
|
||||
"DamageModifiers": [
|
||||
{
|
||||
"Type": "Multiply",
|
||||
|
@ -80,7 +81,7 @@
|
|||
},
|
||||
{
|
||||
"Type": "Multiply",
|
||||
"Value": 2,
|
||||
"Value": 5,
|
||||
"Source": "superbwarfare:vehicle_strike"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"MaxHealth": 250,
|
||||
"MaxEnergy": 5000000,
|
||||
"UpStep": 1.5,
|
||||
"Mass": 13.6,
|
||||
"DamageModifiers": [
|
||||
{
|
||||
"Type": "Multiply",
|
||||
|
@ -80,7 +81,7 @@
|
|||
},
|
||||
{
|
||||
"Type": "Multiply",
|
||||
"Value": 10,
|
||||
"Value": 6,
|
||||
"Source": "superbwarfare:vehicle_strike"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"ID": "superbwarfare:mk_42",
|
||||
"MaxHealth": 350,
|
||||
"Mass": 61.4,
|
||||
"DamageModifiers": [
|
||||
{
|
||||
"Type": "Multiply",
|
||||
|
@ -78,7 +79,7 @@
|
|||
},
|
||||
{
|
||||
"Type": "Multiply",
|
||||
"Value": 10,
|
||||
"Value": 5,
|
||||
"Source": "superbwarfare:vehicle_strike"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"ID": "superbwarfare:mle_1934",
|
||||
"MaxHealth": 350,
|
||||
"Mass": 100,
|
||||
"DamageModifiers": [
|
||||
{
|
||||
"Type": "Multiply",
|
||||
|
@ -78,7 +79,7 @@
|
|||
},
|
||||
{
|
||||
"Type": "Multiply",
|
||||
"Value": 10,
|
||||
"Value": 5,
|
||||
"Source": "superbwarfare:vehicle_strike"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"ID": "superbwarfare:mortar",
|
||||
"MaxHealth": 100
|
||||
"MaxHealth": 100,
|
||||
"Mass": 0.05
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
"MaxHealth": 400,
|
||||
"MaxEnergy": 20000000,
|
||||
"UpStep": 2.25,
|
||||
"Mass": 25,
|
||||
"DamageModifiers": [
|
||||
{
|
||||
"Type": "Multiply",
|
||||
|
@ -85,7 +86,7 @@
|
|||
},
|
||||
{
|
||||
"Type": "Multiply",
|
||||
"Value": 4.5,
|
||||
"Value": 5,
|
||||
"Source": "superbwarfare:vehicle_strike"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"ID": "superbwarfare:speedboat",
|
||||
"MaxHealth": 200,
|
||||
"MaxEnergy": 500000,
|
||||
"Mass": 0.7,
|
||||
"DamageModifiers": [
|
||||
{
|
||||
"Type": "Multiply",
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"MaxHealth": 40,
|
||||
"MaxEnergy": 100000,
|
||||
"UpStep": 0.5,
|
||||
"Mass": 0.02,
|
||||
"AllowFreeCam": true,
|
||||
"DamageModifiers": [
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"MaxHealth": 30,
|
||||
"MaxEnergy": 24000,
|
||||
"UpStep": 1.1,
|
||||
"Mass": 0.03,
|
||||
"DamageModifiers": [
|
||||
{
|
||||
"Type": "Multiply",
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"MaxHealth": 500,
|
||||
"MaxEnergy": 20000000,
|
||||
"UpStep": 2.25,
|
||||
"Mass": 70,
|
||||
"DamageModifiers": [
|
||||
{
|
||||
"Type": "Immunity",
|
||||
|
@ -33,12 +34,13 @@
|
|||
"Source": "#superbwarfare:projectile"
|
||||
},
|
||||
{
|
||||
"Type": "Immunity",
|
||||
"Source": "superbwarfare:vehicle_strike"
|
||||
"Type": "Multiply",
|
||||
"Value": 0.2
|
||||
},
|
||||
{
|
||||
"Type": "Multiply",
|
||||
"Value": 0.2
|
||||
"Value": 2.5,
|
||||
"Source": "superbwarfare:vehicle_strike"
|
||||
},
|
||||
{
|
||||
"Type": "Multiply",
|
||||
|
|
Loading…
Add table
Reference in a new issue