improved localization

This commit is contained in:
Monica Moniot
2022-11-15 18:51:56 -05:00
parent cf8676f49c
commit 073725024e
4 changed files with 11 additions and 11 deletions

View File

@@ -37,9 +37,9 @@ cybersyn-locked-slots=Locked slots per cargo wagon
[cybersyn-messages] [cybersyn-messages]
missing-trains=No trains available to make a delivery from __2__ to __1__ missing-trains=No trains available to make a delivery from __2__ to __1__
lost-train=A train has become lost lost-train=A train from depot __1__ has become lost
nonempty-train=A train has parked in a depot while still containing items; it cannot be dispatched until it is empty nonempty-train=A train is being held in the depot because it still has cargo
unexpected-train=A train has returned to the depot before completing it's delivery unexpected-train=A train has returned to the depot before completing its delivery
[cybersyn-gui] [cybersyn-gui]
combinator-title=Cybernetic combinator combinator-title=Cybernetic combinator

View File

@@ -219,14 +219,15 @@ end
local send_lost_train_alert_icon = {name = LOST_TRAIN_NAME, type = "fluid"} local send_lost_train_alert_icon = {name = LOST_TRAIN_NAME, type = "fluid"}
---@param train LuaTrain ---@param train LuaTrain
function send_lost_train_alert(train) ---@param depot_name string
function send_lost_train_alert(train, depot_name)
local loco = train.front_stock or train.back_stock local loco = train.front_stock or train.back_stock
if loco then if loco then
for _, player in pairs(loco.force.players) do for _, player in pairs(loco.force.players) do
player.add_custom_alert( player.add_custom_alert(
loco, loco,
send_lost_train_alert_icon, send_lost_train_alert_icon,
{"cybersyn-messages.lost-train"}, {"cybersyn-messages.lost-train", depot_name},
true) true)
player.play_sound({path = ALERT_SOUND}) player.play_sound({path = ALERT_SOUND})
end end

View File

@@ -22,10 +22,8 @@ end
---@param train Train ---@param train Train
---@param train_id uint ---@param train_id uint
function remove_train(map_data, train, train_id) function remove_train(map_data, train, train_id)
map_data.trains[train_id] = nil if train.depot then
local depot = train.depot remove_available_train(map_data, train.depot)
if depot then
remove_available_train(map_data, depot)
end end
local layout_id = train.layout_id local layout_id = train.layout_id
local count = map_data.layout_train_count[layout_id] local count = map_data.layout_train_count[layout_id]
@@ -38,6 +36,7 @@ function remove_train(map_data, train, train_id)
else else
map_data.layout_train_count[layout_id] = count - 1 map_data.layout_train_count[layout_id] = count - 1
end end
map_data.trains[train_id] = nil
end end
---@param map_data MapData ---@param map_data MapData

View File

@@ -162,7 +162,7 @@ local function on_station_broken(map_data, station_id, station)
on_failed_delivery(map_data, train) on_failed_delivery(map_data, train)
train.entity.schedule = nil train.entity.schedule = nil
remove_train(map_data, train, train_id) remove_train(map_data, train, train_id)
send_lost_train_alert(train.entity) send_lost_train_alert(train.entity, train.depot_name)
end end
end end
end end
@@ -609,7 +609,7 @@ local function on_train_arrives_buffer(map_data, stop, train)
on_failed_delivery(map_data, train) on_failed_delivery(map_data, train)
remove_train(map_data, train, train.entity.id) remove_train(map_data, train, train.entity.id)
train.entity.schedule = nil train.entity.schedule = nil
send_lost_train_alert(train.entity) send_lost_train_alert(train.entity, train.depot_name)
end end
else else
--train is lost somehow, probably from player intervention --train is lost somehow, probably from player intervention