Made Animal AI default to "PASSIVE" if its type was not found

Added rudimentary fishing for units and merchant ships
Adjusted resource gather rates
Improved Mountain Pass map

This was SVN commit r7799.
This commit is contained in:
WhiteTreePaladin
2010-07-24 20:26:25 +00:00
parent 93802f257a
commit bc704b288a
11 changed files with 66 additions and 13 deletions
@@ -186,7 +186,12 @@ AnimalAI.prototype.Init = function()
AnimalAI.prototype.OnCreate = function()
{
var startingState = this.template.NaturalBehaviour;
startingState = startingState.toUpperCase(startingState) + ".FEEDING";
startingState = startingState.toUpperCase(startingState);
if (startingState == "SKITTISH")
startingState = startingState + ".FEEDING";
else
startingState = "PASSIVE.FEEDING";
AnimalFsm.Init(this, startingState);
};
@@ -3,6 +3,7 @@ function ResourceGatherer() {}
ResourceGatherer.prototype.Schema =
"<a:help>Lets the unit gather resources from entities that have the ResourceSupply component.</a:help>" +
"<a:example>" +
"<MaxDistance>2.0</MaxDistance>" +
"<BaseSpeed>1.0</BaseSpeed>" +
"<Rates>" +
"<food.fish>1</food.fish>" +
@@ -11,6 +12,9 @@ ResourceGatherer.prototype.Schema =
"<wood.tree>2</wood.tree>" +
"</Rates>" +
"</a:example>" +
"<element name='MaxDistance' a:help='Max resource-gathering distance'>" +
"<ref name='positiveDecimal'/>" +
"</element>" +
"<element name='BaseSpeed' a:help='Base resource-gathering rate (in resource units per second)'>" +
"<ref name='positiveDecimal'/>" +
"</element>" +
@@ -46,7 +50,14 @@ ResourceGatherer.prototype.GetGatherRates = function()
ResourceGatherer.prototype.GetRange = function()
{
return { "max": 2, "min": 0 };
//this.template
//warn(this.template);
return { "max": this.template.MaxDistance, "min": 0 };
// return { "max": 2, "min": 0 };
// maybe this should depend on the unit or target or something?
}
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna_fish">
<Identity>
<Civ>gaia</Civ>
<SpecificName>Fish</SpecificName>
</Identity>
<VisualActor>
<Actor>fauna/fish.xml</Actor>
</VisualActor>
</Entity>
@@ -7,7 +7,7 @@
<IconCell>1</IconCell>
</Identity>
<ResourceSupply>
<Amount>5000</Amount>
<Amount>3000</Amount>
<Type>metal.treasure</Type>
</ResourceSupply>
<VisualActor>
@@ -25,9 +25,10 @@
<metal>1</metal>
</Loot>
<ResourceGatherer>
<MaxDistance>2.0</MaxDistance>
<BaseSpeed>1.0</BaseSpeed>
<Rates>
<food.meat>20</food.meat>
<food.meat>12</food.meat>
<metal.treasure>10000</metal.treasure>
</Rates>
</ResourceGatherer>
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Entity parent="template_unit_fauna">
<Identity>
<GenericName>Fish</GenericName>
</Identity>
<Position>
<Altitude>-4.0</Altitude>
<Floating>true</Floating>
</Position>
<UnitMotion disable=""/>
<AnimalAI disable=""/>
<ResourceSupply>
<Amount>500</Amount>
<Type>food.fish</Type>
</ResourceSupply>
</Entity>
@@ -25,12 +25,13 @@
</Loot>
<Looter/>
<ResourceGatherer>
<MaxDistance>2.0</MaxDistance>
<BaseSpeed>1.0</BaseSpeed>
<Rates>
<food.fish>1</food.fish>
<food.fish>.8</food.fish>
<food.fruit>1</food.fruit>
<food.grain>1</food.grain>
<food.meat>1</food.meat>
<food.meat>8</food.meat>
<metal.ore>3</metal.ore>
<metal.treasure>10000</metal.treasure>
<stone.rock>3</stone.rock>
@@ -10,6 +10,14 @@
<metal>100</metal>
</Resources>
</Cost>
<ResourceGatherer>
<MaxDistance>12.0</MaxDistance>
<BaseSpeed>1.0</BaseSpeed>
<Rates>
<food.fish>1</food.fish>
<metal.treasure>10000</metal.treasure>
</Rates>
</ResourceGatherer>
<Armour>
<Hack>10.0</Hack>
<Pierce>10.0</Pierce>
@@ -14,12 +14,13 @@
</Resources>
</Cost>
<ResourceGatherer>
<MaxDistance>2.0</MaxDistance>
<BaseSpeed>1.0</BaseSpeed>
<Rates>
<food.fish>0.8</food.fish>
<food.fruit>3</food.fruit>
<food.grain>3</food.grain>
<food.meat>0.5</food.meat>
<food.fish>.8</food.fish>
<food.fruit>2</food.fruit>
<food.grain>1</food.grain>
<food.meat>6</food.meat>
<metal.ore>1</metal.ore>
<metal.treasure>10000</metal.treasure>
<stone.rock>1</stone.rock>