Sprache Deutsch Language English

Script Documentation FS 2015 - FillActivatable (Patch 1.3)

Script Documentation Overview

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
10FillActivatable = {}
11local FillActivatable_mt = Class(FillActivatable);
12
13function FillActivatable:new(fillable)
14 local self = {};
15 setmetatable(self, FillActivatable_mt);
16
17 self.fillable = fillable;
18 self.activateText = "unknown";
19
20 return self;
21end;
22
23function 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;
34end;
35
36function FillActivatable:onActivateObject()
37 self.fillable:setIsFilling(not self.fillable.isFilling);
38 self:updateActivateText();
39 g_currentMission:addActivatableObject(self);
40end;
41
42function FillActivatable:drawActivate()
43 -- TODO draw icon
44end;
45
46function 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;
52end;
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de
Script Documentation Overview