Sprache Deutsch Language English

Script Dokumentation LS 2015 - BunkerSiloShovelTrigger (Patch 1.3)

Script Dokumentation Übersicht

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
3BunkerSiloShovelTrigger = {};
4BunkerSiloShovelTrigger_mt = Class(BunkerSiloShovelTrigger, ShovelFillTrigger);
5
6
7function 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;
18end;
19
20--[[function BunkerSiloShovelTrigger:delete()
21 BunkerSiloShovelTrigger:superClass().delete(self);
22end;]]
23
24function 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;
32end;
33
34function 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
43end
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