Cooler akimbo, Custom_, & more

This commit is contained in:
Fesiug 2023-11-18 00:29:04 -05:00
parent 569d7e11b1
commit fca318aa2e
8 changed files with 209 additions and 75 deletions

View File

@ -0,0 +1,34 @@
AddCSLuaFile()
function EFFECT:Init( data )
-- Because CEffectData is a shared object, we can't just store it and use its' properties later
-- Instead, we store the properties themselves
self.offset = data:GetOrigin() + Vector( 0, 0, 0.2 )
self.angles = data:GetAngles()
self.particles = 4
end
function EFFECT:Think()
return true
end
function EFFECT:Render()
local emitter = ParticleEmitter( self.offset, false )
for i=0, self.particles do
local particle = emitter:Add( "effects/softglow", self.offset )
if particle then
particle:SetAngles( self.angles )
particle:SetVelocity( Vector( 0, 0, 15 ) )
particle:SetColor( 255, 102, 0 )
particle:SetLifeTime( 0 )
particle:SetDieTime( 0.2 )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( 1.6 )
particle:SetStartLength( 1 )
particle:SetEndSize( 1.2 )
particle:SetEndLength( 4 )
end
end
emitter:Finish()
end

View File

@ -1,11 +1,23 @@
function SWEP:PrimaryAttack()
self:BFire( false )-- self:GetTempHandedness() )
return true
end
function SWEP:SecondaryAttack()
self:BFire( true )-- self:GetTempHandedness() )
return true
end
function SWEP:BFire( hand ) function SWEP:BFire( hand )
if self:BTable( hand ) then if self:BTable( hand ) then
local p = self:GetOwner()
local wep_table = self:BTable( hand ) local wep_table = self:BTable( hand )
local wep_class = self:BClass( hand ) local wep_class = self:BClass( hand )
if wep_class.Fire then if wep_class.Custom_Fire then
if wep_class.Fire( self, wep_table ) then return end if wep_class.Custom_Fire( self, wep_table, wep_class, hand ) then return end
end end
if self:D_GetDelay( hand ) > CurTime() then if self:D_GetDelay( hand ) > CurTime() then
return return
@ -28,6 +40,15 @@ function SWEP:BFire( hand )
self:D_SetDelay( hand, CurTime() + wep_class.Delay ) self:D_SetDelay( hand, CurTime() + wep_class.Delay )
self:D_SetBurst( hand, self:D_GetBurst( hand ) + 1 ) self:D_SetBurst( hand, self:D_GetBurst( hand ) + 1 )
if CLIENT and IsFirstTimePredicted() then
local vStart = self:GetAttachment( 1 ).Pos
local vPoint = p:GetEyeTrace().HitPos
local effectdata = EffectData()
effectdata:SetStart( vStart )
effectdata:SetOrigin( vPoint )
util.Effect( "ToolTracer", effectdata )
end
end end
end end

View File

@ -89,12 +89,12 @@ function SWEP:BHolster( hand )
if self:D_GetID( hand ) == "" then if self:D_GetID( hand ) == "" then
return -- What the hell are you holstering..? return -- What the hell are you holstering..?
end end
local p = self:GetOwner()
local item = p:INV_Get()[ self:D_GetID( hand ) ] local p = self:GetOwner()
local item = self:BTable( hand )
if item then if item then
local class = WEAPONS[item.Class] local class = WEAPONS[item.Class]
if class.Holster then class.Holster( self, self:BTable( hand ) ) end if class.Custom_Holster then class.Custom_Holster( self, item, class, hand ) end
end end
self:D_SetID( hand, "" ) self:D_SetID( hand, "" )

View File

