Sprache Deutsch Language English

Script Dokumentation LS 2015 - PloughRotationEvent (Patch 1.3)

Script Dokumentation Übersicht

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
3PloughRotationEvent = {};
4PloughRotationEvent_mt = Class(PloughRotationEvent, Event);
5
6InitStaticEventClass(PloughRotationEvent, "PloughRotationEvent", EventIds.EVENT_PLOUGH_ROTATION);
7
8function PloughRotationEvent:emptyNew()
9 local self = Event:new(PloughRotationEvent_mt);
10 return self;
11end;
12
13function PloughRotationEvent:new(object, rotationMax)
14 local self = PloughRotationEvent:emptyNew()
15 self.object = object;
16 self.rotationMax = rotationMax;
17 return self;
18end;
19
20function PloughRotationEvent:readStream(streamId, connection)
21 local id = streamReadInt32(streamId);
22 self.rotationMax = streamReadBool(streamId);
23 self.object = networkGetObject(id);
24 self:run(connection);
25end;
26
27function PloughRotationEvent:writeStream(streamId, connection)
28 streamWriteInt32(streamId, networkGetObjectId(self.object));
29 streamWriteBool(streamId, self.rotationMax);
30end;
31
32function 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;
37end;
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