Adds forward walking on shift

The state of the shift modifier is now distributed across the
network. Walking speeds and animation states are being updated
according to it.

Fixes #130
This commit is contained in:
logsol 2016-10-09 19:56:06 +02:00
parent 062402db58
commit b798e6acac
5 changed files with 39 additions and 9 deletions

View file

@ -216,6 +216,7 @@ function (Parent, KeyboardInput, DomController, Settings, Swiper) {
KeyboardAndMouse.prototype.activateModifier = function() {
this.modifier = true;
this.playerController.activateModifier();
};
KeyboardAndMouse.prototype.deactivateModifier = function() {
@ -223,6 +224,7 @@ function (Parent, KeyboardInput, DomController, Settings, Swiper) {
this.x = this.lastLookDirection * Settings.VIEWPORT_LOOK_AHEAD;
this.y = 0;
this.onXyChange(this.x, this.y);
this.playerController.deactivateModifier();
};
return KeyboardAndMouse;

View file

@ -98,6 +98,18 @@ function (Parent, Nc, KeyboardAndMouse, Gamepad, PointerLockManager) {
Nc.trigger(Nc.ns.client.game.zoomReset, false);
};
PlayerController.prototype.activateModifier = function() {
if (!this.isPlayerInputAllowed()) return;
Parent.prototype.activateModifier.call(this);
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, "activateModifier");
};
PlayerController.prototype.deactivateModifier = function() {
if (!this.isPlayerInputAllowed()) return;
Parent.prototype.deactivateModifier.call(this);
Nc.trigger(Nc.ns.client.to.server.gameCommand.send, "deactivateModifier");
};
/*
* Client overwrite - allow player input if PointerLock is locked to canvas
* and is not in between games