Script Dokumentation LS 2015 - PloughRotationEvent (Patch 1.3)
scripts/vehicles/specializations/PloughRotationEvent.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 | PloughRotationEvent = {}; |
4 | PloughRotationEvent_mt = Class(PloughRotationEvent, Event); |
5 | |
6 | InitStaticEventClass(PloughRotationEvent, "PloughRotationEvent", EventIds.EVENT_PLOUGH_ROTATION); |
7 | |
8 | function PloughRotationEvent:emptyNew() |
9 | local self = Event:new(PloughRotationEvent_mt); |
10 | return self; |
11 | end; |
12 | |
13 | function PloughRotationEvent:new(object, rotationMax) |
14 | local self = PloughRotationEvent:emptyNew() |
15 | self.object = object; |
16 | self.rotationMax = rotationMax; |
17 | return self; |
18 | end; |
19 | |
20 | function PloughRotationEvent:readStream(streamId, connection) |
21 | local id = streamReadInt32(streamId); |
22 | self.rotationMax = streamReadBool(streamId); |
23 | self.object = networkGetObject(id); |
24 | self:run(connection); |
25 | end; |
26 | |
27 | function PloughRotationEvent:writeStream(streamId, connection) |
28 | streamWriteInt32(streamId, networkGetObjectId(self.object)); |
29 | streamWriteBool(streamId, self.rotationMax); |
30 | end; |
31 | |
32 | function PloughRotationEvent:run(connection) |
33 | self.object:setRotationMax(self.rotationMax, true); |
34 | if not connection:getIsServer() then |
35 | g_server:broadcastEvent(PloughRotationEvent:new(self.object, self.rotationMax), nil, connection, self.object); |
36 | end; |
37 | end;
|
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de