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
|
|
@ -54,7 +54,7 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Nc, reque
|
|||
|
||||
if(this.me) {
|
||||
this.me.update();
|
||||
this.localMePositionUpdate();
|
||||
this.mePositionStateUpdate();
|
||||
}
|
||||
|
||||
for (var i = 0; i < this.gameObjects.animated.length; i++) {
|
||||
|
|
@ -66,9 +66,9 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Nc, reque
|
|||
DomController.statsEnd();
|
||||
}
|
||||
|
||||
GameController.prototype.localMePositionUpdate = function() {
|
||||
if(this.me.isStateUpdateNeeded()) {
|
||||
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, "meStateUpdate", this.me.getStateUpdate());
|
||||
GameController.prototype.mePositionStateUpdate = function() {
|
||||
if(this.me.isPositionStateUpdateNeeded()) {
|
||||
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, "mePositionStateUpdate", this.me.getPositionStateUpdate());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -119,8 +119,10 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Nc, reque
|
|||
|
||||
if (gameObject instanceof Doll) {
|
||||
if(gameObject === this.me.doll) {
|
||||
this.me.setLastServerState(update);
|
||||
continue; // this is to ignore own doll updates from world update
|
||||
this.me.setLastServerPositionState(update);
|
||||
if(!this.me.acceptPositionStateUpdateFromServer()) {
|
||||
continue; // this is to ignore own doll updates from world update
|
||||
}
|
||||
}
|
||||
gameObject.setActionState(update.as);
|
||||
gameObject.lookAt(update.laxy.x, update.laxy.y);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue