mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
fixes position state update and removes dev graphs for better fps
This commit is contained in:
parent
db95465208
commit
a8adbcf140
6 changed files with 55 additions and 29 deletions
|
|
@ -52,7 +52,7 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Nc, reque
|
|||
|
||||
if(this.me) {
|
||||
this.me.update();
|
||||
this.mePositionStateUpdate();
|
||||
this.mePositionStateOverride();
|
||||
}
|
||||
|
||||
//for (var uid in this.gameObjects.animated) {
|
||||
|
|
@ -65,9 +65,13 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Nc, reque
|
|||
DomController.fpsStep();
|
||||
};
|
||||
|
||||
GameController.prototype.mePositionStateUpdate = function() {
|
||||
if(this.me.isPositionStateUpdateNeeded()) {
|
||||
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, "mePositionStateUpdate", this.me.getPositionStateUpdate());
|
||||
GameController.prototype.mePositionStateOverride = function() {
|
||||
if(this.me.isPositionStateOverrideNeeded()) {
|
||||
Nc.trigger(
|
||||
Nc.ns.client.to.server.gameCommand.send,
|
||||
"mePositionStateOverride",
|
||||
this.me.getPositionStateOverride()
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -126,6 +130,17 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Nc, reque
|
|||
};
|
||||
*/
|
||||
|
||||
GameController.prototype.updateGameObject = function (gameObject, gameObjectUpdate) {
|
||||
if(gameObject === this.me.doll) {
|
||||
this.me.setLastServerPositionState(gameObjectUpdate);
|
||||
if(!this.me.acceptPositionStateUpdateFromServer()) {
|
||||
return; // this is to ignore own doll updates from world update
|
||||
}
|
||||
}
|
||||
|
||||
Parent.prototype.updateGameObject.call(this, gameObject, gameObjectUpdate);
|
||||
}
|
||||
|
||||
GameController.prototype.createMe = function(user) {
|
||||
this.me = new Me(user.id, this.physicsEngine, user);
|
||||
this.players[user.id] = this.me;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue