Script v1.7.1.0
- AI
- Animals
- Contracts
- Debug
- Economy
- Effects
- Events
- Farms
- GUI
- Handtools
- I3d
- Materials
- Misc
- Objects
- Placeables
- Player
- Shop
- Sounds
- Specializations
- Triggers
- AnimalLoadingTrigger
- BasketTrigger
- FillPlane
- FillTrigger
- InsideBuildingTrigger
- LoadTrigger
- LoadTriggerSetIsLoadingEv...
- LoanTrigger
- RainDropFactorTrigger
- ShopTrigger
- TransportMissionTrigger
- UnloadFeedingTrough
- UnloadTrigger
- WeighStation
- Utils
- Vehicles
- Weather
Engine v1.7.1.0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- XML
- general
Foundation Reference
FillPlane
Functionsdelete
DescriptionDestructorDefinition
delete()Code
34 | function FillPlane:delete() |
35 | end |
initDataStructures
DescriptionInit class membersDefinition
initDataStructures()Code
39 | function FillPlane:initDataStructures() |
40 | self.node = nil |
41 | self.maxCapacity = 0 |
42 | self.moveMinY = 0 |
43 | self.moveMaxY = 0 |
44 | self.loaded = false |
45 | self.colorChange = false |
46 | end |
load
DescriptionLoads fill planeDefinition
load(table rootNode, string xmlFile, string xmlNode)Arguments
table | rootNode | of the object |
string | xmlFile | file to read |
string | xmlNode | xmlNode to read from |
53 | function FillPlane:load(rootNode, xmlFile, xmlNode) |
54 | local fillPlaneNodeStr = XMLUtil.getValueFromXMLFileOrUserAttribute(xmlFile, xmlNode, "node", getXMLString, rootNode) |
55 | |
56 | if fillPlaneNodeStr ~= nil then |
57 | local fillPlaneNode = I3DUtil.indexToObject(rootNode, fillPlaneNodeStr) |
58 | |
59 | if fillPlaneNode ~= nil then |
60 | self.node = fillPlaneNode |
61 | self.moveMinY = Utils.getNoNil(XMLUtil.getValueFromXMLFileOrUserAttribute(xmlFile, xmlNode, "minY", getXMLFloat, rootNode), 0) |
62 | self.moveMaxY = Utils.getNoNil(XMLUtil.getValueFromXMLFileOrUserAttribute(xmlFile, xmlNode, "maxY", getXMLFloat, rootNode), 0) |
63 | self.colorChange = Utils.getNoNil(XMLUtil.getValueFromXMLFileOrUserAttribute(xmlFile, xmlNode, "colorChange", getXMLBool, rootNode), false) |
64 | assert(self.moveMinY <= self.moveMaxY) |
65 | self.loaded = self.node ~= nil |
66 | local x, _, z = getTranslation(self.node) |
67 | setTranslation(self.node, x, self.moveMinY, z) |
68 | end |
69 | end |
70 | end |
new
DescriptionCreates a new instance of the classDefinition
new(table customMt)Arguments
table | customMt | meta table |
table | self | returns the instance |
23 | function FillPlane:new(customMt) |
24 | local self = {} |
25 | setmetatable(self, customMt or FillPlane_mt) |
26 | |
27 | self:initDataStructures() |
28 | |
29 | return self |
30 | end |
setColorScale
DescriptionSets fill plane color shaderDefinition
setColorScale(float[] a)Arguments
float[] | a | float array for r, g, b |
92 | function FillPlane:setColorScale(colorScale) |
93 | if self.loaded then |
94 | setShaderParameter(self.node, "colorScale", colorScale[1], colorScale[2], colorScale[3], 0, false) |
95 | end |
96 | end |
setState
DescriptionChanges fill levels visualsDefinition
setState(table instance)Arguments
table | instance | target to check fillLevel |
bool | true | if level has changed |
76 | function FillPlane:setState(state) |
77 | if self.loaded then |
78 | local delta = self.moveMaxY - self.moveMinY |
79 | local y = math.min(self.moveMinY + delta * state, self.moveMaxY) |
80 | local x, oldY, z = getTranslation(self.node) |
81 | setTranslation(self.node, x, y, z) |
82 | |
83 | return oldY ~= y |
84 | end |
85 | |
86 | return false |
87 | end |