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