Sprache Deutsch Language English

Script Dokumentation LS 2015 - ManureSpreader (Patch 1.3)

Script Dokumentation Übersicht

scripts/vehicles/specializations/ManureSpreader.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-- 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
10ManureSpreader = {};
11
12function ManureSpreader.prerequisitesPresent(specializations)
13 return SpecializationUtil.hasSpecialization(Sprayer, specializations) and SpecializationUtil.hasSpecialization(AnimatedVehicle, specializations);
14end;
15
16function 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;
37end;
38
39function ManureSpreader:delete()
40end;
41
42function ManureSpreader:readStream(streamId, connection)
43end;
44
45function ManureSpreader:writeStream(streamId, connection)
46end;
47
48function ManureSpreader:readUpdateStream(streamId, timestamp, connection)
49end;
50
51function ManureSpreader:writeUpdateStream(streamId, connection, dirtyMask)
52end;
53
54function ManureSpreader:mouseEvent(posX, posY, isDown, isUp, button)
55end;
56
57function ManureSpreader:keyEvent(unicode, sym, modifier, isDown)
58end;
59
60function 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;
71end;
72
73function ManureSpreader:updateTick(dt)
74end;
75
76function ManureSpreader:draw()
77end;
78
79function ManureSpreader:onDetach()
80end;
81
82function ManureSpreader:onLeave()
83end;
84
85function ManureSpreader:onDeactivate()
86end;
87
88function ManureSpreader:onDeactivateSounds()
89end;
90
91function 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;
95end;
96
97function 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;
101end;
102
103function 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));
109end;
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