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 @@ -261,6 +261,21 @@ // to be possible to add a batch (based on resource costs and length limits). let cmpPlayer = QueryOwnerInterface(this.entity); + if (!this.queue.length) + { + let cmpUpgrade = Engine.QueryInterface(this.entity, IID_Upgrade); + if (cmpUpgrade && cmpUpgrade.IsUpgrading()) + { + let cmpGUIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface); + cmpGUIInterface.PushNotification({ + "players": [cmpPlayer.GetPlayerID()], + "message": markForTranslation("Entity is being upgraded. Cannot start production."), + "translateMessage": true, + }); + return; + } + } + if (this.queue.length < this.MaxQueueSize) { @@ -870,6 +885,11 @@ this.CalculateEntitiesList(); }; +ProductionQueue.prototype.HasQueuedProduction = function() +{ + return this.queue.length > 0; +} + ProductionQueue.prototype.OnDisabledTemplatesChanged = function(msg) { // If the disabled templates of the player is changed, Index: binaries/data/mods/public/simulation/components/Upgrade.js =================================================================== --- binaries/data/mods/public/simulation/components/Upgrade.js +++ binaries/data/mods/public/simulation/components/Upgrade.js @@ -228,6 +228,17 @@ return false; let cmpPlayer = QueryOwnerInterface(this.entity, IID_Player); + let cmpProductionQueue = Engine.QueryInterface(this.entity, IID_ProductionQueue); + if (cmpProductionQueue && cmpProductionQueue.HasQueuedProduction()) + { + let cmpGUIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface); + cmpGUIInterface.PushNotification({ + "players": [cmpPlayer.GetPlayerID()], + "message": markForTranslation("Entity is producing. Cannot start upgrading."), + "translateMessage": true, + }); + return false; + } this.expendedResources = this.GetResourceCosts(template); if (!cmpPlayer.TrySubtractResources(this.expendedResources))