Script Dokumentation LS 2015 - BalerCreateBaleEvent (Patch 1.3)
scripts/vehicles/specializations/BalerCreateBaleEvent.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 | |
3 | BalerCreateBaleEvent = {}; |
4 | BalerCreateBaleEvent_mt = Class(BalerCreateBaleEvent, Event); |
5 | |
6 | InitStaticEventClass(BalerCreateBaleEvent, "BalerCreateBaleEvent", EventIds.EVENT_BALER_CREATE_BALE); |
7 | |
8 | function BalerCreateBaleEvent:emptyNew() |
9 | local self = Event:new(BalerCreateBaleEvent_mt); |
10 | return self; |
11 | end; |
12 | |
13 | function BalerCreateBaleEvent:new(object, baleFillType, baleTime) |
14 | local self = BalerCreateBaleEvent:emptyNew() |
15 | self.baleFillType = baleFillType; |
16 | self.baleTime = baleTime; |
17 | self.object = object; |
18 | return self; |
19 | end; |
20 | |
21 | function BalerCreateBaleEvent:readStream(streamId, connection) |
22 | self.object = networkGetObject(streamReadInt32(streamId)); |
23 | self.baleTime = streamReadFloat32(streamId); |
24 | self.baleFillType = streamReadUIntN(streamId, Fillable.sendNumBits); |
25 | self:run(connection); |
26 | end; |
27 | |
28 | function BalerCreateBaleEvent:writeStream(streamId, connection) |
29 | streamWriteInt32(streamId, networkGetObjectId(self.object)); |
30 | streamWriteFloat32(streamId, self.baleTime); |
31 | streamWriteUIntN(streamId, self.baleFillType, Fillable.sendNumBits); |
32 | |
33 | end; |
34 | |
35 | function BalerCreateBaleEvent:run(connection) |
36 | --print("creating bale"); |
37 | self.object:createBale(self.baleFillType); |
38 | self.object:setBaleTime(table.getn(self.object.bales), self.baleTime); |
39 | end;
|
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de