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

Commit 1c6529d

Browse files
committed
More flame tweaks;
- Elementary step towards fire reacting to flammable terrain materials
1 parent 10fafeb commit 1c6529d

File tree

5 files changed

+77
-19
lines changed

5 files changed

+77
-19
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ AddDevice = TDExplosive
241241
MaxVelocity = 25
242242
InheritsVel = 0
243243
LifeVariation = 0.20
244+
SpreadMode = 1
244245
AddGib = Gib
245246
GibParticle = PEmitter
246247
CopyOf = Flame Hurt Short
@@ -249,7 +250,6 @@ AddDevice = TDExplosive
249250
MaxVelocity = 40
250251
InheritsVel = 0
251252
LifeVariation = 0.20
252-
SpreadMode = 1
253253
AddGib = Gib
254254
GibParticle = PEmitter
255255
CopyOf = Ground Flame

Data/Base.rte/Effects.ini

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,41 @@ AddEffect = MOPixel
4242
TrailLength = 1
4343

4444

45+
AddEffect = MOPixel
46+
PresetName = Ash Particle 1
47+
Mass = 0.001
48+
GlobalAccScalar = 0.1
49+
AirResistance = 0.01
50+
AirThreshold = 1
51+
RestThreshold = 10000
52+
Sharpness = 0
53+
Color = Color
54+
R = 62
55+
G = 62
56+
B = 62
57+
Atom = Atom
58+
Material = Material
59+
CopyOf = Ashes
60+
61+
62+
AddEffect = MOPixel
63+
CopyOf = Ash Particle 1
64+
PresetName = Ash Particle 2
65+
Color = Color
66+
R = 32
67+
G = 32
68+
B = 32
69+
70+
71+
AddEffect = MOPixel
72+
CopyOf = Ash Particle 1
73+
PresetName = Ash Particle 3
74+
Color = Color
75+
R = 96
76+
G = 96
77+
B = 96
78+
79+
4580
AddEffect = MOPixel
4681
PresetName = Drop Oil
4782
Mass = 0.03
@@ -394,11 +429,11 @@ AddEffect = MOPixel
394429
AddEffect = MOPixel
395430
PresetName = Ground Fire Burn Particle
396431
Mass = 0.01
397-
GlobalAccScalar = -0.4
398-
AirResistance = 0.01
432+
GlobalAccScalar = -0.5
433+
AirResistance = 0.05
399434
RestThreshold = -1
400435
LifeTime = 75
401-
Sharpness = 200
436+
Sharpness = 175
402437
HitsMOs = 1
403438
GetsHitByMOs = 0
404439
Color = Color
@@ -419,6 +454,7 @@ AddEffect = MOPixel
419454
CopyOf = Ground Fire Burn Particle
420455
PresetName = Fire Burn Particle
421456
GlobalAccScalar = -0.3
457+
AirResistance = 0.03
422458
LifeTime = 150
423459
ScreenEffect = ContentFile
424460
FilePath = Base.rte/Effects/Glows/FireGlowTiny.png

Data/Base.rte/Effects/Pyro.ini

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,13 +1301,12 @@ AddEffect = PEmitter
13011301
AngleDegrees = 90
13021302
EmissionOffset = Vector
13031303
X = 0
1304-
Y = -2
1304+
Y = -1
13051305
EmissionEnabled = 1
13061306
EmissionsIgnoreThis = 0
13071307
NegativeThrottleMultiplier = 0.75
13081308
PositiveThrottleMultiplier = 1.5
1309-
BurstSize = 5
1310-
BurstScale = 2
1309+
BurstSize = 3
13111310
BurstTriggered = 1
13121311

13131312

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ function Create(self)
99
end
1010

1111
function Update(self)
12-
self.ageRatio = 1 - self.Age/self.Lifetime;
12+
self.ageRatio = 1 - self.Age/self.deleteDelay;
1313
self:NotResting();
1414
--TODO: Use Throttle to combine multiple flames into one
1515
self.Throttle = self.Throttle - TimerMan.DeltaTimeMS/self.Lifetime;
1616