@ -54,11 +54,6 @@ function SWEP:SetupDataTables()
self:SetWep2_Firemode( 1 ) self:SetWep2_Firemode( 1 )
end end
function SWEP:PrimaryAttack()
self:BFire( self:GetTempHandedness() )
return true
end
-- BENNY shit -- BENNY shit
function SWEP:BTable( alt ) function SWEP:BTable( alt )
return self:GetOwner():INV_Get()[ alt and self:GetWep2() or self:GetWep1() ] return self:GetOwner():INV_Get()[ alt and self:GetWep2() or self:GetWep1() ]
@ -96,10 +91,6 @@ function SWEP:B_FiremodeName( alt )
end end
end end
function SWEP:SecondaryAttack()
return true
end
function SWEP:Reload() function SWEP:Reload()
local p = self:GetOwner() local p = self:GetOwner()
local inv = p:INV_Get() local inv = p:INV_Get()
@ -108,8 +99,8 @@ function SWEP:Reload()
local wep_table = self:BTable( hand ) local wep_table = self:BTable( hand )
local wep_class = self:BClass( hand ) local wep_class = self:BClass( hand )
if wep_table then if wep_table then
if wep_class.Reload then if wep_class.Custom_Reload then
if wep_class.Reload( self, wep_table ) then return end if wep_class.Custom_Reload( self, wep_table ) then return end
end end
if self:D_GetDelay( hand ) > CurTime() then if self:D_GetDelay( hand ) > CurTime() then
return false return false
@ -167,16 +158,38 @@ end
CreateClientConVar( "benny_toggleaim", 0, true, true ) CreateClientConVar( "benny_toggleaim", 0, true, true )
hook.Add( "PlayerButtonDown", "Benny_PlayerButtonDown_TempForAim", function( ply, button )
local wep = ply:BennyCheck()
if button == KEY_F then
if tobool(ply:GetInfoNum("benny_toggleaim", 0)) then
wep:SetUserAim( !wep:GetUserAim() )
else
wep:SetUserAim( true )
end
end
end)
hook.Add( "PlayerButtonUp", "Benny_PlayerButtonUp_TempForAim", function( ply, button )
local wep = ply:BennyCheck()
if button == KEY_F then
if !tobool(ply:GetInfoNum("benny_toggleaim", 0)) then
wep:SetUserAim( false )
end
end
end)
function SWEP:Think() function SWEP:Think()
local p = self:GetOwner() local p = self:GetOwner()
if tobool(p:GetInfoNum("benny_toggleaim", 0)) then --if tobool(p:GetInfoNum("benny_toggleaim", 0)) then
if p:KeyPressed( IN_ATTACK2 ) then -- if p:KeyPressed( IN_ATTACK2 ) then
self:SetUserAim( !self:GetUserAim() ) -- self:SetUserAim( !self:GetUserAim() )
end -- end
else --else
self:SetUserAim( p:KeyDown( IN_ATTACK2 ) ) -- self:SetUserAim( p:KeyDown( IN_ATTACK2 ) )
end --end
if p:KeyPressed( IN_ZOOM ) and (SERVER or (CLIENT and IsFirstTimePredicted())) then if p:KeyPressed( IN_ZOOM ) and (SERVER or (CLIENT and IsFirstTimePredicted())) then
self:SetTempHandedness( !self:GetTempHandedness() ) self:SetTempHandedness( !self:GetTempHandedness() )
@ -207,8 +220,8 @@ function SWEP:Think()
end end
if self:BClass( false ) then if self:BClass( false ) then
if self:BClass( false ).Think then if self:BClass( false ).Custom_Think then
self:BClass( false ).Think( self, self:BTable( false ) ) self:BClass( false ).Custom_Think( self, self:BTable( false ) )
end end
end end

View File

