mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-07-04 05:55:47 -07:00
drop carried resources when finishing to build a dropsite
This was SVN commit r17801.
This commit is contained in:
parent
05cf535c58
commit
ec43274e2b
1 changed files with 11 additions and 0 deletions
|
|
@ -2735,6 +2735,17 @@ UnitAI.prototype.UnitFsmSpec = {
|
|||
// Idle animation while moving towards finished construction looks weird (ghosty).
|
||||
var oldState = this.GetCurrentState();
|
||||
|
||||
// Drop any resource we can if we are in range when the construction finishes
|
||||
var cmpResourceGatherer = Engine.QueryInterface(this.entity, IID_ResourceGatherer);
|
||||
var cmpResourceDropsite = Engine.QueryInterface(msg.data.newentity, IID_ResourceDropsite);
|
||||
if (cmpResourceGatherer && cmpResourceDropsite && this.CheckTargetRange(msg.data.newentity, IID_Builder) &&
|
||||
this.CanReturnResource(msg.data.newentity, true))
|
||||
{
|
||||
let dropsiteTypes = cmpResourceDropsite.GetTypes();
|
||||
cmpResourceGatherer.CommitResources(dropsiteTypes);
|
||||
this.SetGathererAnimationOverride();
|
||||
}
|
||||
|
||||
// We finished building it.
|
||||
// Switch to the next order (if any)
|
||||
if (this.FinishOrder())
|
||||
|
|
|
|||
Loading…
Reference in a new issue