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