-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathboom.js
More file actions
19 lines (14 loc) · 795 Bytes
/
boom.js
File metadata and controls
19 lines (14 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function boom (params, player){
var strength = 5; // sets a default value for the strength of the explosion
if(params.length > 0){ // if there are parameters, take the first as the strength
strength = parseInt(params[0]); // converts the first parameter to an integer value.
if(strength <= 0) strength = 5; // if that value is 0 or less, it's set to the default of 5
}
var d = new Drone(player.location); // create a drone at the player's location
d.fwd(5); // send the drone forward 5
var loc = d.getLocation(); // get the full 3D location of the drone as a location object
// the location object contains a reference to a world object which has a
// createExplosion method. We'll invoke it.
loc.world.createExplosion(d.x, d.y, d.z, strength, false, true);
}
command ( boom )