Script v1_7_1_0
- AI
- Animals
- Collections
- Contracts
- Debug
- Economy
- Elements
- EnvironmentalScore
- Errors
- Events
- GUI
- Handtools
- Hud
- I3d
- Input
- Jobs
- Maps
- Materials
- Misc
- Objects
- Parameters
- Placeables
- Placement
- Player
- Shop
- Sounds
- Specialization
- Specializations
- StateMachine
- Statistics
- Tasks
- Triggers
- Utils
- Vehicles
Engine v1_7_1_0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- general
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- NoteNode
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- VoiceChat
- XML
Foundation Reference
ParticleSystemManager
DescriptionThis class handles all particlesParent
AbstractManagerFunctions
- addParticleSystem
- addParticleType
- getParticleSystem
- getParticleSystemTypeByName
- initDataStructures
- loadMapData
- new
- unloadMapData
addParticleSystem
DescriptionAdds a new material typeDefinition
addParticleSystem(string particleType, integer materialIndex, integer materialId)Arguments
string | particleType | particleType |
integer | materialIndex | material index |
integer | materialId | internal material id |
129 | function ParticleSystemManager:addParticleSystem(particleType, particleSystem) |
130 | if self.particleSystems[particleType] ~= nil then |
131 | ParticleUtil.deleteParticleSystem(self.particleSystems[particleType]) |
132 | end |
133 | |
134 | self.particleSystems[particleType] = particleSystem |
135 | end |
addParticleType
DescriptionAdds a new particle typeDefinition
addParticleType(string name)Arguments
string | name | name |
93 | function ParticleSystemManager:addParticleType(name) |
94 | if not ClassUtil.getIsValidIndexName(name) then |
95 | print("Warning: '"..tostring(name).."' is not a valid name for a particleType. Ignoring it!") |
96 | return nil |
97 | end |
98 | |
99 | name = name:upper() |
100 | |
101 | if self.nameToIndex[name] == nil then |
102 | table.insert(self.particleTypes, name) |
103 | self.nameToIndex[name] = #self.particleTypes |
104 | end |
105 | end |
getParticleSystem
DescriptionReturns particle system for given propertiesDefinition
getParticleSystem(integer fillType, string particleTypeName)Arguments
integer | fillType | fill type |
string | particleTypeName | name of particle type |
table | particleSystem |
142 | function ParticleSystemManager:getParticleSystem(particleTypeName) |
143 | local particleType = self:getParticleSystemTypeByName(particleTypeName) |
144 | if particleType == nil then |
145 | return nil |
146 | end |
147 | |
148 | return self.particleSystems[particleType] |
149 | end |
getParticleSystemTypeByName
DescriptionReturns a particleType by nameDefinition
getParticleSystemTypeByName(string name)Arguments
string | name | name of particle type |
string | particleType | the real particle name, nil if not defined |
111 | function ParticleSystemManager:getParticleSystemTypeByName(name) |
112 | if name ~= nil then |
113 | name = name:upper() |
114 | |
115 | -- atm we just return the uppercase name because a particle type is only defined as a base string |
116 | if self.nameToIndex[name] ~= nil then |
117 | return name |
118 | end |
119 | end |
120 | |
121 | return nil |
122 | end |
initDataStructures
DescriptionInitialize data structuresDefinition
initDataStructures()Code
27 | function ParticleSystemManager:initDataStructures() |
28 | self.nameToIndex = {} |
29 | self.particleTypes = {} |
30 | self.particleSystems = {} |
31 | end |
loadMapData
DescriptionLoad data on map loadDefinition
loadMapData()Return Values
boolean | true | if loading was successful else false |
36 | function ParticleSystemManager:loadMapData() |
37 | ParticleSystemManager:superClass().loadMapData(self) |
38 | |
39 | self:addParticleType("unloading") |
40 | self:addParticleType("smoke") |
41 | self:addParticleType("smoke_chimney") |
42 | self:addParticleType("chopper") |
43 | self:addParticleType("straw") |
44 | self:addParticleType("cutter_chopper") |
45 | self:addParticleType("soil") |
46 | self:addParticleType("soil_smoke") |
47 | self:addParticleType("soil_chunks") |
48 | self:addParticleType("soil_big_chunks") |
49 | self:addParticleType("soil_harvesting") |
50 | self:addParticleType("spreader") |
51 | self:addParticleType("spreader_smoke") |
52 | self:addParticleType("windrower") |
53 | self:addParticleType("tedder") |
54 | self:addParticleType("weeder") |
55 | self:addParticleType("crusher_wood") |
56 | self:addParticleType("crusher_dust") |
57 | self:addParticleType("prepare_fruit") |
58 | self:addParticleType("cleaning_soil") |
59 | self:addParticleType("cleaning_dust") |
60 | self:addParticleType("washer_water") |
61 | self:addParticleType("chainsaw_wood") |
62 | self:addParticleType("chainsaw_dust") |
63 | self:addParticleType("pickup") |
64 | self:addParticleType("pickup_falling") |
65 | self:addParticleType("sowing") |
66 | self:addParticleType("loading") |
67 | self:addParticleType("wheel_dust") |
68 | self:addParticleType("wheel_dry") |
69 | self:addParticleType("wheel_wet") |
70 | self:addParticleType("wheel_snow") |
71 | self:addParticleType("bees") |
72 | self:addParticleType("horse_step_slow") |
73 | self:addParticleType("horse_step_fast") |
74 | |
75 | ParticleType = self.nameToIndex |
76 | |
77 | return true |
78 | end |
new
DescriptionCreating managerDefinition
new()Return Values
table | instance | instance of object |
19 | function ParticleSystemManager.new(customMt) |
20 | local self = AbstractManager.new(customMt or ParticleSystemManager_mt) |
21 | |
22 | return self |
23 | end |
unloadMapData
DescriptionUnload data on mission deleteDefinition
unloadMapData()Code
82 | function ParticleSystemManager:unloadMapData() |
83 | for _, fillTypeParticleSystem in pairs(self.particleSystems) do |
84 | ParticleUtil.deleteParticleSystem(fillTypeParticleSystem) |
85 | end |
86 | |
87 | ParticleSystemManager:superClass().unloadMapData(self) |
88 | end |