Re: [MOD 0.16] Charge Transmission - Wireless Bot Charging
Posted: Sat Apr 06, 2019 4:22 am
I got it partly working for version 0.17. Here is a copy of my notes that I placed in discussions in the mod portal.
Needed to edit the json file as usual, and update the science labels to the new ones.
In prototypes/charger.lua (in a couple of places):
-- energy_usage = "0kW", -- game does not like this
energy_usage = "0.0001kW",
And the new science pack names:
{"automation-science-pack", 1},
{"logistic-science-pack", 1},
{"chemical-science-pack", 1},
{"production-science-pack", 1}
Needed to edit the json file as usual.
Initially had a crash when placing the Charge Transmission device. The game didn't like the return of an 'inf' when a real was expected so I removed math.huge and replaced it with 1000000. Don't know if a larger value is needed or not.
Changed Control.lua as shown below.
--bot.energy = math.huge
bot.energy = 1000000000 --edit: changed from 1 million to 1 billion - maybe needs to be bigger?
Seems to work ok after a few minutes testing.
Edit: The offsets for the interface needs adjusted.
Changes in charger.lua to adjust interface:
selection_box =
{
util.by_pixel(9, -13), util.by_pixel(31, 9) -- changed this line
},
...
-- shift = util.by_pixel(20, 20), -- from this
shift = util.by_pixel(20, -2), -- to this
hr_version =
{
filename = "__ChargeTransmission__/graphics/entities/charger/hr/base-interface.png",
width = 28,
height = 28,
x = (i-1) * 28,
scale = 0.5,
-- shift = util.by_pixel(20, 20), -- from this
shift = util.by_pixel(20, -2), -- to this
}
I don't know how to fix the menu that pops up when you click on the interface. Currently dispays a blank dialog.
Needed to edit the json file as usual, and update the science labels to the new ones.
In prototypes/charger.lua (in a couple of places):
-- energy_usage = "0kW", -- game does not like this
energy_usage = "0.0001kW",
And the new science pack names:
{"automation-science-pack", 1},
{"logistic-science-pack", 1},
{"chemical-science-pack", 1},
{"production-science-pack", 1}
Needed to edit the json file as usual.
Initially had a crash when placing the Charge Transmission device. The game didn't like the return of an 'inf' when a real was expected so I removed math.huge and replaced it with 1000000. Don't know if a larger value is needed or not.
Changed Control.lua as shown below.
--bot.energy = math.huge
bot.energy = 1000000000 --edit: changed from 1 million to 1 billion - maybe needs to be bigger?
Seems to work ok after a few minutes testing.
Edit: The offsets for the interface needs adjusted.
Changes in charger.lua to adjust interface:
selection_box =
{
util.by_pixel(9, -13), util.by_pixel(31, 9) -- changed this line
},
...
-- shift = util.by_pixel(20, 20), -- from this
shift = util.by_pixel(20, -2), -- to this
hr_version =
{
filename = "__ChargeTransmission__/graphics/entities/charger/hr/base-interface.png",
width = 28,
height = 28,
x = (i-1) * 28,
scale = 0.5,
-- shift = util.by_pixel(20, 20), -- from this
shift = util.by_pixel(20, -2), -- to this
}
I don't know how to fix the menu that pops up when you click on the interface. Currently dispays a blank dialog.