feat: traktorer i et andet run vises låst med run-navn i stedet for at kunne vælges (v1.9.7.0)
This commit is contained in:
@@ -318,9 +318,18 @@ function SmartPickupFrame:fillVehicleRows(adEnv, run)
|
||||
for _, vehicle in ipairs(ADRunsController.getFarmVehicles(adEnv)) do
|
||||
local id = ADRunsController.getVehicleId(vehicle)
|
||||
local row = self:addRow(self.vehiclePrefab, {kind = "vehicle", vehicle = vehicle, row = nil})
|
||||
self.rowData[row:getDescendantByName("option")].row = row
|
||||
row:getDescendantByName("option"):setState(inRun[id] and SmartPickupFrame.STATE_ON or SmartPickupFrame.STATE_OFF, false)
|
||||
row:getDescendantByName("title"):setText(self:describeVehicle(adEnv, run, vehicle, inRun[id]))
|
||||
local option, title = row:getDescendantByName("option"), row:getDescendantByName("title")
|
||||
self.rowData[option].row = row
|
||||
option:setState(inRun[id] and SmartPickupFrame.STATE_ON or SmartPickupFrame.STATE_OFF, false)
|
||||
-- Traktorer i et ANDET run kan ikke vælges her (én traktor = ét run); rækken viser hvor den er.
|
||||
local otherRun = ADRunsController.getRunForVehicle(vehicle)
|
||||
if otherRun ~= nil and otherRun.id ~= run.id then
|
||||
option:setDisabled(true)
|
||||
self.rowData[option].locked = true
|
||||
title:setText(string.format("%s — %s", ADRunsController.getVehicleLabel(adEnv, vehicle), string.format(self.i18n:getText("spu_inRun"), tostring(otherRun.name))))
|
||||
else
|
||||
title:setText(self:describeVehicle(adEnv, run, vehicle, inRun[id]))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -560,7 +569,7 @@ end
|
||||
function SmartPickupFrame:onClickVehicle(state, element)
|
||||
self:safe(function(frame)
|
||||
local run, data = frame:getRun(), frame.rowData[element]
|
||||
if run == nil or data == nil then return end
|
||||
if run == nil or data == nil or data.locked then return end
|
||||
if state == SmartPickupFrame.STATE_ON then
|
||||
local previousRunId = ADRunsController.assignVehicle(run.id, data.vehicle)
|
||||
if previousRunId ~= nil then
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
<text name="spu_renameTitle" text="Navn på run"/>
|
||||
<text name="spu_deleteConfirm" text="Slet run '%s'? Traktorerne stoppes ikke."/>
|
||||
<text name="spu_capacity" text="%s l"/>
|
||||
<text name="spu_inRun" text="i run '%s'"/>
|
||||
<text name="spu_needs" text="Hentes (mest trængende først): %s"/>
|
||||
<text name="spu_needs_noTarget" text="(vælg et mål for at se behov)"/>
|
||||
<text name="spu_needs_none" text="Målet tager ingen af run'ets varer"/>
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
<text name="spu_renameTitle" text="Run name"/>
|
||||
<text name="spu_deleteConfirm" text="Delete run '%s'? Tractors are not stopped."/>
|
||||
<text name="spu_capacity" text="%s l"/>
|
||||
<text name="spu_inRun" text="in run '%s'"/>
|
||||
<text name="spu_needs" text="To fetch (neediest first): %s"/>
|
||||
<text name="spu_needs_noTarget" text="(choose a target to see needs)"/>
|
||||
<text name="spu_needs_none" text="The target accepts none of the run's goods"/>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<modDesc descVersion="107">
|
||||
<author>masterdraco</author>
|
||||
<version>1.9.6.0</version>
|
||||
<version>1.9.7.0</version>
|
||||
<title>
|
||||
<en>AD Smart Pickup</en>
|
||||
</title>
|
||||
|
||||
Reference in New Issue
Block a user