mirror of
https://github.com/danbulant/flying-squid
synced 2026-07-06 19:50:40 +00:00
add /spawnObject <id>
This commit is contained in:
parent
d87e9a3a31
commit
3b46fc348f
1 changed files with 19 additions and 1 deletions
|
|
@ -73,7 +73,7 @@ module.exports.server=function(serv,options) {
|
||||||
module.exports.player=function(player,serv){
|
module.exports.player=function(player,serv){
|
||||||
player.commands.add({
|
player.commands.add({
|
||||||
base: 'spawn',
|
base: 'spawn',
|
||||||
info: 'Spawn an entity',
|
info: 'Spawn a mob',
|
||||||
usage: '/spawn <entity_id>',
|
usage: '/spawn <entity_id>',
|
||||||
parse(str) {
|
parse(str) {
|
||||||
var results=str.match(/(\d+)/);
|
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 <entity_id>',
|
||||||
|
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({
|
player.commands.add({
|
||||||
base: 'summon',
|
base: 'summon',
|
||||||
info: 'Summon an entity',
|
info: 'Summon an entity',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue