#6587 closed enhancement (fixed)
Tooltip issue after modifying a tech for the Macedonian civ bonus
Reported by: | Langbart | Owned by: | marder |
---|---|---|---|
Priority: | Nice to Have | Milestone: | Alpha 26 |
Component: | UI & Simulation | Keywords: | |
Cc: | Patch: | Phab:D4750 |
Description (last modified by )
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 (if(0) equals to false
).
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"), { |
See also comment:3 below for the other issue regarding the correct display of the tooltip in the structure tree for the modified techs.
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).
Change History (9)
comment:1 by , 21 months ago
comment:2 by , 21 months ago
... so far this will only solve half of the problem, cos the Structure Tree
still shows the wrong value in its tooltip.
comment:3 by , 21 months ago
- the easiest way to solve the second part would be to rework all the storehouse techs (one for the
maces
and one for all the other civs) and remove the civ bonus. This is not a good solution as there are unnecessarily several slightly different variants of the same technology. Don't like it!
- Better to modify the function
GetTechnologyDataHelper
(globalscripts/Templates.js - Line 574) so it recognises modification as does theGetTemplateDataHelper
(globalscripts/Templates.js - Line 159)
comment:4 by , 21 months ago
Description: | modified (diff) |
---|---|
Summary: | Dealing with a tooltip of zero time cost → Tooltip issue after modifying a tech for the Macedonian civ bonus |
Updating the title to make the issue clearer
comment:5 by , 21 months ago
The issue with the Structure Tree is that r26015 removed default Researcher/TechCostMultiplier
values; and whilst r26192 fixed that for the simulation, a fix was not applied to globalscripts which expects there to be values for each possible resource specified within templates.
This is causing other technology costs to be displayed incorrectly within the Structure Tree, such as those of the Mauryan temple and the Gallic forge.
comment:6 by , 20 months ago
Patch: | → Phab:D4750 |
---|
Thank you!