mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-07-05 17:30:44 +08:00
Updated GarageServer.IO API calls to support client side prediction for entities - #20
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user