Just in case an OXP has deleted a standard role.
This commit is contained in:
parent
d5093e2412
commit
622874c444
@ -344,9 +344,31 @@ this.startUp = function()
|
||||
}
|
||||
}
|
||||
|
||||
// just in case a role has been defined out by OXP
|
||||
this.$roleFallbacks = {
|
||||
"asteroid" : "[asteroid]",
|
||||
"boulder" : "[boulder]",
|
||||
"splinter" : "[splinter]",
|
||||
"police" : "[viper]",
|
||||
"missile" : "[missile]",
|
||||
"energy-bomb" : "[qbomb]"
|
||||
};
|
||||
|
||||
this._addShips = function(role,num,pos,rad)
|
||||
{
|
||||
var arr = system.addShips(role,num,pos,rad);
|
||||
if (!arr || arr.length == 0)
|
||||
{
|
||||
role = this.$roleFallbacks[role];
|
||||
if (role)
|
||||
{
|
||||
arr = system.addShips(role,num,pos,rad);
|
||||
}
|
||||
}
|
||||
if (!arr || arr.length == 0)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
this.$shipList = this.$shipList.concat(arr);
|
||||
return arr;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user