mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-20 15:01:17 +00:00
sendRelativePositionChange needs to be async because of behavior use
not sure if that behavior thingy has its place in that function, I think 'move' is not really a behavior at all. 'letPlayerMove' would be a normal behavior and it would be in sendRelativePositionChange. Making plugins able to break function is not at all a good idea imho.
This commit is contained in:
parent
bb75c6c1a0
commit
6ab320e3bc
1 changed files with 5 additions and 5 deletions
|
|
@ -52,10 +52,10 @@ module.exports.player=function(player)
|
|||
});
|
||||
|
||||
player.sendRelativePositionChange = (newPosition, onGround) => {
|
||||
player.behavior('move', {
|
||||
return player.behavior('move', {
|
||||
onGround: onGround,
|
||||
position: newPosition
|
||||
}, () => {
|
||||
}, async () => {
|
||||
if (player.position.distanceTo(new Vec3(0, 0, 0)) != 0) {
|
||||
var diff = newPosition.minus(player.position);
|
||||
if(diff.abs().x>127 || diff.abs().y>127 || diff.abs().z>127)
|
||||
|
|
@ -85,7 +85,7 @@ module.exports.player=function(player)
|
|||
}, () => {
|
||||
player.sendPosition();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
player.sendPosition = () => {
|
||||
player._client.write('position', {
|
||||
|
|
@ -98,8 +98,8 @@ module.exports.player=function(player)
|
|||
});
|
||||
};
|
||||
|
||||
player.teleport = (position) => {
|
||||
player.sendRelativePositionChange(position, false);
|
||||
player.teleport = async (position) => {
|
||||
await player.sendRelativePositionChange(position, false);
|
||||
player.sendPosition();
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue