Skip to content

Commit 31b8215

Browse files
committed
Diff fixes
- fixes issue Big M #286 - fixes Coursegenerator keybind only working if fieldwork is possible - fixes client trying to load Courseplay xml
1 parent 6fc8cae commit 31b8215

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

Courseplay.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function Courseplay:loadMap(filename)
106106
self:load()
107107
self:setupGui()
108108
self:loadUserSettings()
109-
if g_currentMission.missionInfo.savegameDirectory ~= nil then
109+
if g_server ~= nil and g_currentMission.missionInfo.savegameDirectory ~= nil then
110110
local saveGamePath = g_currentMission.missionInfo.savegameDirectory .."/"
111111
local filePath = saveGamePath .. "Courseplay.xml"
112112
self.xmlFile = XMLFile.load("cpXml", filePath , self.xmlSchema)

scripts/ai/tasks/CpAITaskFieldWork.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ function CpAITaskFieldWork:start()
6666
spec.isActive = true
6767
self.vehicle:raiseAIEvent("onAIFieldWorkerStart", "onAIImplementStart")
6868
if self.isServer then
69-
spec.isActive = true
70-
spec:updateAIFieldWorkerImplementData()
69+
self.vehicle:updateAIFieldWorkerImplementData()
7170
if self.vehicle:getAINeedsTrafficCollisionBox() and (AIFieldWorker.TRAFFIC_COLLISION ~= nil and
7271
(AIFieldWorker.TRAFFIC_COLLISION ~= 0 and spec.aiTrafficCollision == nil)) then
7372

scripts/specializations/CpAIWorker.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ function CpAIWorker:onRegisterActionEvents(isActiveForInput, isActiveForInputIgn
147147
end)
148148

149149
addActionEvent(self, InputAction.CP_GENERATE_COURSE, function (self)
150-
CourseGeneratorInterface.generateDefaultCourse()
150+
if self:getCanStartCpFieldWork() then
151+
CourseGeneratorInterface.generateDefaultCourse()
152+
end
151153
end)
152154
addActionEvent(self, InputAction.CP_CHANGE_SELECTED_JOB, function (self)
153155
local currentJobSetting = self:cpGetHudSelectedJobSetting()
@@ -238,6 +240,9 @@ function CpAIWorker:updateActionEvents()
238240

239241
actionEvent = spec.actionEvents[InputAction.CP_CLEAR_COURSE]
240242
g_inputBinding:setActionEventActive(actionEvent.actionEventId, self:hasCpCourse())
243+
244+
actionEvent = spec.actionEvents[InputAction.CP_GENERATE_COURSE]
245+
g_inputBinding:setActionEventActive(actionEvent.actionEventId, self:getCanStartCpFieldWork())
241246
end
242247
end
243248

0 commit comments

Comments
 (0)