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
|
||||||
-- if IsValid(p) then
|
else
|
||||||
-- -- Specify a good position
|
if IsValid(wm) then wm:Remove() end
|
||||||
-- local offsetVec = Vector(12.8, -1.4, 2.6)
|
end
|
||||||
-- local offsetAng = Angle(180 - 10, 180, 0)
|
end
|
||||||
--
|
do
|
||||||
-- local boneid = p:LookupBone("ValveBiped.Bip01_R_Hand") -- Right Hand
|
local wm = self.CWM_Left
|
||||||
-- if !boneid then return end
|
local class = self:BClass( true )
|
||||||
|
if class then
|
||||||
-- local matrix = p:GetBoneMatrix(boneid)
|
if !IsValid(wm) then
|
||||||
-- if !matrix then return end
|
wm = ClientsideModel( class.WModel )
|
||||||
|
self.CWM_Left = wm
|
||||||
-- local newPos, newAng = LocalToWorld(offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles())
|
end
|
||||||
|
wm:SetModel( class.WModel )
|
||||||
-- wm:SetPos(newPos)
|
wm:SetNoDraw( true )
|
||||||
-- wm:SetAngles(newAng)
|
|
||||||
|
if IsValid(p) then
|
||||||
-- wm:SetupBones()
|
-- Specify a good position
|
||||||
-- else
|
wm:SetPos( vector_origin )
|
||||||
-- wm:SetPos(self:GetPos())
|
wm:SetAngles( angle_zero )
|
||||||
-- wm:SetAngles(self:GetAngles())
|
wm:SetupBones()
|
||||||
-- wm:SetupBones()
|
|
||||||
-- end
|
local pv = wm:GetBoneMatrix( wm:LookupBone( "ValveBiped.Bip01_R_Hand" ) ):GetTranslation()
|
||||||
|
local pa = wm:GetBoneMatrix( wm:LookupBone( "ValveBiped.Bip01_R_Hand" ) ):GetAngles()
|
||||||
if self:GetUserAim() then wm:DrawModel() end
|
pv.x = -pv.x
|
||||||
|
pv.y = pv.y
|
||||||
|
pv.z = -pv.z
|
||||||
|
pa.p = -pa.p
|
||||||
|
pa.r = pa.r + 180
|
||||||
|
|
||||||
|
local boneid = p:LookupBone("ValveBiped.Bip01_L_Hand") -- Right Hand
|
||||||
|
if !boneid then return end
|
||||||
|
|
||||||
|
local matrix = p:GetBoneMatrix(boneid)
|
||||||
|
if !matrix then return end
|
||||||
|
|
||||||
|
local newPos, newAng = LocalToWorld(pv, pa, matrix:GetTranslation(), matrix:GetAngles())
|
||||||
|
|
||||||
|
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 )
|
||||||
} )
|
|
||||||
|
|
||||||
-- self:FireCL( tr )
|
|
||||||
-- self:FireSV( tr )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function SWEP:BulletCallback()
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function SWEP:FireCL( tr )
|
|
||||||
if CLIENT and IsFirstTimePredicted() then
|
if CLIENT and IsFirstTimePredicted() then
|
||||||
do
|
self:FireCL( hand, tr )
|
||||||
local vStart = self.CWM:GetAttachment( 1 ).Pos
|
end
|
||||||
|
return bc
|
||||||
|
end,
|
||||||
|
} )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function SWEP:FireCL( hand, tr )
|
||||||
|
-- PROTO: This is shit! Replace it with a function that gets the right model.
|
||||||
|
local vStart = (hand and self.CWM_Left or 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 )
|
||||||
|
@ -133,28 +125,3 @@ function SWEP:FireCL( tr )
|
||||||
effectdata:SetFlags( 1 )
|
effectdata:SetFlags( 1 )
|
||||||
util.Effect( "Tracer", effectdata )
|
util.Effect( "Tracer", effectdata )
|
||||||
end
|
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
|
|
|
@ -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