Charge Transmission deprecated

by Dustine

Special entities that wirelessly charge bots around them. An idea by Mike C from the KatherineOfSkies community.

Content
6 years ago
0.15 - 0.16
10
Logistic network

b on_tick error

3 years ago

https://i.imgur.com/h6k25zD.png

I managed to get the mod to load for .18 but now I'm getting the on_tick error with line 349 calling line 314 in control.lua

3 years ago

Will also register this on github

3 years ago

[314] local function on_tick(event)
--[[ Free Charger Reassignment (4c/s) ]]
if event.tick%15 == 0 then
if not free_chargers[counters.next_charger] then counters.next_charger = nil end
local next_charger
counters.next_charger, next_charger = next(free_chargers, counters.next_charger)

if next_charger then
  if next_charger.base.valid then
    if pair_charger(next_charger) then
      free_chargers[next_charger.id] = nil
    end
  else free_chargers[next_charger.id] = nil end
end

end

--[[ Robot Recharging (25?r/10??/tick) ]]
local total_robots = constants.robots_limit

local step = math.ceil(#active_nodes/constants.nodes_interval)
local n_start = #active_nodes - ((event.tick % constants.nodes_interval) * step)
local n_stop = n_start - step + 1

for n = n_start, math.max(1, n_stop), -1 do
if total_robots <= 0 then goto end_bots end
local node = nodes[active_nodes[n]]

if node and node.active and node.cell.valid then
  local beam_position = constants.have_beams and node.cell.owner.position
  local surface = node.cell.owner.surface
  local force = node.cell.owner.force.name
  local bots = node.cell.to_charge_robots

  for _, bot in pairs(bots) do
    node.cost = node.cost - bot.energy

[349] bot.energy = math.huge

New response