SetWeaponHoldType -> SetHoldType

This commit is contained in:
JetBoom 2014-11-10 00:26:49 -05:00
parent 745b69bffc
commit 6af66c30a5
26 changed files with 38 additions and 62 deletions

View file

@ -49,6 +49,7 @@ function ENT:GetPlayerColor()
end
function ENT:ViewModelChanged( vm, old, new )
if not IsValid(self) then return end
-- Ignore other peoples viewmodel changes!
if ( vm:GetOwner() != self:GetOwner() ) then return end

View file

@ -172,7 +172,7 @@ local pweapon_holdtype = SimplePanel( pweapon )
end
hbox.OnSelect = function(panel,index,value)
if (!value) then return end
wep:SetWeaponHoldType( value )
wep:SetHoldType( value )
wep.HoldType = value
RunConsoleCommand("swepck_setholdtype", value)
end

View file

@ -29,7 +29,7 @@ local function Cmd_SetHoldType( pl, cmd, args )
local holdtype = args[1]
local wep = GetSCKSWEP( pl )
if (IsValid(wep) and holdtype and table.HasValue( wep:GetHoldTypes(), holdtype )) then
wep:SetWeaponHoldType( holdtype )
wep:SetHoldType( holdtype )
wep.HoldType = holdtype
end

View file

@ -76,7 +76,7 @@ local sck_class = ""
function SWEP:Initialize()
self:SetWeaponHoldType(self.HoldType)
self:SetHoldType(self.HoldType)
self:SetIronSights( true )
self:ResetIronSights()

View file

@ -18,7 +18,7 @@ SWEP.WalkSpeed = SPEED_NORMAL
SWEP.FullWalkSpeed = SPEED_SLOWEST
function SWEP:Initialize()
self:SetWeaponHoldType("slam")
self:SetHoldType("slam")
self:SetDeploySpeed(1.1)
self:HideViewAndWorldModel()
end

View file

@ -21,7 +21,7 @@ end
SWEP.WalkSpeed = SPEED_SLOWEST
function SWEP:Initialize()
self:SetWeaponHoldType("rpg")
self:SetHoldType("rpg")
self:SetDeploySpeed(1.1)
end

View file

@ -33,7 +33,7 @@ SWEP.EmptyWhenPurchased = true
function SWEP:Initialize()
if not self:IsValid() then return end --???
self:SetWeaponHoldType(self.HoldType)
self:SetHoldType(self.HoldType)
self:SetDeploySpeed(1.1)
-- 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 b then
self:SetWeaponHoldType(self.IronSightsHoldType)
self:SetHoldType(self.IronSightsHoldType)
else
self:SetWeaponHoldType(self.HoldType)
self:SetHoldType(self.HoldType)
end
end
@ -266,7 +266,7 @@ function SWEP:SetWeaponHoldType( t )
local index = ActIndex[ t ]
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"
index = ActIndex[ t ]
end

View file

@ -44,7 +44,7 @@ SWEP.SwingOffset = Vector(0, 0, 0)
function SWEP:Initialize()
self:SetDeploySpeed(1.1)
self:SetWeaponHoldType(self.HoldType)
self:SetHoldType(self.HoldType)
self:SetWeaponSwingHoldType(self.SwingHoldType)
if CLIENT then
@ -54,7 +54,7 @@ end
function SWEP:SetWeaponSwingHoldType(t)
local old = self.ActivityTranslate
self:SetWeaponHoldType(t)
self:SetHoldType(t)
local new = self.ActivityTranslate
self.ActivityTranslate = old
self.ActivityTranslateSwing = new

View file

@ -18,7 +18,7 @@ SWEP.WalkSpeed = SPEED_NORMAL
SWEP.FullWalkSpeed = SPEED_SLOW
function SWEP:Initialize()
self:SetWeaponHoldType("slam")
self:SetHoldType("slam")
self:SetDeploySpeed(1.1)
self:HideViewAndWorldModel()
end

View file

@ -34,7 +34,7 @@ SWEP.NoPickupNotification = true
SWEP.HoldType = "slam"
function SWEP:Initialize()
self:SetWeaponHoldType(self.HoldType)
self:SetHoldType(self.HoldType)
end
if SERVER then

View file

@ -50,7 +50,7 @@ SWEP.Secondary.Ammo = "none"
SWEP.WalkSpeed = SPEED_FAST
function SWEP:Initialize()
self:SetWeaponHoldType("grenade")
self:SetHoldType("grenade")
self:SetDeploySpeed(1.1)
if CLIENT then

View file

@ -40,7 +40,7 @@ SWEP.NoPickupNotification = true
SWEP.HoldType = "slam"
function SWEP:Initialize()
self:SetWeaponHoldType(self.HoldType)
self:SetHoldType(self.HoldType)
self:SetDeploySpeed(10)
end

View file

