Ykkrosh
dd809f83e8
Simplify the format a bit. Use less <interleave> in the RNG so that error reports become understandable. Fixes #491. This was SVN commit r7478.
31 lines
714 B
JavaScript
31 lines
714 B
JavaScript
function PlayerManager() {}
|
|
|
|
PlayerManager.prototype.Schema =
|
|
"<a:component type='system'/><empty/>";
|
|
|
|
PlayerManager.prototype.Init = function()
|
|
{
|
|
this.playerEntities = []; // list of player entity IDs
|
|
};
|
|
|
|
PlayerManager.prototype.AddPlayer = function(ent)
|
|
{
|
|
var id = this.playerEntities.length;
|
|
Engine.QueryInterface(ent, IID_Player).SetPlayerID(id);
|
|
this.playerEntities.push(ent);
|
|
return id;
|
|
};
|
|
|
|
PlayerManager.prototype.GetPlayerByID = function(id)
|
|
{
|
|
return this.playerEntities[id];
|
|
// TODO: report error message if invalid id
|
|
};
|
|
|
|
PlayerManager.prototype.GetNumPlayers = function()
|
|
{
|
|
return this.playerEntities.length;
|
|
};
|
|
|
|
Engine.RegisterComponentType(IID_PlayerManager, "PlayerManager", PlayerManager);
|