mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 02:46:49 +00:00
Auto-gather all types of treasures. Fixes #1422. Patch by Deiz.
This was SVN commit r11948.
This commit is contained in:
@@ -229,14 +229,14 @@ function getActionInfo(action, target)
|
||||
}
|
||||
else if (targetState.resourceSupply)
|
||||
{
|
||||
var resourceType = targetState.resourceSupply.type.specific;
|
||||
if (targetState.resourceSupply.type.generic === "treasure")
|
||||
var resourceType = targetState.resourceSupply.type;
|
||||
if (resourceType.generic == "treasure")
|
||||
{
|
||||
cursor = "action-gather-" + targetState.resourceSupply.type.generic;
|
||||
cursor = "action-gather-" + resourceType.generic;
|
||||
}
|
||||
else
|
||||
{
|
||||
cursor = "action-gather-" + targetState.resourceSupply.type.specific;
|
||||
cursor = "action-gather-" + resourceType.specific;
|
||||
}
|
||||
data.command = "gather";
|
||||
data.resourceType = resourceType;
|
||||
|
||||
@@ -511,7 +511,7 @@ var UnitFsmSpec = {
|
||||
"Order.GatherNearPosition": function(msg) {
|
||||
// TODO: see notes in Order.Attack
|
||||
var cmpFormation = Engine.QueryInterface(this.entity, IID_Formation);
|
||||
cmpFormation.CallMemberFunction("GatherNearPosition", [msg.data.x, msg.data.z, msg.data.type, false]);
|
||||
cmpFormation.CallMemberFunction("GatherNearPosition", [msg.data.x, msg.data.z, msg.data.type, msg.data.template, false]);
|
||||
cmpFormation.Disband();
|
||||
},
|
||||
|
||||
@@ -946,8 +946,9 @@ var UnitFsmSpec = {
|
||||
var nearby = this.FindNearbyResource(function (ent, type, template) {
|
||||
return (
|
||||
ent != oldTarget
|
||||
&& type.specific == oldType.specific
|
||||
&& (type.specific != "meat" || oldTemplate == template)
|
||||
&& ((type.generic == "treasure" && oldType.generic == "treasure")
|
||||
|| (type.specific == oldType.specific
|
||||
&& (type.specific != "meat" || oldTemplate == template)))
|
||||
);
|
||||
});
|
||||
if (nearby)
|
||||
@@ -981,8 +982,9 @@ var UnitFsmSpec = {
|
||||
// Also don't switch to a different type of huntable animal
|
||||
var nearby = this.FindNearbyResource(function (ent, type, template) {
|
||||
return (
|
||||
type.specific == resourceType
|
||||
&& (type.specific != "meat" || resourceTemplate == template)
|
||||
(type.generic == "treasure" && resourceType.generic == "treasure")
|
||||
|| (type.specific == resourceType.specific
|
||||
&& (type.specific != "meat" || resourceTemplate == template))
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1130,8 +1132,9 @@ var UnitFsmSpec = {
|
||||
// Also don't switch to a different type of huntable animal
|
||||
var nearby = this.FindNearbyResource(function (ent, type, template) {
|
||||
return (
|
||||
type.specific == resourceType.specific
|
||||
&& (type.specific != "meat" || resourceTemplate == template)
|
||||
(type.generic == "treasure" && resourceType.generic == "treasure")
|
||||
|| (type.specific == resourceType.specific
|
||||
&& (type.specific != "meat" || resourceTemplate == template))
|
||||
);
|
||||
});
|
||||
if (nearby)
|
||||
|
||||
Reference in New Issue
Block a user