mirror of
https://github.com/Xevion/project-cybersyn.git
synced 2025-12-06 07:15:58 -06:00
added the ability for ups to be set to 0
This commit is contained in:
@@ -50,7 +50,6 @@ This mod adds a single new entity to the game, the cybernetic combinator. This c
|
||||
|
||||
When placed adjacent to a vanilla train stop, a Cybersyn station is created. This station can provide or request items to your train network. Connect the input of the combinator to a circuit network; When a positive item signal is received, this station will provide that item to the network, when a negative signal is received, this station will request that item from the network. When a station is providing an item that another station is requesting, a train order will automatically be generated to transfer those items from the providing station to the requesting station. When a train arrives to fulfill this order, the output of the combinator will give the full list of items expected to be loaded (positive) or unloaded (negative) from the train.
|
||||
|
||||
|
||||
### Depot control combinator
|
||||
|
||||

|
||||
@@ -61,8 +60,7 @@ When placed adjacent to a vanilla train stop, a Cybersyn depot is created. Any t
|
||||
|
||||

|
||||
|
||||
When placed adjacent to the train stop of an already existing Cybersyn station, this combinator will provide a second set of inputs and outputs that can be used to more precisely control this station. The combinator input allows for request thresholds to be set per-item. Any non-zero item signal given on the input circuit network will override the station's request thresholds for just that item. The output of the combinator gives the sum total of all item loading or unloading orders in progress for the station. The very tick a train is dispatched for a new order to the station, that order is added to the output of this combinator, and it is removed as soon as the train leaves the station. The primary use case for this is to prevent duplicate orders from being generated for stations that provide the same pool of items. Only one train can be dispatched per-tick specifically to accommodate this.
|
||||
|
||||
When placed adjacent to the train stop of an already existing Cybersyn station, this combinator will provide a second set of inputs and outputs that can be used to more precisely control this station. The combinator input allows for request thresholds to be set per-item. Any non-zero item signal given on the input circuit network will override the station's request thresholds for just that item. The output of the combinator gives the sum total of all item loading or unloading orders in progress for the station. The very tick a train is dispatched for a new order to the station, that order is added to the output of this combinator, and it is removed as soon as the train leaves the station. The primary use case for this is to prevent duplicate orders from being generated for stations that provide the same pool of items. Only one train can be dispatched per-tick per-item specifically to accommodate this.
|
||||
|
||||
### Wagon control combinator
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ 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-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-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-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-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.
|
||||
@@ -27,7 +27,7 @@ cybersyn-combinator=Cybernetic combinator
|
||||
cybersyn-combinator-output=Cybernetic combinator output
|
||||
|
||||
[entity-description]
|
||||
cybersyn-combinator=Has 4 different operation modes. Primary control allows providing and requesting. Optional Control allows setting thresholds per-item and reading all in progress deliveries. Depot control allows parked trains to be added to the network. Wagon control allows for reading the desired contents of the adjacent wagon.
|
||||
cybersyn-combinator=Has 4 different control modes. Primary control allows providing and requesting. Optional Control allows setting thresholds per-item and reading all in progress deliveries. Depot control allows parked trains to be added to the network. Wagon control allows for reading the desired contents of the adjacent wagon.
|
||||
cybersyn-combinator-output=¡Viva la Revolución!
|
||||
|
||||
[technology-name]
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
---@field public all_names (string|SignalID)[]
|
||||
|
||||
---@class CybersynModSettings
|
||||
---@field public tps int
|
||||
---@field public tps double
|
||||
---@field public update_rate int
|
||||
---@field public r_threshold int
|
||||
---@field public network_flag int
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
--By Mami
|
||||
local flib_event = require("__flib__.event")
|
||||
local floor = math.floor
|
||||
local ceil = math.ceil
|
||||
local table_insert = table.insert
|
||||
|
||||
|
||||
@@ -843,11 +844,13 @@ local function on_settings_changed(event)
|
||||
mod_settings.warmup_time = settings.global["cybersyn-warmup-time"].value--[[@as int]]
|
||||
mod_settings.stuck_train_time = settings.global["cybersyn-stuck-train-time"].value--[[@as int]]
|
||||
if event.setting == "cybersyn-ticks-per-second" then
|
||||
local nth_tick = math.ceil(60/mod_settings.tps);
|
||||
flib_event.on_nth_tick(nil)
|
||||
flib_event.on_nth_tick(nth_tick, function()
|
||||
tick(global, mod_settings)
|
||||
end)
|
||||
if mod_settings.tps > DELTA then
|
||||
local nth_tick = ceil(60/mod_settings.tps);
|
||||
flib_event.on_nth_tick(nth_tick, function()
|
||||
tick(global, mod_settings)
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -868,7 +871,7 @@ local filter_broken = {
|
||||
{filter = "rolling-stock"},
|
||||
}
|
||||
local function main()
|
||||
mod_settings.tps = settings.global["cybersyn-ticks-per-second"].value --[[@as int]]
|
||||
mod_settings.tps = settings.global["cybersyn-ticks-per-second"].value --[[@as double]]
|
||||
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]]
|
||||
@@ -891,10 +894,14 @@ local function main()
|
||||
|
||||
flib_event.register(defines.events.on_entity_settings_pasted, on_paste)
|
||||
|
||||
local nth_tick = math.ceil(60/mod_settings.tps);
|
||||
flib_event.on_nth_tick(nth_tick, function()
|
||||
tick(global, mod_settings)
|
||||
end)
|
||||
if mod_settings.tps > DELTA then
|
||||
local nth_tick = ceil(60/mod_settings.tps);
|
||||
flib_event.on_nth_tick(nth_tick, function()
|
||||
tick(global, mod_settings)
|
||||
end)
|
||||
else
|
||||
flib_event.on_nth_tick(nil)
|
||||
end
|
||||
|
||||
flib_event.register(defines.events.on_train_created, on_train_built)
|
||||
flib_event.register(defines.events.on_train_changed_state, on_train_changed)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
--By Mami
|
||||
data:extend({
|
||||
{
|
||||
type = "int-setting",
|
||||
type = "double-setting",
|
||||
name = "cybersyn-ticks-per-second",
|
||||
order = "aa",
|
||||
setting_type = "runtime-global",
|
||||
default_value = 30,
|
||||
minimum_value = 1,
|
||||
minimum_value = 0,
|
||||
maximum_value = 60,
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user