1
0
forked from 0ad/0ad

Use separate mode when carrying meat.

Fix tests.

This was SVN commit r8594.
This commit is contained in:
Ykkrosh 2010-11-13 21:39:39 +00:00
parent f4b0b72aa8
commit 8798b7671c
4 changed files with 32 additions and 1 deletions

View File

@ -7,6 +7,7 @@
<animation file="infantry/spear/idle/isp_01.psa" name="Idle" speed="200"/> <animation file="infantry/spear/idle/isp_01.psa" name="Idle" speed="200"/>
<animation file="biped/walk_spearshield.psa" name="Walk" speed="120"/> <animation file="biped/walk_spearshield.psa" name="Walk" speed="120"/>
<animation file="biped/walk_spearshield.psa" name="carry_food" speed="120"/> <animation file="biped/walk_spearshield.psa" name="carry_food" speed="120"/>
<animation file="biped/walk_spearshield.psa" name="carry_meat" speed="120"/>
<animation file="biped/walk_spearshield.psa" name="carry_wood" speed="120"/> <animation file="biped/walk_spearshield.psa" name="carry_wood" speed="120"/>
<animation file="biped/walk_spearshield.psa" name="carry_stone" speed="120"/> <animation file="biped/walk_spearshield.psa" name="carry_stone" speed="120"/>
<animation file="biped/walk_spearshield.psa" name="carry_metal" speed="120"/> <animation file="biped/walk_spearshield.psa" name="carry_metal" speed="120"/>
@ -116,6 +117,15 @@
</variant> </variant>
<variant name="carry_food"> <variant name="carry_food">
<props>
<prop attachpoint="shield"/>
<prop attachpoint="r_hand"/>
<prop attachpoint="l_hand"/>
<prop actor="props/units/tools/basket.xml" attachpoint="l_leg"/>
<prop actor="props/special/eyecandy/basket_celt_a.xml" attachpoint="head"/>
</props>
</variant>
<variant name="carry_meat">
<props> <props>
<prop attachpoint="shield"/> <prop attachpoint="shield"/>
<prop attachpoint="r_hand"/> <prop attachpoint="r_hand"/>

View File

@ -61,6 +61,9 @@ ResourceGatherer.prototype.Init = function()
// (Note that this component supports carrying multiple types of resources, // (Note that this component supports carrying multiple types of resources,
// each with an independent capacity, but the rest of the game currently // each with an independent capacity, but the rest of the game currently
// ensures and assumes we'll only be carrying one type at once) // ensures and assumes we'll only be carrying one type at once)
// The last exact type gathered, so we can render appropriate props
this.lastCarriedType = undefined; // { generic, specific }
}; };
/** /**
@ -94,6 +97,15 @@ ResourceGatherer.prototype.GetMainCarryingType = function()
return undefined; return undefined;
}; };
/**
* Returns the exact resource type we last picked up, in the form
* { generic, specific }
*/
ResourceGatherer.prototype.GetLastCarriedType = function()
{
return this.lastCarriedType;
};
ResourceGatherer.prototype.GetGatherRates = function() ResourceGatherer.prototype.GetGatherRates = function()
{ {
var ret = {}; var ret = {};
@ -133,6 +145,8 @@ ResourceGatherer.prototype.PerformGather = function(target)
this.carrying[type.generic] += status.amount; this.carrying[type.generic] += status.amount;
this.lastCarriedType = type;
// Update stats of how much the player collected. // Update stats of how much the player collected.
// (We have to do it here rather than at the dropsite, because we // (We have to do it here rather than at the dropsite, because we
// need to know what subtype it was) // need to know what subtype it was)

View File

@ -535,7 +535,13 @@ var UnitFsmSpec = {
"enter": function () { "enter": function () {
// Work out what we're carrying, in order to select an appropriate animation // Work out what we're carrying, in order to select an appropriate animation
var cmpResourceGatherer = Engine.QueryInterface(this.entity, IID_ResourceGatherer); var cmpResourceGatherer = Engine.QueryInterface(this.entity, IID_ResourceGatherer);
var typename = "carry_" + cmpResourceGatherer.GetMainCarryingType(); var type = cmpResourceGatherer.GetLastCarriedType();
var typename = "carry_" + type.generic;
// Special case for meat
if (type.specific == "meat")
typename = "carry_" + type.specific;
this.SelectAnimation(typename, false, this.GetWalkSpeed()); this.SelectAnimation(typename, false, this.GetWalkSpeed());
}, },

View File

@ -6,6 +6,7 @@ Engine.LoadComponentScript("interfaces/GarrisonHolder.js");
Engine.LoadComponentScript("interfaces/Health.js"); Engine.LoadComponentScript("interfaces/Health.js");
Engine.LoadComponentScript("interfaces/Identity.js"); Engine.LoadComponentScript("interfaces/Identity.js");
Engine.LoadComponentScript("interfaces/RallyPoint.js"); Engine.LoadComponentScript("interfaces/RallyPoint.js");
Engine.LoadComponentScript("interfaces/ResourceDropsite.js");
Engine.LoadComponentScript("interfaces/ResourceGatherer.js"); Engine.LoadComponentScript("interfaces/ResourceGatherer.js");
Engine.LoadComponentScript("interfaces/ResourceSupply.js"); Engine.LoadComponentScript("interfaces/ResourceSupply.js");
Engine.LoadComponentScript("interfaces/TrainingQueue.js"); Engine.LoadComponentScript("interfaces/TrainingQueue.js");