Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit af18246

Browse files
committed
Re-implement PEmitter flame particle now that it is supported by lua + other flame-related tweaks
1 parent b39bfea commit af18246

File tree

12 files changed

+110
-91
lines changed

12 files changed

+110
-91
lines changed

Base.rte/Devices/Explosives/NapalmBomb/NapalmBomb.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,23 +231,23 @@ AddDevice = TDExplosive
231231
MaxVelocity = 40
232232
LifeVariation = 0.50
233233
AddGib = Gib
234-
GibParticle = MOSParticle
234+
GibParticle = PEmitter
235235
CopyOf = Flame 2 Hurt
236236
Count = 10
237237
MinVelocity = 10
238238
MaxVelocity = 25
239239
InheritsVel = 0
240240
LifeVariation = 0.20
241241
AddGib = Gib
242-
GibParticle = MOSParticle
242+
GibParticle = PEmitter
243243
CopyOf = Flame Hurt Short
244244
Count = 20
245245
MinVelocity = 20
246246
MaxVelocity = 40
247247
InheritsVel = 0
248248
LifeVariation = 0.20
249249
AddGib = Gib
250-
GibParticle = MOSParticle
250+
GibParticle = PEmitter
251251
CopyOf = Ground Flame
252252
Count = 30
253253
MinVelocity = 10

Base.rte/Effects/Pyro.ini

Lines changed: 54 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -979,22 +979,22 @@ AddEffect = MOSParticle
979979
SpriteFile = ContentFile
980980
FilePath = Base.rte/Effects/Pyro/FireBlastSmallB.bmp
981981
Mass = 0.49
982-
LifeTime = 600
983-
GlobalAccScalar = -0.4
984-
AirResistance = 0.04
982+
LifeTime = 800
983+
AirResistance = 0.05
985984
AirThreshold = 3
986985

987986

988987
AddEffect = MOSParticle
989988
CopyOf = Flame Smoke 2
990989
PresetName = Flame Smoke 2 Glow
991990
LifeTime = 700
992-
AirResistance = 0.03
991+
AirResistance = 0.037
992+
AirThreshold = 2
993993
ScreenEffect = ContentFile
994994
FilePath = Base.rte/Effects/Glows/FireGlow1.bmp
995995
EffectStartTime = 1
996996
EffectAlwaysShows = 1
997-
EffectStopTime = 300
997+
EffectStopTime = 350
998998
EffectStartStrength = 0.5
999999
EffectStopStrength = 0.0
10001000

@@ -1110,9 +1110,6 @@ AddEffect = AEmitter
11101110
ParticlesPerMinute = 0
11111111
BurstSize = 0
11121112
BurstScale = 0
1113-
BurstSpacing = 0
1114-
EmissionDamage = 0
1115-
FlashOnlyOnBurst = 0
11161113

11171114

11181115
AddAmmo = MOSRotating
@@ -1238,17 +1235,20 @@ AddEffect = MOSParticle
12381235

12391236

