Skip to content

Commit

Permalink
Typos, code tweaks and et all
Browse files Browse the repository at this point in the history
  • Loading branch information
dustine committed Jun 15, 2017
1 parent b6756d6 commit 5a46e90
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 48 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Enter the **Bot Charger**, the only (for now?) entity added by this mod, which w

From now on, the charger will scan over that roboport's *construction range* and recharge any bots inside it every second or so.

Chargers connected to the same roboport will share the load between themselves; this is important as each charger has a limited energy input ammount and can only fulfill so many robots (see overtaxing below).
Chargers connected to the same roboport will share the load between themselves; this is important as each charger has a limited energy input amount and can only fulfill so many robots (see overtaxing below).

### Reassigning a target roboport

Expand All @@ -41,7 +41,7 @@ E(bot) = drain + speed * movement cost * worker speed bonus
```

- *Drain* and *movement cost* can be gathered from a robot's tooltip, they're the `3kW + 5kJ/m`, respectively.
- *Worker speed bonus* can be found from the Bonuses tab (warning: `+300%` would mean the bonus is `400%`).
- *Worker speed bonus* can be found from the Bonuses tab (warning: `+300%` would mean the total is `400%`).
- *Speed* isn't directly said ingame but for vanilla it's `3m/s` for logistic robots and `3.6m/s` for construction robots.

This means that the more *Worker Robot Speed* research obtained the higher a bot's energy maintenance will be, and that construction robots are always slightly more power hungry.
Expand Down Expand Up @@ -73,16 +73,16 @@ Well, chargers don't have any particle effects, by design (lag, ya know) to warn
If you're sure a charger is out of commission (bots still charging around the roboport rather frequently), the likely reasons are:

1. Charger isn't paired to any roboport
1. Charger is overtaxed (orange alert)
1. Energy supply isn't enough to keep the charger powered up
1. Charger is overtaxed (see next question)

For the first one, hover your mouse over the charger's antenna and see if it points to any roboport. If not, pick and place the charger on a more suitable (closer) place.

The second and third issues are usually telegraphed in-game by alerts (the custom orange alert indicates overtaxing, specifically, see the next question for more details). To verify this, check the electricity values on the sidebar, both the main body AND the antenna must be on the green to be functioning properly. If not, try increasing the power supply or adding more chargers.
The second and third issues are usually telegraphed in-game by alerts. To verify this, check the electricity values on the sidebar, both the main body AND the antenna must be on the green to be functioning properly. If not, try increasing the power supply or adding more chargers.

If it is something else, please submit a bug report. ~~That includes having a more intuitive symbol for the overtaxing alert, it's weird there's no suitable standard iconography that I could find.~~

### How does LuaForce::worker_robots_battery_modifier affect chargers
### How does LuaForce::worker\_robots\_battery\_modifier affect chargers

In short, it does not. As of right now (0.15.20), the force-specific modifier only changes a bot's initial energy. A charger will refill a bot to its maximum, leaving it alone if it's overcharged (if the modifier is positive), and charge it right up to max if it isn't (negative modifier).

Expand Down
45 changes: 3 additions & 42 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,7 @@ local Position = require "stdlib/area/position"
local Entity = require "stdlib/entity/entity"
require "stdlib/event/event"

MOD = {config = {}}
MOD.config.quickstart = {
mod_name = "ChargeTransmission",
clear_items = true,
power_armor = "power-armor-mk2",
equipment = {
"creative-mode_super-fusion-reactor-equipment",
"personal-roboport-mk2-equipment",
"belt-immunity-equipment"
},
starter_tracks = true,
destroy_everything = true,
disable_rso_starting = true,
disable_rso_chunk = true,
floor_tile = "lab-dark-1",
floor_tile_alt = "lab-dark-2",
ore_patches = true,
make_train = true,
area_box = {{-250, -250}, {250, 250}},
chunk_bounds = true,
center_map_tag = true,
setup_power = true,
stacks = {
"construction-robot",
},
quickbar = {
"picker-tape-measure",
"creative-mode_item-source",
"creative-mode_fluid-source",
"creative-mode_energy-source",
"creative-mode_super-substation",
"creative-mode_magic-wand-modifier",
"creative-mode_super-roboport",
"charge-transmission_charger"
}
}
MOD = {config = {quickstart = require "quickstart-config"}}
require "stdlib/debug/quickstart"

local nodes, counters, new_nodes, is_charged, unpaired, bot_max
Expand All @@ -65,11 +30,7 @@ end
-- Automatically blacklists chargeless robots (Creative Mode, Nuclear/Fusion Bots, ...)
local function is_chargeable_bot(proto)
-- Creative Mode; Nuclear Robots; Jamozed's Fusion Robots
if proto.energy_per_tick == 0 and proto.energy_per_move == 0 then return false end
-- (use case without known mods that haven't already matched previously)
if proto.speed_multiplier_when_out_of_energy >= 1 then return false end

return true
return (proto.energy_per_tick > 0 or proto.energy_per_move > 0) and proto.speed_multiplier_when_out_of_energy < 1
end

local function set_chargeable_bots()
Expand Down Expand Up @@ -316,7 +277,7 @@ script.on_event(defines.events.on_tick, function(event)
counters.uid, next_charger = next(unpaired, counters.uid)
-- print("on_tick:unpair:"..(counters.uid or "nil")..":"..((next_charger and next_charger.valid and next_charger.unit_number) or "nil"))
if next_charger then
if next_charger and next_charger.valid then
if next_charger.valid then
local data = Entity.get_data(next_charger)
data.cell, data.index = get_closest_cell(next_charger)
-- Entity.set_data(unpaired_charger, data)
Expand Down
2 changes: 1 addition & 1 deletion prototypes/entities/charger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ local entity_warning = {
collision_box = {{-0.8, -0.8}, {0.8, 0.8}},
selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
pictures = {
Prototype.empty_sprite(),
Prototype.empty_sprite(),
Prototype.empty_sprite(),
{
priority = "extra-high",
Expand Down
35 changes: 35 additions & 0 deletions quickstart-config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
return {
mod_name = "ChargeTransmission",
clear_items = true,
power_armor = "power-armor-mk2",
equipment = {
"creative-mode_super-fusion-reactor-equipment",
"personal-roboport-mk2-equipment",
"belt-immunity-equipment"
},
starter_tracks = true,
destroy_everything = true,
disable_rso_starting = true,
disable_rso_chunk = true,
floor_tile = "lab-dark-1",
floor_tile_alt = "lab-dark-2",
ore_patches = true,
make_train = true,
area_box = {{-250, -250}, {250, 250}},
chunk_bounds = true,
center_map_tag = true,
setup_power = true,
stacks = {
"construction-robot",
},
quickbar = {
"picker-tape-measure",
"creative-mode_item-source",
"creative-mode_fluid-source",
"creative-mode_energy-source",
"creative-mode_super-substation",
"creative-mode_magic-wand-modifier",
"creative-mode_super-roboport",
"charge-transmission_charger"
}
}

0 comments on commit 5a46e90

Please sign in to comment.