Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create the Graviton Gun #69

Merged
merged 27 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b806e26
Create the Graviton Gun
legokidlogan Sep 30, 2024
34d4617
Increase range
legokidlogan Sep 30, 2024
cac85c0
Remove dead code
legokidlogan Sep 30, 2024
de791e4
Knock out of chute, but don't disable chute entirely
legokidlogan Sep 30, 2024
82c2dbc
Make beam linger for longer and look better
legokidlogan Sep 30, 2024
2cee445
Add an overcharge effect
legokidlogan Sep 30, 2024
52172c5
Fix typo
legokidlogan Sep 30, 2024
8ad6c3f
Add SWEP instructions
legokidlogan Sep 30, 2024
c31e1ea
Slow down parachuters
legokidlogan Sep 30, 2024
38997c9
Stack acceleration when hit multiple times
legokidlogan Sep 30, 2024
8ca919d
Multiply accel when in chute (currently 1, no effect)
legokidlogan Sep 30, 2024
7492603
Tweak threshold and damage easing
legokidlogan Sep 30, 2024
721a6cb
Don't play looping sound if the initial hit kills the victim
legokidlogan Sep 30, 2024
05964d5
Ignore people too close to the ground
legokidlogan Oct 1, 2024
b7d04e8
End status in water
legokidlogan Oct 1, 2024
3ee4c52
Turn looping sound into a constant
legokidlogan Oct 1, 2024
f78a6da
Ignore if in water
legokidlogan Oct 1, 2024
a1418d5
Block parachutes again
legokidlogan Oct 1, 2024
64ad8d7
Change horizToDown based on distance
legokidlogan Oct 1, 2024
f922d41
Tweak numbers
legokidlogan Oct 1, 2024
2e221c7
Tweak numbers
legokidlogan Oct 1, 2024
0e5685a
Fix invalid ent error
legokidlogan Oct 7, 2024
b7cfe70
Clamp charge
legokidlogan Oct 7, 2024
0773bbd
Avoid divide by zero
legokidlogan Oct 7, 2024
24a7389
Clamp charge in crosshair
legokidlogan Oct 7, 2024
5dee40c
Cleanup
legokidlogan Oct 7, 2024
e520130
Cleanup
legokidlogan Oct 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
- [Simple Weapons SWEP Base](https://github.com/TankNut/simple-weapons) - GitHub
- [Ithaca M37 (bonk gun model)](https://steamcommunity.com/sharedfiles/filedetails/?id=128091208) - Workshop
- [MMod Tau Cannon (ion cannon)](https://steamcommunity.com/sharedfiles/filedetails/?id=2885673816) - Workshop rip from MMod
- [Jan 2000 Beta Physgun (graviton gun)](https://steamcommunity.com/sharedfiles/filedetails/?id=2862946909) - Workshop
68 changes: 49 additions & 19 deletions lua/autorun/client/cfc_pvp_weapons.lua
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
local hintConvars = {}
CFCPvPWeapons = CFCPvPWeapons or {}

local hintConvars = {}

list.Set( "ContentCategoryIcons", "CFC", "icon16/star.png" )


-- Most reliable way on client to listen when a weapon is equipped without using net messages.
-- Only misses if the weapon is given via initial loadout on spawn, which is fine in this case.
hook.Add( "HUDWeaponPickedUp", "CFC_PvPWeapons_FirstTimeHints", function( wep )
if not IsValid( wep ) then return end

local hints = wep.CFC_FirstTimeHints
if not hints then return end

local class = wep:GetClass()
local convar = hintConvars[class]

if not convar then
convar = CreateClientConVar( "cfc_pvp_weapons_hint_seen_" .. class, "0", true, false )
hintConvars[class] = convar
--[[
- Plays a set of hints.

hints: (table or string)
- If a string, provide the class of a SWEP that has a CFC_FirstTimeHints table.
- If a table, use the following format:
{
{
Message = STRING,
Sound = STRING,
Duration = NUMBER,
DelayNext = NUMBER,
},
(...)
}
--]]
function CFCPvPWeapons.PlayHints( hints )
if type( hints ) == "string" then
local swep = weapons.GetStored( hints )
if not swep then return end

hints = swep.CFC_FirstTimeHints
if not hints then return end
end

if convar:GetInt() == 1 then return end

convar:SetInt( 1 )

local hintInd = 1

local function showHint()
Expand Down Expand Up @@ -51,4 +57,28 @@ hook.Add( "HUDWeaponPickedUp", "CFC_PvPWeapons_FirstTimeHints", function( wep )
end

showHint()
end


-- Most reliable way on client to listen when a weapon is equipped without using net messages.
-- Only misses if the weapon is given via initial loadout on spawn, which is fine in this case.
hook.Add( "HUDWeaponPickedUp", "CFC_PvPWeapons_FirstTimeHints", function( wep )
if not IsValid( wep ) then return end

local hints = wep.CFC_FirstTimeHints
if not hints then return end

local class = wep:GetClass()
local convar = hintConvars[class]

if not convar then
convar = CreateClientConVar( "cfc_pvp_weapons_hint_seen_" .. class, "0", true, false )
hintConvars[class] = convar
end

if convar:GetInt() == 1 then return end

convar:SetInt( 1 )

CFCPvPWeapons.PlayHints( hints )
end )
3 changes: 3 additions & 0 deletions lua/autorun/client/cfc_pvp_weapons_killicons.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
local icol = Color( 255, 255, 255, 255 )
local icolOrange = Color( 255, 80, 0, 255 )

killicon.Add( "cfc_bonk_shotgun", "vgui/hud/cfc_bonk_shotgun", icol )
killicon.Add( "cfc_trash_blaster", "vgui/hud/cfc_trash_blaster", icol ) -- Sadly won't appear since the kills will attribute to generic prop kill instead
killicon.Add( "cfc_ion_cannon", "vgui/hud/cfc_ion_cannon", icol )

killicon.Add( "cfc_graviton_gun", "vgui/hud/cfc_graviton_gun", icolOrange )
Loading