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.el = data:GetEntity()
|
||||
self.en = data:GetEntity()
|
||||
if IsValid(self.en.CWM) then self.en = self.en.CWM end
|
||||
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.CreationTime = UnPredictedCurTime()
|
||||
|
|
|
@ -1,40 +1,68 @@
|
|||
function SWEP:DrawWorldModel()
|
||||
local p = self:GetOwner()
|
||||
local wm = self.CWM
|
||||
local class = self:BClass( false )
|
||||
if class then
|
||||
if !IsValid(wm) then
|
||||
wm = ClientsideModel( class.WModel )
|
||||
self.CWM = wm
|
||||
do
|
||||
local wm = self.CWM
|
||||
local class = self:BClass( false )
|
||||
if class then
|
||||
if !IsValid(wm) then
|
||||
wm = ClientsideModel( class.WModel )
|
||||
self.CWM = wm
|
||||
end
|
||||
wm:SetModel( class.WModel )
|
||||
wm:SetNoDraw( true )
|
||||
wm:AddEffects( EF_BONEMERGE )
|
||||
wm:SetParent( p )
|
||||
if true or self:GetUserAim() then wm:DrawModel() end
|
||||
else
|
||||
if IsValid(wm) then wm:Remove() end
|
||||
end
|
||||
wm:SetModel( class.WModel )
|
||||
wm:SetNoDraw( true )
|
||||
wm:AddEffects( EF_BONEMERGE )
|
||||
wm:SetParent( p )
|
||||
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
|
||||
-- Specify a good position
|
||||
wm:SetPos( vector_origin )
|
||||
wm:SetAngles( angle_zero )
|
||||
wm:SetupBones()
|
||||
|
||||
-- if IsValid(p) then
|
||||
-- -- Specify a good position
|
||||
-- local offsetVec = Vector(12.8, -1.4, 2.6)
|
||||
-- local offsetAng = Angle(180 - 10, 180, 0)
|
||||
--
|
||||
-- local boneid = p:LookupBone("ValveBiped.Bip01_R_Hand") -- Right Hand
|
||||
-- if !boneid then return end
|
||||
local pv = wm:GetBoneMatrix( wm:LookupBone( "ValveBiped.Bip01_R_Hand" ) ):GetTranslation()
|
||||
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 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 matrix = p:GetBoneMatrix(boneid)
|
||||
if !matrix then return end
|
||||
|
||||
-- local newPos, newAng = LocalToWorld(offsetVec, offsetAng, matrix:GetTranslation(), matrix:GetAngles())
|
||||
local newPos, newAng = LocalToWorld(pv, pa, matrix:GetTranslation(), matrix:GetAngles())
|
||||
|
||||
-- wm:SetPos(newPos)
|
||||
-- wm:SetAngles(newAng)
|
||||
wm:SetPos(newPos)
|
||||
wm:SetAngles(newAng)
|
||||
|
||||
-- wm:SetupBones()
|
||||
-- else
|
||||
-- wm:SetPos(self:GetPos())
|
||||
-- wm:SetAngles(self:GetAngles())
|
||||
-- wm:SetupBones()
|
||||
-- end
|
||||
wm:SetupBones()
|
||||
else
|
||||
wm:SetPos(self:GetPos())
|
||||
wm:SetAngles(self:GetAngles())
|
||||
wm:SetupBones()
|
||||
end
|
||||
|
||||
if self:GetUserAim() then wm:DrawModel() end
|
||||
if true or self:GetUserAim() then wm:DrawModel() end
|
||||
else
|
||||
if IsValid(wm) then wm:Remove() end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -62,24 +62,20 @@ function SWEP:BFire( hand )
|
|||
|
||||
|
||||
if CLIENT and IsFirstTimePredicted() then
|
||||
if IsValid(self.CWM) and self.CWM:GetAttachment( 1 ) then
|
||||
local vStart = self.CWM:GetAttachment( 1 ).Pos
|
||||
--local vPoint = p:GetEyeTrace().HitPos
|
||||
--local effectdata = EffectData()
|
||||
--effectdata:SetStart( vStart )
|
||||
--effectdata:SetOrigin( vPoint )
|
||||
--util.Effect( "ToolTracer", effectdata )
|
||||
-- PROTO: This is shit! Replace it with a function that gets the right model.
|
||||
if IsValid(hand and self.CWM_Left or self.CWM) and (hand and self.CWM_Left or self.CWM):GetAttachment( 1 ) then
|
||||
local vStart = (hand and self.CWM_Left or self.CWM):GetAttachment( 1 ).Pos
|
||||
local ed = EffectData()
|
||||
ed:SetOrigin( vStart )
|
||||
--ed:SetAngles( Angle() )
|
||||
ed:SetEntity( self )
|
||||
ed:SetAttachment( 1 )
|
||||
ed:SetAttachment( (hand and 16 or 0) + 1 )
|
||||
util.Effect( "benny_muzzleflash", ed )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local bc = { effects = false, damage = true }
|
||||
function SWEP:CallFire( hand )
|
||||
local p = self:GetOwner()
|
||||
local class = self:BClass( hand )
|
||||
|
@ -105,56 +101,27 @@ function SWEP:CallFire( hand )
|
|||
Force = class.Damage/10,
|
||||
Src = p:EyePos(),
|
||||
Dir = dir:Forward(),
|
||||
Tracer = 0,
|
||||
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
|
||||
|
||||
function SWEP:BulletCallback()
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
|
||||
function SWEP:FireCL( tr )
|
||||
if CLIENT and IsFirstTimePredicted() then
|
||||
do
|
||||
local vStart = self.CWM:GetAttachment( 1 ).Pos
|
||||
local vPoint = tr.HitPos
|
||||
local effectdata = EffectData()
|
||||
effectdata:SetStart( vStart )
|
||||
effectdata:SetOrigin( vPoint )
|
||||
effectdata:SetEntity( self )
|
||||
effectdata:SetScale( 1025*12 )
|
||||
effectdata:SetFlags( 1 )
|
||||
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
|
||||
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 effectdata = EffectData()
|
||||
effectdata:SetStart( vStart )
|
||||
effectdata:SetOrigin( vPoint )
|
||||
effectdata:SetEntity( self )
|
||||
effectdata:SetScale( 1025*12 )
|
||||
effectdata:SetFlags( 1 )
|
||||
util.Effect( "Tracer", effectdata )
|
||||
end
|
|
@ -150,7 +150,7 @@ local fallbackstat = {
|
|||
}
|
||||
|
||||
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 )
|
||||
return thereturn
|
||||
end
|
||||
|
|
|
@ -252,12 +252,13 @@ function SWEP:Think()
|
|||
end
|
||||
|
||||
local ht = "normal"
|
||||
if self:GetUserAim() and self:D_GetHolstering( false ) < 0 then
|
||||
if self:BClass( false ) then
|
||||
if self:BClass( false ) and self:D_GetHolstering( false ) < 0 then
|
||||
ht = "passive"
|
||||
if self:GetUserAim() then
|
||||
if self:BClass( true ) then
|
||||
ht = "duel"
|
||||
else
|
||||
ht = self:BClass( false ).HoldType or "revolver"
|
||||
ht = self:GetStat( false, "HoldType" )
|
||||
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 )
|
||||
return true
|
||||
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 )
|
||||
end)
|
|
@ -11,8 +11,8 @@ function GM:PlayerSpawn( ply )
|
|||
ply:SetDuckSpeed( 0.1 )
|
||||
ply:SetUnDuckSpeed( 0.1 )
|
||||
ply:SetSlowWalkSpeed( 100 )
|
||||
ply:SetWalkSpeed( 160 )
|
||||
ply:SetRunSpeed( 220 )
|
||||
ply:SetWalkSpeed( 200 )
|
||||
ply:SetRunSpeed( 200 )
|
||||
ply:SetStepSize( 16 )
|
||||
ply:SetCanZoom( false )
|
||||
|
||||
|
|
Loading…
Reference in New Issue