Display gather rates per subtype
Currently gather rates per subtype of resource are averaged , which hides important information for players. Therefore they do not realise some units may be better collecting grain or fruit. Also removing todo from the code. Thank @Stan for fruit and grain icons without cursor and new fish. Differential revision: D3310 Accepted by: wraitii Comments by: Freagarach, Nescio Ref: #4077 This was SVN commit r24549.
This commit is contained in:
parent
1b2ef6988a
commit
7148aa5554
BIN
binaries/data/mods/public/art/textures/ui/session/icons/resources/fish_small.png
(Stored with Git LFS)
Normal file
BIN
binaries/data/mods/public/art/textures/ui/session/icons/resources/fish_small.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
binaries/data/mods/public/art/textures/ui/session/icons/resources/fruit_small.png
(Stored with Git LFS)
Normal file
BIN
binaries/data/mods/public/art/textures/ui/session/icons/resources/fruit_small.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
binaries/data/mods/public/art/textures/ui/session/icons/resources/grain_small.png
(Stored with Git LFS)
Normal file
BIN
binaries/data/mods/public/art/textures/ui/session/icons/resources/grain_small.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
binaries/data/mods/public/art/textures/ui/session/icons/resources/meat_small.png
(Stored with Git LFS)
Normal file
BIN
binaries/data/mods/public/art/textures/ui/session/icons/resources/meat_small.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<setup>
|
||||||
|
<icon name="icon_food_fish"
|
||||||
|
sprite="stretched:session/icons/resources/fish_small.png"
|
||||||
|
size="16 16"
|
||||||
|
/>
|
||||||
|
</setup>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<setup>
|
||||||
|
<icon name="icon_food_fruit"
|
||||||
|
sprite="stretched:session/icons/resources/fruit_small.png"
|
||||||
|
size="16 16"
|
||||||
|
/>
|
||||||
|
</setup>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<setup>
|
||||||
|
<icon name="icon_food_grain"
|
||||||
|
sprite="stretched:session/icons/resources/grain_small.png"
|
||||||
|
size="16 16"
|
||||||
|
/>
|
||||||
|
</setup>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<setup>
|
||||||
|
<icon name="icon_food_meat"
|
||||||
|
sprite="stretched:session/icons/resources/meat_small.png"
|
||||||
|
size="16 16"
|
||||||
|
/>
|
||||||
|
</setup>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<setup>
|
||||||
|
<icon name="icon_metal_ore"
|
||||||
|
sprite="stretched:session/icons/resources/metal_small.png"
|
||||||
|
size="16 16"
|
||||||
|
/>
|
||||||
|
</setup>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<setup>
|
||||||
|
<icon name="icon_stone_rock"
|
||||||
|
sprite="stretched:session/icons/resources/stone_small.png"
|
||||||
|
size="16 16"
|
||||||
|
/>
|
||||||
|
</setup>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<setup>
|
||||||
|
<icon name="icon_wood_tree"
|
||||||
|
sprite="stretched:session/icons/resources/wood_small.png"
|
||||||
|
size="16 16"
|
||||||
|
/>
|
||||||
|
</setup>
|
@ -703,23 +703,20 @@ function getGatherTooltip(template)
|
|||||||
if (!template.resourceGatherRates)
|
if (!template.resourceGatherRates)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
// Average the resource rates (TODO: distinguish between subtypes)
|
|
||||||
let rates = {};
|
let rates = {};
|
||||||
for (let resource of g_ResourceData.GetResources())
|
for (let resource of g_ResourceData.GetResources())
|
||||||
{
|
{
|
||||||
let types = [resource.code];
|
let types = [resource.code];
|
||||||
for (let subtype in resource.subtypes)
|
for (let subtype in resource.subtypes)
|
||||||
// We ignore ruins as those are not that common and skew the results
|
{
|
||||||
if (subtype !== "ruins")
|
// We ignore ruins as those are not that common
|
||||||
types.push(resource.code + "." + subtype);
|
if (subtype == "ruins")
|
||||||
|
continue;
|
||||||
|
|
||||||
let [rate, count] = types.reduce((sum, t) => {
|
let rate = template.resourceGatherRates[resource.code + "." + subtype];
|
||||||
let r = template.resourceGatherRates[t];
|
if (rate > 0)
|
||||||
return [sum[0] + (r > 0 ? r : 0), sum[1] + (r > 0 ? 1 : 0)];
|
rates[resource.code + "_" + subtype] = rate;
|
||||||
}, [0, 0]);
|
}
|
||||||
|
|
||||||
if (rate > 0)
|
|
||||||
rates[resource.code] = +(rate / count).toFixed(2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Object.keys(rates).length)
|
if (!Object.keys(rates).length)
|
||||||
|
Loading…
Reference in New Issue
Block a user