SetWeaponHoldType -> SetHoldType
This commit is contained in:
parent
745b69bffc
commit
6af66c30a5
26 changed files with 38 additions and 62 deletions
|
@ -49,6 +49,7 @@ function ENT:GetPlayerColor()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:ViewModelChanged( vm, old, new )
|
function ENT:ViewModelChanged( vm, old, new )
|
||||||
|
if not IsValid(self) then return end
|
||||||
|
|
||||||
-- Ignore other peoples viewmodel changes!
|
-- Ignore other peoples viewmodel changes!
|
||||||
if ( vm:GetOwner() != self:GetOwner() ) then return end
|
if ( vm:GetOwner() != self:GetOwner() ) then return end
|
||||||
|
|
|
@ -172,7 +172,7 @@ local pweapon_holdtype = SimplePanel( pweapon )
|
||||||
end
|
end
|
||||||
hbox.OnSelect = function(panel,index,value)
|
hbox.OnSelect = function(panel,index,value)
|
||||||
if (!value) then return end
|
if (!value) then return end
|
||||||
wep:SetWeaponHoldType( value )
|
wep:SetHoldType( value )
|
||||||
wep.HoldType = value
|
wep.HoldType = value
|
||||||
RunConsoleCommand("swepck_setholdtype", value)
|
RunConsoleCommand("swepck_setholdtype", value)
|
||||||
end
|
end
|
||||||
|
|
|
@ -29,7 +29,7 @@ local function Cmd_SetHoldType( pl, cmd, args )
|
||||||
local holdtype = args[1]
|
local holdtype = args[1]
|
||||||
local wep = GetSCKSWEP( pl )
|
local wep = GetSCKSWEP( pl )
|
||||||
if (IsValid(wep) and holdtype and table.HasValue( wep:GetHoldTypes(), holdtype )) then
|
if (IsValid(wep) and holdtype and table.HasValue( wep:GetHoldTypes(), holdtype )) then
|
||||||
wep:SetWeaponHoldType( holdtype )
|
wep:SetHoldType( holdtype )
|
||||||
wep.HoldType = holdtype
|
wep.HoldType = holdtype
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ local sck_class = ""
|
||||||
|
|
||||||
function SWEP:Initialize()
|
function SWEP:Initialize()
|
||||||
|
|
||||||
self:SetWeaponHoldType(self.HoldType)
|
self:SetHoldType(self.HoldType)
|
||||||
|
|
||||||
self:SetIronSights( true )
|
self:SetIronSights( true )
|
||||||
self:ResetIronSights()
|
self:ResetIronSights()
|
||||||
|
|
|
@ -18,7 +18,7 @@ SWEP.WalkSpeed = SPEED_NORMAL
|
||||||
SWEP.FullWalkSpeed = SPEED_SLOWEST
|
SWEP.FullWalkSpeed = SPEED_SLOWEST
|
||||||
|
|
||||||
function SWEP:Initialize()
|
function SWEP:Initialize()
|
||||||
self:SetWeaponHoldType("slam")
|
self:SetHoldType("slam")
|
||||||
self:SetDeploySpeed(1.1)
|
self:SetDeploySpeed(1.1)
|
||||||
self:HideViewAndWorldModel()
|
self:HideViewAndWorldModel()
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,7 +21,7 @@ end
|
||||||
SWEP.WalkSpeed = SPEED_SLOWEST
|
SWEP.WalkSpeed = SPEED_SLOWEST
|
||||||
|
|
||||||
function SWEP:Initialize()
|
function SWEP:Initialize()
|
||||||
self:SetWeaponHoldType("rpg")
|
self:SetHoldType("rpg")
|
||||||
self:SetDeploySpeed(1.1)
|
self:SetDeploySpeed(1.1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ SWEP.EmptyWhenPurchased = true
|
||||||
function SWEP:Initialize()
|
function SWEP:Initialize()
|
||||||
if not self:IsValid() then return end --???
|
if not self:IsValid() then return end --???
|
||||||
|
|
||||||
self:SetWeaponHoldType(self.HoldType)
|
self:SetHoldType(self.HoldType)
|
||||||
self:SetDeploySpeed(1.1)
|
self:SetDeploySpeed(1.1)
|
||||||
|
|
||||||
-- Maybe we didn't want to convert the weapon to the new system...
|
-- Maybe we didn't want to convert the weapon to the new system...
|
||||||
|
@ -89,9 +89,9 @@ function SWEP:SetIronsights(b)
|
||||||
|
|
||||||
if self.IronSightsHoldType then
|
if self.IronSightsHoldType then
|
||||||
if b then
|
if b then
|
||||||
self:SetWeaponHoldType(self.IronSightsHoldType)
|
self:SetHoldType(self.IronSightsHoldType)
|
||||||
else
|
else
|
||||||
self:SetWeaponHoldType(self.HoldType)
|
self:SetHoldType(self.HoldType)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ function SWEP:SetWeaponHoldType( t )
|
||||||
local index = ActIndex[ t ]
|
local index = ActIndex[ t ]
|
||||||
|
|
||||||
if ( index == nil ) then
|
if ( index == nil ) then
|
||||||
Msg( "SWEP:SetWeaponHoldType - ActIndex[ \""..t.."\" ] isn't set! (defaulting to normal)\n" )
|
Msg( "SWEP:SetWeaponHoldType - ActIndex[ \""..t.."\" ] isn't set! (defaulting to normal) (from "..self:GetClass()..")\n" )
|
||||||
t = "normal"
|
t = "normal"
|
||||||
index = ActIndex[ t ]
|
index = ActIndex[ t ]
|
||||||
end
|
end
|
||||||
|
|
|
@ -44,7 +44,7 @@ SWEP.SwingOffset = Vector(0, 0, 0)
|
||||||
|
|
||||||
function SWEP:Initialize()
|
function SWEP:Initialize()
|
||||||
self:SetDeploySpeed(1.1)
|
self:SetDeploySpeed(1.1)
|
||||||
self:SetWeaponHoldType(self.HoldType)
|
self:SetHoldType(self.HoldType)
|
||||||
self:SetWeaponSwingHoldType(self.SwingHoldType)
|
self:SetWeaponSwingHoldType(self.SwingHoldType)
|
||||||
|
|
||||||
if CLIENT then
|
if CLIENT then
|
||||||
|
@ -54,7 +54,7 @@ end
|
||||||
|
|
||||||
function SWEP:SetWeaponSwingHoldType(t)
|
function SWEP:SetWeaponSwingHoldType(t)
|
||||||
local old = self.ActivityTranslate
|
local old = self.ActivityTranslate
|
||||||
self:SetWeaponHoldType(t)
|
self:SetHoldType(t)
|
||||||
local new = self.ActivityTranslate
|
local new = self.ActivityTranslate
|
||||||
self.ActivityTranslate = old
|
self.ActivityTranslate = old
|
||||||
self.ActivityTranslateSwing = new
|
self.ActivityTranslateSwing = new
|
||||||
|
|
|
@ -18,7 +18,7 @@ SWEP.WalkSpeed = SPEED_NORMAL
|
||||||
SWEP.FullWalkSpeed = SPEED_SLOW
|
SWEP.FullWalkSpeed = SPEED_SLOW
|
||||||
|
|
||||||
function SWEP:Initialize()
|
function SWEP:Initialize()
|
||||||
self:SetWeaponHoldType("slam")
|
self:SetHoldType("slam")
|
||||||
self:SetDeploySpeed(1.1)
|
self:SetDeploySpeed(1.1)
|
||||||
self:HideViewAndWorldModel()
|
self:HideViewAndWorldModel()
|
||||||
end
|
end
|
||||||
|
|
|
@ -34,7 +34,7 @@ SWEP.NoPickupNotification = true
|
||||||
SWEP.HoldType = "slam"
|
SWEP.HoldType = "slam"
|
||||||
|
|
||||||
function SWEP:Initialize()
|
function SWEP:Initialize()
|
||||||
self:SetWeaponHoldType(self.HoldType)
|
self:SetHoldType(self.HoldType)
|
||||||
end
|
end
|
||||||
|
|
||||||
if SERVER then
|
if SERVER then
|
||||||
|
|
|
@ -50,7 +50,7 @@ SWEP.Secondary.Ammo = "none"
|
||||||
SWEP.WalkSpeed = SPEED_FAST
|
SWEP.WalkSpeed = SPEED_FAST
|
||||||
|
|
||||||
function SWEP:Initialize()
|
function SWEP:Initialize()
|
||||||
self:SetWeaponHoldType("grenade")
|
self:SetHoldType("grenade")
|
||||||
self:SetDeploySpeed(1.1)
|
self:SetDeploySpeed(1.1)
|
||||||
|
|
||||||
if CLIENT then
|
if CLIENT then
|
||||||
|
|
|
@ -40,7 +40,7 @@ SWEP.NoPickupNotification = true
|
||||||
SWEP.HoldType = "slam"
|
SWEP.HoldType = "slam"
|
||||||
|
|
||||||
function SWEP:Initialize()
|
function SWEP:Initialize()
|
||||||
self:SetWeaponHoldType(self.HoldType)
|
self:SetHoldType(self.HoldType)
|
||||||
self:SetDeploySpeed(10)
|
self:SetDeploySpeed(10)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ SWEP.WalkSpeed = SPEED_NORMAL
|
||||||
SWEP.FullWalkSpeed = SPEED_SLOWEST
|
SWEP.FullWalkSpeed = SPEED_SLOWEST
|
||||||
|
|
||||||
function SWEP:Initialize()
|
function SWEP:Initialize()
|
||||||
self:SetWeaponHoldType("slam")
|
self:SetHoldType("slam")
|
||||||
self:SetDeploySpeed(1.1)
|
self:SetDeploySpeed(1.1)
|
||||||
self:HideViewAndWorldModel()
|
self:HideViewAndWorldModel()
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,7 +18,7 @@ SWEP.Secondary.Ammo = "none"
|
||||||
SWEP.WalkSpeed = SPEED_FAST
|
SWEP.WalkSpeed = SPEED_FAST
|
||||||
|
|
||||||
function SWEP:Initialize()
|
function SWEP:Initialize()
|
||||||
self:SetWeaponHoldType("grenade")
|
self:SetHoldType("grenade")
|
||||||
self:SetDeploySpeed(1.1)
|
self:SetDeploySpeed(1.1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ SWEP.WalkSpeed = SPEED_NORMAL
|
||||||
SWEP.FullWalkSpeed = SPEED_SLOWEST
|
SWEP.FullWalkSpeed = SPEED_SLOWEST
|
||||||
|
|
||||||
function SWEP:Initialize()
|
function SWEP:Initialize()
|
||||||
self:SetWeaponHoldType("slam")
|
self:SetHoldType("slam")
|
||||||
self:SetDeploySpeed(1.1)
|
self:SetDeploySpeed(1.1)
|
||||||
self:HideViewAndWorldModel()
|
self:HideViewAndWorldModel()
|
||||||
end
|
end
|
||||||
|
|
|
@ -40,7 +40,7 @@ SWEP.NoPickupNotification = true
|
||||||
SWEP.HoldType = "slam"
|
SWEP.HoldType = "slam"
|
||||||
|
|
||||||
function SWEP:Initialize()
|
function SWEP:Initialize()
|
||||||
self:SetWeaponHoldType(self.HoldType)
|
self:SetHoldType(self.HoldType)
|
||||||
self:SetDeploySpeed(10)
|
self:SetDeploySpeed(10)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ SWEP.Secondary.Ammo = "none"
|
||||||
SWEP.WalkSpeed = SPEED_FAST
|
SWEP.WalkSpeed = SPEED_FAST
|
||||||
|
|
||||||
function SWEP:Initialize()
|
function SWEP:Initialize()
|
||||||
self:SetWeaponHoldType("grenade")
|
self:SetHoldType("grenade")
|
||||||
self:SetDeploySpeed(1.1)
|
self:SetDeploySpeed(1.1)
|
||||||
|
|
||||||
if CLIENT then
|
if CLIENT then
|
||||||
|
|
|
@ -42,7 +42,7 @@ SWEP.NoPickupNotification = true
|
||||||
SWEP.HoldType = "slam"
|
SWEP.HoldType = "slam"
|
||||||
|
|
||||||
function SWEP:Initialize()
|
function SWEP:Initialize()
|
||||||
self:SetWeaponHoldType(self.HoldType)
|
self:SetHoldType(self.HoldType)
|
||||||
self:SetDeploySpeed(10)
|
self:SetDeploySpeed(10)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ SWEP.NoMagazine = true
|
||||||
SWEP.HoldType = "slam"
|
SWEP.HoldType = "slam"
|
||||||
|
|
||||||
function SWEP:Initialize()
|
function SWEP:Initialize()
|
||||||
self:SetWeaponHoldType(self.HoldType)
|
self:SetHoldType(self.HoldType)
|
||||||
self:SetDeploySpeed(1.1)
|
self:SetDeploySpeed(1.1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ SWEP.WalkSpeed = SPEED_NORMAL
|
||||||
SWEP.FullWalkSpeed = SPEED_SLOW
|
SWEP.FullWalkSpeed = SPEED_SLOW
|
||||||
|
|
||||||
function SWEP:Initialize()
|
function SWEP:Initialize()
|
||||||
self:SetWeaponHoldType("slam")
|
self:SetHoldType("slam")
|
||||||
self:SetDeploySpeed(1.1)
|
self:SetDeploySpeed(1.1)
|
||||||
self:HideViewAndWorldModel()
|
self:HideViewAndWorldModel()
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,7 +18,7 @@ SWEP.WalkSpeed = SPEED_NORMAL
|
||||||
SWEP.FullWalkSpeed = SPEED_SLOWEST
|
SWEP.FullWalkSpeed = SPEED_SLOWEST
|
||||||
|
|
||||||
function SWEP:Initialize()
|
function SWEP:Initialize()
|
||||||
self:SetWeaponHoldType("slam")
|
self:SetHoldType("slam")
|
||||||
self:SetDeploySpeed(1.1)
|
self:SetDeploySpeed(1.1)
|
||||||
self:HideViewAndWorldModel()
|
self:HideViewAndWorldModel()
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,7 +18,7 @@ SWEP.WalkSpeed = SPEED_NORMAL
|
||||||
SWEP.FullWalkSpeed = SPEED_SLOWEST
|
SWEP.FullWalkSpeed = SPEED_SLOWEST
|
||||||
|
|
||||||
function SWEP:Initialize()
|
function SWEP:Initialize()
|
||||||
self:SetWeaponHoldType("slam")
|
self:SetHoldType("slam")
|
||||||
self:SetDeploySpeed(1.1)
|
self:SetDeploySpeed(1.1)
|
||||||
self:HideViewAndWorldModel()
|
self:HideViewAndWorldModel()
|
||||||
end
|
end
|
||||||
|
|
|
@ -50,7 +50,7 @@ SWEP.Secondary.Ammo = "none"
|
||||||
SWEP.WalkSpeed = SPEED_FAST
|
SWEP.WalkSpeed = SPEED_FAST
|
||||||
|
|
||||||
function SWEP:Initialize()
|
function SWEP:Initialize()
|
||||||
self:SetWeaponHoldType("grenade")
|
self:SetHoldType("grenade")
|
||||||
self:SetDeploySpeed(1.1)
|
self:SetDeploySpeed(1.1)
|
||||||
|
|
||||||
if CLIENT then
|
if CLIENT then
|
||||||
|
|
|
@ -28,9 +28,9 @@ function SWEP:SetIronsights(b)
|
||||||
|
|
||||||
if self.IronSightsHoldType then
|
if self.IronSightsHoldType then
|
||||||
if b then
|
if b then
|
||||||
self:SetWeaponHoldType(self.IronSightsHoldType)
|
self:SetHoldType(self.IronSightsHoldType)
|
||||||
else
|
else
|
||||||
self:SetWeaponHoldType(self.HoldType)
|
self:SetHoldType(self.HoldType)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1600,6 +1600,9 @@ function GM:PlayerInitialSpawnRound(pl)
|
||||||
pl.DamageDealt[TEAM_UNDEAD] = 0
|
pl.DamageDealt[TEAM_UNDEAD] = 0
|
||||||
pl.DamageDealt[TEAM_HUMAN] = 0
|
pl.DamageDealt[TEAM_HUMAN] = 0
|
||||||
|
|
||||||
|
pl.m_PointQueue = 0
|
||||||
|
pl.m_LastDamageDealt = 0
|
||||||
|
|
||||||
pl.HealedThisRound = 0
|
pl.HealedThisRound = 0
|
||||||
pl.CarryOverHealth = 0
|
pl.CarryOverHealth = 0
|
||||||
pl.RepairedThisRound = 0
|
pl.RepairedThisRound = 0
|
||||||
|
|
|
@ -248,52 +248,24 @@ function meta:GiveEmptyWeapon(weptype)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
meta.OldGive = meta.Give
|
local OldGive = meta.Give
|
||||||
function meta:Give(weptype)
|
function meta:Give(weptype)
|
||||||
if self:Team() ~= TEAM_HUMAN then
|
if self:Team() ~= TEAM_HUMAN then
|
||||||
self:OldGive(weptype)
|
return OldGive(self, weptype)
|
||||||
return
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local weps = self:GetWeapons()
|
local weps = self:GetWeapons()
|
||||||
local autoswitch = #weps == 1 and weps[1]:IsValid() and weps[1].AutoSwitchFrom
|
local autoswitch = #weps == 1 and weps[1]:IsValid() and weps[1].AutoSwitchFrom
|
||||||
|
|
||||||
self:OldGive(weptype)
|
local ret = OldGive(self, weptype)
|
||||||
|
|
||||||
if autoswitch then
|
if autoswitch then
|
||||||
self:SelectWeapon(weptype)
|
self:SelectWeapon(weptype)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Here for when garry makes weapons use 357 ammo like he does every other update.
|
|
||||||
--[[local oldgive = meta.Give
|
|
||||||
function meta:Give(...)
|
|
||||||
local wep = oldgive(self, ...)
|
|
||||||
if wep:IsValid() then
|
|
||||||
if wep.Primary and wep.Primary.Ammo and wep.Primary.Ammo ~= "none" then
|
|
||||||
self:RemoveAmmo(wep.Primary.DefaultClip - wep.Primary.ClipSize, "357")
|
|
||||||
wep:SetClip1(0)
|
|
||||||
|
|
||||||
if wep.Primary.DefaultClip > wep.Primary.ClipSize then
|
|
||||||
self:GiveAmmo(wep.Primary.DefaultClip, wep.Primary.Ammo, true)
|
|
||||||
end
|
|
||||||
wep:SetClip1(wep.Primary.ClipSize)
|
|
||||||
self:RemoveAmmo(wep.Primary.ClipSize, wep.Primary.Ammo)
|
|
||||||
end
|
|
||||||
if wep.Secondary and wep.Secondary.Ammo and wep.Secondary.Ammo ~= "none" then
|
|
||||||
self:RemoveAmmo(wep.Secondary.DefaultClip - wep.Secondary.ClipSize, "357")
|
|
||||||
wep:SetClip2(0)
|
|
||||||
|
|
||||||
if wep.Secondary.DefaultClip > wep.Secondary.ClipSize then
|
|
||||||
self:GiveAmmo(wep.Secondary.DefaultClip, wep.Secondary.Ammo, true)
|
|
||||||
end
|
|
||||||
wep:SetClip2(wep.Secondary.ClipSize)
|
|
||||||
self:RemoveAmmo(wep.Secondary.ClipSize, wep.Secondary.Ammo)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return wep
|
|
||||||
end]]
|
|
||||||
|
|
||||||
function meta:StartFeignDeath(force)
|
function meta:StartFeignDeath(force)
|
||||||
local feigndeath = self.FeignDeath
|
local feigndeath = self.FeignDeath
|
||||||
if feigndeath and feigndeath:IsValid() then
|
if feigndeath and feigndeath:IsValid() then
|
||||||
|
|
Loading…
Reference in a new issue