Index: binaries/data/mods/public/simulation/components/ProductionQueue.js
===================================================================
--- binaries/data/mods/public/simulation/components/ProductionQueue.js
+++ binaries/data/mods/public/simulation/components/ProductionQueue.js
@@ -29,7 +29,12 @@
"" +
"" +
Resources.BuildSchema("nonNegativeDecimal", ["time"]) +
- "";
+ "" +
+ "" +
+ "" +
+ "" +
+ "" +
+ "";
ProductionQueue.prototype.ProgressInterval = 1000;
ProductionQueue.prototype.MaxQueueSize = 16;
@@ -68,6 +73,8 @@
this.entityCache = [];
this.spawnNotified = false;
+
+ this.autoProduce = "Autoproduce" in this.template;
};
/*
@@ -557,7 +564,9 @@
if (cmpPlayer && this.queue.length)
cmpPlayer.UnBlockTraining();
}
- if (msg.to != INVALID_PLAYER)
+ if (msg.to == INVALID_PLAYER)
+ this.autoProduce = false;
+ else
this.CalculateEntitiesList();
// Reset the production queue whenever the owner changes.
@@ -566,6 +575,7 @@
// created from it. Also it means we don't have to worry about
// updating the reserved pop slots.)
this.ResetQueue();
+ this.CheckAutoproduction();
};
ProductionQueue.prototype.OnCivChanged = function()
@@ -840,6 +850,7 @@
// Unset flag that training is blocked.
// (This might happen when the player unqueues all batches.)
cmpPlayer.UnBlockTraining();
+ this.CheckAutoproduction();
}
else
{
@@ -861,6 +872,15 @@
this.timer = cmpTimer.SetTimeout(this.entity, IID_ProductionQueue, "ProgressTimeout", this.ProgressInterval, {});
};
+/**
+ * Checks for autoproduction. And adds a (single) batch if applicable.
+ */
+ProductionQueue.prototype.CheckAutoproduction = function()
+{
+ if (this.autoProduce)
+ this.AddBatch(pickRandom(this.entitiesList), "unit", 1);
+};
+
ProductionQueue.prototype.OnValueModification = function(msg)
{
// If the promotion requirements of units is changed,
Index: binaries/data/mods/public/simulation/templates/template_structure_civic_civil_centre.xml
===================================================================
--- binaries/data/mods/public/simulation/templates/template_structure_civic_civil_centre.xml
+++ binaries/data/mods/public/simulation/templates/template_structure_civic_civil_centre.xml
@@ -112,6 +112,7 @@
unlock_spies
spy_counter
+
food wood stone metal