From 3b46fc348f1b5a524d29ec149fb15940769836b9 Mon Sep 17 00:00:00 2001 From: Romain Beaumont Date: Mon, 16 Nov 2015 23:48:49 +0100 Subject: [PATCH] add /spawnObject --- src/lib/plugins/entities.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/lib/plugins/entities.js b/src/lib/plugins/entities.js index a03506a..032cdb0 100644 --- a/src/lib/plugins/entities.js +++ b/src/lib/plugins/entities.js @@ -73,7 +73,7 @@ module.exports.server=function(serv,options) { module.exports.player=function(player,serv){ player.commands.add({ base: 'spawn', - info: 'Spawn an entity', + info: 'Spawn a mob', usage: '/spawn ', parse(str) { var results=str.match(/(\d+)/); @@ -89,6 +89,24 @@ module.exports.player=function(player,serv){ } }); + player.commands.add({ + base: 'spawnObject', + info: 'Spawn an object', + usage: '/spawnObject ', + parse(str) { + var results=str.match(/(\d+)/); + if (!results) return false; + return { + id: parseInt(results[1]) + } + }, + action({id}) { + serv.spawnObject(id, player.world, player.entity.position.scaled(1/32), { + velocity: Vec3((Math.random() - 0.5) * 10, Math.random()*10 + 10, (Math.random() - 0.5) * 10) + }); + } + }); + player.commands.add({ base: 'summon', info: 'Summon an entity',