Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de
1 | WaterTrailerSetIsFillingEvent = {}; |
2 | WaterTrailerSetIsFillingEvent_mt = Class(WaterTrailerSetIsFillingEvent, Event); |
3 | |
4 | InitStaticEventClass(WaterTrailerSetIsFillingEvent, "WaterTrailerSetIsFillingEvent", EventIds.EVENT_WATER_TRAILER_SET_IS_FILLING); |
5 | |
6 | function WaterTrailerSetIsFillingEvent:emptyNew() |
7 | local self = Event:new(WaterTrailerSetIsFillingEvent_mt); |
8 | return self; |
9 | end; |
10 | |
11 | function WaterTrailerSetIsFillingEvent:new(object, isFilling) |
12 | local self = WaterTrailerSetIsFillingEvent:emptyNew() |
13 | self.object = object; |
14 | self.isFilling = isFilling; |
15 | return self; |
16 | end; |
17 | |
18 | function WaterTrailerSetIsFillingEvent:readStream(streamId, connection) |
19 | self.object = networkGetObject(streamReadInt32(streamId)); |
20 | self.isFilling = streamReadBool(streamId); |
21 | self:run(connection); |
22 | end; |
23 | |
24 | function WaterTrailerSetIsFillingEvent:writeStream(streamId, connection) |
25 | streamWriteInt32(streamId, networkGetObjectId(self.object)); |
26 | streamWriteBool(streamId, self.isFilling); |
27 | end; |
28 | |
29 | function WaterTrailerSetIsFillingEvent:run(connection) |
30 | if not connection:getIsServer() then |
31 | g_server:broadcastEvent(self, false, connection, self.object); |
32 | end; |
33 | self.object:setIsWaterTrailerFilling(self.isFilling, true); |
34 | end; |
35 | |
36 | function WaterTrailerSetIsFillingEvent.sendEvent(object, isFilling, noEventSend) |
37 | if isFilling ~= object.isWaterTrailerFilling then |
38 | if noEventSend == nil or noEventSend == false then |
39 | if g_server ~= nil then |
40 | g_server:broadcastEvent(WaterTrailerSetIsFillingEvent:new(object, isFilling), nil, nil, object); |
41 | else |
42 | g_client:getServerConnection():sendEvent(WaterTrailerSetIsFillingEvent:new(object, isFilling)); |
43 | end; |
44 | end; |
45 | end; |
46 | end;
|
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de