Skip to content

Commit

Permalink
Add Groundpound powerup (#43)
Browse files Browse the repository at this point in the history
* Create Groundpound powerup

* Add sounds and effects

* Tweak config

* Add usage note

* Add screenshake

* Tweak config

* Groundpound punch/juice

Add custom effect
Play different sounds
Rework damage calc
Buff knockback on props

* Some magic numbers as variables

+ Increase terminal dmgmul, 25 > 75
+ fix terminal radius

* More fixes, + comment

* Add cooldown to fastfall start sound

* Fix comment

* Use a less generic name

* Use a less generic name; use poroper effect file structure

* Fix killicon

* Create the effect ourselves

* Localize

* Style

* Use local

* Split into separate functions

* Localization not really needed here anymore

* Fix nil

* Fix inverted logic

* Cut particle amount in half

---------

Co-authored-by: StrawWagen <[email protected]>
  • Loading branch information
legokidlogan and StrawWagen authored Dec 22, 2024
1 parent 5b57baa commit 7f773e4
Show file tree
Hide file tree
Showing 13 changed files with 558 additions and 0 deletions.
36 changes: 36 additions & 0 deletions lua/effects/powerups_groundpound_shockwave/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
function EFFECT:Init( data )
local pos = data:GetOrigin()
local scale = data:GetScale()

self.Emitter = ParticleEmitter( pos )

local maxsize = 350 * scale
local ptclCount = 300 * scale

for _ = 1, ptclCount do
local particle = self.Emitter:Add( "particle/smokesprites_000" .. math.random( 1, 9 ), pos )
if particle then
particle:SetVelocity( Vector( math.random( -10, 10 ), math.random( -10, 10 ), 0 ):GetNormal() * 10000 * scale )
particle:SetDieTime( 3.5 * scale )
particle:SetStartAlpha( math.Rand( 40, 60 ) )
particle:SetEndAlpha( 0 )
particle:SetStartSize( math.Rand( maxsize * 0.4, maxsize * 0.5 ) )
particle:SetEndSize( math.Rand( maxsize * 0.8, maxsize ) )
particle:SetRoll( math.Rand( 0, 360 ) )
particle:SetRollDelta( math.Rand( -1, 1 ) )
particle:SetColor( 90, 83, 68 )
particle:SetAirResistance( 50 )
particle:SetCollide( true )
particle:SetBounce( 0 )
end
end
end

function EFFECT:Think()
self.Emitter:Finish()
return false
end

function EFFECT:Render()

end
91 changes: 91 additions & 0 deletions lua/effects/powerups_groundpound_shockwave_huge/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
-- Slimmed down version of m9k_gdcw_cinematicboom from M9K

function EFFECT:Init( data )
self.Pos = data:GetOrigin() -- Origin determines the global position of the effect
self.Scale = data:GetScale() -- Scale determines how large the effect is
self.DirVec = data:GetNormal() -- Normal determines the direction of impact for the effect
self.Emitter = ParticleEmitter( self.Pos ) -- Emitter must be there so you don't get an error

sound.Play( "ambient/explosions/explode_" .. math.random( 1, 4 ) .. ".wav", self.Pos, 100, 100 )

self:Dust()

self.Emitter:Finish()
end

function EFFECT:Dust()
local emitter = self.Emitter
local dir = self.DirVec
local pos = self.Pos
local scale = self.Scale

for _ = 1, 5 do
local Flash = emitter:Add( "effects/muzzleflash" .. math.random( 1, 4 ), self.Pos )
if Flash then
Flash:SetVelocity( dir * 100 )
Flash:SetAirResistance( 200 )
Flash:SetDieTime( 0.15 )
Flash:SetStartAlpha( 255 )
Flash:SetEndAlpha( 0 )
Flash:SetStartSize( scale * 300 )
Flash:SetEndSize( 0 )
Flash:SetRoll( math.Rand( 180, 480 ) )
Flash:SetRollDelta( math.Rand( -1, 1 ) )
Flash:SetColor( 255, 255, 255 )
Flash:SetCollide( true )
end
end

for _ = 1, 10 * scale do
local Dust = emitter:Add( "particle/particle_composite", pos )
if Dust then
Dust:SetVelocity( dir * math.random( 100, 400 ) * scale + VectorRand():GetNormalized() * 300 * scale )
Dust:SetDieTime( math.Rand( 2, 3 ) )
Dust:SetStartAlpha( 230 )
Dust:SetEndAlpha( 0 )
Dust:SetStartSize( 50 * scale )
Dust:SetEndSize( 100 * scale )
Dust:SetRoll( math.Rand( 150, 360 ) )
Dust:SetRollDelta( math.Rand( -1, 1 ) )
Dust:SetAirResistance( 150 )
Dust:SetGravity( Vector( 0, 0, math.Rand( -100, -400 ) ) )
Dust:SetColor( 80, 80, 80 )
Dust:SetCollide( true )
end
end

for _ = 1, 7 * scale do
local Dust = emitter:Add( "particle/smokesprites_000" .. math.random( 1, 9 ), pos )
if Dust then
Dust:SetVelocity( dir * math.random( 100, 400 ) * scale + VectorRand():GetNormalized() * 400 * scale )
Dust:SetDieTime( math.Rand( 1, 3 ) * scale )
Dust:SetStartAlpha( 50 )
Dust:SetEndAlpha( 0 )
Dust:SetStartSize( 80 * scale )
Dust:SetEndSize( 100 * scale )
Dust:SetRoll( math.Rand( 150, 360 ) )
Dust:SetRollDelta( math.Rand( -1, 1 ) )
Dust:SetAirResistance( 250 )
Dust:SetGravity( Vector( math.Rand( -200, 200 ), math.Rand( -200, 200 ), math.Rand( 10, 100 ) ) )
Dust:SetColor( 90, 85, 75 )
Dust:SetCollide( true )
end
end

for _ = 1, 12 * scale do
local Debris = emitter:Add( "effects/fleck_cement" .. math.random( 1, 2 ), pos )
if Debris then
Debris:SetVelocity( dir * math.random( 0, 700 ) * scale + VectorRand():GetNormalized() * math.random( 0, 700 ) * scale )
Debris:SetDieTime( math.random( 1, 2 ) * scale )
Debris:SetStartAlpha( 255 )
Debris:SetEndAlpha( 0 )
Debris:SetStartSize( math.random( 5, 10 ) * scale )
Debris:SetRoll( math.Rand( 0, 360 ) )
Debris:SetRollDelta( math.Rand( -5, 5 ) )
Debris:SetAirResistance( 40 )
Debris:SetColor( 60, 60, 60 )
Debris:SetGravity( Vector( 0, 0, -600 ) )
Debris:SetCollide( true )
end
end
end
13 changes: 13 additions & 0 deletions lua/entities/cfc_powerup_groundpound_inflictor.moon
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
AddCSLuaFile!

DEFINE_BASECLASS "base_point"

ENT.Type = "point"
ENT.Spawnable = false


ENT.Initialize = =>
-- Do nothing

ENT.UpdateTransmitState = ->
TRANSMIT_NEVER
1 change: 1 addition & 0 deletions lua/entities/powerup_groundpound/cl_init.moon
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include "shared.lua"
7 changes: 7 additions & 0 deletions lua/entities/powerup_groundpound/init.moon
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
AddCSLuaFile "cl_init.lua"
AddCSLuaFile "shared.lua"
include "shared.lua"

ENT.Base = "base_cfc_powerup"
ENT.Powerup = "powerup_groundpound"
ENT.Color = Color 125, 80, 95
9 changes: 9 additions & 0 deletions lua/entities/powerup_groundpound/shared.moon
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ENT.Base = "base_cfc_powerup"

ENT.Type = "anim"
ENT.PrintName = "Groundpound Powerup"
ENT.Purpose = "Crouch to fall quickly and create a shockwave on impact"
ENT.Category = "Powerups"

ENT.Spawnable = true
ENT.AdminOnly = true
30 changes: 30 additions & 0 deletions lua/powerups/config/sv_config.moon
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,36 @@
helpText: "What sound should play when the bolt acquires a target?"
-- =======================================================================

-- Groundpound ===============================================================
"cfc_powerups_groundpound_uses":
default: 10
helpText: "How many uses of the Groundpound powerup is given"

"cfc_powerups_groundpound_acceleration":
default: 600
helpText: "Added hmu/s^2 Groundpound acceleration to the player"

"cfc_powerups_groundpound_min_speed":
default: 600
helpText: "The minimum falling speed needed for Groundpound shockwaves"

"cfc_powerups_groundpound_base_damage":
default: 100
helpText: "Base groundpound damage/radius"

"cfc_powerups_groundpound_added_damage":
default: 0.25
helpText: "Damage/radius added per speed player is above the min speed"

"cfc_powerups_groundpound_knockback_multiplier":
default: 10
helpText: "Knockback multiplier for Groundpound shockwaves, scales based on final damage"

"cfc_powerups_groundpound_knockback_max":
default: 1500
helpText: "Knockback maximum for Groundpound shockwaves"
-- =======================================================================

-- Shotgun ================================================================
"cfc_powerups_shotgun_duration":
default: 300
Expand Down
1 change: 1 addition & 0 deletions lua/powerups/loaders/cfc_powerups_killicons.moon
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
icolOrange = Color 255, 80, 0, 255

killicon.Add "cfc_powerup_hotshot_inflictor", "vgui/hud/cfc_powerup_hotshot", icolOrange
killicon.Add "cfc_powerup_groundpound_inflictor", "vgui/hud/cfc_powerup_groundpound", icolOrange
killicon.Add "cfc_powerup_thorns_inflictor", "vgui/hud/cfc_powerup_thorns", icolOrange
1 change: 1 addition & 0 deletions lua/powerups/loaders/sv_powerups_init.moon
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ include "powerups/server/grenadier.lua"
include "powerups/server/flux_shield.lua"
include "powerups/server/thorns.lua"
include "powerups/server/magnetic_crossbow.lua"
include "powerups/server/groundpound.lua"
include "powerups/server/shotgun.lua"
include "powerups/server/phoenix.lua"
include "powerups/server/super_speed.lua"
Expand Down
Loading

0 comments on commit 7f773e4

Please sign in to comment.