17-
if self.target and MovableMan:ValidMO(self.target) and self.target.ID ~= rte.NoMOID and not self.target.ToDelete then
18-
self.Vel = self.target.Vel;
17+
if self.target and IsMOSRotating(self.target) and self.target.ID ~= rte.NoMOID and not self.target.ToDelete then
18+
self.Vel = Vector();
1919
self.Pos = self.target.Pos + Vector(self.stickOffset.X, self.stickOffset.Y):RadRotate(self.target.RotAngle - self.targetStickAngle);
2020
local actor = self.target:GetRootParent();
2121
if MovableMan:IsActor(actor) then
@@ -35,7 +35,7 @@ end
3535
function OnCollideWithMO(self, mo, rootMO)
3636
if self.target == nil then
3737
--Stick to objects on collision
38-
if not mo.ToDelete and IsMOSRotating(mo) and math.random() < self.ageRatio - 0.5 then
38+
if not mo.ToDelete and IsMOSRotating(mo) and math.random() < self.ageRatio then
3939
self.target = ToMOSRotating(mo);
4040
self.targetStickAngle = mo.RotAngle;
4141
local velOffset = self.PrevVel * rte.PxTravelledPerFrame * 0.5;
@@ -53,11 +53,17 @@ function OnCollideWithMO(self, mo, rootMO)
5353
end
5454

5555
function OnCollideWithTerrain(self, terrainID)
56-
if self.HitsMOs then
56+
if terrainID == rte.grassID then
57+
local newFlame = CreatePEmitter("Ground Flame", "Base.rte");
58+
newFlame.Pos = self.Pos;
59+
newFlame.Vel = self.Vel;
60+
MovableMan:AddParticle(newFlame);
61+
self.ToDelete = true;
62+
elseif self.HitsMOs then
5763
--Let the flames linger occasionally
5864
if math.random() < 0.5 then
5965
self.GlobalAccScalar = 0.9;
60-
self.deleteDelay = terrainID == rte.grassID and self.Lifetime or math.random(self.Age, self.Lifetime);
66+
self.deleteDelay = math.random(self.Age, self.Lifetime);
6167
end
6268
self.HitsMOs = false;
6369
end

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

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,43 @@ function Create(self)
22
self.shortFlame = CreatePEmitter("Flame Hurt Short Float", "Base.rte");
33

44
self.flameTimer = Timer();
5-
self.flameTimer:SetSimTimeLimitMS(math.random(self.Lifetime));
5+
self.flameSpawnDelay = math.random(1000);
66
--Define Throttle for non-emitter particles
77
if self.Throttle == nil then
88
self.Throttle = 0;
99
end
1010
end
1111

1212
function Update(self)
13+
self.ageRatio = 1 - self.Age/self.Lifetime;
1314
self:NotResting();
1415
--TODO: Use Throttle to combine multiple flames into one
1516
self.Throttle = self.Throttle - TimerMan.DeltaTimeMS/self.Lifetime;
1617
--Spawn another, shorter flame occasionally
17-
if self.flameTimer:IsPastSimTimeLimit() then
18+
if self.flameTimer:IsPastSimMS(self.flameSpawnDelay) then
1819
self.flameTimer:Reset();
19-
self.flameTimer:SetSimTimeLimitMS(1000 + self.Age);
20+
self.flameSpawnDelay = 1000 + self.Age * 0.25;
2021

2122
local particle = self.shortFlame:Clone();
22-
particle.Lifetime = math.max(particle.Lifetime - self.Age, 100);
23-
particle.Vel = self.Vel + Vector(0, -3) + Vector(math.random(), 0):RadRotate(RangeRand(-math.pi, math.pi));
24-
particle.Pos = self.Pos - Vector(0, 1);
23+
particle.Lifetime = 100 + math.max(particle.Lifetime * self.ageRatio);
24+
particle.Vel = self.Vel + Vector(0, -2) + Vector(math.random(), 0):RadRotate(RangeRand(-math.pi, math.pi));
25+
particle.Pos = self.Pos + Vector(0, -1);
2526
MovableMan:AddParticle(particle);
2627
end
28+
end
29+
30+
function OnCollideWithTerrain(self, terrainID)
31+
if (self.Vel + self.PrevVel):MagnitudeIsLessThan(1) then
32+
local checkPos = self.Pos + Vector(math.random(-1, 1), math.random(-1, 1));
33+
if SceneMan:GetTerrMatter(checkPos.X, checkPos.Y) == rte.grassID then
34+
local px = SceneMan:DislodgePixel(checkPos.X, checkPos.Y);
35+
if px and (px.Material.PresetName == "Grass" or px.Material.PresetName == "Vegetation") then
36+
px.ToDelete = true;
37+
px = CreateMOPixel("Ash Particle " .. math.random(3), "Base.rte");
38+
px.Pos = checkPos;
39+
px.Vel = Vector(0, -2):RadRotate(math.pi * RangeRand(-0.5, 0.5));
40+
MovableMan:AddParticle(px);
41+
end
42+
end
43+
end
2744
end

0 commit comments

Comments
 (0)