Movement penalties! Akimbo effects! More fixes!
This commit is contained in:
parent
316feb6463
commit
8a31b270f0
|
@ -12,8 +12,13 @@ function EFFECT:Init( data )
|
||||||
self.angles = data:GetAngles()
|
self.angles = data:GetAngles()
|
||||||
self.el = data:GetEntity()
|
self.el = data:GetEntity()
|
||||||
self.en = data:GetEntity()
|
self.en = data:GetEntity()
|
||||||
if IsValid(self.en.CWM) then self.en = self.en.CWM end
|
|
||||||
self.ea = data:GetAttachment()
|
self.ea = data:GetAttachment()
|
||||||
|
if self.ea > 16 then
|
||||||
|
if IsValid(self.en.CWM_Left) then self.en = self.en.CWM_Left end
|
||||||
|
self.ea = self.ea - 16
|
||||||
|
else
|
||||||
|
if IsValid(self.en.CWM) then self.en = self.en.CWM end
|
||||||
|
end
|
||||||
self.particles = 1
|
self.particles = 1
|
||||||
|
|
||||||
self.CreationTime = UnPredictedCurTime()
|
self.CreationTime = UnPredictedCurTime()
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
function SWEP:DrawWorldModel()
|
function SWEP:DrawWorldModel()
|
||||||
local p = self:GetOwner()
|
local p = self:GetOwner()
|
||||||
|
do
|
||||||
local wm = self.CWM
|
local wm = self.CWM
|
||||||
local class = self:BClass( false )
|
local class = self:BClass( false )
|
||||||
if class then
|
if class then
|
||||||
|
@ -11,30 +12,57 @@ function SWEP:DrawWorldModel()
|
||||||
wm:SetNoDraw( true )
|
wm:SetNoDraw( true )
|
||||||
wm:AddEffects( EF_BONEMERGE )
|
wm:AddEffects( EF_BONEMERGE )
|
||||||
wm:SetParent( p )
|
wm:SetParent( p )
|
||||||
|
if true or self:GetUserAim() then wm:DrawModel() end
|
||||||
|
else
|
||||||
|
if IsValid(wm) then wm:Remove() end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
do
|
||||||
|
local wm = self.CWM_Left
|
||||||
|
local class = self:BClass( true )
|
||||||
|
if class then
|
||||||
|
if !IsValid(wm) then
|
||||||
|
wm = ClientsideModel( class.WModel )
|
||||||
|
self.CWM_Left = wm
|
||||||
|
end
|
||||||
|
wm:SetModel( class.WModel )
|
||||||
|
wm:SetNoDraw( true )
|
||||||
|
|
||||||
-- if IsValid(p) then
|
if IsValid(p) then
|
||||||
-- -- Specify a good position
|
-- Specify a good position
|
||||||
-- local offsetVec = Vector(12.8, -1.4, 2.6)
|
wm:SetPos( vector_origin )
|
||||||
-- local offsetAng = Angle(180 - 10, 180, 0)
|
wm:SetAngles( angle_zero )
|
||||||
--
|
wm:SetupBones()
|
||||||
-- local boneid = p:LookupBone("ValveBiped.Bip01_R_Hand") -- Right Hand
|
|
||||||
-- if !boneid then return end
|
|
||||||
|
|
||||||
-- local matrix = p:GetBoneMatrix(boneid)
|
local pv = wm:GetBoneMatrix( wm:LookupBone( "ValveBiped.Bip01_R_Hand" ) ):GetTranslation()
|
||||||
-- if !matrix then return end
|
local pa = wm:GetBoneMatrix( wm:LookupBone( "ValveBiped.Bip01_R_Hand" ) ):GetAngles()
|
||||||
|
pv.x = -pv.x
|
||||||
|
pv.y = pv.y
|
||||||
|
pv.z = -pv.z
|
||||||
|
pa.p = -pa.p
|
||||||
|
pa.r = pa.r + 180
|
||||||
|
|
||||||
-- local newPos, newAng = LocalToWorld(offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles())
|
local boneid = p:LookupBone("ValveBiped.Bip01_L_Hand") -- Right Hand
|
||||||
|
if !boneid then return end
|
||||||
|
|
||||||
-- wm:SetPos(newPos)
|
local matrix = p:GetBoneMatrix(boneid)
|
||||||
-- wm:SetAngles(newAng)
|
if !matrix then return end
|
||||||
|
|
||||||
-- wm:SetupBones()
|
local newPos, newAng = LocalToWorld(pv, pa, matrix:GetTranslation(), matrix:GetAngles())
|
||||||
-- else
|
|
||||||
-- wm:SetPos(self:GetPos())
|
|
||||||
-- wm:SetAngles(self:GetAngles())
|
|
||||||
-- wm:SetupBones()
|
|
||||||
-- end
|
|
||||||
|
|
||||||
if self:GetUserAim() then wm:DrawModel() end
|
wm:SetPos(newPos)
|
||||||
|
wm:SetAngles(newAng)
|
||||||
|
|
||||||
|
wm:SetupBones()
|
||||||
|
else
|
||||||
|
wm:SetPos(self:GetPos())
|
||||||
|
wm:SetAngles(self:GetAngles())
|
||||||
|
wm:SetupBones()
|
||||||
|
end
|
||||||
|
|
||||||
|
if true or self:GetUserAim() then wm:DrawModel() end
|
||||||
|
else
|
||||||
|
if IsValid(wm) then wm:Remove() end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -62,24 +62,20 @@ function SWEP:BFire( hand )
|
||||||
|
|
||||||
|
|
||||||
if CLIENT and IsFirstTimePredicted() then
|
if CLIENT and IsFirstTimePredicted() then
|
||||||
if IsValid(self.CWM) and self.CWM:GetAttachment( 1 ) then
|
-- PROTO: This is shit! Replace it with a function that gets the right model.
|
||||||
local vStart = self.CWM:GetAttachment( 1 ).Pos
|
if IsValid(hand and self.CWM_Left or self.CWM) and (hand and self.CWM_Left or self.CWM):GetAttachment( 1 ) then
|
||||||
--local vPoint = p:GetEyeTrace().HitPos
|
local vStart = (hand and self.CWM_Left or self.CWM):GetAttachment( 1 ).Pos
|
||||||
--local effectdata = EffectData()
|
|
||||||
--effectdata:SetStart( vStart )
|
|
||||||
--effectdata:SetOrigin( vPoint )
|
|
||||||
--util.Effect( "ToolTracer", effectdata )
|
|
||||||
local ed = EffectData()
|
local ed = EffectData()
|
||||||
ed:SetOrigin( vStart )
|
ed:SetOrigin( vStart )
|
||||||
--ed:SetAngles( Angle() )
|
|
||||||
ed:SetEntity( self )
|
ed:SetEntity( self )
|
||||||
ed:SetAttachment( 1 )
|
ed:SetAttachment( (hand and 16 or 0) + 1 )
|
||||||
util.Effect( "benny_muzzleflash", ed )
|
util.Effect( "benny_muzzleflash", ed )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local bc = { effects = false, damage = true }
|
||||||
function SWEP:CallFire( hand )
|
function SWEP:CallFire( hand )
|
||||||
local p = self:GetOwner()
|
local p = self:GetOwner()
|
||||||
local class = self:BClass( hand )
|
local class = self:BClass( hand )
|
||||||
|
@ -105,25 +101,21 @@ function SWEP:CallFire( hand )
|
||||||
Force = class.Damage/10,
|
Force = class.Damage/10,
|
||||||
Src = p:EyePos(),
|
Src = p:EyePos(),
|
||||||
Dir = dir:Forward(),
|
Dir = dir:Forward(),
|
||||||
|
Tracer = 0,
|
||||||
IgnoreEntity = p,
|
IgnoreEntity = p,
|
||||||
Callback = self.BulletCallback,
|
Callback = function( atk, tr, dmginfo )
|
||||||
|
if CLIENT and IsFirstTimePredicted() then
|
||||||
|
self:FireCL( hand, tr )
|
||||||
|
end
|
||||||
|
return bc
|
||||||
|
end,
|
||||||
} )
|
} )
|
||||||
|
|
||||||
-- self:FireCL( tr )
|
|
||||||
-- self:FireSV( tr )
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:BulletCallback()
|
function SWEP:FireCL( hand, tr )
|
||||||
return true
|
-- PROTO: This is shit! Replace it with a function that gets the right model.
|
||||||
end
|
local vStart = (hand and self.CWM_Left or self.CWM):GetAttachment( 1 ).Pos
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function SWEP:FireCL( tr )
|
|
||||||
if CLIENT and IsFirstTimePredicted() then
|
|
||||||
do
|
|
||||||
local vStart = self.CWM:GetAttachment( 1 ).Pos
|
|
||||||
local vPoint = tr.HitPos
|
local vPoint = tr.HitPos
|
||||||
local effectdata = EffectData()
|
local effectdata = EffectData()
|
||||||
effectdata:SetStart( vStart )
|
effectdata:SetStart( vStart )
|
||||||
|
@ -132,29 +124,4 @@ function SWEP:FireCL( tr )
|
||||||
effectdata:SetScale( 1025*12 )
|
effectdata:SetScale( 1025*12 )
|
||||||
effectdata:SetFlags( 1 )
|
effectdata:SetFlags( 1 )
|
||||||
util.Effect( "Tracer", effectdata )
|
util.Effect( "Tracer", effectdata )
|
||||||
end
|
|
||||||
-- util.DecalEx( Material( util.DecalMaterial( "Impact.Concrete" ) ), tr.Entity, tr.HitPos, tr.HitNormal, color_white, 1, 1 )
|
|
||||||
do
|
|
||||||
local effectdata = EffectData()
|
|
||||||
effectdata:SetOrigin( tr.HitPos )
|
|
||||||
effectdata:SetStart( tr.StartPos )
|
|
||||||
effectdata:SetSurfaceProp( tr.SurfaceProps )
|
|
||||||
effectdata:SetEntity( tr.Entity )
|
|
||||||
effectdata:SetDamageType( DMG_BULLET )
|
|
||||||
util.Effect( "Impact", effectdata )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function SWEP:FireSV( tr )
|
|
||||||
local class = self:BClass( false )
|
|
||||||
if SERVER and IsValid( tr.Entity ) then
|
|
||||||
local dmginfo = DamageInfo()
|
|
||||||
dmginfo:SetDamage( class.Damage )
|
|
||||||
dmginfo:SetAttacker( self:GetOwner() )
|
|
||||||
dmginfo:SetInflictor( self )
|
|
||||||
dmginfo:SetDamageType( DMG_BULLET )
|
|
||||||
dmginfo:SetDamagePosition( tr.HitPos )
|
|
||||||
tr.Entity:TakeDamageInfo( dmginfo )
|
|
||||||
end
|
|
||||||
end
|
end
|
|
@ -150,7 +150,7 @@ local fallbackstat = {
|
||||||
}
|
}
|
||||||
|
|
||||||
function SWEP:GetStat( hand, stat )
|
function SWEP:GetStat( hand, stat )
|
||||||
local thereturn = (self:BClass( hand )[stat] or fallbackstat[stat])
|
local thereturn = (self:BClass( hand ) and self:BClass( hand )[stat] or fallbackstat[stat])
|
||||||
assert( thereturn, "No stat for " .. stat )
|
assert( thereturn, "No stat for " .. stat )
|
||||||
return thereturn
|
return thereturn
|
||||||
end
|
end
|
||||||
|
|
|
@ -252,12 +252,13 @@ function SWEP:Think()
|
||||||
end
|
end
|
||||||
|
|
||||||
local ht = "normal"
|
local ht = "normal"
|
||||||
if self:GetUserAim() and self:D_GetHolstering( false ) < 0 then
|
if self:BClass( false ) and self:D_GetHolstering( false ) < 0 then
|
||||||
if self:BClass( false ) then
|
ht = "passive"
|
||||||
|
if self:GetUserAim() then
|
||||||
if self:BClass( true ) then
|
if self:BClass( true ) then
|
||||||
ht = "duel"
|
ht = "duel"
|
||||||
else
|
else
|
||||||
ht = self:BClass( false ).HoldType or "revolver"
|
ht = self:GetStat( false, "HoldType" )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -148,5 +148,15 @@ hook.Add( "Move", "Benny_Move", function( ply, mv )
|
||||||
ply:SetMoveType( (ply:GetVaultTransition() == 0) and MOVETYPE_WALK or MOVETYPE_NOCLIP )
|
ply:SetMoveType( (ply:GetVaultTransition() == 0) and MOVETYPE_WALK or MOVETYPE_NOCLIP )
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local w = ply:BennyCheck()
|
||||||
|
if w then
|
||||||
|
local targetspeed = ply:GetMaxSpeed()
|
||||||
|
|
||||||
|
targetspeed = targetspeed * w:GetStat( false, "Speed_Move" )
|
||||||
|
|
||||||
|
mv:SetMaxSpeed( targetspeed )
|
||||||
|
mv:SetMaxClientSpeed( targetspeed )
|
||||||
|
end
|
||||||
--debugoverlay.Box( Target+(TargetNor*16), ba, bb, 0, CR )
|
--debugoverlay.Box( Target+(TargetNor*16), ba, bb, 0, CR )
|
||||||
end)
|
end)
|
|
@ -11,8 +11,8 @@ function GM:PlayerSpawn( ply )
|
||||||
ply:SetDuckSpeed( 0.1 )
|
ply:SetDuckSpeed( 0.1 )
|
||||||
ply:SetUnDuckSpeed( 0.1 )
|
ply:SetUnDuckSpeed( 0.1 )
|
||||||
ply:SetSlowWalkSpeed( 100 )
|
ply:SetSlowWalkSpeed( 100 )
|
||||||
ply:SetWalkSpeed( 160 )
|
ply:SetWalkSpeed( 200 )
|
||||||
ply:SetRunSpeed( 220 )
|
ply:SetRunSpeed( 200 )
|
||||||
ply:SetStepSize( 16 )
|
ply:SetStepSize( 16 )
|
||||||
ply:SetCanZoom( false )
|
ply:SetCanZoom( false )
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue