Guns are now very drop-unsafe

Adds more guns
This commit is contained in:
Fesiug 2024-09-21 23:44:08 -04:00
parent bf1dd2f99b
commit a7825e495a
Signed by: Fesiug
GPG Key ID: 374BFF45E1EEF243
4 changed files with 334 additions and 25 deletions

View File

@ -60,6 +60,8 @@ function ENT:Think()
end
end
self.Class:EntThink( self )
if CLIENT then return true end
self.BAsleep = self.BAsleep or false
@ -72,7 +74,7 @@ function ENT:Think()
net.WriteEntity(self)
net.Broadcast()
print("SV Stopping prediction on", self)
self:SetCollisionGroup( COLLISION_GROUP_WEAPON )
--self:SetCollisionGroup( COLLISION_GROUP_WEAPON )
self.BAsleep = true
end
elseif self.BAsleep then
@ -114,6 +116,7 @@ end
if SERVER then
function ENT:PhysicsCollide( data, collider )
self.Class:EntPhysicsCollide( self, data, collider )
if ( data.DeltaTime > 0.1 ) then
--self:EmitSound( str, 70, 100, 1, CHAN_STATIC )
end

View File

@ -205,14 +205,11 @@ function SWEP:Think()
local ActiveR_Valid = ActiveR:IsValid()
if DesireR != ActiveR then
print(DesireR, ActiveR)
if ActiveR_Valid then
if ActiveR:GetHolsterIn() == 0 then
--self:Deactive()
print("hi?")
ActiveR.Class.Holster( ActiveR.Class, ActiveR, self )
else
-- wait
-- Waiting for holster to finish
end
else
if DesireR_Valid then

View File

