Sprache Deutsch Language English

Script Dokumentation LS 2015 - SowingMachineSetSeedIndex (Patch 1.3)

Script Dokumentation Übersicht

scripts/vehicles/specializations/SowingMachineSetSeedIndex.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
3SowingMachineSetSeedIndex = {};
4SowingMachineSetSeedIndex_mt = Class(SowingMachineSetSeedIndex, Event);
5
6InitStaticEventClass(SowingMachineSetSeedIndex, "SowingMachineSetSeedIndex", EventIds.EVENT_SOWING_MACHINE_SET_SEED_INDEX);
7
8function SowingMachineSetSeedIndex:emptyNew()
9 local self = Event:new(SowingMachineSetSeedIndex_mt);
10 return self;
11end;
12
13function SowingMachineSetSeedIndex:new(object, seedIndex)
14 local self = SowingMachineSetSeedIndex:emptyNew()
15 self.object = object;
16 self.seedIndex = seedIndex;
17 return self;
18end;
19
20function SowingMachineSetSeedIndex:readStream(streamId, connection)
21 self.object = networkGetObject(streamReadInt32(streamId));
22 self.seedIndex = streamReadUInt8(streamId);
23 self:run(connection);
24end;
25
26function SowingMachineSetSeedIndex:writeStream(streamId, connection)
27 streamWriteInt32(streamId, networkGetObjectId(self.object));
28 streamWriteUInt8(streamId, self.seedIndex);
29end;
30
31function SowingMachineSetSeedIndex:run(connection)
32 if not connection:getIsServer() then
33 g_server:broadcastEvent(self, false, connection, self.object);
34 end;
35 self.object:setSeedIndex(self.seedIndex, true);
36end;
37
38function SowingMachineSetSeedIndex.sendEvent(object, seedIndex, noEventSend)
39 if noEventSend == nil or noEventSend == false then
40 if g_server ~= nil then
41 g_server:broadcastEvent(SowingMachineSetSeedIndex:new(object, seedIndex), nil, nil, self);
42 else
43 g_client:getServerConnection():sendEvent(SowingMachineSetSeedIndex:new(object, seedIndex));
44 end;
45 end;
46end;
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