Sprache Deutsch Language English

Script Dokumentation LS 2015 - OverloadingSetPipeStateEvent (Patch 1.3)

Script Dokumentation Übersicht

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
3OverloadingSetPipeStateEvent = {};
4OverloadingSetPipeStateEvent_mt = Class(OverloadingSetPipeStateEvent, Event);
5
6InitStaticEventClass(OverloadingSetPipeStateEvent, "OverloadingSetPipeStateEvent", EventIds.EVENT_OVERLOADING_SET_PIPE_STATE);
7
8function OverloadingSetPipeStateEvent:emptyNew()
9 local self = Event:new(OverloadingSetPipeStateEvent_mt);
10 return self;
11end;
12
13function 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;
19end;
20
21function OverloadingSetPipeStateEvent:readStream(streamId, connection)
22 local id = streamReadInt32(streamId);
23 self.pipeState = streamReadUIntN(streamId, 3);
24 self.object = networkGetObject(id);
25 self:run(connection);
26end;
27
28function OverloadingSetPipeStateEvent:writeStream(streamId, connection)
29 streamWriteInt32(streamId, networkGetObjectId(self.object));
30 streamWriteUIntN(streamId, self.pipeState, 3);
31end;
32
33function 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;
38end;
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