添加激光防御塔冷却配置项

This commit is contained in:
Light_Quanta 2025-03-20 18:15:15 +08:00
parent 875148aa0e
commit 8e728df3d5
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
2 changed files with 6 additions and 3 deletions

View file

@ -40,6 +40,7 @@ public class VehicleConfig {
public static ForgeConfigSpec.IntValue ANNIHILATOR_MAX_ENERGY;
public static ForgeConfigSpec.IntValue LASER_TOWER_HP;
public static ForgeConfigSpec.IntValue LASER_TOWER_COOLDOWN;
public static ForgeConfigSpec.IntValue LASER_TOWER_DAMAGE;
public static ForgeConfigSpec.IntValue LASER_TOWER_SHOOT_COST;
public static ForgeConfigSpec.IntValue LASER_TOWER_MAX_ENERGY;
@ -198,6 +199,9 @@ public class VehicleConfig {
builder.comment("The damage of Laser Tower");
LASER_TOWER_DAMAGE = builder.defineInRange("laser_tower_damage", 15, 1, 10000000);
builder.comment("The cooldown time(ticks) of Laser Tower");
LASER_TOWER_COOLDOWN = builder.defineInRange("laser_tower_cooldown", 40, 15, 10000000);
builder.comment("The energy cost of Laser Tower per shoot");
LASER_TOWER_SHOOT_COST = builder.defineInRange("laser_tower_shoot_cost", 5000, 0, 2147483647);

View file

@ -251,7 +251,7 @@ public class LaserTowerEntity extends EnergyVehicleEntity implements GeoEntity,
}
public void autoAim() {
if (this.getEnergy() <= 0 || !entityData.get(ACTIVE) || this.entityData.get(COOL_DOWN) > 30) {
if (this.getEnergy() <= 0 || !entityData.get(ACTIVE)) {
return;
}
@ -296,8 +296,7 @@ public class LaserTowerEntity extends EnergyVehicleEntity implements GeoEntity,
}
if (this.entityData.get(COOL_DOWN) == 0 && VectorTool.calculateAngle(getViewVector(1), targetVec) < 1 && checkNoClip(target)) {
this.entityData.set(COOL_DOWN, 40);
this.entityData.set(COOL_DOWN, VehicleConfig.LASER_TOWER_COOLDOWN.get());
if (level() instanceof ServerLevel serverLevel) {
this.level().playSound(this, getOnPos(), ModSounds.LASER_TOWER_SHOOT.get(), SoundSource.PLAYERS, 2, random.nextFloat() * 0.1f + 1);