mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
added areaSensor to doll and not allowing client to update position when another player is nearby
This commit is contained in:
parent
e7f4b6043d
commit
b500ef436d
5 changed files with 78 additions and 18 deletions
|
|
@ -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.')
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue