mirror of
https://github.com/danbulant/flying-squid
synced 2026-07-07 04:00:46 +00:00
add a /summonMany command, useful for testing
This commit is contained in:
parent
02eed8229f
commit
5940f91fce
1 changed files with 25 additions and 0 deletions
|
|
@ -127,6 +127,31 @@ module.exports.player=function(player,serv){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
player.commands.add({
|
||||||
|
base: 'summonMany',
|
||||||
|
info: 'Summon many entities',
|
||||||
|
usage: '/summonMany <number> <entity_name>',
|
||||||
|
op: true,
|
||||||
|
parse(str) {
|
||||||
|
var args=str.split(" ");
|
||||||
|
if(args.length!=2)
|
||||||
|
return false;
|
||||||
|
return {number:args[0],name:args[1]};
|
||||||
|
},
|
||||||
|
action({number,name}) {
|
||||||
|
const entity=entitiesByName[name];
|
||||||
|
if(!entity) {
|
||||||
|
player.chat("No entity named "+name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let s=Math.floor(Math.sqrt(number));
|
||||||
|
for(let i=0;i<number;i++)
|
||||||
|
serv.spawnMob(entity.id, player.world, player.position.scaled(1/32).offset(Math.floor(i/s*10),0,i%s*10), {
|
||||||
|
velocity: Vec3((Math.random() - 0.5) * 10, Math.random()*10 + 10, (Math.random() - 0.5) * 10)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
player.commands.add({
|
player.commands.add({
|
||||||
base: 'pile',
|
base: 'pile',
|
||||||
info: 'make a pile of entities',
|
info: 'make a pile of entities',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue