Script v1.4.4.0
Engine v7.0.0.2
- General
- Entity
- Node
- Scenegraph
- Lighting
- Camera
- Shape
- Particle System
- Physics
- Spline
- Animation
- Overlays
- Sound
- Input
- XML
- Network
- Callbacks
- Text Rendering
- Terrain Detail
- Tire Track
- Editor
- Rendering
- String
- Math
- I3D
- Fillplanes
Foundation Reference
FillActivatable
DescriptionThis is the activable class for fillablesFunctions
new
DescriptionReturns new instance of classDefinition
new(table fillable)Arguments
table | fillable | object of fillable |
table | self | new instance |
19 | function FillActivatable:new(fillable) |
20 | local self = {}; |
21 | setmetatable(self, FillActivatable_mt); |
22 | |
23 | self.fillable = fillable; |
24 | self.activateText = "unknown"; |
25 | |
26 | return self; |
27 | end; |
getIsActivatable
DescriptionReturns if is activateableDefinition
getIsActivatable()Return Values
boolean | isActivateable | is activateable |
32 | function FillActivatable:getIsActivatable() |
33 | if self.fillable:getIsActiveForInput() and self.fillable:getFillLevel() < self.fillable:getCapacity() then |
34 | -- find the first trigger which is activable |
35 | for _,trigger in ipairs(self.fillable.fillTriggers) do |
36 | if trigger:getIsActivatable(self.fillable) then |
37 | self:updateActivateText(); |
38 | return true; |
39 | end; |
40 | end; |
41 | end |
42 | return false; |
43 | end; |
onActivateObject
DescriptionCalled on activate objectDefinition
onActivateObject()Code
47 | function FillActivatable:onActivateObject() |
48 | self.fillable:setIsFilling(not self.fillable.isFilling); |
49 | self:updateActivateText(); |
50 | g_currentMission:addActivatableObject(self); |
51 | end; |
updateActivateText
DescriptionUpdates activate textDefinition
updateActivateText()Code
59 | function FillActivatable:updateActivateText() |
60 | if self.fillable.isFilling then |
61 | self.activateText = string.format(g_i18n:getText("action_stopRefillingOBJECT"), self.fillable.typeDesc); |
62 | else |
63 | self.activateText = string.format(g_i18n:getText("action_refillOBJECT"), self.fillable.typeDesc); |
64 | end; |
65 | end; |