Try number 42.

This commit is contained in:
azastrael 2015-12-06 04:13:30 +01:00
parent 284cdc73fa
commit 3849de3aa3
2 changed files with 9 additions and 7 deletions

View file

@ -17,19 +17,16 @@ module.exports.player = (player, serv) => {
if(!(player_from = serv.getPlayer(args[0])) || !(player_to = serv.getPlayer(args[1])))
return false;
player_from.position = new Vec3(player_to.position.x, player_to.position.y, player_to.position.z);
player_from.sendPosition();
player_from.teleport(player_to.position.clone());
} else if(args.length === 3) {
player.position = new Vec3(args[0]*32, args[1]*32, args[2]*32);
player.sendPosition();
player.teleport(new Vec3(args[0]*32, args[1]*32, args[2]*32));
} else if(args.length === 4) {
let player_from;
if(!(player_from = serv.getPlayer(args[0])))
return false;
player_from.position = new Vec3(args[1]*32, args[2]*32, args[3]*32);
player_from.sendPosition();
player_from.teleport(new Vec3(args[1]*32, args[2]*32, args[3]*32));
}
}
});

View file

@ -97,6 +97,11 @@ module.exports.player=function(player)
flags: 0x00
});
};
player.teleport = (position) => {
player.sendRelativePositionChange(position, false);
player.sendPosition();
}
};
module.exports.entity=function(entity,serv){
@ -157,4 +162,4 @@ module.exports.entity=function(entity,serv){
else z = Math.max(-max.z, Math.min(max.z, current.z + newVel.z));
return new Vec3(x, y, z);
}
};
};