MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / SpawnElectricEffect

Function SpawnElectricEffect

TombEngine/Game/effects/Electricity.cpp:140–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138 }
139
140 void SpawnElectricEffect(const ItemInfo& item, int jointNumber, const Vector3i& offset, const float spawnRadius, float beamOriginRadius, float beamTargetRadius, int frequency, const Vector3& pos)
141 {
142 // TODO: Make electric effect correctly spawn randomly on any mesh bounds surface and water surfaces. -- Tomo
143
144 int randomIndex = Random::GenerateInt(0, 100);
145 auto pos1 = Vector3::Zero;
146
147 if (randomIndex < frequency)
148 {
149 if (pos != Vector3::Zero)
150 {
151 pos1 = pos + offset.ToVector3();
152 }
153 else
154 {
155 pos1 = GetJointPosition(item, jointNumber, offset).ToVector3();
156 }
157
158 auto sphere = BoundingSphere(pos1, spawnRadius);
159 auto pos2 = Random::GeneratePointOnSphere(sphere);
160
161 SpawnElectricityGlow(pos2, 28, 32, 32, 64);
162
163 SpawnCyborgSpark(pos2);
164 SpawnDynamicLight(pos2.x, pos2.y, pos2.z, Random::GenerateInt(4, 8), 31, 63, 127);
165
166 sphere = BoundingSphere(pos1, beamOriginRadius);
167 auto sphere1 = BoundingSphere(pos1, beamTargetRadius);
168 pos1 = Random::GeneratePointOnSphere(sphere);
169 pos2 = Random::GeneratePointOnSphere(sphere1);
170
171 SpawnElectricity(pos1, pos2, Random::GenerateInt(8, 16), 32, 64, 128, 24, (int)ElectricityFlags::Spline | (int)ElectricityFlags::ThinOut | (int)ElectricityFlags::ThinIn, 6, 8);
172 }
173 }
174
175 void SpawnHelicalLaser(const Vector3& origin, const Vector3& target)
176 {

Callers 1

Calls 8

GenerateIntFunction · 0.85
GetJointPositionFunction · 0.85
GeneratePointOnSphereFunction · 0.85
SpawnElectricityGlowFunction · 0.85
SpawnCyborgSparkFunction · 0.85
SpawnDynamicLightFunction · 0.85
SpawnElectricityFunction · 0.85
ToVector3Method · 0.45

Tested by

no test coverage detected