12401237
AddEffect = PEmitter
1241-
PresetName = Flame 1 Hurt Emitter
1242-
AirResistance = 0.01
1238+
PresetName = Flame 1 Hurt
1239+
GlobalAccScalar = 0.9
1240+
AirResistance = 0.04
1241+
AirThreshold = 1
12431242
RestThreshold = -1
12441243
Mass = 0.98
1245-
LifeTime = 8000
1244+
LifeTime = 6000
12461245
Sharpness = 0.1
12471246
HitsMOs = 0
12481247
GetsHitByMOs = 0
1248+
ScriptPath = Base.rte/Effects/Pyro/Flame/Flame.lua
12491249
SpriteFile = ContentFile
12501250
FilePath = Base.rte/Effects/Pyro/Flame/Flame.bmp
1251-
FrameCount = 84
1251+
FrameCount = 86
12521252
SpriteAnimMode = 7
12531253
SpriteOffset = Vector
12541254
X = -10
@@ -1261,39 +1261,67 @@ AddEffect = PEmitter
12611261
FilePath = Base.rte/Effects/Glows/FireGlow1.bmp
12621262
EffectAlwaysShows = 0
12631263
EffectStartTime = 0
1264-
EffectStopTime = 8000
1265-
EffectStartStrength = 0.5
1266-
EffectStopStrength = 0.1
1264+
EffectStopTime = 5000
1265+
EffectStartStrength = 0.4
1266+
EffectStopStrength = 0.0
12671267
AddEmission = Emission
12681268
EmittedParticle = MOPixel
12691269
CopyOf = Ground Fire Burn Particle
1270-
ParticlesPerMinute = 1200
1270+
ParticlesPerMinute = 900
12711271
LifeVariation = 0.25
12721272
Spread = 1.5
1273-
MaxVelocity = 20
1274-
MinVelocity = -10
1273+
MaxVelocity = 18
1274+
MinVelocity = -9
12751275
PushesEmitter = 0
1276+
InheritsVel = 1
12761277
AddEmission = Emission
12771278
EmittedParticle = MOSParticle
12781279
CopyOf = Flame Smoke 2
1279-
ParticlesPerMinute = 1600
1280-
LifeVariation = 0.50
1280+
ParticlesPerMinute = 1200
1281+
LifeVariation = 0.75
12811282
Spread = 1.5
1282-
MaxVelocity = 8
1283-
MinVelocity = -4
1283+
MaxVelocity = 1
1284+
MinVelocity = 0
12841285
PushesEmitter = 0
1286+
InheritsVel = 1
12851287
EmissionAngle = Matrix
12861288
AngleDegrees = 90
12871289
EmissionEnabled = 1
12881290
EmissionsIgnoreThis = 0
1289-
BurstSize = 5
1291+
BurstSize = 4
12901292
BurstScale = 2
1291-
BurstTriggered = 0
1293+
BurstTriggered = 1
12921294

12931295

12941296
AddEffect = PEmitter
1295-
CopyOf = Flame 1 Hurt Emitter
1296-
PresetName = Flame 2 Hurt Emitter
1297+
CopyOf = Flame 1 Hurt
1298+
PresetName = Flame Hurt Short
1299+
GlobalAccScalar = 0.5
1300+
LifeTime = 4500
1301+
EffectStartTime = 10
1302+
1303+
1304+
AddEffect = PEmitter
1305+
CopyOf = Flame 1 Hurt
1306+
PresetName = Flame 2 Hurt
1307+
ScreenEffect = ContentFile
1308+
FilePath = Base.rte/Effects/Glows/FireGlow1.bmp
1309+
EffectStopTime = 3000
1310+
EffectStartStrength = 0.6
1311+
EffectStopStrength = 0.0
1312+
1313+
1314+
AddEffect = PEmitter
1315+
CopyOf = Flame Hurt Short
1316+
PresetName = Flame Hurt Short Float
1317+
GlobalAccScalar = -0.1
1318+
1319+
1320+
AddEffect = PEmitter
1321+
CopyOf = Flame 1 Hurt
1322+
PresetName = Ground Flame
1323+
LifeTime = 7500
1324+
EffectStopStrength = 0
12971325

12981326

12991327
///////////////////////////////////////////////////////////////////////

