1
0
forked from 0ad/0ad

Some fixes after the split of turrets.

21e866fcf0
Crossbowmen should be able to turret (noted by @Nescio).
TurretHolders should be able to pick entities up.

Differential revision: D3744
This was SVN commit r25163.
This commit is contained in:
Freagarach 2021-03-30 11:24:08 +00:00
parent fd1d7d5d83
commit 496884ac73
3 changed files with 10 additions and 8 deletions

View File

@ -351,11 +351,11 @@ UnitAI.prototype.UnitFsmSpec = {
},
"Order.PickupUnit": function(msg) {
let cmpGarrisonHolder = Engine.QueryInterface(this.entity, IID_GarrisonHolder);
if (!cmpGarrisonHolder || cmpGarrisonHolder.IsFull())
let cmpHolder = Engine.QueryInterface(this.entity, msg.data.iid);
if (!cmpHolder || cmpHolder.IsFull())
return this.FinishOrder();
let range = cmpGarrisonHolder.GetLoadingRange();
let range = cmpHolder.GetLoadingRange();
msg.data.min = range.min;
msg.data.max = range.max;
if (this.CheckRange(msg.data))
@ -1116,7 +1116,7 @@ UnitAI.prototype.UnitFsmSpec = {
if (cmpHolder && cmpHolder.CanPickup(this.entity))
{
this.pickup = this.order.data.target; // temporary, deleted in "leave"
Engine.PostMessage(this.pickup, MT_PickupRequested, { "entity": this.entity });
Engine.PostMessage(this.pickup, MT_PickupRequested, { "entity": this.entity, "iid": this.order.data.garrison ? IID_GarrisonHolder : IID_TurretHolder });
}
return false;
},
@ -3230,7 +3230,7 @@ UnitAI.prototype.UnitFsmSpec = {
if (cmpHolder && cmpHolder.CanPickup(this.entity))
{
this.pickup = this.order.data.target;
Engine.PostMessage(this.pickup, MT_PickupRequested, { "entity": this.entity });
Engine.PostMessage(this.pickup, MT_PickupRequested, { "entity": this.entity, "iid": this.order.data.garrison ? IID_GarrisonHolder : IID_TurretHolder });
}
return false;
},
@ -3431,8 +3431,8 @@ UnitAI.prototype.UnitFsmSpec = {
"LOADING": {
"enter": function() {
let cmpGarrisonHolder = Engine.QueryInterface(this.entity, IID_GarrisonHolder);
if (!cmpGarrisonHolder || cmpGarrisonHolder.IsFull())
let cmpHolder = Engine.QueryInterface(this.entity, this.order.data.iid);
if (!cmpHolder || cmpHolder.IsFull())
{
this.FinishOrder();
return true;
@ -3702,7 +3702,7 @@ UnitAI.prototype.OnPickupRequested = function(msg)
{
if (this.HasPickupOrder(msg.entity))
return;
this.PushOrderAfterForced("PickupUnit", { "target": msg.entity });
this.PushOrderAfterForced("PickupUnit", { "target": msg.entity, "iid": msg.iid });
};
UnitAI.prototype.OnPickupCanceled = function(msg)

View File

@ -45,6 +45,7 @@
<attack_ranged>attack/weapon/bow_attack.xml</attack_ranged>
</SoundGroups>
</Sound>
<Turretable/>
<UnitMotion>
<WalkSpeed op="mul">1.2</WalkSpeed>
</UnitMotion>

View File

@ -42,4 +42,5 @@
<attack_ranged>attack/weapon/bow_attack.xml</attack_ranged>
</SoundGroups>
</Sound>
<Turretable/>
</Entity>