Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de
1 | -- |
2 | -- ManureSpreader |
3 | -- Class for all sprayers |
4 | -- |
5 | -- @author Stefan Geiger |
6 | -- @date 24/02/08 |
7 | -- |
8 | -- Copyright (C) GIANTS Software GmbH, Confidential, All Rights Reserved. |
9 | |
10 | ManureSpreader = {}; |
11 | |
12 | function ManureSpreader.prerequisitesPresent(specializations) |
13 | return SpecializationUtil.hasSpecialization(Sprayer, specializations) and SpecializationUtil.hasSpecialization(AnimatedVehicle, specializations); |
14 | end; |
15 | |
16 | function ManureSpreader:load(xmlFile) |
17 | |
18 | self.getTipScrollerSpeed = Utils.overwrittenFunction(self.getTipScrollerSpeed, ForageWagon.getTipScrollerSpeed); |
19 | |
20 | self.manureSpreaderTurnedOnRotationNodes = Utils.loadRotationNodes(xmlFile, {}, "vehicle.turnedOnRotationNodes.turnedOnRotationNode", "manureSpreader", self.components); |
21 | self.manureSpreaderScrollers = Utils.loadScrollers(self.components, xmlFile, "vehicle.manureSpreaderScrollers.scrollerNode", {}, false); |
22 | |
23 | self.turnedOnTipScrollerSpeedFactor = Utils.getNoNil(getXMLFloat(xmlFile, "vehicle.turnedOnTipScrollerSpeedFactor#value"), 0.25); |
24 | |
25 | local doorAnimation = {}; |
26 | doorAnimation.name = getXMLString(xmlFile, "vehicle.doorAnimation#name"); |
27 | doorAnimation.openSpeedScale = Utils.getNoNil(getXMLFloat(xmlFile, "vehicle.doorAnimation#openSpeedScale"), 1); |
28 | doorAnimation.closeSpeedScale = Utils.getNoNil(getXMLFloat(xmlFile, "vehicle.doorAnimation#closeSpeedScale"), -doorAnimation.openSpeedScale); |
29 | if doorAnimation.name ~= nil then |
30 | self.doorAnimation = doorAnimation; |
31 | end; |
32 | |
33 | local fillVolumeHeightRefNodeString = getXMLString(xmlFile, "vehicle.fillVolumeHeightRefNode#index"); |
34 | if fillVolumeHeightRefNodeString ~= nil then |
35 | self.fillVolumeHeightRefNode = Utils.indexToObject(self.components, fillVolumeHeightRefNodeString); |
36 | end; |
37 | end; |
38 | |
39 | function ManureSpreader:delete() |
40 | end; |
41 | |
42 | function ManureSpreader:readStream(streamId, connection) |
43 | end; |
44 | |
45 | function ManureSpreader:writeStream(streamId, connection) |
46 | end; |
47 | |
48 | function ManureSpreader:readUpdateStream(streamId, timestamp, connection) |
49 | end; |
50 | |
51 | function ManureSpreader:writeUpdateStream(streamId, connection, dirtyMask) |
52 | end; |
53 | |
54 | function ManureSpreader:mouseEvent(posX, posY, isDown, isUp, button) |
55 | end; |
56 | |
57 | function ManureSpreader:keyEvent(unicode, sym, modifier, isDown) |
58 | end; |
59 | |
60 | function ManureSpreader:update(dt) |
61 | if self.isClient then |
62 | Utils.updateRotationNodes(self, self.manureSpreaderTurnedOnRotationNodes, dt, self:getIsActive() and self:getIsTurnedOn() ); |
63 | Utils.updateScrollers(self.manureSpreaderScrollers, dt, self:getIsActive() and self:getIsTurnedOn()); |
64 | |
65 | if self:getIsTurnedOn() then |
66 | if self.fillVolumeHeightRefNode ~= nil and self.fillVolumeHeightRefNodeToFillVolumeHeight[self.fillVolumeHeightRefNode] ~= nil then |
67 | self.fillVolumeHeightRefNodeToFillVolumeHeight[self.fillVolumeHeightRefNode].volumeHeightIsDirty = true; |
68 | end; |
69 | end; |
70 | end; |
71 | end; |
72 | |
73 | function ManureSpreader:updateTick(dt) |
74 | end; |
75 | |
76 | function ManureSpreader:draw() |
77 | end; |
78 | |
79 | function ManureSpreader:onDetach() |
80 | end; |
81 | |
82 | function ManureSpreader:onLeave() |
83 | end; |
84 | |
85 | function ManureSpreader:onDeactivate() |
86 | end; |
87 | |
88 | function ManureSpreader:onDeactivateSounds() |
89 | end; |
90 | |
91 | function ManureSpreader:onTurnedOn(noEventSend) |
92 | if self.doorAnimation ~= nil then |
93 | self:playAnimation(self.doorAnimation.name, self.doorAnimation.openSpeedScale, self:getAnimationTime(self.doorAnimation.name), true); |
94 | end; |
95 | end; |
96 | |
97 | function ManureSpreader:onTurnedOff(noEventSend) |
98 | if self.doorAnimation ~= nil then |
99 | self:playAnimation(self.doorAnimation.name, self.doorAnimation.closeSpeedScale, self:getAnimationTime(self.doorAnimation.name), true); |
100 | end; |
101 | end; |
102 | |
103 | function ManureSpreader:getTipScrollerSpeed(superFunc) |
104 | local value = 0; |
105 | if self:getIsTurnedOn() then |
106 | value = self.turnedOnTipScrollerSpeedFactor; |
107 | end; |
108 | value = math.max(value, superFunc(self)); |
109 | end;
|
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de