mirror of
https://github.com/darksaid98/SiegeEngines.git
synced 2026-12-01 14:38:55 +00:00
feat: more config options for projectiles
This commit is contained in:
1 parent
629211c8dc
commit
082d6e4087
6 files changed
+30
-10
No files matched your search
@@ -23,6 +23,7 @@ import com.github.alathra.siegeengines.projectile.FireworkProjectile;
|
||||
import com.github.alathra.siegeengines.projectile.ProjectileType;
|
||||
import com.github.alathra.siegeengines.projectile.SiegeEngineProjectile;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class Config {
|
||||
|
||||
private static FileConfiguration config;
|
||||
@@ -257,6 +258,8 @@ public class Config {
|
||||
.getInt("Projectiles." + projectileName + ".ProjectileCount");
|
||||
explosiveProjectile.soundType = Sound
|
||||
.valueOf(config.getString("Projectiles." + projectileName + ".FireSound"));
|
||||
explosiveProjectile.velocityFactor = (float) config
|
||||
.getDouble("Projectiles." + projectileName + ".VelocityFactor");
|
||||
projectileMap.put(projectileName, explosiveProjectile);
|
||||
break;
|
||||
case ENTITY:
|
||||
@@ -269,6 +272,12 @@ public class Config {
|
||||
.valueOf(config.getString("Projectiles." + projectileName + ".EntityType"));
|
||||
entityProjectile.soundType = Sound
|
||||
.valueOf(config.getString("Projectiles." + projectileName + ".FireSound"));
|
||||
entityProjectile.velocityFactor = (float) config
|
||||
.getDouble("Projectiles." + projectileName + ".VelocityFactor");
|
||||
if (entityProjectile.entityType.equals(EntityType.ARROW)) {
|
||||
entityProjectile.arrowDamageFactor = (float) config
|
||||
.getDouble("Projectiles." + projectileName + ".ArrowDamageFactor");
|
||||
}
|
||||
projectileMap.put(projectileName, entityProjectile);
|
||||
break;
|
||||
case FIREWORK:
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.github.alathra.siegeengines.SiegeEnginesUtil;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
@@ -26,6 +25,8 @@ public class EntityProjectile extends SiegeEngineProjectile {
|
||||
public float inaccuracy = 0.2f;
|
||||
public Particle particleType = Particle.CAMPFIRE_SIGNAL_SMOKE;
|
||||
public Sound soundType = Sound.ENTITY_GENERIC_EXPLODE;
|
||||
public float velocityFactor = 1.0f;
|
||||
public float arrowDamageFactor = 1.0f;
|
||||
|
||||
private boolean playSound = true;
|
||||
|
||||
@@ -43,10 +44,10 @@ public class EntityProjectile extends SiegeEngineProjectile {
|
||||
if (delayedFire) {
|
||||
baseDelay += delayTime;
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(SiegeEngines.getInstance(), () -> {
|
||||
CreateEntity(entity, FireLocation, velocity, player);
|
||||
CreateEntity(entity, FireLocation, velocity*velocityFactor, player);
|
||||
}, (long) baseDelay);
|
||||
} else {
|
||||
CreateEntity(entity, FireLocation, velocity, player);
|
||||
CreateEntity(entity, FireLocation, velocity*velocityFactor, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,7 +70,7 @@ public class EntityProjectile extends SiegeEngineProjectile {
|
||||
}
|
||||
if (arrow instanceof Arrow) {
|
||||
Arrow arr = (Arrow) arrow;
|
||||
arr.setDamage(8);
|
||||
arr.setDamage(8*arrowDamageFactor);
|
||||
if (player instanceof org.bukkit.projectiles.ProjectileSource) {
|
||||
arr.setShooter((org.bukkit.projectiles.ProjectileSource) player);
|
||||
arr.setPickupStatus(org.bukkit.entity.AbstractArrow.PickupStatus.CREATIVE_ONLY);
|
||||
|
||||
@@ -29,6 +29,7 @@ public class ExplosiveProjectile extends SiegeEngineProjectile {
|
||||
public Particle particleType = Particle.EXPLOSION_LARGE;
|
||||
public Sound soundType = Sound.ENTITY_GENERIC_EXPLODE;
|
||||
public Boolean alertOnLanding = false;
|
||||
public float velocityFactor = 1.0f;
|
||||
|
||||
private boolean playSound = true;
|
||||
|
||||
@@ -44,10 +45,10 @@ public class ExplosiveProjectile extends SiegeEngineProjectile {
|
||||
if (delayedFire) {
|
||||
baseDelay += delayTime;
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(SiegeEngines.getInstance(), () -> {
|
||||
CreateEntity(entity, loc, velocity, player);
|
||||
CreateEntity(entity, loc, velocity*velocityFactor, player);
|
||||
}, (long) baseDelay);
|
||||
} else {
|
||||
CreateEntity(entity, loc, velocity, player);
|
||||
CreateEntity(entity, loc, velocity*velocityFactor, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class FireworkProjectile extends SiegeEngineProjectile {
|
||||
public float inaccuracy = 0.125f;
|
||||
public Particle particleType = Particle.FLASH;
|
||||
public Sound soundType = Sound.ENTITY_FIREWORK_ROCKET_BLAST_FAR;
|
||||
public float velocityFactor = 0.5f;
|
||||
public float velocityFactor = 1.0f;
|
||||
|
||||
private boolean playSound = true;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class FireworkProjectile extends SiegeEngineProjectile {
|
||||
CreateEntity(entity, FireLocation, velocity*velocityFactor, player);
|
||||
}, (long) baseDelay);
|
||||
} else {
|
||||
CreateEntity(entity, FireLocation, velocity, player);
|
||||
CreateEntity(entity, FireLocation, velocity*velocityFactor, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user