added areaSensor to doll and not allowing client to update position when another player is nearby

This commit is contained in:
logsol 2014-05-29 20:27:41 +02:00
parent e7f4b6043d
commit b500ef436d
5 changed files with 78 additions and 18 deletions

View file

@ -40,7 +40,7 @@ function(Parent, Nc, Parser, Settings) {
this.player.suicide();
};
PlayerController.prototype.meStateUpdate = function(update) {
PlayerController.prototype.mePositionStateUpdate = function(update) {
if(!this.player.doll) {
console.warn('me state update, even though doll does not exist');
@ -54,10 +54,10 @@ function(Parent, Nc, Parser, Settings) {
if(difference.x < Settings.PUNKBUSTER_DIFFERENCE_METERS
|| difference.y < Settings.PUNKBUSTER_DIFFERENCE_METERS) {
this.player.doll.body.SetAwake(true);
this.player.doll.body.SetPosition(update.p);
this.player.doll.updatePositionState(update.p);
} else {
// HARD UPDATE FOR SELF
console.log(this.player.user.options.nickname + ' is cheating.')
}
};

View file

@ -74,7 +74,14 @@ function (Parent, Item, Box2D, Nc) {
}
}
}
Doll.prototype.updatePositionState = function(positionState) {
if(!this.isAnotherPlayerNearby()) {
this.body.SetAwake(true);
this.body.SetPosition(positionState);
}
};
return Doll;
});