Sprache Deutsch Language English

Script Dokumentation LS 2015 - AICombineSetStartedEvent (Patch 1.3)

Script Dokumentation Übersicht

scripts/vehicles/specializations/AICombineSetStartedEvent.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
3AICombineSetStartedEvent = {};
4AICombineSetStartedEvent_mt = Class(AICombineSetStartedEvent, Event);
5
6InitStaticEventClass(AICombineSetStartedEvent, "AICombineSetStartedEvent", EventIds.EVENT_AICOMBINE_SET_STARTED);
7
8function AICombineSetStartedEvent:emptyNew()
9 local self = Event:new(AICombineSetStartedEvent_mt);
10 return self;
11end;
12
13function AICombineSetStartedEvent:new(object, isStarted)
14 local self = AICombineSetStartedEvent:emptyNew()
15 self.object = object;
16 self.isStarted = isStarted;
17 return self;
18end;
19
20function AICombineSetStartedEvent:readStream(streamId, connection)
21 local id = streamReadInt32(streamId);
22 self.isStarted = streamReadBool(streamId);
23 self.object = networkGetObject(id);
24 self:run(connection);
25end;
26
27function AICombineSetStartedEvent:writeStream(streamId, connection)
28 streamWriteInt32(streamId, networkGetObjectId(self.object));
29 streamWriteBool(streamId, self.isStarted);
30end;
31
32function AICombineSetStartedEvent:run(connection)
33 if self.isStarted then
34 self.object:startAIThreshing(true);
35 else
36 self.object:stopAIThreshing(true);
37 end;
38 if not connection:getIsServer() then
39 g_server:broadcastEvent(AICombineSetStartedEvent:new(self.object, self.isStarted), nil, connection, self.object);
40 end;
41end;
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