|
1 | 1 | function Create(self)
|
2 | 2 | self.smokeTrailLifeTime = self:NumberValueExists("SmokeTrailLifeTime") and self:GetNumberValue("SmokeTrailLifeTime") or 150;
|
3 | 3 | self.smokeTrailRadius = self:NumberValueExists("SmokeTrailRadius") and self:GetNumberValue("SmokeTrailRadius") or ToMOSprite(self):GetSpriteHeight() * 0.5;
|
| 4 | + self.smokeTrailTwirl = self:NumberValueExists("SmokeTrailTwirl") and self:GetNumberValue("SmokeTrailTwirl") or 0; |
| 5 | + self.smokeTwirlCounter = math.random() < 0.5 and math.pi or 0; |
4 | 6 | end
|
5 | 7 | function Update(self)
|
6 | 8 | local effect;
|
7 | 9 | local offset = self.Vel * rte.PxTravelledPerFrame; --The effect will be created the next frame so move it one frame backwards towards the barrel
|
8 | 10 |
|
9 |
| - local trailLength = math.floor(offset.Magnitude + 0.5); |
10 |
| - for i = 1, trailLength, 6 do |
11 |
| - effect = CreateMOSParticle("Tiny Smoke Trail 1", "Base.rte"); |
| 11 | + local trailLength = math.floor(offset.Magnitude * 0.5 - 1); |
| 12 | + for i = 1, trailLength do |
| 13 | + local effect = CreateMOSParticle("Tiny Smoke Trail 1", "Base.rte"); |
12 | 14 | if effect then
|
13 | 15 | effect.Pos = self.Pos - offset * (i/trailLength) + Vector(RangeRand(-1, 1), RangeRand(-1, 1)) * self.smokeTrailRadius;
|
14 |
| - effect.Vel = self.Vel * RangeRand(0.75, 1.0); |
15 |
| - effect.Lifetime = self.smokeTrailLifeTime * RangeRand(1.0, 1.5); |
| 16 | + effect.Vel = self.Vel * RangeRand(0.75, 1); |
| 17 | + effect.Lifetime = self.smokeTrailLifeTime * RangeRand(0.5, 1); |
| 18 | + |
| 19 | + if self.smokeTrailTwirl > 0 then |
| 20 | + effect.AirResistance = effect.AirResistance * RangeRand(0.9, 1); |
| 21 | + effect.GlobalAccScalar = effect.GlobalAccScalar * math.random(); |
| 22 | + |
| 23 | + effect.Pos = self.Pos - offset + offset * i/trailLength; |
| 24 | + effect.Vel = self.Vel + Vector(0, math.sin(self.smokeTwirlCounter) * self.smokeTrailTwirl + RangeRand(-0.1, 0.1)):RadRotate(self.Vel.AbsRadAngle); |
| 25 | + |
| 26 | + self.smokeTwirlCounter = self.smokeTwirlCounter + RangeRand(-0.2, 0.4); |
| 27 | + end |
16 | 28 | MovableMan:AddParticle(effect);
|
17 | 29 | end
|
18 | 30 | end
|
|
0 commit comments