Base.rte/Effects/Pyro/Flame/Flame.lua

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ function Create(self)
22
self.strength = 1;
33
self.checkTimer = Timer();
44
self.checkDelay = math.random(25);
5-
if string.find(self.PresetName, "Short") then
6-
self.isShort = true;
7-
self.deleteDelay = self.Lifetime * RangeRand(0.05, 0.15);
8-
end
95
if string.find(self.PresetName, "Ground") then
106
self.notSticky = true;
7+
elseif string.find(self.PresetName, "Short") then
8+
self.isShort = true;
9+
self.deleteDelay = self.Lifetime * RangeRand(0.05, 0.15);
1110
end
1211
end
1312
function Update(self)
@@ -30,7 +29,7 @@ function Update(self)
3029
if self.checkTimer:IsPastSimMS(self.checkDelay) then
3130
self.checkTimer:Reset();
3231
self.checkDelay = math.floor(self.checkDelay * 1.05 + 3); --Gradually extend the delay for optimization reasons
33-
local checkPos = self.Pos + self.Vel * rte.PxTravelledPerFrame * math.random();
32+
local checkPos = Vector(self.Pos.X, self.Pos.Y - 1) + self.Vel * rte.PxTravelledPerFrame * math.random();
3433
local moCheck = SceneMan:GetMOIDPixel(checkPos.X, checkPos.Y);
3534
if moCheck ~= rte.NoMOID then
3635
local mo = MovableMan:GetMOFromID(moCheck);
@@ -45,39 +44,18 @@ function Update(self)
4544
self.stickPos = SceneMan:ShortestDistance(mo.Pos, self.Pos, SceneMan.SceneWrapsX) * 0.8;
4645
self.Pos = mo.Pos + Vector(self.stickPos.X, self.stickPos.Y);
4746
end
47+
elseif not self.isShort and math.random() < 0.1 then
48+
--Spawn another, shorter flame particle occasionally
49+
local particle = CreatePEmitter("Flame Hurt Short Float");
50+
particle.Lifetime = particle.Lifetime * RangeRand(0.6, 0.9);
51+
particle.Vel = self.Vel + Vector(0, -3) + Vector(math.random(), 0):RadRotate(math.random() * math.pi * 2);
52+
particle.Pos = Vector(self.Pos.X, self.Pos.Y - 1);
53+
MovableMan:AddParticle(particle);
4854
end
4955
if self.deleteDelay and self.Age > self.deleteDelay then
5056
self.ToDelete = true;
5157
end
5258
end
5359
end
5460
end
55-
local age = (self.Age * 0.0001) + 1; --Have age slightly affect particle settings relative to 10 seconds
56-
local chance = math.random();
57-
local particle;
58-
if chance < (0.08/age) then
59-
particle = CreateMOPixel("Ground Fire Burn Particle");
60-
particle.Vel = self.Vel + Vector(RangeRand(-15, 15), -math.random(-10, 20));
61-
particle.Sharpness = particle.Sharpness * RangeRand(0.5, 1.0);
62-
if self.Team ~= Activity.NOTEAM then
63-
particle.Team = self.Team;
64-
particle.IgnoresTeamHits = true;
65-
end
66-
elseif chance < (0.4/age) then
67-
--Spawn another, shorter flame particle occasionally
68-
if not self.isShort and math.random() < 0.05 then
69-
particle = CreateMOSParticle("Flame Hurt Short Float");
70-
particle.Lifetime = 4000/age;
71-
particle.Vel = self.Vel + Vector(0, -3);
72-
else
73-
particle = CreateMOSParticle("Flame Smoke 2");
74-
particle.Lifetime = math.random(250, 1000)/age;
75-
particle.Vel = self.Vel + Vector(0, -1);
76-
end
77-
particle.Vel = particle.Vel + Vector(math.random(), 0):RadRotate(math.random() * 6.28);
78-
end
79-
if particle then
80-
particle.Pos = Vector(self.Pos.X + math.random(-2, 2), self.Pos.Y - math.random(0, 4));
81-
MovableMan:AddParticle(particle);
82-
end
8361
end

Browncoats.rte/Devices/Explosives/FireBomb/FireBomb.lua

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ function Create(self)
44
self.lifeTimer = Timer();
55
self.emitTimerA = Timer();
66
self.emitTimerB = Timer();
7+
self.emitSpread = math.pi * 2;
78

89
self.smallAngle = math.pi/6;
910

@@ -51,32 +52,32 @@ function Update(self)
5152

5253
local fireA = CreateMOPixel("Particle Browncoat Incendiary Flame 1");
5354
fireA.Pos = self.Pos;
54-
fireA.Vel = self.Vel/2 + Vector(math.random(10, 15), 0):RadRotate(randomAngleA);
55+
fireA.Vel = self.Vel * 0.5 + Vector(math.random(10, 15), 0):RadRotate(randomAngleA);
5556
MovableMan:AddParticle(fireA);
5657

