Sprache Deutsch Language English

Script Dokumentation LS 2015 - ReverseDriving (Patch 1.3)

Script Dokumentation Übersicht

scripts/vehicles/specializations/ReverseDriving.lua

Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de
1--
2-- ReverseDriving
3-- This is the specialization for vehicles with reverse driving functionality
4--
5-- @author Manuel Leithner
6-- @date 10/12/13
7--
8-- Copyright (C) GIANTS Software GmbH, Confidential, All Rights Reserved.
9
10source("dataS/scripts/vehicles/specializations/ReverseDrivingSetStateEvent.lua");
11
12ReverseDriving = {};
13
14function ReverseDriving.prerequisitesPresent(specializations)
15 return SpecializationUtil.hasSpecialization(Drivable, specializations);
16end;
17
18function ReverseDriving:load(xmlFile)
19
20 self.setIsReverseDriving = SpecializationUtil.callSpecializationsFunction("setIsReverseDriving");
21
22 self:setIsReverseDriving(false, true);
23 self.isReverseDriving = false;
24end;
25
26function ReverseDriving:delete()
27end;
28
29function ReverseDriving:mouseEvent(posX, posY, isDown, isUp, button)
30end;
31
32function ReverseDriving:keyEvent(unicode, sym, modifier, isDown)
33end;
34
35function ReverseDriving:update(dt)
36 if self:getIsActive() then
37 if self:getIsActiveForInput() then
38 if InputBinding.hasEvent(InputBinding.CHANGE_DRIVING_DIRECTION) then
39 self:setIsReverseDriving(not self.isReverseDriving);
40 end;
41 end;
42 end;
43end;
44
45function ReverseDriving:draw()
46 if self.isClient then
47 if self:getIsActiveForInput() then
48 g_currentMission:addHelpButtonText(g_i18n:getText("CHANGE_DRIVING_DIRECTION"), InputBinding.CHANGE_DRIVING_DIRECTION);
49 end;
50 end;
51end;
52
53function ReverseDriving:setIsReverseDriving(isReverseDriving, noEventSend)
54 if isReverseDriving ~= self.isReverseDriving then
55 ReverseDrivingSetStateEvent.sendEvent(self, isReverseDriving, noEventSend)
56 self.isReverseDriving = isReverseDriving;
57 local dir = 1;
58 if not isReverseDriving then
59 dir = -1;
60 end;
61
62 self.reverserDirection = -dir;
63
64 if self.playAnimation ~= nil then
65 self:playAnimation("reverseDirection", dir, self:getAnimationTime("reverseDirection"), true);
66 end;
67 end;
68end;
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