Skip to content
This repository
Browse code

Merge #468 from @sdab - railgun tweaks

  • Loading branch information...
commit b8d922ae5fb2e92e600a0ff89b9f7cfba6a17ff5 2 parents 4e8d1d4 + 6d1e874
Rasmus Praestholm authored
11  src/main/java/org/terasology/componentSystem/action/TunnelAction.java
@@ -19,11 +19,7 @@
19 19
 
20 20
 import org.terasology.components.actions.TunnelActionComponent;
21 21
 import org.terasology.entityFactory.DroppedBlockFactory;
22  
-import org.terasology.entitySystem.EntityManager;
23  
-import org.terasology.entitySystem.EntityRef;
24  
-import org.terasology.entitySystem.EventHandlerSystem;
25  
-import org.terasology.entitySystem.ReceiveEvent;
26  
-import org.terasology.entitySystem.RegisterComponentSystem;
  22
+import org.terasology.entitySystem.*;
27 23
 import org.terasology.events.ActivateEvent;
28 24
 import org.terasology.game.CoreRegistry;
29 25
 import org.terasology.math.Vector3i;
@@ -61,7 +57,7 @@ public void initialise() {
61 57
     public void shutdown() {
62 58
     }
63 59
 
64  
-    @ReceiveEvent(components = TunnelActionComponent.class)
  60
+    @ReceiveEvent(components = TunnelActionComponent.class, priority = EventPriority.PRIORITY_HIGH)
65 61
     public void onActivate(ActivateEvent event, EntityRef entity) {
66 62
 
67 63
         Vector3f dir = new Vector3f(event.getDirection());
@@ -111,5 +107,8 @@ public void onActivate(ActivateEvent event, EntityRef entity) {
111 107
                 }
112 108
             }
113 109
         }
  110
+        //If no blocks were destroyed, cancel the event
  111
+        if(blockCounter == MAX_DESTROYED_BLOCKS)
  112
+            event.cancel();
114 113
     }
115 114
 }

0 notes on commit b8d922a

Please sign in to comment.
Something went wrong with that request. Please try again.