Sprache Deutsch Language English

Script Dokumentation LS 2015 - FillableShovelFillTrigger (Patch 1.3)

Script Dokumentation Übersicht

scripts/triggers/FillableShovelFillTrigger.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
3FillableShovelFillTrigger = {};
4FillableShovelFillTrigger_mt = Class(FillableShovelFillTrigger, ShovelFillTrigger);
5
6
7function FillableShovelFillTrigger: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 = FillableShovelFillTrigger_mt;
13 end;
14
15 local self = ShovelFillTrigger:new(mt);
16
17 return self;
18end;
19
20--[[function FillableShovelFillTrigger:delete()
21 FillableShovelFillTrigger:superClass().delete(self);
22end;]]
23
24function FillableShovelFillTrigger:load(nodeId, fillable)
25
26 -- just pass in any fill type, we won't use it later on
27 if not FillableShovelFillTrigger:superClass().load(self, nodeId, Fillable.FILLTYPE_MANURE) then
28 return false;
29 end
30 self.fillable = fillable;
31 return true;
32end;
33
34function FillableShovelFillTrigger:fillShovel(shovel, dt)
35 local fillType = self.fillable.currentFillType;
36 local fillLevel = self.fillable:getFillLevel(fillType)
37 if fillLevel > 0 and shovel.lastShovelEmptyTime + 5000 <= shovel.time then
38 local delta = shovel:fillShovelFromTrigger(self, fillLevel, fillType, dt);
39 if delta > 0 then
40 self.fillable:setFillLevel(fillLevel - delta, fillType);
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