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 | SetIsFillingEvent = {}; |
4 | SetIsFillingEvent_mt = Class(SetIsFillingEvent, Event); |
5 | |
6 | InitStaticEventClass(SetIsFillingEvent, "SetIsFillingEvent", EventIds.EVENT_SET_IS_FILLING); |
7 | |
8 | function SetIsFillingEvent:emptyNew() |
9 | local self = Event:new(SetIsFillingEvent_mt); |
10 | return self; |
11 | end; |
12 | |
13 | function SetIsFillingEvent:new(object, isFilling) |
14 | local self = SetIsFillingEvent:emptyNew() |
15 | self.object = object; |
16 | self.isFilling = isFilling; |
17 | return self; |
18 | end; |
19 | |
20 | function SetIsFillingEvent:readStream(streamId, connection) |
21 | self.object = networkGetObject(streamReadInt32(streamId)); |
22 | self.isFilling = streamReadBool(streamId); |
23 | self:run(connection); |
24 | end; |
25 | |
26 | function SetIsFillingEvent:writeStream(streamId, connection) |
27 | streamWriteInt32(streamId, networkGetObjectId(self.object)); |
28 | streamWriteBool(streamId, self.isFilling); |
29 | end; |
30 | |
31 | function 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); |
36 | end; |
37 | |
38 | function 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; |
48 | end;
|
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de