improve input packets
This commit is contained in:
parent
a2a93882f0
commit
d6daed2e9b
5 changed files with 36 additions and 37 deletions
|
@ -31,7 +31,12 @@ class Player {
|
|||
}
|
||||
|
||||
updateInputs(data) {
|
||||
this.ship.updateInputs(data);
|
||||
let input = {};
|
||||
let sanitize = v => {
|
||||
return v.length ? v.map(a => sanitize(a)) : +v || 0;
|
||||
}
|
||||
data.forEach((v, i) => input[this.inputInterface[i]] = sanitize(v));
|
||||
this.ship.updateInputs(input);
|
||||
this.lastAction = Date.now();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue