v0.7.1: made adjustments to cut down on SFX spam from some traps
This commit is contained in:
committed by
Evan Debenham
parent
bf5e12e9d3
commit
a7f1174bb9
+9
-1
@@ -51,6 +51,7 @@ public class FlockTrap extends Trap {
|
|||||||
protected boolean act() {
|
protected boolean act() {
|
||||||
PathFinder.buildDistanceMap( pos, BArray.not( Dungeon.level.solid, null ), 2 );
|
PathFinder.buildDistanceMap( pos, BArray.not( Dungeon.level.solid, null ), 2 );
|
||||||
for (int i = 0; i < PathFinder.distance.length; i++) {
|
for (int i = 0; i < PathFinder.distance.length; i++) {
|
||||||
|
Trap t;
|
||||||
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
|
if (PathFinder.distance[i] < Integer.MAX_VALUE) {
|
||||||
if (Dungeon.level.insideMap(i)
|
if (Dungeon.level.insideMap(i)
|
||||||
&& Actor.findChar(i) == null
|
&& Actor.findChar(i) == null
|
||||||
@@ -58,9 +59,16 @@ public class FlockTrap extends Trap {
|
|||||||
Sheep sheep = new Sheep();
|
Sheep sheep = new Sheep();
|
||||||
sheep.lifespan = Random.NormalIntRange(3 + Dungeon.depth/4, 6 + Dungeon.depth/2 );
|
sheep.lifespan = Random.NormalIntRange(3 + Dungeon.depth/4, 6 + Dungeon.depth/2 );
|
||||||
sheep.pos = i;
|
sheep.pos = i;
|
||||||
Dungeon.level.press(sheep.pos, sheep);
|
|
||||||
GameScene.add(sheep);
|
GameScene.add(sheep);
|
||||||
CellEmitter.get(i).burst(Speck.factory(Speck.WOOL), 4);
|
CellEmitter.get(i).burst(Speck.factory(Speck.WOOL), 4);
|
||||||
|
//before the tile is pressed, directly trigger traps to avoid sfx spam
|
||||||
|
if ((t = Dungeon.level.traps.get(i)) != null && t.active){
|
||||||
|
t.disarm();
|
||||||
|
t.reveal();
|
||||||
|
t.activate();
|
||||||
|
}
|
||||||
|
Dungeon.level.press(sheep.pos, sheep);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-1
@@ -86,9 +86,15 @@ public class SummoningTrap extends Trap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//important to process the visuals and pressing of cells last, so spawned mobs have a chance to occupy cells first
|
//important to process the visuals and pressing of cells last, so spawned mobs have a chance to occupy cells first
|
||||||
|
Trap t;
|
||||||
for (Mob mob : mobs){
|
for (Mob mob : mobs){
|
||||||
|
//manually trigger traps first to avoid sfx spam
|
||||||
|
if ((t = Dungeon.level.traps.get(mob.pos)) != null && t.active){
|
||||||
|
t.disarm();
|
||||||
|
t.reveal();
|
||||||
|
t.activate();
|
||||||
|
}
|
||||||
ScrollOfTeleportation.appear(mob, mob.pos);
|
ScrollOfTeleportation.appear(mob, mob.pos);
|
||||||
//so hidden traps are triggered as well
|
|
||||||
Dungeon.level.press(mob.pos, mob, true);
|
Dungeon.level.press(mob.pos, mob, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user