Script v1.7.1.0
- AI
- Animals
- Contracts
- Debug
- Economy
- Effects
- Events
- Farms
- GUI
- Handtools
- I3d
- Materials
- Misc
- AbstractManager
- AsyncManager
- AutoSaveManager
- BaleTypeManager
- BrandColorManager
- ConnectionHoseManager
- DeferredLoadingManager
- DepthOfFieldManager
- FillTypeManager
- FruitTypeManager
- GameplayHintManager
- GroundTypeManager
- HelpLineManager
- MapManager
- PlaceableTypeManager
- SleepManager
- SplitTypeManager
- SprayTypeManager
- TensionBeltManager
- ToolTypeManager
- TreePlantManager
- Objects
- Placeables
- Player
- Shop
- Sounds
- Specializations
- Triggers
- 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
FillTypeManager
DescriptionThis class handles all fillTypes and fillTypeCategoriesParent
AbstractManagerFunctions
- getFillTypeByIndex
- getFillTypeByName
- getFillTypeIndexByName
- getFillTypeNameByIndex
- getFillTypes
- getFillTypesByCategoryNames
- initDataStructures
- loadMapData
- new
getFillTypeByIndex
DescriptionGets a fillType by indexDefinition
getFillTypeByIndex(integer index)Arguments
integer | index | the fillType index |
table | fillType | the fillType object |
309 | function FillTypeManager:getFillTypeByIndex(index) |
310 | if index ~= nil then |
311 | return self.fillTypes[index] |
312 | end |
313 | return nil |
314 | end |
getFillTypeByName
DescriptionGets a fillType by index nameDefinition
getFillTypeByName(string name)Arguments
string | name | the fillType index name |
table | fillType | the fillType object |
343 | function FillTypeManager:getFillTypeByName(name) |
344 | if ClassUtil.getIsValidIndexName(name) then |
345 | name = name:upper() |
346 | return self.nameToFillType[name] |
347 | end |
348 | return nil |
349 | end |
getFillTypeIndexByName
DescriptionGets a fillType index by nameDefinition
getFillTypeIndexByName(string name)Arguments
string | name | the fillType index name |
integer | fillTypeIndex | the fillType index |
331 | function FillTypeManager:getFillTypeIndexByName(name) |
332 | if name ~= nil then |
333 | name = name:upper() |
334 | return self.nameToIndex[name] |
335 | end |
336 | return nil |
337 | end |
getFillTypeNameByIndex
DescriptionGets a fillTypeName by indexDefinition
getFillTypeNameByIndex(integer index)Arguments
integer | index | the fillType index |
string | fillTypeName | the fillType name |
320 | function FillTypeManager:getFillTypeNameByIndex(index) |
321 | if index ~= nil then |
322 | return self.indexToName[index] |
323 | end |
324 | return nil |
325 | end |
getFillTypes
DescriptionGets a list of fillTypesDefinition
getFillTypes()Return Values
table | fillTypes | list of fillTypes |
354 | function FillTypeManager:getFillTypes() |
355 | return self.fillTypes |
356 | end |
getFillTypesByCategoryNames
DescriptionGets a list of fillTypes of the given category namesDefinition
getFillTypesByCategoryNames(string name, string warning)Arguments
string | name | fillType category index names |
string | warning | a warning text shown if a category is not found |
table | fillTypes | list of fillTypes |
406 | function FillTypeManager:getFillTypesByCategoryNames(names, warning) |
407 | local fillTypes = {} |
408 | local alreadyAdded = {} |
409 | local categories = StringUtil.splitString(" ", names); |
410 | for _, categoryName in pairs(categories) do |
411 | categoryName = categoryName:upper() |
412 | local categoryFillTypes = self.categoryNameToFillTypes[categoryName]; |
413 | if categoryFillTypes ~= nil then |
414 | for fillType, _ in pairs(categoryFillTypes) do |
415 | if alreadyAdded[fillType] == nil then |
416 | table.insert(fillTypes, fillType); |
417 | alreadyAdded[fillType] = true |
418 | end |
419 | end |
420 | else |
421 | if warning ~= nil then |
422 | print(string.format(warning, categoryName)); |
423 | end |
424 | end |
425 | end |
426 | return fillTypes |
427 | end |
initDataStructures
DescriptionInitialize data structuresDefinition
initDataStructures()Code
30 | function FillTypeManager:initDataStructures() |
31 | self.fillTypes = {} |
32 | self.nameToFillType = {} |
33 | self.indexToFillType = {} |
34 | self.nameToIndex = {} |
35 | self.indexToName = {} |
36 | |
37 | self.fillTypeConverters = {} |
38 | self.converterNameToIndex = {} |
39 | self.nameToConverter = {} |
40 | |
41 | self.categories = {} |
42 | self.nameToCategoryIndex = {} |
43 | self.categoryIndexToFillTypes = {} |
44 | self.categoryNameToFillTypes = {} |
45 | |
46 | self.fillTypeSamples = {} |
47 | self.fillTypeToSample = {} |
48 | |
49 | FillType = self.nameToIndex |
50 | FillTypeCategory = self.categories |
51 | end |
loadMapData
DescriptionLoad data on map loadDefinition
loadMapData()Return Values
boolean | true | if loading was successful else false |
62 | function FillTypeManager:loadMapData(xmlFile, missionInfo, baseDirectory) |
63 | FillTypeManager:superClass().loadMapData(self) |
64 | |
65 | self:loadDefaultTypes() |
66 | return XMLUtil.loadDataFromMapXML(xmlFile, "fillTypes", baseDirectory, self, self.loadFillTypes, missionInfo, baseDirectory) |
67 | end |
new
DescriptionCreating managerDefinition
new()Return Values
table | instance | instance of object |
23 | function FillTypeManager:new(customMt) |
24 | local self = AbstractManager:new(customMt or FillTypeManager_mt) |
25 | return self |
26 | end |