Script v1.7.1.0
- AI
- Animals
- AnimalFoodManager
- AnimalHusbandryNoMorePall...
- AnimalManager
- AnimalNameManager
- CrowsWildlife
- Dog
- Horse
- HusbandryModuleBase
- HusbandryModuleFood
- HusbandryModuleFoodSpilla...
- HusbandryModuleLiquidManu...
- HusbandryModuleManure
- HusbandryModuleMilk
- HusbandryModulePallets
- HusbandryModuleStraw
- LightWildlife
- RideableAnimal
- Contracts
- Debug
- Economy
- Effects
- Events
- Farms
- GUI
- Handtools
- I3d
- Materials
- Misc
- 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
AnimalNameManager
DescriptionThis class handles animal namingParent
AbstractManagerFunctions
getRandomName
DescriptionDefinitiongetRandomName()Return Values
table | returns | a food group or nil if nothing is found |
74 | function AnimalNameManager:getRandomName() |
75 | local index = math.random(#self.names) |
76 | |
77 | if index > 0 then |
78 | return self.names[index] |
79 | end |
80 | return "" |
81 | end |
initDataStructures
DescriptionInitialize data structuresDefinition
initDataStructures()Code
24 | function AnimalNameManager:initDataStructures() |
25 | self.names = {} |
26 | end |
loadMapData
DescriptionLoad data on map loadDefinition
loadMapData()Return Values
boolean | true | if loading was successful else false |
31 | function AnimalNameManager:loadMapData(xmlFile, missionInfo) |
32 | AnimalNameManager:superClass().loadMapData(self) |
33 | |
34 | local filename = Utils.getFilename(getXMLString(xmlFile, "map.animalNames#filename"), g_currentMission.baseDirectory) |
35 | if filename == nil or filename == "" then |
36 | print("Error: Could not load animal name configuration file '" .. tostring(filename) .. "'!") |
37 | return false |
38 | end |
39 | |
40 | self:loadNamesFromXML(filename) |
41 | |
42 | return true |
43 | end |
new
DescriptionCreating managerDefinition
new()Return Values
table | instance | instance of object |
16 | function AnimalNameManager:new(customMt) |
17 | local self = AbstractManager:new(customMt or AnimalNameManager_mt) |
18 | |
19 | return self |
20 | end |