charging_offsets ["solved"]
Posted: Fri May 14, 2021 2:56 pm
as my first mod, I thought about doing something easy.
copy a roboport, disable the inventory and double the number of recharge stations.
I got everything working except the charging_offsets.
for some reason, they all just charge at the center.
this is the code I use:
try it here https://mods.factorio.com/mod/RechargePort
copy a roboport, disable the inventory and double the number of recharge stations.
I got everything working except the charging_offsets.
for some reason, they all just charge at the center.
this is the code I use:
Code: Select all
local oldTechnology = table.deepcopy(data.raw["technology"]["construction-robotics"])
local oldRecipy = table.deepcopy(data.raw["recipe"]["roboport"])
local oldEntity = table.deepcopy(data.raw["roboport"]["roboport"])
local oldItem = table.deepcopy(data.raw["item"]["roboport"])
--Backpack
local newItem = oldItem
newItem.name = "rechargeport"
newItem.icons = {
{
icon = newItem.icon,
tint = {r=1,g=0,b=0}
},
}
newItem.place_result = "rechargeport"
--technology
local newTechnology = oldTechnology
newTechnology.name = "rechargeport"
newTechnology.effects = {
{
type = "unlock-recipe",
recipe = "rechargeport"
}
}
newTechnology.prerequisites = {"construction-robotics","logistic-robotics"}
newTechnology.unit = {
count = 50,
ingredients = {
{"automation-science-pack", 1},
{"logistic-science-pack", 1}
},
time = 30
}
--Entity
local newEntity = oldEntity
newEntity.name = "rechargeport"
newEntity.energy_source ={
type = "electric",
usage_priority = "secondary-input",
input_flow_limit = "9MW",
buffer_capacity = "160MJ"
}
newEntity.energy_usage = "10kW"
newEntity.robot_slots_count = 0
newEntity.material_slots_count = 0
newEntity.charging_station_count = 8
newEntity.charging_offsets = {{-1.5, -0.5}, {1.5, -0.5}, {1.5, 1.5}, {-1.5, 1.5}, {1.5, .5}, {-1.5, .5}, {0, 1.5}, {0, -1},}
--Recipy
local newRecipy = oldRecipy
newRecipy.enabled = false
newRecipy.name = newItem.name
newRecipy.ingredients = {{"steel-plate",30},{"advanced-circuit",30},{"copper-cable",30}}
newRecipy.results = {
{type = "item", name = newItem.name, amount = 1},
}
data:extend{newItem,newEntity,newRecipy,newTechnology}