From 090c60e627a2be65ff9e34dda09dbe06853a16ca Mon Sep 17 00:00:00 2001 From: Monica Moniot Date: Tue, 29 Nov 2022 15:12:28 -0500 Subject: [PATCH] prepared for 1.0.0 --- TODO | 4 ++-- cybersyn/locale/en/base.cfg | 6 ++++-- cybersyn/scripts/constants.lua | 1 + cybersyn/scripts/factorio-api.lua | 4 ++-- cybersyn/scripts/main.lua | 4 +++- cybersyn/settings.lua | 25 +++++++++++++++++-------- 6 files changed, 29 insertions(+), 15 deletions(-) diff --git a/TODO b/TODO index 9dfd64e..afa49f5 100644 --- a/TODO +++ b/TODO @@ -1,12 +1,12 @@ bugs: - + request threshold is being bypassed somehow major: do hardcore testing models & art - railloader compat minor: + railloader compat close gui when the combinator is destroyed do not play close sound when a different gui is opened gui can desync if settings are changed outside of it while it is open diff --git a/cybersyn/locale/en/base.cfg b/cybersyn/locale/en/base.cfg index 0ce4490..ba5eecf 100644 --- a/cybersyn/locale/en/base.cfg +++ b/cybersyn/locale/en/base.cfg @@ -1,14 +1,16 @@ [mod-setting-name] cybersyn-ticks-per-second=Central planning updates per second +cybersyn-wait-time=Required inactivity duration (sec) cybersyn-request-threshold=Default requester threshold -cybersyn-network-flag=Default network flags +cybersyn-network-flag=Default sub-network flags 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. Only one deliveries can be made per update. This value will be rounded up to a divisor of 60. +cybersyn-wait-time=How many seconds the duration of a train's inactivity order will be set to. Trains will be forced to wait in the station or depot until this amount of time has passed without the train receiving any kind of interaction. Non-zero values prevent inserters from getting stuck and prevent trains from leaving depots without refueling. Decimal values are allowed, they will be rounded up to a multiple of 1/60 (0.01667). 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 networks a station will service when no network signal is given to a station. This integer is interpretted bit-wise to give 32 possible network flags to choose from. +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-network flags to choose from. 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. diff --git a/cybersyn/scripts/constants.lua b/cybersyn/scripts/constants.lua index e76795d..869cf7d 100644 --- a/cybersyn/scripts/constants.lua +++ b/cybersyn/scripts/constants.lua @@ -22,6 +22,7 @@ OPERATION_DEPOT = "+" OPERATION_WAGON_MANIFEST = "-" NETWORK_SIGNAL_DEFAULT = {name="signal-A", type="virtual"} +INACTIVITY_TIME = 60 DELTA = 1/2048 diff --git a/cybersyn/scripts/factorio-api.lua b/cybersyn/scripts/factorio-api.lua index 19d8897..6f64eb4 100644 --- a/cybersyn/scripts/factorio-api.lua +++ b/cybersyn/scripts/factorio-api.lua @@ -39,7 +39,7 @@ end ------------------------------------------------------------------------------ -local create_loading_order_condition = {type = "inactivity", compare_type = "and", ticks = 120} +local create_loading_order_condition = {type = "inactivity", compare_type = "and", ticks = INACTIVITY_TIME} ---@param stop LuaEntity ---@param manifest Manifest function create_loading_order(stop, manifest) @@ -68,7 +68,7 @@ function create_unloading_order(stop) return {station = stop.backer_name, wait_conditions = create_unloading_order_condition} end -local create_inactivity_order_condition = {{type = "inactivity", compare_type = "and", ticks = 120}} +local create_inactivity_order_condition = {{type = "inactivity", compare_type = "and", ticks = INACTIVITY_TIME}} ---@param depot_name string function create_inactivity_order(depot_name) return {station = depot_name, wait_conditions = create_inactivity_order_condition} diff --git a/cybersyn/scripts/main.lua b/cybersyn/scripts/main.lua index a877c37..24907d7 100644 --- a/cybersyn/scripts/main.lua +++ b/cybersyn/scripts/main.lua @@ -645,7 +645,9 @@ local function on_train_arrives_buffer(map_data, stop, train) set_r_wagon_combs(map_data, station, train) end elseif train.status == STATUS_P and train.p_station_id == station_id then - elseif train.status == STATUS_R and train.r_station_id == station_id then + --this player intervention that is considered valid + elseif (train.status == STATUS_R or train.status == STATUS_R_TO_D) and train.r_station_id == station_id then + --this player intervention that is considered valid else on_failed_delivery(map_data, train) remove_train(map_data, train, train.entity.id) diff --git a/cybersyn/settings.lua b/cybersyn/settings.lua index 424bfd8..60bbaa6 100644 --- a/cybersyn/settings.lua +++ b/cybersyn/settings.lua @@ -9,28 +9,37 @@ data:extend({ minimum_value = 1, maximum_value = 60, }, + --{ + -- type = "int-setting", + -- name = "cybersyn-wait-time", + -- order = "ab", + -- setting_type = "runtime-global", + -- default_value = 2000, + -- minimum_value = 1, + -- maximum_value = 2147483647, + --}, { - type = "int-setting", + type = "double-setting", name = "cybersyn-request-threshold", - order = "ab", + order = "ac", setting_type = "runtime-global", - default_value = 2000, - minimum_value = 1, + default_value = 1, + minimum_value = 0, maximum_value = 2147483647, }, { type = "int-setting", name = "cybersyn-network-flag", - order = "ac", + order = "ad", setting_type = "runtime-global", - default_value = 1, + default_value = -1, minimum_value = -2147483648, maximum_value = 2147483647, }, { type = "int-setting", name = "cybersyn-warmup-time", - order = "ad", + order = "ae", setting_type = "runtime-global", default_value = 20, minimum_value = 0, @@ -39,7 +48,7 @@ data:extend({ { type = "int-setting", name = "cybersyn-stuck-train-time", - order = "ae", + order = "af", setting_type = "runtime-global", default_value = 600, minimum_value = 0,