@ -18,7 +18,7 @@ SWEP.WalkSpeed = SPEED_NORMAL
SWEP.FullWalkSpeed = SPEED_SLOWEST
function SWEP:Initialize()
self:SetWeaponHoldType("slam")
self:SetHoldType("slam")
self:SetDeploySpeed(1.1)
self:HideViewAndWorldModel()
end

View file

@ -18,7 +18,7 @@ SWEP.Secondary.Ammo = "none"
SWEP.WalkSpeed = SPEED_FAST
function SWEP:Initialize()
self:SetWeaponHoldType("grenade")
self:SetHoldType("grenade")
self:SetDeploySpeed(1.1)
end

View file

@ -18,7 +18,7 @@ SWEP.WalkSpeed = SPEED_NORMAL
SWEP.FullWalkSpeed = SPEED_SLOWEST
function SWEP:Initialize()
self:SetWeaponHoldType("slam")
self:SetHoldType("slam")
self:SetDeploySpeed(1.1)
self:HideViewAndWorldModel()
end

View file

@ -40,7 +40,7 @@ SWEP.NoPickupNotification = true
SWEP.HoldType = "slam"
function SWEP:Initialize()
self:SetWeaponHoldType(self.HoldType)
self:SetHoldType(self.HoldType)
self:SetDeploySpeed(10)
end

View file

@ -53,7 +53,7 @@ SWEP.Secondary.Ammo = "none"
SWEP.WalkSpeed = SPEED_FAST
function SWEP:Initialize()
self:SetWeaponHoldType("grenade")
self:SetHoldType("grenade")
self:SetDeploySpeed(1.1)
if CLIENT then

View file

@ -42,7 +42,7 @@ SWEP.NoPickupNotification = true
SWEP.HoldType = "slam"
function SWEP:Initialize()
self:SetWeaponHoldType(self.HoldType)
self:SetHoldType(self.HoldType)
self:SetDeploySpeed(10)
end

View file

@ -40,7 +40,7 @@ SWEP.NoMagazine = true
SWEP.HoldType = "slam"
function SWEP:Initialize()
self:SetWeaponHoldType(self.HoldType)
self:SetHoldType(self.HoldType)
self:SetDeploySpeed(1.1)
end

View file

@ -18,7 +18,7 @@ SWEP.WalkSpeed = SPEED_NORMAL
SWEP.FullWalkSpeed = SPEED_SLOW
function SWEP:Initialize()
self:SetWeaponHoldType("slam")
self:SetHoldType("slam")
self:SetDeploySpeed(1.1)
self:HideViewAndWorldModel()
end

View file

@ -18,7 +18,7 @@ SWEP.WalkSpeed = SPEED_NORMAL
SWEP.FullWalkSpeed = SPEED_SLOWEST
function SWEP:Initialize()
self:SetWeaponHoldType("slam")
self:SetHoldType("slam")
self:SetDeploySpeed(1.1)
self:HideViewAndWorldModel()
end

View file

@ -18,7 +18,7 @@ SWEP.WalkSpeed = SPEED_NORMAL
SWEP.FullWalkSpeed = SPEED_SLOWEST
function SWEP:Initialize()
self:SetWeaponHoldType("slam")
self:SetHoldType("slam")
self:SetDeploySpeed(1.1)
self:HideViewAndWorldModel()
end

View file

@ -50,7 +50,7 @@ SWEP.Secondary.Ammo = "none"
SWEP.WalkSpeed = SPEED_FAST
function SWEP:Initialize()
self:SetWeaponHoldType("grenade")
self:SetHoldType("grenade")
self:SetDeploySpeed(1.1)
if CLIENT then

View file

@ -28,9 +28,9 @@ function SWEP:SetIronsights(b)
if self.IronSightsHoldType then
if b then
self:SetWeaponHoldType(self.IronSightsHoldType)
self:SetHoldType(self.IronSightsHoldType)
else
self:SetWeaponHoldType(self.HoldType)
self:SetHoldType(self.HoldType)
end
end

View file

@ -1600,6 +1600,9 @@ function GM:PlayerInitialSpawnRound(pl)
pl.DamageDealt[TEAM_UNDEAD] = 0
pl.DamageDealt[TEAM_HUMAN] = 0
pl.m_PointQueue = 0
pl.m_LastDamageDealt = 0
pl.HealedThisRound = 0
pl.CarryOverHealth = 0
pl.RepairedThisRound = 0

View file

@ -248,51 +248,23 @@ function meta:GiveEmptyWeapon(weptype)
end
end
meta.OldGive = meta.Give
local OldGive = meta.Give
function meta:Give(weptype)
if self:Team() ~= TEAM_HUMAN then
self:OldGive(weptype)
return
return OldGive(self, weptype)
end
local weps = self:GetWeapons()
local autoswitch = #weps == 1 and weps[1]:IsValid() and weps[1].AutoSwitchFrom
self:OldGive(weptype)
local ret = OldGive(self, weptype)
if autoswitch then
self:SelectWeapon(weptype)
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)
return ret
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)
local feigndeath = self.FeignDeath