diff --git a/cybersyn/graphics/combinator/cybernetic-displays.png b/cybersyn/graphics/combinator/cybernetic-displays.png index febe915..7d5d36a 100644 Binary files a/cybersyn/graphics/combinator/cybernetic-displays.png and b/cybersyn/graphics/combinator/cybernetic-displays.png differ diff --git a/cybersyn/graphics/combinator/hr-cybernetic-displays.png b/cybersyn/graphics/combinator/hr-cybernetic-displays.png index 807d053..280cc00 100644 Binary files a/cybersyn/graphics/combinator/hr-cybernetic-displays.png and b/cybersyn/graphics/combinator/hr-cybernetic-displays.png differ diff --git a/cybersyn/locale/en/base.cfg b/cybersyn/locale/en/base.cfg index 9ecb0d1..ef5f3f0 100644 --- a/cybersyn/locale/en/base.cfg +++ b/cybersyn/locale/en/base.cfg @@ -3,16 +3,18 @@ cybersyn-ticks-per-second=Central planning updates per second cybersyn-update-rate=Central planning update rate cybersyn-request-threshold=Default requester threshold cybersyn-network-flag=Default network mask -cybersyn-depot-bypass-threshold=Depot bypass fuel threshold +cybersyn-fuel-threshold=Fuel threshold +cybersyn-depot-bypass-enabled=Depot bypass enabled cybersyn-warmup-time=Station warmup time (sec) cybersyn-stuck-train-time=Stuck train timeout (sec) [mod-setting-description] -cybersyn-ticks-per-second=How many times per second the central planner should update the state of the network and schedule deliveries. This value will be rounded up to a divisor of 60. +cybersyn-ticks-per-second=How many times per second the central planner should update the state of the network and schedule deliveries. This value will be rounded up to a divisor of 60. Setting this to 0 will stop all dispatches. cybersyn-update-rate=How many stations per tick can be polled at once or can have deliveries scheduled at once. Larger number allow the central planner to keep more up to date on the current state of the network, but at the cost of performance. cybersyn-request-threshold=The default request threshold when a request threshold signal is not given to a station. When a station receives a negative item signal that surpasses its request threshold, so long as any station exists with a positive signal greater than the request threshold, a delivery of that item will be scheduled between the two stations. cybersyn-network-flag=The default set of sub-networks a station will service when no network signal is given to a station. This integer is interpretted bit-wise to give 32 possible sub-networks to choose from. -cybersyn-depot-bypass-threshold=What percentage of the fuel inventory of the a train must be full to activate depot bypass. When a train qualifies for depot bypass, it may take a new order from the network before having to return to its depot, dramatically reducing travel time. If this is set to 1, depot bypass will be disabled. +cybersyn-fuel-threshold=What percentage of a train's fuel inventory must be full to skip refueling. If this is set to 1, trains will always visit a fuel loader after completing a delivery. +cybersyn-depot-bypass-enabled=If checked, when a train completes a delivery and refueling, it may take a new order from the network before having to return to its depot. cybersyn-warmup-time=How many seconds a cybernetic combinator will wait before connecting to the Cybersyn network. This is a grace period to modify or correct the circuit network before trains start dispatching to a newly blueprinted station. cybersyn-stuck-train-time=After this many seconds from a train's dispatch, an alert will be sent to let you know a train is probably stuck and has not completed its delivery. The player will likely have to debug their network to get the train unstuck. @@ -49,12 +51,12 @@ stuck-train=A train from depot __1__ is stuck [cybersyn-gui] combinator-title=Cybernetic combinator -operation=Mode -comb1=Primary station control -comb2=Optional station control -depot=Depot control -refueler=Refueling station control -wagon-manifest=Wagon control +operation=Control Mode +comb1=Primary station +comb2=Optional station +depot=Depot +refueler=Fuel loader +wagon-manifest=Wagon network=Network network-tooltip=A signal is used to identify which network this combinator is a member of. Trains will only be dispatched from depots to provide and request stations if they are all identified with the same signal. auto-tooltip=When checked trains in the network are automatically added to the allow-list if every wagon of the train is able to be loaded or unloaded by this station. When unchecked the allow-list is not used and all trains are allowed to park here. diff --git a/cybersyn/prototypes/entity.lua b/cybersyn/prototypes/entity.lua index 29080e7..7f597ad 100644 --- a/cybersyn/prototypes/entity.lua +++ b/cybersyn/prototypes/entity.lua @@ -212,6 +212,7 @@ combinator_entity.divide_symbol_sprites = create_combinator_display(30, 0, { 0, combinator_entity.modulo_symbol_sprites = create_combinator_display(45, 0, { 0, -0.140625, }, { 0, -0.328125, }) combinator_entity.power_symbol_sprites = create_combinator_display(0, 11, { 0, -0.140625, }, { 0, -0.328125, }) combinator_entity.left_shift_symbol_sprites = create_combinator_display(15, 11, { 0, -0.140625, }, { 0, -0.328125, }) +combinator_entity.right_shift_symbol_sprites = create_combinator_display(30, 11, { 0, -0.140625, }, { 0, -0.328125, }) combinator_entity.multiply_symbol_sprites = combinator_entity.divide_symbol_sprites diff --git a/cybersyn/scripts/global.lua b/cybersyn/scripts/global.lua index 786914e..e5a5226 100644 --- a/cybersyn/scripts/global.lua +++ b/cybersyn/scripts/global.lua @@ -105,7 +105,8 @@ ---@field public network_flag int ---@field public warmup_time double ---@field public stuck_train_time double ----@field public depot_bypass_threshold double +---@field public fuel_threshold double +---@field public depot_bypass_enabled boolean ---@field public missing_train_alert_enabled boolean --interface setting ---@field public stuck_train_alert_enabled boolean --interface setting ---@field public react_to_nonempty_train_in_depot boolean --interface setting diff --git a/cybersyn/scripts/main.lua b/cybersyn/scripts/main.lua index 05a57c5..84c219f 100644 --- a/cybersyn/scripts/main.lua +++ b/cybersyn/scripts/main.lua @@ -658,7 +658,8 @@ local function on_settings_changed(event) mod_settings.update_rate = settings.global["cybersyn-update-rate"].value --[[@as int]] mod_settings.r_threshold = settings.global["cybersyn-request-threshold"].value--[[@as int]] mod_settings.network_flag = settings.global["cybersyn-network-flag"].value--[[@as int]] - mod_settings.depot_bypass_threshold = settings.global["cybersyn-depot-bypass-threshold"].value--[[@as double]] + mod_settings.fuel_threshold = settings.global["cybersyn-fuel-threshold"].value--[[@as double]] + mod_settings.depot_bypass_enabled = settings.global["cybersyn-depot-bypass-enabled"].value--[[@as boolean]] mod_settings.warmup_time = settings.global["cybersyn-warmup-time"].value--[[@as double]] mod_settings.stuck_train_time = settings.global["cybersyn-stuck-train-time"].value--[[@as double]] if event.setting == "cybersyn-ticks-per-second" then @@ -802,9 +803,10 @@ local function main() mod_settings.update_rate = settings.global["cybersyn-update-rate"].value --[[@as int]] mod_settings.r_threshold = settings.global["cybersyn-request-threshold"].value--[[@as int]] mod_settings.network_flag = settings.global["cybersyn-network-flag"].value--[[@as int]] - mod_settings.depot_bypass_threshold = settings.global["cybersyn-depot-bypass-threshold"].value--[[@as double]] + mod_settings.fuel_threshold = settings.global["cybersyn-fuel-threshold"].value--[[@as double]] mod_settings.warmup_time = settings.global["cybersyn-warmup-time"].value--[[@as double]] mod_settings.stuck_train_time = settings.global["cybersyn-stuck-train-time"].value--[[@as double]] + mod_settings.depot_bypass_enabled = settings.global["cybersyn-depot-bypass-enabled"].value--[[@as boolean]] mod_settings.missing_train_alert_enabled = true mod_settings.stuck_train_alert_enabled = true diff --git a/cybersyn/scripts/train-events.lua b/cybersyn/scripts/train-events.lua index 4ed6501..60e62a6 100644 --- a/cybersyn/scripts/train-events.lua +++ b/cybersyn/scripts/train-events.lua @@ -311,19 +311,14 @@ local function on_train_leaves_stop(map_data, mod_settings, train_id, train) end end end - if total_slots == 0 then - --if total_slots == 0 it's probably a modded electric train - if mod_settings.depot_bypass_threshold < 1 then + if total_slots == 0 or fuel_fill/total_slots > mod_settings.fuel_threshold then + --if total_slots == 0, it's probably a modded electric train + if mod_settings.depot_bypass_enabled then train.status = STATUS_TO_D_BYPASS add_available_train(map_data, train_id, train) interface_raise_train_status_changed(train_id, STATUS_R, STATUS_TO_D_BYPASS) return end - elseif fuel_fill/total_slots > mod_settings.depot_bypass_threshold then - train.status = STATUS_TO_D_BYPASS - add_available_train(map_data, train_id, train) - interface_raise_train_status_changed(train_id, STATUS_R, STATUS_TO_D_BYPASS) - return else local refuelers = map_data.to_refuelers[train.network_name] if refuelers then @@ -363,13 +358,17 @@ local function on_train_leaves_stop(map_data, mod_settings, train_id, train) interface_raise_train_status_changed(train_id, STATUS_R, STATUS_TO_D) elseif train.status == STATUS_F then local refueler = map_data.refuelers[train.refueler_id] - train.status = STATUS_TO_D_BYPASS train.refueler_id = nil refueler.trains_total = refueler.trains_total - 1 - add_available_train(map_data, train_id, train) unset_wagon_combs(map_data, refueler) set_combinator_output(map_data, refueler.entity_comb, nil) - interface_raise_train_status_changed(train_id, STATUS_F, STATUS_TO_D_BYPASS) + if mod_settings.depot_bypass_enabled then + train.status = STATUS_TO_D_BYPASS + add_available_train(map_data, train_id, train) + else + train.status = STATUS_TO_D + end + interface_raise_train_status_changed(train_id, STATUS_F, train.status) elseif train.status == STATUS_D then --The train is leaving the depot without a manifest, the player likely intervened local depot = map_data.depots[train.parked_at_depot_id--[[@as uint]]] diff --git a/cybersyn/settings.lua b/cybersyn/settings.lua index e8fef94..50aec31 100644 --- a/cybersyn/settings.lua +++ b/cybersyn/settings.lua @@ -47,17 +47,24 @@ data:extend({ }, { type = "double-setting", - name = "cybersyn-depot-bypass-threshold", + name = "cybersyn-fuel-threshold", order = "ae", setting_type = "runtime-global", default_value = .5, minimum_value = 0, maximum_value = 1, }, + { + type = "bool-setting", + name = "cybersyn-depot-bypass-enabled", + order = "af", + setting_type = "runtime-global", + default_value = true, + }, { type = "double-setting", name = "cybersyn-warmup-time", - order = "af", + order = "ag", setting_type = "runtime-global", default_value = 20, minimum_value = 0, @@ -66,7 +73,7 @@ data:extend({ { type = "double-setting", name = "cybersyn-stuck-train-time", - order = "ag", + order = "ah", setting_type = "runtime-global", default_value = 600, minimum_value = 0, diff --git a/dev/combinator-displays.png b/dev/combinator-displays.png new file mode 100644 index 0000000..ef1db3d Binary files /dev/null and b/dev/combinator-displays.png differ diff --git a/dev/hr-combinator-displays.png b/dev/hr-combinator-displays.png new file mode 100644 index 0000000..707a9eb Binary files /dev/null and b/dev/hr-combinator-displays.png differ