Script Dokumentation LS 2015 - PloughLimitToFieldEvent (Patch 1.3)
scripts/vehicles/specializations/PloughLimitToFieldEvent.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 | PloughLimitToFieldEvent = {}; |
4 | PloughLimitToFieldEvent_mt = Class(PloughLimitToFieldEvent, Event); |
5 | |
6 | InitStaticEventClass(PloughLimitToFieldEvent, "PloughLimitToFieldEvent", EventIds.EVENT_PLOUGH_LIMIT_TO_FIELD); |
7 | |
8 | function PloughLimitToFieldEvent:emptyNew() |
9 | local self = Event:new(PloughLimitToFieldEvent_mt); |
10 | return self; |
11 | end; |
12 | |
13 | function PloughLimitToFieldEvent:new(object, ploughLimitToField) |
14 | local self = PloughLimitToFieldEvent:emptyNew() |
15 | self.object = object; |
16 | self.ploughLimitToField = ploughLimitToField; |
17 | return self; |
18 | end; |
19 | |
20 | function PloughLimitToFieldEvent:readStream(streamId, connection) |
21 | local id = streamReadInt32(streamId); |
22 | self.ploughLimitToField = streamReadBool(streamId); |
23 | self.object = networkGetObject(id); |
24 | self:run(connection); |
25 | end; |
26 | |
27 | function PloughLimitToFieldEvent:writeStream(streamId, connection) |
28 | streamWriteInt32(streamId, networkGetObjectId(self.object)); |
29 | streamWriteBool(streamId, self.ploughLimitToField); |
30 | end; |
31 | |
32 | function PloughLimitToFieldEvent:run(connection) |
33 | self.object:setPloughLimitToField(self.ploughLimitToField, true); |
34 | if not connection:getIsServer() then |
35 | g_server:broadcastEvent(PloughLimitToFieldEvent:new(self.object, self.ploughLimitToField), nil, connection, self.object); |
36 | end; |
37 | end;
|
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de