Updated GarageServer.IO API calls to support client side prediction for entities - #20

This commit is contained in:
Jeremiah Billmann
2015-05-20 02:10:07 +00:00
parent 21d8fb2884
commit fbdcfe3da5
12 changed files with 48 additions and 25 deletions
+3 -2
View File
@@ -8,7 +8,7 @@ function EntityController (maxHistorySecondBuffer) {
}
EntityController.prototype = {
add: function (id) {
add: function (id, referrerId) {
var newEntity, entityFound = false;
this.entities.some(function (entity) {
@@ -20,7 +20,8 @@ EntityController.prototype = {
});
if (!entityFound) {
newEntity = new entity(id, this.maxHistorySecondBuffer);
var referrerSeq = this.entities.filter(function (value) { return value.referrerId === referrerId; }).length;
newEntity = new entity(id, referrerId, referrerSeq, this.maxHistorySecondBuffer);
this.entities.push(newEntity);
}
return newEntity;