charging_offsets ["solved"]

Place to get help with not working mods / modding interface.
Post Reply
boeljoet
Inserter
Inserter
Posts: 20
Joined: Fri Sep 09, 2016 7:54 am
Contact:

charging_offsets ["solved"]

Post by boeljoet »

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:

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}
try it here https://mods.factorio.com/mod/RechargePort
Last edited by boeljoet on Tue Feb 27, 2024 5:23 pm, edited 1 time in total.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: charging_offsets

Post by DaveMcW »

If you set charging_station_count, it disables charging_offsets and uses charging_distance instead.

boeljoet
Inserter
Inserter
Posts: 20
Joined: Fri Sep 09, 2016 7:54 am
Contact:

Re: charging_offsets

Post by boeljoet »

DaveMcW wrote:
Fri May 14, 2021 5:12 pm
If you set charging_station_count, it disables charging_offsets and uses charging_distance instead.
this solved it.
not sure how to mark it as solved,
this drove me crazy, tysm ^^

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: charging_offsets

Post by eradicator »

boeljoet wrote:
Fri May 14, 2021 5:55 pm
not sure how to mark it as solved,
Press "edit" on the first post and add "[Solved]" to the subject. Most people don't bother though...
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Post Reply

Return to “Modding help”