@ -102,6 +102,12 @@ AddItem( "base", {
end
end,
["EntThink"] = function( class, ent, handler )
end,
["EntPhysicsCollide"] = function( class, ent, data, collider )
end,
["Reload"] = function( class, ent, handler )
end,
})
@ -129,7 +135,7 @@ local AnimationLookup = {
},
["holster"] = {
["handgun"] = "handgun_holster",
["rifle"] = "holster_handgun",
["rifle"] = "handgun_holster",
},
}
@ -191,7 +197,10 @@ AddItem( "base_firearm", {
local Topped = ent:GetBurstCount() == class.BurstCount
local Runaway = class.BurstRunaway
local BAuto = class.BurstAuto
local Firedown = handler:GetOwner():KeyDown( IN_ATTACK )
local Firedown = false
if IsValid(handler) then
Firedown = handler:GetOwner():KeyDown( IN_ATTACK )
end
if Runaway and InProcess and !Topped then
class:Attack( ent, handler )
else
@ -213,6 +222,33 @@ AddItem( "base_firearm", {
BaseClass.Think( class, ent, handler )
end,
["EntThink"] = function( class, ent, handler )
if IsValid(handler) then return end
local InProcess = ent:GetBurstCount() > 0
local Topped = ent:GetBurstCount() == class.BurstCount
local Runaway = class.BurstRunaway
local BAuto = class.BurstAuto
local Firedown = false
if Runaway and InProcess and !Topped then
class:Attack( ent, handler )
else
if !Firedown then
if !Topped and InProcess then
ent:SetDelayBurst( CurTime() + class.BurstDelay )
end
ent:SetBurstCount( 0 )
end
if Topped and BAuto then
ent:SetBurstCount( 0 )
ent:SetDelayBurst( CurTime() + class.BurstDelay )
end
end
if ent:GetRefillTime() != 0 and ent:GetRefillTime() <= CurTime() then
ent:SetClip( class.ClipSize )
ent:SetRefillTime( 0 )
end
end,
["Attack"] = function( class, ent, handler )
if ent:GetClip() <= 0 then return end
if ent:GetDelay() > CurTime() then return end
@ -220,6 +256,9 @@ AddItem( "base_firearm", {
if ent:GetBurstCount() >= class.BurstCount then return end
if ent:GetHolsterIn() != 0 then return end
local HandlerValid = IsValid(handler)
local handlerorself = HandlerValid and handler or ent
local Runaway = class.BurstRunaway
local BAuto = class.BurstAuto
ent:SetBurstCount( ent:GetBurstCount() + 1 )
@ -232,19 +271,20 @@ AddItem( "base_firearm", {
ent:SetClip( ent:GetClip() - 1 )
if ent:GetClip() == 0 then
handler:EmitSound( "benny/weapons/1911/slidedrop.ogg", 70, 100, 0.4, CHAN_STATIC )
handlerorself:EmitSound( "benny/weapons/1911/slidedrop.ogg", 70, 100, 0.4, CHAN_STATIC )
end
ent:SetDelay( CurTime() + class.Delay )
handler:EmitSound( istable(class.FireSound) and TSelShared(class.FireSound, "FireSound") or class.FireSound, 140, 100, 0.4, CHAN_STATIC )
handlerorself:EmitSound( istable(class.FireSound) and TSelShared(class.FireSound, "FireSound") or class.FireSound, 100, 100, 0.5, CHAN_STATIC )
local acc = math.rad( class.Accuracy or 0 )
if HandlerValid then
local p = handler:GetOwner()
p:LagCompensation(true)
handler:FireBullets( {
Attacker = p,
Damage = 1,
Force = 1,
Force = 5,
Tracer = 0,
Num = class.Pellets,
Dir = p:GetAimVector(),
@ -252,9 +292,26 @@ AddItem( "base_firearm", {
Spread = Vector( acc, acc, 0 ),
} )
p:LagCompensation(false)
else
ent:FireBullets( {
Attacker = ent,
Damage = 1,
Force = 1,
Tracer = 0,
Num = class.Pellets,
Dir = ent:GetForward(),
Src = ent:GetPos(),
Spread = Vector( acc, acc, 0 ),
} )
local physobj = ent:GetPhysicsObject()
if physobj:IsValid() then
physobj:AddVelocity( ent:GetForward() * -300 )
physobj:AddAngleVelocity( VectorRand( -360*20, 360*20 ) )
end
end
local ply = handler:GetOwner()
if SERVER or CLIENT and IsFirstTimePredicted() then
local ply = handlerorself:GetOwner()
if HandlerValid and (SERVER or CLIENT and IsFirstTimePredicted()) then
ply:AddVCDSequenceToGestureSlot( GESTURE_SLOT_ATTACK_AND_RELOAD, ply:LookupSequence( AnimationLookup["fire"][class.HoldType] ), 0, true )
end
@ -318,6 +375,12 @@ AddItem( "base_firearm", {
end
end,
["EntPhysicsCollide"] = function( class, ent, data, collider )
if ( data.DeltaTime > 0.1 and data.Speed > 200 ) then
class:Attack( ent )
end
end,
["FinishHolster"] = function( class, ent, handler )
handler:EmitSound( "weapons/m4a1/m4a1_deploy.wav", 70, 125, 0.4, CHAN_STATIC )
BaseClass.FinishHolster( class, ent, handler )
@ -727,6 +790,7 @@ do -- Rifles
end
do -- MGs
AddItem( "qbb", {
PrintName = "#Item.qbb.Name",
Description = "#Item.qbb.Description",
@ -749,6 +813,53 @@ do -- MGs
Accuracy_Reset = 0.4,
Accuracy_Decay = 12,
})
AddItem( "stoner", {
PrintName = "#Item.stoner.Name",
Description = "#Item.stoner.Description",
Category = "machinegun",
Base = "base_firearm",
Model = "models/benny/weapons/test_stoner.mdl",
HoldType = "rifle",
ClipSize = 100,
Delay = (60/880),
FireSound = {
"benny/weapons/stoner63/01.ogg",
"benny/weapons/stoner63/02.ogg",
"benny/weapons/stoner63/03.ogg",
},
Accuracy = 1,
Accuracy_Add = 0.4,
Accuracy_Reset = 0.4,
Accuracy_Decay = 12,
})
AddItem( "hk21", {
PrintName = "#Item.hk21.Name",
Description = "#Item.hk21.Description",
Category = "machinegun",
Base = "base_firearm",
Model = "models/benny/weapons/test_hk21.mdl",
HoldType = "rifle",
ClipSize = 70,
Delay = (60/640),
FireSound = {
"benny/weapons/hk21/39_01.ogg",
"benny/weapons/hk21/39_02.ogg",
"benny/weapons/hk21/39_03.ogg",
},
Accuracy = 1,
Accuracy_Add = 0.4,
Accuracy_Reset = 0.4,
Accuracy_Decay = 12,
})
end
do -- SMGs
@ -835,7 +946,7 @@ do -- Shotguns
Category = "shotgun",
Base = "base_firearm",
Model = "models/weapons/w_shotgun.mdl",
Model = "models/benny/weapons/test_spas12.mdl",
HoldType = "rifle",
ClipSize = 8,
@ -858,6 +969,180 @@ do -- Shotguns
Accuracy_Decay = 12,
})
AddItem( "aa12", {
PrintName = "#Item.aa12.Name",
Description = "#Item.aa12.Description",
Category = "shotgun",
Base = "base_firearm",
Model = "models/benny/weapons/test_aa12.mdl",
HoldType = "rifle",
ClipSize = 8,
Pellets = 8,
Delay = 0.4,
BurstCount = 1,
FireSound = {
"benny/weapons/spas12/01.ogg",
"benny/weapons/spas12/02.ogg",
"benny/weapons/spas12/03.ogg",
},
MagOutSound = "benny/weapons/spas12/magout-01.ogg",
MagInSound = "benny/weapons/spas12/magout-02.ogg",
BoltDropSound = "benny/weapons/spas12/magin.ogg",
BoltPullSound = "benny/weapons/glock/magin.ogg",
Accuracy = 8,
Accuracy_Add = 0.4,
Accuracy_Reset = 0.4,
Accuracy_Decay = 12,
})
AddItem( "db", {
PrintName = "#Item.db.Name",
Description = "#Item.db.Description",
Category = "shotgun",
Base = "base_firearm",
Model = "models/benny/weapons/test_db.mdl",
HoldType = "rifle",
ClipSize = 2,
Pellets = 8,
Delay = 0.4,
BurstCount = 1,
FireSound = {
"benny/weapons/spas12/01.ogg",
"benny/weapons/spas12/02.ogg",
"benny/weapons/spas12/03.ogg",
},
MagOutSound = "benny/weapons/spas12/magout-01.ogg",
MagInSound = "benny/weapons/spas12/magout-02.ogg",
BoltDropSound = "benny/weapons/spas12/magin.ogg",
BoltPullSound = "benny/weapons/glock/magin.ogg",
Accuracy = 4,
Accuracy_Add = 0.4,
Accuracy_Reset = 0.4,
Accuracy_Decay = 12,
})
AddItem( "1887", {
PrintName = "#Item.1887.Name",
Description = "#Item.1887.Description",
Category = "shotgun",
Base = "base_firearm",
Model = "models/benny/weapons/test_1887.mdl",
HoldType = "rifle",
ClipSize = 5,
Pellets = 8,
Delay = 0.4,
BurstCount = 1,
FireSound = {
"benny/weapons/spas12/01.ogg",
"benny/weapons/spas12/02.ogg",
"benny/weapons/spas12/03.ogg",
},
MagOutSound = "benny/weapons/spas12/magout-01.ogg",
MagInSound = "benny/weapons/spas12/magout-02.ogg",
BoltDropSound = "benny/weapons/spas12/magin.ogg",
BoltPullSound = "benny/weapons/glock/magin.ogg",
Accuracy = 8,
Accuracy_Add = 0.4,
Accuracy_Reset = 0.4,
Accuracy_Decay = 12,
})
AddItem( "spas15", {
PrintName = "#Item.spas15.Name",
Description = "#Item.spas15.Description",
Category = "shotgun",
Base = "base_firearm",
Model = "models/benny/weapons/test_spas15.mdl",
HoldType = "rifle",
ClipSize = 6,
Pellets = 8,
Delay = 0.6,
BurstCount = 1,
FireSound = {
"benny/weapons/spas12/01.ogg",
"benny/weapons/spas12/02.ogg",
"benny/weapons/spas12/03.ogg",
},
MagOutSound = "benny/weapons/spas12/magout-01.ogg",
MagInSound = "benny/weapons/spas12/magout-02.ogg",
BoltDropSound = "benny/weapons/spas12/magin.ogg",
BoltPullSound = "benny/weapons/glock/magin.ogg",
Accuracy = 8,
Accuracy_Add = 0.4,
Accuracy_Reset = 0.4,
Accuracy_Decay = 12,
})
AddItem( "r870", {
PrintName = "#Item.r870.Name",
Description = "#Item.r870.Description",
Category = "shotgun",
Base = "base_firearm",
Model = "models/benny/weapons/test_r870.mdl",
HoldType = "rifle",
ClipSize = 4,
Pellets = 8,
Delay = 0.6,
BurstCount = 1,
FireSound = {
"benny/weapons/spas12/01.ogg",
"benny/weapons/spas12/02.ogg",
"benny/weapons/spas12/03.ogg",
},
MagOutSound = "benny/weapons/spas12/magout-01.ogg",
MagInSound = "benny/weapons/spas12/magout-02.ogg",
BoltDropSound = "benny/weapons/spas12/magin.ogg",
BoltPullSound = "benny/weapons/glock/magin.ogg",
Accuracy = 8,
Accuracy_Add = 0.4,
Accuracy_Reset = 0.4,
Accuracy_Decay = 12,
})
AddItem( "striker", {
PrintName = "#Item.striker.Name",
Description = "#Item.striker.Description",
Category = "shotgun",
Base = "base_firearm",
Model = "models/benny/weapons/test_striker.mdl",
HoldType = "rifle",
ClipSize = 12,
Pellets = 8,
Delay = 0.3,
BurstCount = 1,
FireSound = {
"benny/weapons/spas12/01.ogg",
"benny/weapons/spas12/02.ogg",
"benny/weapons/spas12/03.ogg",
},
MagOutSound = "benny/weapons/spas12/magout-01.ogg",
MagInSound = "benny/weapons/spas12/magout-02.ogg",
BoltDropSound = "benny/weapons/spas12/magin.ogg",
BoltPullSound = "benny/weapons/glock/magin.ogg",
Accuracy = 8,
Accuracy_Add = 0.4,
Accuracy_Reset = 0.4,
Accuracy_Decay = 12,
})
end
-- bat

View File

@ -35,6 +35,12 @@ L["#Item.qbz.Description"] = "Low-profile bullpup assault rifle"
L["#Item.qbb.Name"] = "QBB-LSW"
L["#Item.qbb.Description"] = "Bullpup machine gun"
L["#Item.stoner.Name"] = "STONER-63"
L["#Item.stoner.Description"] = "Modular machine gun"
L["#Item.hk21.Name"] = "HK-21"
L["#Item.hk21.Description"] = "Powerful medium machine gun"
L["#Item.m16a2.Name"] = "M16A2"
L["#Item.m16a2.Description"] = "Rugged burst rifle"
@ -56,6 +62,24 @@ L["#Item.mp7.Description"] = "Special forces PDW"
L["#Item.mac11.Name"] = "MAC-11"
L["#Item.mac11.Description"] = "Tiny hornet gun"
L["#Item.1887.Name"] = "1887"
L["#Item.1887.Description"] = "Lever-action"
L["#Item.db.Name"] = "DB"
L["#Item.db.Description"] = "Side-by-side shotgun"
L["#Item.aa12.Name"] = "AA-12"
L["#Item.aa12.Description"] = "Automatic combat shotgun"
L["#Item.striker.Name"] = "Streetsweeper"
L["#Item.striker.Description"] = "Semi-automatic drum-fed shotgun"
L["#Item.r870.Name"] = "R870"
L["#Item.r870.Description"] = "Sawn-off pump-action shotgun"
L["#Item.spas15.Name"] = "SPAS-15"
L["#Item.spas15.Description"] = "Mag-fed pump-action shotgun"
L["#Item.satchels.Name"] = "Satchels"
L["#Item.satchels.Description"] = "Packs of bombs and a detonator"