Script Dokumentation LS 2015 - RidgeMarkerSetStateEvent (Patch 1.3)
scripts/vehicles/specializations/RidgeMarkerSetStateEvent.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 | RidgeMarkerSetStateEvent = {}; |
4 | RidgeMarkerSetStateEvent_mt = Class(RidgeMarkerSetStateEvent, Event); |
5 | |
6 | InitStaticEventClass(RidgeMarkerSetStateEvent, "RidgeMarkerSetStateEvent", EventIds.EVENT_RIDGE_MARKER_SET_STATE); |
7 | |
8 | function RidgeMarkerSetStateEvent:emptyNew() |
9 | local self = Event:new(RidgeMarkerSetStateEvent_mt); |
10 | return self; |
11 | end; |
12 | |
13 | function RidgeMarkerSetStateEvent:new(object, state) |
14 | local self = RidgeMarkerSetStateEvent:emptyNew() |
15 | self.object = object; |
16 | self.state = state; |
17 | assert(state >= 0 and state < RidgeMarker.numMaxStates); |
18 | return self; |
19 | end; |
20 | |
21 | function RidgeMarkerSetStateEvent:readStream(streamId, connection) |
22 | self.object = networkGetObject(streamReadInt32(streamId)); |
23 | self.state = streamReadUIntN(streamId, RidgeMarker.sendNumBits); |
24 | self:run(connection); |
25 | end; |
26 | |
27 | function RidgeMarkerSetStateEvent:writeStream(streamId, connection) |
28 | streamWriteInt32(streamId, networkGetObjectId(self.object)); |
29 | streamWriteUIntN(streamId, self.state, RidgeMarker.sendNumBits); |
30 | end; |
31 | |
32 | function RidgeMarkerSetStateEvent:run(connection) |
33 | self.object:setRidgeMarkerState(self.state, true); |
34 | if not connection:getIsServer() then |
35 | g_server:broadcastEvent(RidgeMarkerSetStateEvent:new(self.object, self.state), 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