Sprache Deutsch Language English

Script Dokumentation LS 2015 - TourIcons (Patch 1.3)

Script Dokumentation Übersicht

scripts/objects/TourIcons.lua

Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de
1-- TourIcons class
2--
3-- Tour icons are part of the (optional) guided tour at the career game's start
4--
5-- Copyright (C) GIANTS Software GmbH, Confidential, All Rights Reserved.
6
7TourIcons = {}
8
9local TourIcons_mt = Class(TourIcons);
10
11function TourIcons:onCreate(id)
12 local tourIcons = TourIcons:new(id);
13 table.insert(g_currentMission.updateables, tourIcons);
14 g_currentMission.tourIconsBase = tourIcons;
15 -- print("created TourIcons, id: ", id);
16end;
17
18function TourIcons:new(name)
19 local self = {};
20 setmetatable(self, TourIcons_mt);
21
22 self.me = name;
23 local num = getNumOfChildren(self.me);
24
25 self.tourIcons = {};
26 for i = 0, num - 1 do
27 local tourIconTriggerId = getChildAt(self.me, i);
28 local tourIconId = getChildAt(tourIconTriggerId, 0);
29 addTrigger(tourIconTriggerId, "triggerCallback", self);
30 setVisibility(tourIconId, false);
31 local tourIcon = {tourIconTriggerId = tourIconTriggerId, tourIconId = tourIconId};
32 table.insert(self.tourIcons, tourIcon);
33 end;
34 self.visible = false;
35 self.mapHotspot = nil;
36 self.currentTourIconNumber = 1;
37 self.alpha = 0.25;
38 self.alphaDirection = 1;
39 self.startTourDialog = false;
40 self.startTourDialogDelay = 0;
41 self.permanentMessageDelay = 0;
42 self.isPaused = false;
43 self.pauseTime = 0;
44 self.soldStuffAtGrainElevator = false;
45
46 _, self.permanentTextSize = getNormalizedScreenValues(0, 28);
47
48 return self;
49end;
50
51function TourIcons:delete()
52 if g_currentMission:getIsClient() then
53 for _, tourIcon in pairs(self.tourIcons) do
54 removeTrigger(tourIcon.tourIconTriggerId);
55 end;
56 end;
57end;
58
59function TourIcons:showTourDialog()
60
61 local yesNoDialog = g_gui:showGui("YesNoDialog");
62 yesNoDialog.target:setTitle(g_i18n:getText("tourStartDialogTitle"));
63 yesNoDialog.target:setText(g_i18n:getText("tourStartDialogText"));
64 yesNoDialog.target:setCallbacks(self.reactToDialog, self);
65 yesNoDialog.target:setIconProfile("iconTour");
66
67 --g_ingameMissionStartDialog:setTitle(g_i18n:getText("tourStartDialogTitle"));
68 --g_ingameMissionStartDialog:setText(g_i18n:getText("tourStartDialogText"));
69 --g_ingameMissionStartDialog:setAcceptText(g_i18n:getText("Button_Yes"));
70 --g_ingameMissionStartDialog:setDenyText(g_i18n:getText("Button_No"));
71 --g_ingameMissionStartDialog:setCallbacks(self.reactToDialog, self);
72 --g_gui:showGui("IngameMissionStartDialog");
73 --return true;
74end;
75
76function TourIcons:reactToDialog(yes)
77 if yes then
78 self.visible = true;
79 self:activateNextIcon();
80 -- hide all non-tour question marks
81 g_currentMission.showHelpIcons = false;
82 if g_currentMission.helpIconsBase ~= nil then
83 g_currentMission.helpIconsBase:showHelpIcons(false, true);
84 end;
85 -- disable missions during the tour
86 g_currentMission.missionStats.missionFrequency = 3;
87 g_currentMission.ingameMissionManager:setMissionInterval(3);
88 else
89 self.visible = false;
90 g_currentMission.inGameMessage:showMessage(g_i18n:getText("tourMessageTitle0"), g_i18n:getText("tourMessageText0"), -1);
91 end;
92
93 -- prepare field that needs to be cultivated (regardless of tour)
94 local densityId = g_currentMission.terrainDetailId;
95 local barleyId = g_currentMission.fruits[FruitUtil.FRUITTYPE_BARLEY].id;
96 local barleyDesc = FruitUtil.fruitIndexToDesc[FruitUtil.FRUITTYPE_BARLEY];
97 setDensityMaskedParallelogram(barleyId, 663.5, -682.5, 56, 0, 0, 35.5, 0, g_currentMission.numFruitStateChannels, densityId, g_currentMission.terrainDetailTypeFirstChannel, g_currentMission.terrainDetailTypeNumChannels, barleyDesc.cutState + 1);
98 setDensityMaskedParallelogram(g_currentMission.terrainDetailId, 663.5, -682.5, 56, 0, 0, 35.5, g_currentMission.terrainDetailTypeFirstChannel, g_currentMission.terrainDetailTypeNumChannels, densityId, g_currentMission.terrainDetailTypeFirstChannel, g_currentMission.terrainDetailTypeNumChannels, 2 ^ g_currentMission.sowingChannel);
99
100 g_gui:showGui("");
101 InputBinding.setShowMouseCursor(false);
102end;
103
104function TourIcons:update(dt)
105
106 if self.startTourDialog then
107 self.startTourDialogDelay = self.startTourDialogDelay - dt;
108 if self.startTourDialogDelay < 0 then
109 self.startTourDialog = false;
110 g_currentMission.inGameMessage:showDialog(self.showTourDialog, self);
111 end;
112 end;
113
114 if self.isPaused then
115 if self.pauseTime > 0 then
116 self.pauseTime = self.pauseTime - dt;
117 else
118 self.pauseTime = 0;
119 self.isPaused = false;
120 self:activateNextIcon();
121 end;
122 end;
123
124 if self.visible and not self.isPaused then
125-- for _, tourIcon in pairs(self.tourIcons) do
126-- if getVisibility(tourIcon.tourIconId) then
127-- rotate(tourIcon.tourIconId, 0, 0.002 * dt, 0);
128-- end;
129-- end;
130
131 -- show current permanent message on screen if no ingame message or any other GUI screen is displayed
132 if not g_currentMission.inGameMessage:getIsVisible() and g_gui.currentGui == nil then
133
134 if g_i18n:hasText("tourPermanentText" .. self.currentTourIconNumber - 1) then
135
136 if self.permanentMessageDelay > 0 then
137 self.permanentMessageDelay = self.permanentMessageDelay - dt;
138 self.alpha = 0.25;
139 self.alphaDirection = 1;
140 else
141
142 setTextColor(1, 1, 1, self.alpha);
143 setTextBold(true);
144 setTextAlignment(RenderText.ALIGN_CENTER);
145 setTextWrapWidth(0.35);
146 if GS_IS_CONSOLE_VERSION then
147 setTextWrapWidth(0.295);
148 end;
149 renderText(0.5, 0.93, self.permanentTextSize, g_i18n:getText("tourPermanentText" .. self.currentTourIconNumber - 1));
150 setTextWrapWidth(0);
151 setTextAlignment(RenderText.ALIGN_LEFT);
152 setTextBold(false);
153 setTextColor(1, 1, 1, 1);
154
155 self.alpha = self.alpha + self.alphaDirection * (dt / 600) ;
156 if self.alpha > 1 or self.alpha < 0.25 then
157 self.alphaDirection = self.alphaDirection * -1;
158 self.alpha = Utils.clamp(self.alpha, 0.25, 1);
159 end;
160 end;
161
162 end;
163 end;
164
165 -- handle special cases
166
167 -- icon #3 activates as soon as the player enters the tour's combine harvester
168 if self.currentTourIconNumber <= 3 then
169 if g_currentMission.controlledVehicle ~= nil and g_currentMission.controlledVehicle == g_currentMission.tourVehicles["tourCombine"] then
170 self.currentTourIconNumber = 3;
171 -- self:activateNextIcon();
172 self.pauseTime = 1000;
173 self.isPaused = true;
174 end;
175 end;
176
177 -- wait for player to attach the cutter
178 if self.currentTourIconNumber == 4 then
179 if g_currentMission.controlledVehicle ~= nil and g_currentMission.controlledVehicle == g_currentMission.tourVehicles["tourCombine"] then
180 if g_currentMission.controlledVehicle.numAttachedCutters > 0 then
181 -- self:activateNextIcon();
182 self.pauseTime = 1000;
183 self.isPaused = true;
184 end;
185 end;
186 end;
187
188 -- wait for player to activate the cutter
189 if self.currentTourIconNumber == 5 then
190 if g_currentMission.controlledVehicle ~= nil and g_currentMission.controlledVehicle == g_currentMission.tourVehicles["tourCombine"] then
191 if g_currentMission.controlledVehicle.isTurnedOn then
192 -- self:activateNextIcon();
193 self.pauseTime = 1000;
194 self.isPaused = true;
195 end;
196 end;
197 end;
198
199 -- wait for player to unload the combine
200 -- also handles case where player skips the previous question marks
201 if self.currentTourIconNumber > 5 and self.currentTourIconNumber <= 8 then
202 if g_currentMission.controlledVehicle ~= nil and g_currentMission.controlledVehicle == g_currentMission.tourVehicles["tourCombine"] then
203 if g_currentMission.controlledVehicle.pipeIsUnloading then
204 self.currentTourIconNumber = 8;
205 -- self:activateNextIcon();
206 self.pauseTime = 1000;
207 self.isPaused = true;
208 end;
209 elseif g_currentMission.tourVehicles["tourCombine"].pipeIsUnloading then
210 self.currentTourIconNumber = 8;
211 -- self:activateNextIcon();
212 self.pauseTime = 1000;
213 self.isPaused = true;
214 end;
215 end;
216
217 -- wait for player to enter the tractor
218 if self.currentTourIconNumber == 9 then
219 if g_currentMission.controlledVehicle ~= nil and g_currentMission.controlledVehicle == g_currentMission.tourVehicles["tourTractor1"] then
220 -- self:activateNextIcon();
221 self.pauseTime = 1000;
222 self.isPaused = true;
223 end;
224 end;
225
226 -- wait for player to attach the trailer to the tractor
227 if self.currentTourIconNumber == 10 then
228 if g_currentMission.controlledVehicle ~= nil and g_currentMission.controlledVehicle == g_currentMission.tourVehicles["tourTractor1"] then
229 if #g_currentMission.controlledVehicle.attachedImplements > 0 then
230 self:activateNextIcon();
231 end;
232 end;
233 end;
234
235 -- wait for player to finish unloading the trailer
236 -- also handles case where player skips previous question marks
237 if self.currentTourIconNumber > 1 and self.currentTourIconNumber <= 12 then
238 if g_currentMission.tourVehicles["tourTrailer"] ~= nil and g_currentMission.tourVehicles["tourTrailer"].tipState == Trailer.TIPSTATE_CLOSING and self.soldStuffAtGrainElevator then
239 self.currentTourIconNumber = 12;
240 -- self:activateNextIcon();
241 self.pauseTime = 1000;
242 self.isPaused = true;
243 end;
244 end;
245
246 -- wait for player to attach the cultivator
247 if self.currentTourIconNumber == 14 then
248 if g_currentMission.controlledVehicle ~= nil and g_currentMission.controlledVehicle == g_currentMission.tourVehicles["tourTractor2"] then
249 if #g_currentMission.controlledVehicle.attachedImplements > 1 then
250 -- self:activateNextIcon();
251 self.pauseTime = 1000;
252 self.isPaused = true;
253 end;
254 end;
255 end;
256
257 -- wait for player to attach the sowing machine
258 if self.currentTourIconNumber == 17 then
259 if g_currentMission.controlledVehicle ~= nil and g_currentMission.controlledVehicle == g_currentMission.tourVehicles["tourTractor3"] then
260 if #g_currentMission.controlledVehicle.attachedImplements > 1 then
261 -- self:activateNextIcon();
262 self.pauseTime = 1000;
263 self.isPaused = true;
264 end;
265 end;
266 end;
267
268 -- wait for player to fill the sowing machine
269 if self.currentTourIconNumber == 18 then
270 if g_currentMission.controlledVehicle ~= nil and g_currentMission.controlledVehicle == g_currentMission.tourVehicles["tourTractor3"] then
271 if #g_currentMission.controlledVehicle.attachedImplements > 0 then
272 local tourSowingMachine = g_currentMission.tourVehicles["tourSowingMachine"];
273 if tourSowingMachine.fillLevel >= 0.9 * tourSowingMachine:getCapacity() then
274 self:activateNextIcon();
275 end;
276 end;
277 end;
278 end;
279
280 end;
281end;
282
283function TourIcons:makeIconVisible(tourIconId)
284 -- make next icon visible
285 setVisibility(tourIconId, true);
286 local x, _, z = getWorldTranslation(tourIconId);
287
288 if self.mapHotspot == nil then
289 self.mapHotspot = g_currentMission.ingameMap:createMapHotspot("missionHotspot", "dataS2/menu/hud/hud_pda_spot_green.png", x, z, nil, nil, true, true, false);
290 else
291 -- move existing spot instead
292 self.mapHotspot.xMapPos = x;
293 self.mapHotspot.yMapPos = z;
294 end;
295
296 g_currentMission.ingameMap:setVisible(true);
297end;
298
299function TourIcons:triggerCallback(triggerId, otherId, onEnter, onLeave, onStay)
300 if onEnter then
301 if self.tourIcons[self.currentTourIconNumber] ~= nil then
302 if self.tourIcons[self.currentTourIconNumber].tourIconTriggerId == triggerId and getVisibility(self.tourIcons[self.currentTourIconNumber].tourIconId) then
303 self:activateNextIcon();
304 end;
305 end;
306 end;
307end;
308
309function TourIcons:activateNextIcon()
310
311 -- make all previous icons invisible (also handles cases where player managed to skip icons)
312 for i = 1, self.currentTourIconNumber do
313 local tourIcon = self.tourIcons[i];
314 if getVisibility(tourIcon.tourIconId) then
315 setVisibility(tourIcon.tourIconId, false);
316 setCollisionMask(tourIcon.tourIconTriggerId, 0);
317 end;
318 end;
319
320 if self.tourIcons[self.currentTourIconNumber + 1] ~= nil then
321 self:makeIconVisible(self.tourIcons[self.currentTourIconNumber + 1].tourIconId);
322 else
323 -- end of tour!
324 if self.mapHotspot ~= nil then
325 g_currentMission.ingameMap:deleteMapHotspot(self.mapHotspot);
326 self.mapHotspot = nil;
327 end;
328 -- re-display non-tour help icons
329 g_currentMission.showHelpIcons = true;
330 if g_currentMission.helpIconsBase ~= nil then
331 g_currentMission.helpIconsBase:showHelpIcons(true, true);
332 end;
333 -- re-enable ingame missions
334 g_currentMission.missionStats.missionFrequency = 2;
335 g_currentMission.ingameMissionManager:setMissionInterval(2);
336
337 self.visible = false;
338 end;
339
340 local getFilenames = function(binding, bindings)
341 if bindings ~= nil and table.getn(bindings) > 1 then
342 return bindings;
343 else
344 return binding.filename;
345 end;
346 end;
347
348
349 -- format: tourMessageTitle*_*
350 local i = 1;
351 while true do
352 if g_i18n:hasText("tourMessageTitle" .. self.currentTourIconNumber .. "_" .. i) then
353 -- hard-coded special cases with command icons shown...
354 local iconFilenames = {};
355 local commandNames = {};
356 if self.currentTourIconNumber == 1 and i == 2 then
357
358
359 local binding, bindings = InputBinding.getControllerSymbolsBindingByActionIndex(InputBinding.TOGGLE_PDA_ZOOM);
360 if (GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled) or binding == nil then
361 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.TOGGLE_PDA_ZOOM);
362 iconFilenames[1] = rawKeyName[1];
363 else
364 iconFilenames[1] = getFilenames(binding, bindings);
365 end;
366 commandNames[1] = g_i18n:getText("PDAZoom");
367
368 end;
369
370 if self.currentTourIconNumber == 2 and i == 2 then
371 local binding, bindings = InputBinding.getControllerSymbolsBindingByActionIndex(InputBinding.ENTER);
372 if (GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled) or binding == nil then
373 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.ENTER);
374 iconFilenames[1] = rawKeyName[1];
375 else
376 iconFilenames[1] = getFilenames(binding, bindings);
377 end;
378 commandNames[1] = g_i18n:getText("ENTER");
379 end;
380
381 if self.currentTourIconNumber == 3 and i == 1 then
382 local binding, bindings = InputBinding.getControllerSymbolsBindingByActionIndex(InputBinding.ATTACH);
383 if (GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled) or binding == nil then
384 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.ATTACH);
385 iconFilenames[1] = rawKeyName[1];
386 else
387 iconFilenames[1] = getFilenames(binding, bindings);
388 end
389 if GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled then
390 iconFilenames[2] = g_i18n:getText("mouse");
391 else
392 local binding = InputBinding.controllerSymbolsBindingsByName["R3-All"];
393 if binding == nil then
394 binding = InputBinding.controllerSymbolsBindingsByName["R-All"];
395 end;
396 if binding ~= nil then
397 iconFilenames[2] = binding.filename;
398 end;
399 end;
400 commandNames[1] = g_i18n:getText("Attach");
401 commandNames[2] = g_i18n:getText("tourMessageCommandMoveCamera");
402 end;
403
404 if self.currentTourIconNumber == 4 and i == 1 then
405 if GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled then
406 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.IMPLEMENT_EXTRA2);
407 iconFilenames[1] = rawKeyName[1];
408 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.IMPLEMENT_EXTRA);
409 iconFilenames[2] = rawKeyName[1];
410 else
411 _, iconFilenames[1] = InputBinding.getDigitalActionGamepadButtonNames(InputBinding.IMPLEMENT_EXTRA2);
412 _, iconFilenames[2] = InputBinding.getDigitalActionGamepadButtonNames(InputBinding.IMPLEMENT_EXTRA);
413 end;
414 commandNames[1] = string.format(g_i18n:getText("unfold_OBJECT"), g_currentMission.tourVehicles["tourCombine"].typeDesc);
415 commandNames[2] = g_i18n:getText("Turn_on_combine");
416 end;
417
418 if self.currentTourIconNumber == 5 and (i == 1 or i == 2) then
419 if GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled then
420 iconFilenames[1] = KeyboardHelper.getKeyNameTable( InputBinding.actions[InputBinding.AXIS_MOVE_FORWARD_VEHICLE].keys2 )[1]; --"w";
421 iconFilenames[2] = KeyboardHelper.getKeyNameTable( InputBinding.actions[InputBinding.AXIS_MOVE_FORWARD_VEHICLE].keys1 )[1]; --"s";
422 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.TOGGLE_CRUISE_CONTROL);
423 iconFilenames[3] = rawKeyName[1];
424 else
425 local binding = InputBinding.controllerSymbolsBindingsByName["R2"];
426 if binding == nil then
427 binding = InputBinding.controllerSymbolsBindingsByName["RT"];
428 end;
429 if binding ~= nil then
430 iconFilenames[1] = binding.filename;
431 end;
432 binding = InputBinding.controllerSymbolsBindingsByName["L2"];
433 if binding == nil then
434 binding = InputBinding.controllerSymbolsBindingsByName["LT"];
435 end;
436 if binding ~= nil then
437 iconFilenames[2] = binding.filename;
438 end;
439 _, iconFilenames[3] = InputBinding.getDigitalActionGamepadButtonNames(InputBinding.TOGGLE_CRUISE_CONTROL);
440 binding = InputBinding.controllerSymbolsBindingsByName["L3-UpDown"];
441 if binding == nil then
442 binding = InputBinding.controllerSymbolsBindingsByName["L-UpDown"];
443 end;
444 if binding ~= nil then
445 iconFilenames[4] = binding.filename;
446 end;
447 end;
448 commandNames[1] = g_i18n:getText("tourMessageCommandAccelerate");
449 commandNames[2] = g_i18n:getText("tourMessageCommandBrake");
450 commandNames[3] = g_i18n:getText("tourMessageCommandCruiseControl");
451 commandNames[4] = g_i18n:getText("tourMessageCommandCruiseControl");
452 end;
453
454 if self.currentTourIconNumber == 6 and i == 1 then
455 if GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled then
456 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.IMPLEMENT_EXTRA);
457 iconFilenames[1] = rawKeyName[1];
458 else
459 _, iconFilenames[1] = InputBinding.getDigitalActionGamepadButtonNames(InputBinding.IMPLEMENT_EXTRA);
460 end;
461 commandNames[1] = g_i18n:getText("Turn_off_combine");
462 end;
463
464 if self.currentTourIconNumber == 7 and i == 1 then
465 if GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled then
466 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.IMPLEMENT_EXTRA3);
467 iconFilenames[1] = rawKeyName[1];
468 else
469 _, iconFilenames[1] = InputBinding.getDigitalActionGamepadButtonNames(InputBinding.IMPLEMENT_EXTRA3);
470 end;
471 commandNames[1] = g_i18n:getText("Dump_corn");
472 end;
473
474 if self.currentTourIconNumber == 8 and i == 2 then
475 local binding, bindings = InputBinding.getControllerSymbolsBindingByActionIndex(InputBinding.ENTER);
476 if (GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled) or binding == nil then
477 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.ENTER);
478 iconFilenames[1] = rawKeyName[1];
479 else
480 iconFilenames[1] = getFilenames(binding, bindings);
481 end;
482 commandNames[1] = g_i18n:getText("ExitVehicle");
483 end;
484
485 if self.currentTourIconNumber == 9 and i == 1 then
486 local binding, bindings = InputBinding.getControllerSymbolsBindingByActionIndex(InputBinding.ATTACH);
487 if (GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled) or binding == nil then
488 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.ATTACH);
489 iconFilenames[1] = rawKeyName[1];
490 else
491 iconFilenames[1] = getFilenames(binding, bindings);
492 end;
493 commandNames[1] = g_i18n:getText("Attach");
494 end;
495
496 if self.currentTourIconNumber == 10 and i == 1 then
497 if GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled then
498 iconFilenames[1] = KeyboardHelper.getKeyNameTable( InputBinding.actions[InputBinding.AXIS_MOVE_FORWARD_VEHICLE].keys2 )[1]; --"w";
499 iconFilenames[2] = KeyboardHelper.getKeyNameTable( InputBinding.actions[InputBinding.AXIS_MOVE_FORWARD_VEHICLE].keys1 )[1]; --"s";
500 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.TOGGLE_CRUISE_CONTROL);
501 iconFilenames[3] = rawKeyName[1];
502 else
503 local binding = InputBinding.controllerSymbolsBindingsByName["R2"];
504 if binding == nil then
505 binding = InputBinding.controllerSymbolsBindingsByName["RT"];
506 end;
507 if binding ~= nil then
508 iconFilenames[1] = binding.filename;
509 end;
510 binding = InputBinding.controllerSymbolsBindingsByName["L2"];
511 if binding == nil then
512 binding = InputBinding.controllerSymbolsBindingsByName["LT"];
513 end;
514 if binding ~= nil then
515 iconFilenames[2] = binding.filename;
516 end;
517 _, iconFilenames[3] = InputBinding.getDigitalActionGamepadButtonNames(InputBinding.TOGGLE_CRUISE_CONTROL);
518 binding = InputBinding.controllerSymbolsBindingsByName["L3-UpDown"];
519 if binding == nil then
520 binding = InputBinding.controllerSymbolsBindingsByName["L-UpDown"];
521 end;
522 if binding ~= nil then
523 iconFilenames[4] = binding.filename;
524 end;
525 end;
526 commandNames[1] = g_i18n:getText("tourMessageCommandAccelerate");
527 commandNames[2] = g_i18n:getText("tourMessageCommandBrake");
528 commandNames[3] = g_i18n:getText("tourMessageCommandCruiseControl");
529 commandNames[4] = g_i18n:getText("tourMessageCommandCruiseControl");
530 end;
531
532 -- show statistics (new)
533 if self.currentTourIconNumber == 11 and i == 1 then
534 local binding, bindings = InputBinding.getControllerSymbolsBindingByActionIndex(InputBinding.TOGGLE_PDA);
535 if (GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled) or binding == nil then
536 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.TOGGLE_PDA);
537 iconFilenames[1] = rawKeyName[1];
538 else
539 iconFilenames[1] = getFilenames(binding, bindings);
540 end;
541 commandNames[1] = g_i18n:getText("tourMessageCommandPDA");
542 end;
543
544 -- unload (new)
545 if self.currentTourIconNumber == 11 and i == 2 then
546 local binding, bindings = InputBinding.getControllerSymbolsBindingByActionIndex(InputBinding.ATTACH);
547 if (GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled) or binding == nil then
548 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.ATTACH);
549 iconFilenames[1] = rawKeyName[1];
550 else
551 iconFilenames[1] = getFilenames(binding, bindings);
552 end;
553 commandNames[1] = g_i18n:getText("Dump");
554 end;
555
556 if self.currentTourIconNumber == 12 and (i == 2 or i == 3) then
557 if GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled then
558 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.SWITCH_VEHICLE);
559 iconFilenames[1] = rawKeyName[1];
560 else
561 iconFilenames[1] = InputBinding.controllerSymbolsBindingsByName["DP-LeftRight"].filename;
562 end;
563 commandNames[1] = g_i18n:getText("tourMessageCommandSwitchVehicles");
564 end;
565
566 -- enter vehicle and attach cultivator (new)
567 if self.currentTourIconNumber == 13 and i == 2 then
568 local binding, bindings = InputBinding.getControllerSymbolsBindingByActionIndex(InputBinding.ENTER);
569 if (GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled) or binding == nil then
570 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.ENTER);
571 iconFilenames[1] = rawKeyName[1];
572 else
573 iconFilenames[1] = getFilenames(binding, bindings);
574 end;
575 commandNames[1] = g_i18n:getText("ENTER");
576
577 local binding, bindings = InputBinding.getControllerSymbolsBindingByActionIndex(InputBinding.ATTACH);
578 if (GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled) or binding == nil then
579 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.ATTACH);
580 iconFilenames[2] = rawKeyName[1];
581 else
582 iconFilenames[2] = getFilenames(binding, bindings);
583 end;
584 commandNames[2] = g_i18n:getText("Attach");
585
586 end;
587
588 if self.currentTourIconNumber == 14 and i == 1 then
589 if GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled then
590 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.LOWER_IMPLEMENT);
591 iconFilenames[1] = rawKeyName[1];
592 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.TOGGLE_CRUISE_CONTROL);
593 iconFilenames[2] = rawKeyName[1];
594 else
595 _, iconFilenames[1] = InputBinding.getDigitalActionGamepadButtonNames(InputBinding.LOWER_IMPLEMENT);
596 _, iconFilenames[2] = InputBinding.getDigitalActionGamepadButtonNames(InputBinding.TOGGLE_CRUISE_CONTROL);
597 binding = InputBinding.controllerSymbolsBindingsByName["L3-UpDown"];
598 if binding == nil then
599 binding = InputBinding.controllerSymbolsBindingsByName["L-UpDown"];
600 end;
601 if binding ~= nil then
602 iconFilenames[3] = binding.filename;
603 end;
604 end;
605 commandNames[1] = g_i18n:getText("LOWER_IMPLEMENT");
606 commandNames[2] = g_i18n:getText("tourMessageCommandCruiseControl");
607 commandNames[3] = g_i18n:getText("tourMessageCommandCruiseControl");
608 end;
609
610 if self.currentTourIconNumber == 15 and i == 2 then
611 if GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled then
612 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.SWITCH_VEHICLE);
613 iconFilenames[1] = rawKeyName[1];
614 else
615 iconFilenames[1] = InputBinding.controllerSymbolsBindingsByName["DP-LeftRight"].filename;
616 end;
617 commandNames[1] = g_i18n:getText("tourMessageCommandSwitchVehicles");
618 end;
619
620 -- enter vehicle and attach sowing machine (new)
621 if self.currentTourIconNumber == 16 and i == 2 then
622 local binding, bindings = InputBinding.getControllerSymbolsBindingByActionIndex(InputBinding.ENTER);
623 if (GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled) or binding == nil then
624 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.ENTER);
625 iconFilenames[1] = rawKeyName[1];
626 else
627 iconFilenames[1] = getFilenames(binding, bindings);
628 end;
629 commandNames[1] = g_i18n:getText("ENTER");
630
631 local binding, bindings = InputBinding.getControllerSymbolsBindingByActionIndex(InputBinding.ATTACH);
632 if (GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled) or binding == nil then
633 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.ATTACH);
634 iconFilenames[2] = rawKeyName[1];
635 else
636 iconFilenames[2] = getFilenames(binding, bindings);
637 end;
638 commandNames[2] = g_i18n:getText("Attach");
639 end;
640
641 if self.currentTourIconNumber == 17 and i == 2 then
642 if GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled then
643 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.ACTIVATE_OBJECT);
644 iconFilenames[1] = rawKeyName[1];
645 else
646 _, iconFilenames[1] = InputBinding.getDigitalActionGamepadButtonNames(InputBinding.ACTIVATE_OBJECT);
647 end;
648 commandNames[1] = g_i18n:getText("tourMessageCommandFillSowingMachine");
649 end;
650
651 -- changed second entry to 'turn on sowing machine'
652 if self.currentTourIconNumber == 19 and i == 1 then
653 if GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled then
654 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.IMPLEMENT_EXTRA3);
655 iconFilenames[1] = rawKeyName[1];
656 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.IMPLEMENT_EXTRA);
657 iconFilenames[2] = rawKeyName[1];
658 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.LOWER_IMPLEMENT);
659 iconFilenames[3] = rawKeyName[1];
660 else
661 _, iconFilenames[1] = InputBinding.getDigitalActionGamepadButtonNames(InputBinding.IMPLEMENT_EXTRA3);
662 _, iconFilenames[2] = InputBinding.getDigitalActionGamepadButtonNames(InputBinding.IMPLEMENT_EXTRA);
663 _, iconFilenames[3] = InputBinding.getDigitalActionGamepadButtonNames(InputBinding.LOWER_IMPLEMENT);
664 end;
665 commandNames[1] = g_i18n:getText("ChooseSeed");
666 commandNames[2] = g_i18n:getText("turn_on");
667 commandNames[3] = g_i18n:getText("LOWER_IMPLEMENT");
668 end;
669
670 if self.currentTourIconNumber == 20 and i == 4 then
671 if GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled then
672 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.SWITCH_VEHICLE);
673 iconFilenames[1] = rawKeyName[1];
674 else
675 iconFilenames[1] = InputBinding.controllerSymbolsBindingsByName["DP-LeftRight"].filename;
676 end;
677 commandNames[1] = g_i18n:getText("tourMessageCommandSwitchVehicles");
678 end;
679
680 if self.currentTourIconNumber == 21 and i == 2 then
681 if GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC and not g_settingsGamepadHelpEnabled then
682 local rawKeyName = InputBinding.getRawKeyNamesOfDigitalAction(InputBinding.TOGGLE_STORE);
683 iconFilenames[1] = rawKeyName[1];
684 else
685 _, iconFilenames[1] = InputBinding.getDigitalActionGamepadButtonNames(InputBinding.TOGGLE_STORE);
686 end;
687 commandNames[1] = g_i18n:getText("TOGGLE_STORE");
688 end;
689
690 if self.currentTourIconNumber == 12 and i == 2 then -- one special case: text 2 for icon 12 has different texts on PC (keyboard vs gamepad), PS3, XBOX, ...
691 if GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_PC then
692 if g_settingsGamepadHelpEnabled then
693 g_currentMission.inGameMessage:showMessage(g_i18n:getText("tourMessageTitle" .. self.currentTourIconNumber .. "_" .. i), g_i18n:getText("tourMessageText" .. self.currentTourIconNumber .. "_" .. i .. "_ps3"), -1, iconFilenames, commandNames);
694 else
695 g_currentMission.inGameMessage:showMessage(g_i18n:getText("tourMessageTitle" .. self.currentTourIconNumber .. "_" .. i), g_i18n:getText("tourMessageText" .. self.currentTourIconNumber .. "_" .. i ), -1, iconFilenames, commandNames);
696 end
697 else
698 if GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_X360 or GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_XBOXONE then
699 g_currentMission.inGameMessage:showMessage(g_i18n:getText("tourMessageTitle" .. self.currentTourIconNumber .. "_" .. i), g_i18n:getText("tourMessageText" .. self.currentTourIconNumber .. "_" .. i .. "_xbox360"), -1, iconFilenames, commandNames);
700 else
701 g_currentMission.inGameMessage:showMessage(g_i18n:getText("tourMessageTitle" .. self.currentTourIconNumber .. "_" .. i), g_i18n:getText("tourMessageText" .. self.currentTourIconNumber .. "_" .. i .. "_ps3"), -1, iconFilenames, commandNames);
702 end;
703 end;
704 else
705 g_currentMission.inGameMessage:showMessage(g_i18n:getText("tourMessageTitle" .. self.currentTourIconNumber .. "_" .. i), g_i18n:getText("tourMessageText" .. self.currentTourIconNumber .. "_" .. i), -1, iconFilenames, commandNames);
706 end;
707 i = i + 1;
708 else
709 break;
710 end;
711 end;
712
713 self.currentTourIconNumber = self.currentTourIconNumber + 1;
714
715 self.permanentMessageDelay = 250;
716
717end;
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de
Script Dokumentation Übersicht