Script Dokumentation LS 2015 - BunkerSiloShovelTrigger (Patch 1.3)
scripts/triggers/BunkerSiloShovelTrigger.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 | BunkerSiloShovelTrigger = {}; |
4 | BunkerSiloShovelTrigger_mt = Class(BunkerSiloShovelTrigger, ShovelFillTrigger); |
5 | |
6 | |
7 | function BunkerSiloShovelTrigger:new(mt) |
8 | -- this trigger should only be created on the server |
9 | assert(g_currentMission:getIsServer()); |
10 | |
11 | if mt == nil then |
12 | mt = BunkerSiloShovelTrigger_mt; |
13 | end; |
14 | |
15 | local self = ShovelFillTrigger:new(mt); |
16 | |
17 | return self; |
18 | end; |
19 | |
20 | --[[function BunkerSiloShovelTrigger:delete() |
21 | BunkerSiloShovelTrigger:superClass().delete(self); |
22 | end;]] |
23 | |
24 | function BunkerSiloShovelTrigger:load(nodeId, bunkerSilo, movingPlane) |
25 | |
26 | if not BunkerSiloShovelTrigger:superClass().load(self, nodeId, Fillable.FILLTYPE_SILAGE) then |
27 | return false; |
28 | end |
29 | self.bunkerSilo = bunkerSilo; |
30 | self.movingPlane = movingPlane; |
31 | return true; |
32 | end; |
33 | |
34 | function BunkerSiloShovelTrigger:fillShovel(shovel, dt) |
35 | if self.bunkerSilo.state == BunkerSilo.STATE_DRAIN and self.movingPlane.fillLevel > 0 then |
36 | local fillLevel = self.movingPlane.fillLevel; |
37 | local delta = shovel:fillShovelFromTrigger(self, fillLevel, Fillable.FILLTYPE_SILAGE, dt); |
38 | |
39 | if delta > 0 then |
40 | self.bunkerSilo:setMovingPlaneFillLevel(self.movingPlane, self.movingPlane.fillLevel - delta, false); |
41 | end |
42 | end |
43 | end
|
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de