From a366576031cf78af8e5138c5fee2fbdf4511fbf2 Mon Sep 17 00:00:00 2001 From: Jeremiah Billmann Date: Sat, 6 Jul 2013 13:49:30 -0400 Subject: [PATCH] Moved id into base entity --- client/garageserver.io.js | 7 +++---- lib/server/entities/entity.js | 4 ++-- lib/server/entities/player.js | 3 +-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/client/garageserver.io.js b/client/garageserver.io.js index 9df433c..7c69929 100644 --- a/client/garageserver.io.js +++ b/client/garageserver.io.js @@ -81,9 +81,9 @@ window.GarageServerIO = (function (window, socketio) { this.time = time; } - function Entity() { + function Entity(id) { this.updates = []; - this.id; + this.id = id; this.currentState = {}; } Entity.prototype = { @@ -133,8 +133,7 @@ window.GarageServerIO = (function (window, socketio) { }; function Player(id) { - Entity.call(this); - this.id = id; + Entity.call(this, id); } Player.prototype = Object.create(Entity.prototype); diff --git a/lib/server/entities/entity.js b/lib/server/entities/entity.js index 6dadc65..f6c3c14 100644 --- a/lib/server/entities/entity.js +++ b/lib/server/entities/entity.js @@ -1,9 +1,9 @@ exports = module.exports = Entity; -function Entity () { +function Entity (id) { this.state; this.sequence = 1; - this.id; + this.id = id; this.stateHistory = []; } diff --git a/lib/server/entities/player.js b/lib/server/entities/player.js index 87a78bf..4131413 100644 --- a/lib/server/entities/player.js +++ b/lib/server/entities/player.js @@ -3,9 +3,8 @@ var Entity = require('./entity'); exports = module.exports = Player; function Player (client) { - Entity.call(this); + Entity.call(this, client.id); this.client = client; - this.id = client.id; this.inputs = []; }