Skip to content

Commit

Permalink
Add "flamethrower", "exhaust" and "exhaust_diy" thruster effects (#3231)
Browse files Browse the repository at this point in the history
* Add entity:parentToAttachment()

* Fix design oversight on timerSetDelay.

* removed unnecessary logic

* Added "exhaust" and "exhaust_diy"

* Flamethrower effect & pictures

* Revert "removed unnecessary logic"

This reverts commit a722a5e.

* Revert "Fix design oversight on timerSetDelay."

This reverts commit e9fe870.

* clean up flamethrower effect
  • Loading branch information
unknao authored Dec 27, 2024
1 parent 93b7900 commit 46f5d5c
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 0 deletions.
62 changes: 62 additions & 0 deletions lua/wire/client/thrusterlib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,68 @@ WireLib.ThrusterEffectThink.smoke_firecolors = smoke(function() return math.rand
WireLib.ThrusterEffectThink.smoke_random = smoke(function() return math.random(100, 255), math.random(100, 255), math.random(100, 255) end)
WireLib.ThrusterEffectThink.smoke_diy = smoke(function(self) local c = self:GetColor() return c.r, c.g, c.b end)

local function exhaust(color)
return function(self)

self.SmokeTimer = self.SmokeTimer or 0
if ( self.SmokeTimer > CurTime() ) then return end

self.SmokeTimer = CurTime() + 0.015

local vOffset = self:LocalToWorld(self:GetOffset() + VectorRand(-1.5, 1.5) )
local vNormal = self:CalcNormal()

local particle = emitter:Add( "particles/smokey", vOffset )
particle:SetVelocity( vNormal * math.Rand( 40, 60 ) )
particle:SetGravity(Vector(0, 0, 25))
particle:SetAirResistance(20)
particle:SetDieTime( 2.0 )
particle:SetStartAlpha( math.Rand( 32, 64 ) )
particle:SetStartSize( math.Rand( 3, 5 ) )
particle:SetEndSize( math.Rand( 20, 26 ) )
particle:SetRoll( math.Rand( -20, 20 ) )
particle:SetRollDelta( math.Rand( -2.5, 2.5 ))
particle:SetColor(color(self))
end
end
WireLib.ThrusterEffectThink.exhaust = exhaust(function() return 200, 200, 210 end)
WireLib.ThrusterEffectThink.exhaust_diy = exhaust(function(self) local c = self:GetColor() return c.r, c.g, c.b end)

WireLib.ThrusterEffectThink.flamethrower = function(self)

self.FlamethrowerTimer = self.FlamethrowerTimer or 0
if ( self.FlamethrowerTimer > CurTime() ) then return end

self.SmokeTimer = CurTime() + 0.003

local vOffset = self:LocalToWorld(self:GetOffset() + VectorRand(-3, 3))
local vNormal = self:CalcNormal()

local particle = emitter:Add( "sprites/physg_glow2", vOffset )
particle:SetVelocity( vNormal * math.Rand( 500, 520 ) )
particle:SetDieTime(0.4)
particle:SetCollide( true )
particle:SetStartSize( math.Rand( 20, 30 ) )
particle:SetEndSize( math.Rand( 100, 120 ) )
particle:SetRoll( math.Rand( -180, 180 ) )
particle:SetRollDelta( math.Rand( -20, 20 ))
particle:SetStartAlpha( math.Rand( 60, 130 ) )
particle:SetAirResistance(100)
particle:SetColor(250, 100, 0)

local particle2 = emitter:Add( "effects/fire_cloud2", vOffset )
particle2:SetVelocity( vNormal * math.Rand( 500, 520 ) )
particle2:SetDieTime(0.3)
particle2:SetCollide( true )
particle2:SetStartSize( math.Rand( 3, 4 ) )
particle2:SetEndSize( math.Rand( 10, 40 ) )
particle2:SetRoll( math.Rand( -180, 180 ) )
particle2:SetRollDelta( math.Rand( -20, 20 ))
particle2:SetStartAlpha( math.Rand( 30, 150 ) )
particle2:SetAirResistance(100)
particle2:SetColor(255, 255, 255)
end

WireLib.ThrusterEffectDraw.color_magic = function(self)

local vOffset = self:LocalToWorld(self:GetOffset())
Expand Down
3 changes: 3 additions & 0 deletions lua/wire/stools/thruster.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ function TOOL.BuildCPanel(panel)
["#Smoke"] = "smoke",
["#Smoke Random"] = "smoke_random",
["#Smoke Do it Youself"] = "smoke_diy",
["#Exhaust"] = "exhaust",
["#Exhaust Do it Yourself"] = "exhaust_diy",
["#Rings"] = "rings",
["#Rings Growing"] = "rings_grow",
["#Rings Shrinking"] = "rings_shrink",
Expand Down Expand Up @@ -92,6 +94,7 @@ function TOOL.BuildCPanel(panel)
--["#Debugger 60 Seconds"] = "debug_60",
["#Fire and Smoke"] = "fire_smoke",
["#Fire and Smoke Huge"] = "fire_smoke_big",
["#Flamethrower"] = "flamethrower",
["#5 Growing Rings"] = "rings_grow_rings",
["#Color and Magic"] = "color_magic",
}
Expand Down
3 changes: 3 additions & 0 deletions lua/wire/stools/vthruster.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ function TOOL.BuildCPanel(panel)
["#Smoke"] = "smoke",
["#Smoke Random"] = "smoke_random",
["#Smoke Do it Youself"] = "smoke_diy",
["#Exhaust"] = "exhaust",
["#Exhaust Do it Yourself"] = "exhaust_diy",
["#Rings"] = "rings",
["#Rings Growing"] = "rings_grow",
["#Rings Shrinking"] = "rings_shrink",
Expand Down Expand Up @@ -173,6 +175,7 @@ function TOOL.BuildCPanel(panel)
--["#Debugger 60 Seconds"] = "debug_60",
["#Fire and Smoke"] = "fire_smoke",
["#Fire and Smoke Huge"] = "fire_smoke_big",
["#Flamethrower"] = "flamethrower",
["#5 Growing Rings"] = "rings_grow_rings",
["#Color and Magic"] = "color_magic",
}
Expand Down
7 changes: 7 additions & 0 deletions materials/gui/thrustereffects/exhaust.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"UnlitGeneric"
{
"$basetexture" "gui/thrustereffects/exhaust"
"$nolod" 1
"$vertexalpha" 1
"$vertexcolor" 1
}
Binary file added materials/gui/thrustereffects/exhaust.vtf
Binary file not shown.
7 changes: 7 additions & 0 deletions materials/gui/thrustereffects/exhaust_diy.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"UnlitGeneric"
{
"$basetexture" "gui/thrustereffects/exhaust"
"$nolod" 1
"$vertexalpha" 1
"$vertexcolor" 1
}
7 changes: 7 additions & 0 deletions materials/gui/thrustereffects/flamethrower.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"UnlitGeneric"
{
"$basetexture" "gui/thrustereffects/flamethrower"
"$nolod" 1
"$vertexalpha" 1
"$vertexcolor" 1
}
Binary file added materials/gui/thrustereffects/flamethrower.vtf
Binary file not shown.

0 comments on commit 46f5d5c

Please sign in to comment.