Script Documentation FS 2015 - FillActivatable (Patch 1.3)
scripts/vehicles/specializations/FillActivatable.lua
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de
1 | -- |
2 | -- FillActivatable |
3 | -- This is the activable class for fillables |
4 | -- |
5 | -- @author Manuel Leithner |
6 | -- @date 03/07/14 |
7 | -- |
8 | -- Copyright (C) GIANTS Software GmbH, Confidential, All Rights Reserved. |
9 | |
10 | FillActivatable = {} |
11 | local FillActivatable_mt = Class(FillActivatable); |
12 | |
13 | function FillActivatable:new(fillable) |
14 | local self = {}; |
15 | setmetatable(self, FillActivatable_mt); |
16 | |
17 | self.fillable = fillable; |
18 | self.activateText = "unknown"; |
19 | |
20 | return self; |
21 | end; |
22 | |
23 | function FillActivatable:getIsActivatable() |
24 | if self.fillable:getIsActiveForInput() and self.fillable.fillLevel < self.fillable:getCapacity() then |
25 | -- find the first trigger which is activable |
26 | for i,trigger in ipairs(self.fillable.fillTriggers) do |
27 | if trigger:getIsActivatable(self.fillable) then |
28 | self:updateActivateText(); |
29 | return true; |
30 | end; |
31 | end; |
32 | end |
33 | return false; |
34 | end; |
35 | |
36 | function FillActivatable:onActivateObject() |
37 | self.fillable:setIsFilling(not self.fillable.isFilling); |
38 | self:updateActivateText(); |
39 | g_currentMission:addActivatableObject(self); |
40 | end; |
41 | |
42 | function FillActivatable:drawActivate() |
43 | -- TODO draw icon |
44 | end; |
45 | |
46 | function FillActivatable:updateActivateText() |
47 | if self.fillable.isFilling then |
48 | self.activateText = string.format(g_i18n:getText("stop_refill_OBJECT"), self.fillable.typeDesc); |
49 | else |
50 | self.activateText = string.format(g_i18n:getText("refill_OBJECT"), self.fillable.typeDesc); |
51 | end; |
52 | end;
|
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de