Solar Calculator deprecated


Do Not Use -- Use the Original Author's update version Updated Kaktusbot's mod from 1.1 - All credit to them - Adds a solar power calculator able to calculate how much energy your solar plants are providing on average right now. Or calculate how much panels and accumulators you need to provide desired power. Supports modded panels, accumulators, different surfaces(planets and orbits in Space Exploration)

Utilities
10 months ago
2.0
571
Power

g Error loading mods

10 months ago

Error loading mods
Failed to load mods: Error while loading shortcut prototype "kaktusbot-sc-switch-calc-gui-shortcut" (shortcut): Value must be a string in property tree at ROOT.shortcut.kaktusbot-sc-switch-calc-gui-shortcut.icon Modifications: Solar Calculator

can this be fixed? the words do little for me :D

10 months ago

Yep, same error here.

10 months ago

The shortcut prototype has changed in 2.0. This can be fixed by changing data.lua to supply the icon filenames directly instead of giving it a sprite.

icon = data.raw["sprite"][defs.button_sprite_name].icon,
small_icon = data.raw["sprite"][defs.button_sprite_name].icon,
10 months ago

Yeah same problem. Error while loading shortcut prototype "kaktusbot-sc-switch-calc-gui-shorctcut" (shortcut): Value must be a string in property tree at ROOT.shortcut.kaktusbot-sc-switch-calc-gui-shorctcut.icon
Modifications: Solar Calculator

10 months ago

+1

10 months ago

+1

10 months ago

+1

10 months ago

The shortcut prototype has changed in 2.0. This can be fixed by changing data.lua to supply the icon filenames directly instead of giving it a sprite.

icon = data.raw["sprite"][defs.button_sprite_name].icon, small_icon = data.raw["sprite"][defs.button_sprite_name].icon,

i replaced the lines but still does not work can you upload your working fix maybe? =)

10 months ago

replace:
icon = data.raw["sprite"][defs.button_sprite_name].icon, small_icon = data.raw["sprite"][defs.button_sprite_name].icon,

with:
icon = "solar-calc-2/button.png", small_icon = "solar-calc-2/button.png",

10 months ago
(updated 10 months ago)

fixed

delete the code of the data.lua file and paste this code:


require("styles")

local defs = require("defs")
data:extend({
{
type = "sprite",
name = defs.button_sprite_name,
filename = "solar-calc-2/button.png",
priority = "extra-high-no-scale",
mipmap_count = 2,
flags = {"gui-icon"},
width = 64,
height = 64,
scale = 1
},
{
type = "sprite",
name = defs.pin_sprite_name,
filename = "solar-calc-2/pin.png",
width = 32,
height = 32,
scale = 1
},
{
type = "sprite",
name = defs.checked_pin_sprite_name,
filename = "solar-calc-2/pin.png",
x = 32,
width = 32,
height = 32,
scale = 1
}
})
data:extend({
{
type = "custom-input",
name = defs.inputs.switch_calc_gui_input,
key_sequence = "",
action = "lua",
localised_name = {"kaktusbot-sc.switch-window"}
},
{
type = "font",
name = defs.fonts.data_label_font,
from = "default",
size = 16
},
{
type = "font",
name = defs.fonts.data_label_bold_font,
from = "default-bold",
size = 16
},
{
type = "font",
name = defs.fonts.info_label_font,
from = "default",
size = 13
}
})

if settings.startup[defs.settings.show_shortcut_bar_button].value then
data:extend({
{
type = "shortcut",
name = defs.shortcuts.switch_calc_gui_shortcut,
action = "lua",
icon = "solar-calc-2/button.png",
small_icon = "solar-calc-2/button.png",
localised_name = { "", "Solar Calculator 2.0" },
associated_control_input = defs.inputs.switch_calc_gui_input
}
})
end

10 months ago

fixed

delete the code of the data.lua file and paste this code:


require("styles")

local defs = require("defs")
data:extend({
{
type = "sprite",
name = defs.button_sprite_name,

Unfortunatly this doesnt work for me. I get this.

Failed to load mods: Path solar-calc-2/button.png not matching the resource path pattern: source/path

10 months ago
(updated 10 months ago)

I did a little modification and this works for me.
Funny enough the previous solution was correc too.
This Thread just deleted some underscores.
Every time a word is "fat" like this : fatword
it actually has two underscores before and after

https://pastecode.io/s/s4ue5it3

New response