Sprache Deutsch Language English

Script Dokumentation LS 2015 - SetIsFillingEvent (Patch 1.3)

Script Dokumentation Übersicht

scripts/vehicles/specializations/SetIsFillingEvent.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
3SetIsFillingEvent = {};
4SetIsFillingEvent_mt = Class(SetIsFillingEvent, Event);
5
6InitStaticEventClass(SetIsFillingEvent, "SetIsFillingEvent", EventIds.EVENT_SET_IS_FILLING);
7
8function SetIsFillingEvent:emptyNew()
9 local self = Event:new(SetIsFillingEvent_mt);
10 return self;
11end;
12
13function SetIsFillingEvent:new(object, isFilling)
14 local self = SetIsFillingEvent:emptyNew()
15 self.object = object;
16 self.isFilling = isFilling;
17 return self;
18end;
19
20function SetIsFillingEvent:readStream(streamId, connection)
21 self.object = networkGetObject(streamReadInt32(streamId));
22 self.isFilling = streamReadBool(streamId);
23 self:run(connection);
24end;
25
26function SetIsFillingEvent:writeStream(streamId, connection)
27 streamWriteInt32(streamId, networkGetObjectId(self.object));
28 streamWriteBool(streamId, self.isFilling);
29end;
30
31function SetIsFillingEvent:run(connection)
32 if not connection:getIsServer() then
33 g_server:broadcastEvent(self, false, connection, self.object);
34 end;
35 self.object:setIsFilling(self.isFilling, true);
36end;
37
38function SetIsFillingEvent.sendEvent(object, isFilling, noEventSend)
39 if isFilling ~= object.isFilling then
40 if noEventSend == nil or noEventSend == false then
41 if g_server ~= nil then
42 g_server:broadcastEvent(SetIsFillingEvent:new(object, isFilling), nil, nil, self);
43 else
44 g_client:getServerConnection():sendEvent(SetIsFillingEvent:new(object, isFilling));
45 end;
46 end;
47 end;
48end;
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