mirror of
https://github.com/Xevion/project-cybersyn.git
synced 2025-12-11 06:08:19 -06:00
added an update rate setting
This commit is contained in:
@@ -65,3 +65,9 @@ Date: 2022-11-29
|
||||
Features:
|
||||
- Minor bugfix
|
||||
- Added placeholder sprites
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 1.0.2
|
||||
Date: 2022-11-29
|
||||
Features:
|
||||
- Added mod description
|
||||
- Added update rate setting
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cybersyn",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"title": "Project Cybersyn",
|
||||
"author": "Mami",
|
||||
"factorio_version": "1.1",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
[mod-setting-name]
|
||||
cybersyn-ticks-per-second=Central planning updates per second
|
||||
cybersyn-update-rate=Central planning update rate
|
||||
cybersyn-wait-time=Required inactivity duration (sec)
|
||||
cybersyn-request-threshold=Default requester threshold
|
||||
cybersyn-network-flag=Default network mask
|
||||
@@ -8,6 +9,7 @@ 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-update-rate=How many stations per tick can be polled 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-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 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.
|
||||
|
||||
@@ -500,7 +500,7 @@ function tick(map_data, mod_settings)
|
||||
end
|
||||
|
||||
if map_data.tick_state == STATE_POLL_STATIONS then
|
||||
for i = 1, 2 do
|
||||
for i = 1, mod_settings.update_rate do
|
||||
if tick_poll_station(map_data, mod_settings) then break end
|
||||
end
|
||||
elseif map_data.tick_state == STATE_DISPATCH then
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
|
||||
---@class CybersynModSettings
|
||||
---@field public tps int
|
||||
---@field public update_rate int
|
||||
---@field public r_threshold int
|
||||
---@field public network_flag int
|
||||
---@field public warmup_time int
|
||||
|
||||
@@ -837,6 +837,7 @@ end
|
||||
|
||||
local function on_settings_changed(event)
|
||||
mod_settings.tps = settings.global["cybersyn-ticks-per-second"].value --[[@as int]]
|
||||
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.warmup_time = settings.global["cybersyn-warmup-time"].value--[[@as int]]
|
||||
@@ -868,6 +869,7 @@ local filter_broken = {
|
||||
}
|
||||
local function main()
|
||||
mod_settings.tps = settings.global["cybersyn-ticks-per-second"].value --[[@as int]]
|
||||
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.warmup_time = settings.global["cybersyn-warmup-time"].value--[[@as int]]
|
||||
|
||||
@@ -9,6 +9,15 @@ data:extend({
|
||||
minimum_value = 1,
|
||||
maximum_value = 60,
|
||||
},
|
||||
{
|
||||
type = "int-setting",
|
||||
name = "cybersyn-update-rate",
|
||||
order = "ab",
|
||||
setting_type = "runtime-global",
|
||||
default_value = 2,
|
||||
minimum_value = 1,
|
||||
maximum_value = 2147483647,
|
||||
},
|
||||
--{
|
||||
-- type = "int-setting",
|
||||
-- name = "cybersyn-wait-time",
|
||||
|
||||
Reference in New Issue
Block a user