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