From 5a46e90d55b758433b75799af9a7c654dccce1b5 Mon Sep 17 00:00:00 2001 From: Dustine Camacho Date: Thu, 15 Jun 2017 05:17:19 +0100 Subject: [PATCH] Typos, code tweaks and et all --- README.md | 10 ++++---- control.lua | 45 +++------------------------------ prototypes/entities/charger.lua | 2 +- quickstart-config.lua | 35 +++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 48 deletions(-) create mode 100644 quickstart-config.lua diff --git a/README.md b/README.md index eea86b7..9319dc2 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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. @@ -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). diff --git a/control.lua b/control.lua index 234b50f..e0db6aa 100644 --- a/control.lua +++ b/control.lua @@ -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 @@ -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() @@ -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) diff --git a/prototypes/entities/charger.lua b/prototypes/entities/charger.lua index 7be10da..5c52471 100644 --- a/prototypes/entities/charger.lua +++ b/prototypes/entities/charger.lua @@ -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", diff --git a/quickstart-config.lua b/quickstart-config.lua new file mode 100644 index 0000000..741320a --- /dev/null +++ b/quickstart-config.lua @@ -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" + } +} \ No newline at end of file