5758
local fireB = CreateMOPixel("Particle Browncoat Incendiary Flame 2");
5859
fireB.Pos = self.Pos;
59-
fireB.Vel = self.Vel/2 + Vector(math.random(5, 10), 0):RadRotate(randomAngleB);
60+
fireB.Vel = self.Vel * 0.5 + Vector(math.random(5, 10), 0):RadRotate(randomAngleB);
6061
MovableMan:AddParticle(fireB);
6162

6263
local fireC = CreateMOSParticle("Tiny Smoke Ball Incendiary Flamer 1");
6364
fireC.Pos = self.Pos;
64-
fireC.Vel = self.Vel/2 + Vector(math.random(2, 5), 0):RadRotate(randomAngleC);
65+
fireC.Vel = self.Vel * 0.5 + Vector(math.random(2, 5), 0):RadRotate(randomAngleC);
6566
MovableMan:AddParticle(fireC);
6667
else
6768
local fireA = CreateMOPixel("Particle Browncoat Incendiary Flame 1");
6869
fireA.Pos = self.Pos;
69-
fireA.Vel = self.Vel/2 + Vector(math.random(10, 15), 0):RadRotate(math.random() * 6.283);
70+
fireA.Vel = self.Vel * 0.5 + Vector(math.random(10, 15), 0):RadRotate(math.random() * self.emitSpread);
7071
MovableMan:AddParticle(fireA);
7172

7273
local fireB = CreateMOPixel("Particle Browncoat Incendiary Flame 2");
7374
fireB.Pos = self.Pos;
74-
fireB.Vel = self.Vel/2 + Vector(math.random(5, 10), 0):RadRotate(math.random() * 6.283);
75+
fireB.Vel = self.Vel * 0.5 + Vector(math.random(5, 10), 0):RadRotate(math.random() * self.emitSpread);
7576
MovableMan:AddParticle(fireB);
7677

7778
local fireC = CreateMOSParticle("Tiny Smoke Ball Incendiary Flamer 1");
7879
fireC.Pos = self.Pos;
79-
fireC.Vel = self.Vel/2 + Vector(math.random(2, 5), 0):RadRotate(math.random() * 6.283);
80+
fireC.Vel = self.Vel * 0.5 + Vector(math.random(2, 5), 0):RadRotate(math.random() * self.emitSpread);
8081
MovableMan:AddParticle(fireC);
8182
end
8283

@@ -93,28 +94,28 @@ function Update(self)
9394

9495
local fireD = CreateMOSParticle("Tiny Smoke Ball Incendiary Flamer 2");
9596
fireD.Pos = self.Pos;
96-
fireD.Vel = self.Vel/2 + Vector(math.random(10, 15), 0):RadRotate(randomAngleA);
97+
fireD.Vel = self.Vel * 0.5 + Vector(math.random(10, 15), 0):RadRotate(randomAngleA);
9798
MovableMan:AddParticle(fireD);
9899

99100
local fireE = CreateMOSParticle("Tiny Smoke Ball Incendiary Flamer 3");
100101
fireE.Pos = self.Pos;
101-
fireE.Vel = self.Vel/2 + Vector(math.random(5, 10), 0):RadRotate(randomAngleB);
102+
fireE.Vel = self.Vel * 0.5 + Vector(math.random(5, 10), 0):RadRotate(randomAngleB);
102103
MovableMan:AddParticle(fireE);
103104

104-
local flame = CreateMOSParticle("Flame Hurt Short Float");
105+
local flame = CreatePEmitter("Flame Hurt Short Float");
105106
flame.Pos = self.Pos;
106-
flame.Vel = self.Vel/2 + Vector(math.random(3, 7), 0):RadRotate(math.random() * 6.283);
107+
flame.Vel = self.Vel * 0.5 + Vector(math.random(3, 7), 0):RadRotate(math.random() * self.emitSpread);
107108
flame.Lifetime = flame.Lifetime * RangeRand(0.5, 1.0);
108109
MovableMan:AddParticle(flame);
109110
else
110111
local fireD = CreateMOSParticle("Tiny Smoke Ball Incendiary Flamer 2");
111112
fireD.Pos = self.Pos;
112-
fireD.Vel = self.Vel/2 + Vector(math.random(10, 15), 0):RadRotate(math.random() * 6.283);
113+
fireD.Vel = self.Vel * 0.5 + Vector(math.random(10, 15), 0):RadRotate(math.random() * self.emitSpread);
113114
MovableMan:AddParticle(fireD);
114115