@ -292,9 +292,17 @@ hook.Add( "CalcView", "Benny_CalcView", function( ply, pos, ang, fov )
end end
end end
if ply:BennyCheck() then -- and ply:GetActiveWeapon():GetAim() > 0 then local wep = ply:BennyCheck()
view.drawviewer = true if wep then -- and ply:GetActiveWeapon():GetAim() > 0 then
view.origin, view.angles, view.fov = bennyfp( view.origin, view.angles, view.fov ) local cv = wep:BClass( true ) and wep:BClass( true ).Custom_CalcView or wep:BClass( false ) and wep:BClass( false ).Custom_CalcView
local halt = false
if cv then
halt = cv( wep, view, view.origin, view.angles, view.fov )
end
if !halt then
view.drawviewer = true
view.origin, view.angles, view.fov = bennyfp( view.origin, view.angles, view.fov )
end
end end
local st = c_over:GetString() local st = c_over:GetString()

View File

@ -232,12 +232,13 @@ if CLIENT then
Collapse:SetLabel( i ) Collapse:SetLabel( i )
local Lays = itemlist:Add( "DIconLayout" ) local Lays = itemlist:Add( "DIconLayout" )
Collapse:SetContents( Lays ) Collapse:SetContents( Lays )
Collapse:SetExpanded( false )
Lays:Dock( FILL ) Lays:Dock( FILL )
Lays:SetSpaceX( ss(1) ) Lays:SetSpaceX( ss(1) )
Lays:SetSpaceY( ss(1) ) Lays:SetSpaceY( ss(1) )
for Mew, New in ipairs( v ) do for Mew, New in ipairs( v ) do
local button = Lays:Add( "DButton" ) local button = Lays:Add( "DButton" )
button:SetSize( ss(96), ss(14) ) button:SetSize( ss(95), ss(14) )
--button:Dock( TOP ) --button:Dock( TOP )
button:DockMargin( 0, 0, 0, ss(4) ) button:DockMargin( 0, 0, 0, ss(4) )

View File

@ -21,7 +21,7 @@ hook.Add( "PlayerNoClip", "Benny_PlayerNoClip", function( ply, desiredNoClipStat
end) end)
hook.Add( "InputMouseApply", "Benny_InputMouseApply", function( cmd, x, y, ang ) hook.Add( "InputMouseApply", "Benny_InputMouseApply", function( cmd, x, y, ang )
if LocalPlayer():BennyCheck() and !LocalPlayer():NoclippingAndNotVaulting() then if LocalPlayer():BennyCheck() and !LocalPlayer():NoclippingAndNotVaulting() and GetConVar("benny_cam_override"):GetBool() == "" then
TPSOverride:Add( Angle( y*0.022, -x*0.022, 0 ) ) TPSOverride:Add( Angle( y*0.022, -x*0.022, 0 ) )
return true return true
end end
@ -76,7 +76,7 @@ hook.Add( "CreateMove", "Benny_CreateMove", function( cmd )
local p = LocalPlayer() local p = LocalPlayer()
local w = p:GetActiveWeapon() local w = p:GetActiveWeapon()
if p:BennyCheck() and !LocalPlayer():NoclippingAndNotVaulting() then -- FPS cam if p:BennyCheck() and !LocalPlayer():NoclippingAndNotVaulting() and GetConVar("benny_cam_override"):GetBool() == "" then -- FPS cam
local aimed = w:GetUserAim() local aimed = w:GetUserAim()
local opos, ang = p:CamSpot( TPSOverride ) local opos, ang = p:CamSpot( TPSOverride )

View File

@ -198,10 +198,8 @@ do -- Toolgun
Delay = (60/300), Delay = (60/300),
Firemodes = FIREMODE_SEMI, Firemodes = FIREMODE_SEMI,
Ammo = 0,
Damage = 0,
Fire = function( self, data ) Custom_Fire = function( self, data )
if self:GetDelay1() > CurTime() then if self:GetDelay1() > CurTime() then
return true return true
end end
@ -226,7 +224,7 @@ do -- Toolgun
return true return true
end, end,
Reload = function( self, data ) Custom_Reload = function( self, data )
if CLIENT and self:GetOwner():KeyPressed( IN_RELOAD ) then if CLIENT and self:GetOwner():KeyPressed( IN_RELOAD ) then
CreateSelect() CreateSelect()
end end
@ -238,6 +236,53 @@ do -- Toolgun
Features = "firearm", Features = "firearm",
} }
WEAPONS["camera"] = {
Name = "DIRECTOR'S CAMERA",
Description = "Developer development device",
Type = "special",
WModel = "models/maxofs2d/camera.mdl",
HoldType = "camera",
GestureDraw = { ACT_HL2MP_GESTURE_RELOAD_REVOLVER, 0.8 },
Delay = (60/300),
Firemodes = FIREMODE_SEMI,
Custom_Fire = function( self, data )
if self:GetDelay1() > CurTime() then
return true
end
self:SetDelay1( CurTime() + 0.2 )
local p = self:GetOwner()
if CLIENT and IsFirstTimePredicted() then
local zp, za, zf = p:EyePos(), p:EyeAngles(), 90
RunConsoleCommand( "benny_cam_override", zp.x .. " " .. zp.y .. " " .. zp.z .. " " .. za.p .. " " .. za.y .. " " .. za.r .. " " .. zf )
end
-- Return true to skip weapon logic
return true
end,
Custom_Reload = function( self, data )
RunConsoleCommand( "benny_cam_override", "" )
-- Return true to skip weapon logic
return true
end,
Custom_CalcView = function( self, data )
if self:GetUserAim() and GetConVar("benny_cam_override"):GetString() == "" then
data.drawviewer = false
return true -- Return true to halt
end
end,
Features = "firearm",
}
end end
do -- Melee do -- Melee
@ -1011,10 +1056,10 @@ do -- Grenades, nothing here is guaranteed.
Description = "Pull the pin and throw it the hell away!", Description = "Pull the pin and throw it the hell away!",
Type = "grenade", Type = "grenade",
Fire = GrenadeFire, Custom_Fire = GrenadeFire,
Reload = GrenadeReload, Custom_Reload = GrenadeReload,
Think = GrenadeThink, Custom_Think = GrenadeThink,
Holster = GrenadeHolster, Custom_Holster = GrenadeHolster,
GrenadeEnt = "benny_grenade_frag", GrenadeEnt = "benny_grenade_frag",
GrenadeFuse = 4, GrenadeFuse = 4,
GrenadeCharge = true, GrenadeCharge = true,
@ -1031,9 +1076,10 @@ do -- Grenades, nothing here is guaranteed.
Description = "Long, audible fuse, but sticks to whatever it touches.", Description = "Long, audible fuse, but sticks to whatever it touches.",
Type = "grenade", Type = "grenade",
Fire = GrenadeFire, Custom_Fire = GrenadeFire,
Reload = GrenadeReload, Custom_Reload = GrenadeReload,
Think = GrenadeThink, Custom_Think = GrenadeThink,
Custom_Holster = GrenadeHolster,
GrenadeEnt = "benny_grenade_semtex", GrenadeEnt = "benny_grenade_semtex",
GrenadeFuse = 4, GrenadeFuse = 4,
GrenadeCharge = true, GrenadeCharge = true,
@ -1050,9 +1096,10 @@ do -- Grenades, nothing here is guaranteed.
Description = "Alcoholic bottle of flame!", Description = "Alcoholic bottle of flame!",
Type = "grenade", Type = "grenade",
Fire = GrenadeFire, Custom_Fire = GrenadeFire,
Reload = GrenadeReload, Custom_Reload = GrenadeReload,
Think = GrenadeThink, Custom_Think = GrenadeThink,
Custom_Holster = GrenadeHolster,
GrenadeEnt = "benny_grenade_molotov", GrenadeEnt = "benny_grenade_molotov",
GrenadeFuse = 4, GrenadeFuse = 4,
GrenadeCharge = true, GrenadeCharge = true,
@ -1069,9 +1116,10 @@ do -- Grenades, nothing here is guaranteed.
Description = "Lightweight knife to throw and pick back up.", Description = "Lightweight knife to throw and pick back up.",
Type = "grenade", Type = "grenade",
Fire = GrenadeFire, Custom_Fire = GrenadeFire,
Reload = GrenadeReload, Custom_Reload = GrenadeReload,
Think = GrenadeThink, Custom_Think = GrenadeThink,
Custom_Holster = GrenadeHolster,
GrenadeEnt = "benny_grenade_tknife", GrenadeEnt = "benny_grenade_tknife",
GrenadeFuse = 4, GrenadeFuse = 4,
GrenadeCharge = true, GrenadeCharge = true,
@ -1088,9 +1136,10 @@ do -- Grenades, nothing here is guaranteed.
Description = "Smoke bomb used to conceal a position, and makes enemies cough.", Description = "Smoke bomb used to conceal a position, and makes enemies cough.",
Type = "grenade", Type = "grenade",
Fire = GrenadeFire, Custom_Fire = GrenadeFire,
Reload = GrenadeReload, Custom_Reload = GrenadeReload,
Think = GrenadeThink, Custom_Think = GrenadeThink,
Custom_Holster = GrenadeHolster,
GrenadeEnt = "benny_grenade_smoke", GrenadeEnt = "benny_grenade_smoke",
GrenadeFuse = 4, GrenadeFuse = 4,
GrenadeCharge = true, GrenadeCharge = true,
@ -1107,9 +1156,10 @@ do -- Grenades, nothing here is guaranteed.
Description = "Stun grenade that gives off a bright flash and a loud 'bang'.", Description = "Stun grenade that gives off a bright flash and a loud 'bang'.",
Type = "grenade", Type = "grenade",
Fire = GrenadeFire, Custom_Fire = GrenadeFire,
Reload = GrenadeReload, Custom_Reload = GrenadeReload,
Think = GrenadeThink, Custom_Think = GrenadeThink,
Custom_Holster = GrenadeHolster,
GrenadeEnt = "benny_grenade_flashbang", GrenadeEnt = "benny_grenade_flashbang",
GrenadeFuse = 2, GrenadeFuse = 2,
GrenadeCharge = false, GrenadeCharge = false,
@ -1126,9 +1176,10 @@ do -- Grenades, nothing here is guaranteed.
Description = "Short burst of gas that slows and disorient targets.", Description = "Short burst of gas that slows and disorient targets.",
Type = "grenade", Type = "grenade",
Fire = GrenadeFire, Custom_Fire = GrenadeFire,
Reload = GrenadeReload, Custom_Reload = GrenadeReload,
Think = GrenadeThink, Custom_Think = GrenadeThink,
Custom_Holster = GrenadeHolster,
GrenadeEnt = "benny_grenade_gas", GrenadeEnt = "benny_grenade_gas",
GrenadeFuse = 4, GrenadeFuse = 4,
GrenadeCharge = true, GrenadeCharge = true,
@ -1145,9 +1196,10 @@ do -- Grenades, nothing here is guaranteed.
Description = "Mine that bounces into the air.", Description = "Mine that bounces into the air.",
Type = "grenade", Type = "grenade",
Fire = GrenadeFire, Custom_Fire = GrenadeFire,
Reload = GrenadeReload, Custom_Reload = GrenadeReload,
Think = GrenadeThink, Custom_Think = GrenadeThink,
Custom_Holster = GrenadeHolster,
GrenadeEnt = "benny_grenade_prox", GrenadeEnt = "benny_grenade_prox",
GrenadeFuse = 4, GrenadeFuse = 4,
GrenadeCharge = true, GrenadeCharge = true,
@ -1164,9 +1216,10 @@ do -- Grenades, nothing here is guaranteed.
Description = "Mine that shoots shrapnel in a cone.", Description = "Mine that shoots shrapnel in a cone.",
Type = "grenade", Type = "grenade",
Fire = GrenadeFire, Custom_Fire = GrenadeFire,
Reload = GrenadeReload, Custom_Reload = GrenadeReload,
Think = GrenadeThink, Custom_Think = GrenadeThink,
Custom_Holster = GrenadeHolster,
GrenadeEnt = "benny_grenade_claymore", GrenadeEnt = "benny_grenade_claymore",
GrenadeFuse = 4, GrenadeFuse = 4,
GrenadeCharge = true, GrenadeCharge = true,
@ -1183,9 +1236,10 @@ do -- Grenades, nothing here is guaranteed.
Description = "Disrupts enemy radar based on proximity.", Description = "Disrupts enemy radar based on proximity.",
Type = "grenade", Type = "grenade",
Fire = GrenadeFire, Custom_Fire = GrenadeFire,
Reload = GrenadeReload, Custom_Reload = GrenadeReload,
Think = GrenadeThink, Custom_Think = GrenadeThink,
Custom_Holster = GrenadeHolster,
GrenadeEnt = "benny_grenade_scrambler", GrenadeEnt = "benny_grenade_scrambler",
GrenadeFuse = 4, GrenadeFuse = 4,
GrenadeCharge = true, GrenadeCharge = true,
@ -1202,9 +1256,10 @@ do -- Grenades, nothing here is guaranteed.
Description = "Disrupts enemy equipment based on proximity.", Description = "Disrupts enemy equipment based on proximity.",
Type = "grenade", Type = "grenade",
Fire = GrenadeFire, Custom_Fire = GrenadeFire,
Reload = GrenadeReload, Custom_Reload = GrenadeReload,
Think = GrenadeThink, Custom_Think = GrenadeThink,
Custom_Holster = GrenadeHolster,
GrenadeEnt = "benny_grenade_emp", GrenadeEnt = "benny_grenade_emp",
GrenadeFuse = 4, GrenadeFuse = 4,
GrenadeCharge = true, GrenadeCharge = true,
@ -1221,9 +1276,10 @@ do -- Grenades, nothing here is guaranteed.
Description = "Charge that stuns and forces enemies to fire their weapons.", Description = "Charge that stuns and forces enemies to fire their weapons.",
Type = "grenade", Type = "grenade",
Fire = GrenadeFire, Custom_Fire = GrenadeFire,
Reload = GrenadeReload, Custom_Reload = GrenadeReload,
Think = GrenadeThink, Custom_Think = GrenadeThink,
Custom_Holster = GrenadeHolster,
GrenadeEnt = "benny_grenade_shockcharge", GrenadeEnt = "benny_grenade_shockcharge",
GrenadeFuse = 4, GrenadeFuse = 4,
GrenadeCharge = true, GrenadeCharge = true,
@ -1240,9 +1296,10 @@ do -- Grenades, nothing here is guaranteed.
Description = "Burns through armor.", Description = "Burns through armor.",
Type = "grenade", Type = "grenade",
Fire = GrenadeFire, Custom_Fire = GrenadeFire,
Reload = GrenadeReload, Custom_Reload = GrenadeReload,
Think = GrenadeThink, Custom_Think = GrenadeThink,
Custom_Holster = GrenadeHolster,
GrenadeEnt = "benny_grenade_thermobaric", GrenadeEnt = "benny_grenade_thermobaric",
GrenadeFuse = 4, GrenadeFuse = 4,
GrenadeCharge = true, GrenadeCharge = true,