Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Bugfix for #198 #468

Merged
merged 1 commit into from

2 participants

@sdab

Fixed a bug in the railgun tool. TunnelAction now cancels the activate event if it ends up destroying no blocks. I also increased its priority to HIGH so that PlaySoundAction is lower than it. The result is that an explosion sound will only play if the railgun actually destroys blocks.

See my comment in issue #198 for more detail. Let me know if you need me to change anything in the pull request.

@sdab sdab Fixed a bug in the railgun tool. TunnelAction now cancels the activat…
…e event if it end up destroying no blocks. I also increased its priority to HIGH so that PlaySoundAction is lower than it. The result is that an explosion sound will only play if the railgun actually destroys blocks
6d1e874
@Cervator Cervator referenced this pull request from a commit
@Cervator Cervator Merge #468 from @sdab - railgun tweaks b8d922a
@Cervator Cervator merged commit 6d1e874 into from
@Cervator
Owner

Appreciated - you should introduce yourself in the forum sometime, also a good place to discuss bigger things if you're planning to stay around a while :-)

http://forum.movingblocks.net/forums/contributor-introductions.7/

@sdab sdab deleted the branch
@sdab

Ah, thanks will do.

@Cervator Cervator referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 2, 2013
  1. @sdab

    Fixed a bug in the railgun tool. TunnelAction now cancels the activat…

    sdab authored
    …e event if it end up destroying no blocks. I also increased its priority to HIGH so that PlaySoundAction is lower than it. The result is that an explosion sound will only play if the railgun actually destroys blocks
This page is out of date. Refresh to see the latest.
View
11 src/main/java/org/terasology/componentSystem/action/TunnelAction.java
@@ -19,11 +19,7 @@
import org.terasology.components.actions.TunnelActionComponent;
import org.terasology.entityFactory.DroppedBlockFactory;
-import org.terasology.entitySystem.EntityManager;
-import org.terasology.entitySystem.EntityRef;
-import org.terasology.entitySystem.EventHandlerSystem;
-import org.terasology.entitySystem.ReceiveEvent;
-import org.terasology.entitySystem.RegisterComponentSystem;
+import org.terasology.entitySystem.*;
import org.terasology.events.ActivateEvent;
import org.terasology.game.CoreRegistry;
import org.terasology.math.Vector3i;
@@ -61,7 +57,7 @@ public void initialise() {
public void shutdown() {
}
- @ReceiveEvent(components = TunnelActionComponent.class)
+ @ReceiveEvent(components = TunnelActionComponent.class, priority = EventPriority.PRIORITY_HIGH)
public void onActivate(ActivateEvent event, EntityRef entity) {
Vector3f dir = new Vector3f(event.getDirection());
@@ -111,5 +107,8 @@ public void onActivate(ActivateEvent event, EntityRef entity) {
}
}
}
+ //If no blocks were destroyed, cancel the event
+ if(blockCounter == MAX_DESTROYED_BLOCKS)
+ event.cancel();
}
}
Something went wrong with that request. Please try again.