Opened 22 months ago
Last modified 16 months ago
#6587 closed enhancement
Dealing with a tooltip of zero time cost — at Initial Version
Reported by: | Langbart | Owned by: | |
---|---|---|---|
Priority: | Nice to Have | Milestone: | Alpha 26 |
Component: | UI & Simulation | Keywords: | |
Cc: | Patch: |
Description
Obelix
reported an issue in the forum about a side effect of the new civbonus (mace_storehouse.json) for the Macedonians
(added with [26627]).
issue
The tech sets the time to zero
Line | |
---|---|
10 | "modifications": [ |
11 | { |
12 | "value": "Researcher/TechCostMultiplier/time", |
13 | "replace": 0 |
14 | } |
15 | ], |
the tooltip time is checked twice for its existence with an if statement.
Line | |
---|---|
720 | let totalCosts = multiplyEntityCosts(template, buildingsCountToTrainFullBatch * fullBatchSize + remainderBatch); |
721 | if (template.cost.time) |
722 | totalCosts.time = Math.ceil(template.cost.time * (entity ? Engine.GuiInterfaceCall("GetBatchTime", { |
723 | "entity": entity, |
724 | "batchSize": buildingsCountToTrainFullBatch > 0 ? fullBatchSize : remainderBatch |
725 | }) : 1)); |
726 | |
727 | let costs = []; |
728 | for (let type of getCostTypes()) |
729 | if (totalCosts[type]) |
730 | costs.push(sprintf(translate("%(component)s %(cost)s"), { |
possible solutions
idea A
rework the JavaScript
part for the tooltip. The result would display a time of 0
.
-
binaries/data/mods/public/gui/common/tooltips.js
a b function getEntityCostComponentsTooltipString(template, entity, buildingsCountTo 718 718 if (!template.cost) 719 719 return []; 720 720 let totalCosts = multiplyEntityCosts(template, buildingsCountToTrainFullBatch * fullBatchSize + remainderBatch); 721 if (t emplate.cost.time)721 if (typeof template.cost.time == "number") 722 722 totalCosts.time = Math.ceil(template.cost.time * (entity ? Engine.GuiInterfaceCall("GetBatchTime", { 723 723 "entity": entity, 724 724 "batchSize": buildingsCountToTrainFullBatch > 0 ? fullBatchSize : remainderBatch … … function getEntityCostComponentsTooltipString(template, entity, buildingsCountTo 726 726 727 727 let costs = []; 728 728 for (let type of getCostTypes()) 729 if (t otalCosts[type])729 if (typeof totalCosts[type] == "number") 730 730 costs.push(sprintf(translate("%(component)s %(cost)s"), { 731 731 "component": resourceIcon(type), 732 732 "cost": totalCosts[type]
idea B
rework the tech, by doing a multiplication with a low value e.g. 0.01
(similar to the cheat code gift from the gods
to get fast actions (fastactions.js). The result would display a time of 1
.
-
binaries/data/mods/public/simulation/data/technologies/civbonuses/mace_storehouse.json
a b 4 4 "description": "The Macedonian economy relied greatly on their vast natural resources.", 5 5 "requirements": { "civ": "mace" }, 6 6 "icon": "wood_axe.png", 7 "tooltip": " Storehouse technologies −100% research time.",7 "tooltip": "Research happens instantly.", 8 8 "modifications": [ 9 { "value": "Researcher/TechCostMultiplier/time", " replace": 0}9 { "value": "Researcher/TechCostMultiplier/time", "multiply": 0.01 } 10 10 ], 11 11 "affects": ["Storehouse"] 12 12 }
additional nitpick
(just a point of polish that they could choose to ignore it)
The string Right-click
(tooltips.js) should get a color treatment,
Line | |
---|---|
1210 | // Translation: Appears in a tooltip to indicate that right-clicking the corresponding GUI element will open the Template Details GUI page. |
1211 | return translate("Right-click to view more information."); |
1212 | } |
like its being done for the string Click
in the getOrderTooltip
function (CounterManager.js).