mirror of
https://github.com/Xevion/project-cybersyn.git
synced 2025-12-09 10:08:15 -06:00
fixed minro display bugs
This commit is contained in:
@@ -29,6 +29,8 @@ STATUS_NAMES_DEFAULT = "entity-status.disabled"
|
|||||||
---@param comb LuaEntity
|
---@param comb LuaEntity
|
||||||
---@param player LuaPlayer
|
---@param player LuaPlayer
|
||||||
function gui_opened(comb, player)
|
function gui_opened(comb, player)
|
||||||
|
combinator_update(global, comb)
|
||||||
|
|
||||||
local rootgui = player.gui.screen
|
local rootgui = player.gui.screen
|
||||||
local selected_index, signal, check, switch_state = get_comb_gui_settings(comb)
|
local selected_index, signal, check, switch_state = get_comb_gui_settings(comb)
|
||||||
|
|
||||||
|
|||||||
@@ -398,18 +398,33 @@ function combinator_update(map_data, comb)
|
|||||||
local old_params = map_data.to_comb_params[unit_number]
|
local old_params = map_data.to_comb_params[unit_number]
|
||||||
local has_changed = false
|
local has_changed = false
|
||||||
|
|
||||||
if params.operation ~= old_params.operation then
|
local stop = map_data.to_stop[comb.unit_number]
|
||||||
if (old_params.operation == MODE_PRIMARY_IO) and (params.operation == MODE_PRIMARY_IO_ACTIVE or params.operation == MODE_PRIMARY_IO_FAILED_REQUEST) then
|
if stop then
|
||||||
|
id = stop.unit_number
|
||||||
|
station = map_data.stations[id]
|
||||||
|
if station then
|
||||||
--make sure only MODE_PRIMARY_IO gets stored on map_data.to_comb_params
|
--make sure only MODE_PRIMARY_IO gets stored on map_data.to_comb_params
|
||||||
params.operation = MODE_PRIMARY_IO
|
if station.display_state >= 2 then
|
||||||
else
|
params.operation = MODE_PRIMARY_IO_ACTIVE
|
||||||
--NOTE: This is rather dangerous, we may need to actually implement operation changing
|
elseif station.display_state == 1 then
|
||||||
on_combinator_broken(map_data, comb)
|
params.operation = MODE_PRIMARY_IO_FAILED_REQUEST
|
||||||
on_combinator_built(map_data, comb)
|
else
|
||||||
interface_raise_combinator_changed(comb, old_params)
|
params.operation = MODE_PRIMARY_IO
|
||||||
return
|
end
|
||||||
|
control.parameters = params
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if params.operation == MODE_PRIMARY_IO_ACTIVE or params.operation == MODE_PRIMARY_IO_FAILED_REQUEST then
|
||||||
|
params.operation = MODE_PRIMARY_IO
|
||||||
|
end
|
||||||
|
if params.operation ~= old_params.operation then
|
||||||
|
--NOTE: This is rather dangerous, we may need to actually implement operation changing
|
||||||
|
on_combinator_broken(map_data, comb)
|
||||||
|
on_combinator_built(map_data, comb)
|
||||||
|
interface_raise_combinator_changed(comb, old_params)
|
||||||
|
return
|
||||||
|
end
|
||||||
local new_signal = params.first_signal
|
local new_signal = params.first_signal
|
||||||
local old_signal = old_params.first_signal
|
local old_signal = old_params.first_signal
|
||||||
local new_network = new_signal and new_signal.name or nil
|
local new_network = new_signal and new_signal.name or nil
|
||||||
@@ -420,24 +435,19 @@ function combinator_update(map_data, comb)
|
|||||||
end
|
end
|
||||||
if params.second_constant ~= old_params.second_constant then
|
if params.second_constant ~= old_params.second_constant then
|
||||||
has_changed = true
|
has_changed = true
|
||||||
local stop = map_data.to_stop[comb.unit_number]
|
if station then
|
||||||
if stop then
|
local pre = station.allows_all_trains
|
||||||
local id = stop.unit_number
|
set_station_from_comb_state(station)
|
||||||
local station = map_data.stations[id]
|
if station.allows_all_trains ~= pre then
|
||||||
if station then
|
update_stop_if_auto(map_data, station, true)
|
||||||
local pre = station.allows_all_trains
|
end
|
||||||
set_station_from_comb_state(station)
|
else
|
||||||
if station.allows_all_trains ~= pre then
|
local refueler = map_data.refuelers[id]
|
||||||
update_stop_if_auto(map_data, station, true)
|
if refueler then
|
||||||
end
|
local pre = refueler.allows_all_trains
|
||||||
else
|
set_refueler_from_comb(mod_settings, refueler)
|
||||||
local refueler = map_data.refuelers[id]
|
if refueler.allows_all_trains ~= pre then
|
||||||
if refueler then
|
update_stop_if_auto(map_data, refueler, false)
|
||||||
local pre = refueler.allows_all_trains
|
|
||||||
set_refueler_from_comb(mod_settings, refueler)
|
|
||||||
if refueler.allows_all_trains ~= pre then
|
|
||||||
update_stop_if_auto(map_data, refueler, false)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -374,9 +374,7 @@ local function on_train_leaves_stop(map_data, mod_settings, train_id, train)
|
|||||||
interface_raise_train_status_changed(train_id, STATUS_F, train.status)
|
interface_raise_train_status_changed(train_id, STATUS_F, train.status)
|
||||||
elseif train.status == STATUS_D then
|
elseif train.status == STATUS_D then
|
||||||
--The train is leaving the depot without a manifest, the player likely intervened
|
--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]]]
|
|
||||||
remove_train(map_data, train_id, train)
|
remove_train(map_data, train_id, train)
|
||||||
send_lost_train_alert(train.entity, depot.entity_stop.backer_name)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user