Skip to content

Commit

Permalink
WE fix some things
Browse files Browse the repository at this point in the history
Fixed error being thrown when launcher isn't placed on green concrete
Made success rate configurable and not be a 10% chance.
  • Loading branch information
koiboi-dev committed Feb 23, 2023
1 parent a561310 commit 8ced547
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private void blockDispense(BlockDispenseEvent blockDispenseEvent, Dispenser disp
TileState state = (TileState)dispenser.getBlock().getState();
PersistentDataContainer cont = state.getPersistentDataContainer();

if (cont.get(new NamespacedKey(MissileWarfare.getInstance(), "canfire"), PersistentDataType.INTEGER) != 1){
if (cont.has(new NamespacedKey(MissileWarfare.getInstance(), "canfire"), PersistentDataType.INTEGER) && cont.get(new NamespacedKey(MissileWarfare.getInstance(), "canfire"), PersistentDataType.INTEGER) != 1){
MissileWarfare.getInstance().getServer().broadcastMessage("Missile at : "+dispenser.getBlock().getLocation().toVector() +" Is unable to fire: Missing GREEN_CONCRETE Below");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,17 @@ public void Update(BukkitRunnable run, MissileController other){
world.spawnParticle(Particle.CAMPFIRE_COSY_SMOKE, pos.toLocation(world), 0, 0, 0, 0, 0.1, null, true);
world.spawnParticle(Particle.CAMPFIRE_COSY_SMOKE, (pos.toLocation(world).subtract(velocity.divide(new Vector(2,2,2)))), 0, 0, 0, 0, 0.1, null, true);
if (target.distanceSquared(pos) < (speed*speed)*1.1){
if (Math.random()>0.1){
if (Math.random()>MissileWarfare.getInstance().getConfig().getDouble("AA-missile-success")){
run.cancel();
return;
}
explode(run);
for (int i = 0; i < 40; i++) {
world.spawnParticle(Particle.CAMPFIRE_COSY_SMOKE, pos.toLocation(world), 0, Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5, 0.1, null, true);
world.spawnParticle(Particle.FLAME, pos.toLocation(world), 0, Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5, 0.1, null,true);
}
if (other.update != null) {
other.explode(other.update);
explode(run);
for (int i = 0; i < 40; i++) {
world.spawnParticle(Particle.CAMPFIRE_COSY_SMOKE, pos.toLocation(world), 0, Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5, 0.1, null, true);
world.spawnParticle(Particle.FLAME, pos.toLocation(world), 0, Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5, 0.1, null,true);
}
run.cancel();
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ saved-packs:
- pack-TW
- pack-FR

# chance for anti missile missile to successfully fire.
AA-missile-success: 0.6

logging:
# Sends a message to console on missile shot :O
logMissileShots: true
Expand Down

0 comments on commit 8ced547

Please sign in to comment.