Script Dokumentation LS 2015 - SetCruiseControlSpeedEvent (Patch 1.3)
scripts/vehicles/specializations/SetCruiseControlSpeedEvent.lua
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de
1 | -- Copyright (C) GIANTS Software GmbH, Confidential, All Rights Reserved. |
2 | |
3 | SetCruiseControlSpeedEvent = {}; |
4 | SetCruiseControlSpeedEvent_mt = Class(SetCruiseControlSpeedEvent, Event); |
5 | |
6 | InitStaticEventClass(SetCruiseControlSpeedEvent, "SetCruiseControlSpeedEvent", EventIds.EVENT_CRUISECONTROL_SET_SPEED); |
7 | |
8 | function SetCruiseControlSpeedEvent:emptyNew() |
9 | local self = Event:new(SetCruiseControlSpeedEvent_mt); |
10 | return self; |
11 | end; |
12 | |
13 | function SetCruiseControlSpeedEvent:new(vehicle, speed) |
14 | local self = SetCruiseControlSpeedEvent:emptyNew() |
15 | self.speed = speed; |
16 | self.vehicle = vehicle; |
17 | return self; |
18 | end; |
19 | |
20 | function SetCruiseControlSpeedEvent:readStream(streamId, connection) |
21 | local id = streamReadInt32(streamId); |
22 | self.speed = streamReadUInt8(streamId); |
23 | self.vehicle = networkGetObject(id); |
24 | self:run(connection); |
25 | end; |
26 | |
27 | function SetCruiseControlSpeedEvent:writeStream(streamId, connection) |
28 | streamWriteInt32(streamId, networkGetObjectId(self.vehicle)); |
29 | streamWriteUInt8(streamId, self.speed); |
30 | end; |
31 | |
32 | function SetCruiseControlSpeedEvent:run(connection) |
33 | self.vehicle:setCruiseControlMaxSpeed(self.speed); |
34 | end;
|
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de