Sprache Deutsch Language English

Script Dokumentation LS 2015 - BalerSetIsUnloadingBaleEvent (Patch 1.3)

Script Dokumentation Übersicht

scripts/vehicles/specializations/BalerSetIsUnloadingBaleEvent.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
3BalerSetIsUnloadingBaleEvent = {};
4BalerSetIsUnloadingBaleEvent_mt = Class(BalerSetIsUnloadingBaleEvent, Event);
5
6InitStaticEventClass(BalerSetIsUnloadingBaleEvent, "BalerSetIsUnloadingBaleEvent", EventIds.EVENT_BALER_SET_IS_UNLOADING_BALE);
7
8function BalerSetIsUnloadingBaleEvent:emptyNew()
9 local self = Event:new(BalerSetIsUnloadingBaleEvent_mt);
10 return self;
11end;
12
13function BalerSetIsUnloadingBaleEvent:new(object, isUnloadingBale)
14 local self = BalerSetIsUnloadingBaleEvent:emptyNew()
15 self.object = object;
16 self.isUnloadingBale = isUnloadingBale;
17 return self;
18end;
19
20function BalerSetIsUnloadingBaleEvent:readStream(streamId, connection)
21 local id = streamReadInt32(streamId);
22 self.isUnloadingBale = streamReadBool(streamId);
23 self.object = networkGetObject(id);
24 self:run(connection);
25end;
26
27function BalerSetIsUnloadingBaleEvent:writeStream(streamId, connection)
28 streamWriteInt32(streamId, networkGetObjectId(self.object));
29 streamWriteBool(streamId, self.isUnloadingBale);
30end;
31
32function 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);
37end;
38
39function 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;
47end;
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