forked from 0ad/0ad
Fix some issues with capturing and miraged entities
This was SVN commit r16564.
This commit is contained in:
parent
6c7eb93e1c
commit
d08fdf43d7
@ -238,10 +238,6 @@ Attack.prototype.GetRestrictedClasses = function(type)
|
||||
|
||||
Attack.prototype.CanAttack = function(target)
|
||||
{
|
||||
var cmpArmour = Engine.QueryInterface(target, IID_DamageReceiver);
|
||||
if (!cmpArmour)
|
||||
return false;
|
||||
|
||||
var cmpFormation = Engine.QueryInterface(target, IID_Formation);
|
||||
if (cmpFormation)
|
||||
return true;
|
||||
|
@ -1714,9 +1714,15 @@ GuiInterface.prototype.CanCapture = function(player, data)
|
||||
if (!cmpAttack)
|
||||
return false;
|
||||
|
||||
var cmpPlayer = QueryOwnerInterface(data.entity);
|
||||
var cmpCapturable = Engine.QueryInterface(data.target, IID_Capturable);
|
||||
if (cmpCapturable && cmpCapturable.CanCapture(cmpPlayer.GetPlayerID()) && cmpAttack.GetAttackTypes().indexOf("Capture") != -1)
|
||||
var owner = QueryOwnerInterface(data.entity).GetPlayerID();
|
||||
|
||||
var cmp = Engine.QueryInterface(data.target, IID_Mirage);
|
||||
if (cmp && !cmp.Capturable())
|
||||
return false
|
||||
else if (!cmp)
|
||||
var cmp = Engine.QueryInterface(data.target, IID_Capturable);
|
||||
|
||||
if (cmp && cmp.CanCapture(owner) && cmpAttack.GetAttackTypes().indexOf("Capture") != -1)
|
||||
return cmpAttack.CanAttack(data.target);
|
||||
|
||||
return false;
|
||||
|
@ -122,6 +122,8 @@ Mirage.prototype.GetCapturePoints = function()
|
||||
return this.capturePoints;
|
||||
};
|
||||
|
||||
Mirage.prototype.CanCapture = Capturable.prototype.CanCapture;
|
||||
|
||||
// ResourceSupply data
|
||||
|
||||
Mirage.prototype.CopyResourceSupply = function(maxAmount, amount, type, isInfinite)
|
||||
|
Loading…
Reference in New Issue
Block a user