115116
local fireE = CreateMOSParticle("Tiny Smoke Ball Incendiary Flamer 3");
116117
fireE.Pos = self.Pos;
117-
fireE.Vel = self.Vel/2 + Vector(math.random(5, 10), 0):RadRotate(math.random() * 6.283);
118+
fireE.Vel = self.Vel * 0.5 + Vector(math.random(5, 10), 0):RadRotate(math.random() * self.emitSpread);
118119
MovableMan:AddParticle(fireE);
119120
end
120121
end

Browncoats.rte/Devices/Explosives/FuelBomb/FuelBomb.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function Update(self)
4444
for i = 1, #self.partList do
4545
if MovableMan:IsParticle(self.partList[i]) and self.partList[i].PresetName == "Browncoat Fuel Bomb Fuel" then
4646
if self.explodeTimer:IsPastSimMS(self.explodeTime + self.partList[i].queue) then
47-
local fire = CreateMOSParticle("Flame ".. math.random(2) .." Hurt");
47+
local fire = CreatePEmitter("Flame ".. math.random(2) .." Hurt");
4848
fire.Pos = Vector(self.partList[i].Pos.X, self.partList[i].Pos.Y);
4949
fire.Vel = self.Vel;
5050
if self.partList[i].target then

Browncoats.rte/Devices/Shared/IncendiaryBulletHeavy.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function Create(self)
55
trail.EffectRotAngle = self.Vel.AbsRadAngle;
66
MovableMan:AddParticle(trail);
77

8-
self.fire = CreateMOSParticle("Flame Hurt Short");
8+
self.fire = CreatePEmitter("Flame Hurt Short");
99
end
1010
function Update(self)
1111
local velFactor = math.floor(1 + math.sqrt(self.Vel.Magnitude)/(1 + self.Age * 0.01));

Browncoats.rte/Devices/Shared/IncendiaryBulletLight.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function Create(self)
55
self.trailGlow.Pos = self.Pos - Vector(self.Vel.X, self.Vel.Y) * rte.PxTravelledPerFrame * 0.5;
66
MovableMan:AddParticle(self.trailGlow);
77

8-
self.fire = CreateMOSParticle("Flame Hurt Short");
8+
self.fire = CreatePEmitter("Flame Hurt Short");
99
end
1010
function Update(self)
1111
if self.trailGlow and MovableMan:IsParticle(self.trailGlow) then

Browncoats.rte/Devices/Weapons/Backblast/Backblast.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ AddAmmo = AEmitter
6161
MinVelocity = 10
6262
PushesEmitter = 0
6363
AddEmission = Emission
64-
EmittedParticle = MOSParticle
64+
EmittedParticle = PEmitter
6565
CopyOf = Flame Hurt Short Float
6666
BurstSize = 6
6767
LifeVariation = 0.10

Browncoats.rte/Devices/Weapons/Flash/Flash.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ AddAmmo = AEmitter
243243
InheritsVel = 0
244244
LifeVariation = 0.30
245245
AddGib = Gib
246-
GibParticle = MOSParticle
246+
GibParticle = PEmitter
247247
CopyOf = Flame Hurt Short
248248
Count = 5
249249
MinVelocity = 5

Browncoats.rte/Devices/Weapons/Heatlance/Heatlance.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ AddAmmo = AEmitter
5050
MinVelocity = 15
5151
PushesEmitter = 0
5252
AddEmission = Emission
53-
EmittedParticle = MOSParticle
53+
EmittedParticle = PEmitter
5454
CopyOf = Flame Hurt Short Float
5555
LifeVariation = 0.10
5656
Spread = 0.05

0 commit comments

Comments
 (0)