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,40 +1,68 @@
|
||||||
function SWEP:DrawWorldModel()
|
function SWEP:DrawWorldModel()
|
||||||
local p = self:GetOwner()
|
local p = self:GetOwner()
|
||||||
local wm = self.CWM
|
do
|
||||||
local class = self:BClass( false )
|
local wm = self.CWM
|
||||||
if class then
|
local class = self:BClass( false )
|
||||||
if !IsValid(wm) then
|
if class then
|
||||||
wm = ClientsideModel( class.WModel )
|
if !IsValid(wm) then
|
||||||
self.CWM = wm
|
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
|
end
|
||||||
wm:SetModel( class.WModel )
|
end
|
||||||
wm:SetNoDraw( true )
|
do
|
||||||
wm:AddEffects( EF_BONEMERGE )
|
local wm = self.CWM_Left
|
||||||
wm:SetParent( p )
|
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
|
local pv = wm:GetBoneMatrix( wm:LookupBone( "ValveBiped.Bip01_R_Hand" ) ):GetTranslation()
|
||||||
-- -- Specify a good position
|
local pa = wm:GetBoneMatrix( wm:LookupBone( "ValveBiped.Bip01_R_Hand" ) ):GetAngles()
|
||||||
-- local offsetVec = Vector(12.8, -1.4, 2.6)
|
pv.x = -pv.x
|
||||||
-- local offsetAng = Angle(180 - 10, 180, 0)
|
pv.y = pv.y
|
||||||
--
|
pv.z = -pv.z
|
||||||
-- local boneid = p:LookupBone("ValveBiped.Bip01_R_Hand") -- Right Hand
|
pa.p = -pa.p
|
||||||
-- if !boneid then return end
|
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)
|
local matrix = p:GetBoneMatrix(boneid)
|
||||||
-- if !matrix then return end
|
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:SetPos(newPos)
|
||||||
-- wm:SetAngles(newAng)
|
wm:SetAngles(newAng)
|
||||||
|
|
||||||
-- wm:SetupBones()
|
wm:SetupBones()
|
||||||
-- else
|
else
|
||||||
-- wm:SetPos(self:GetPos())
|
wm:SetPos(self:GetPos())
|
||||||
-- wm:SetAngles(self:GetAngles())
|
wm:SetAngles(self:GetAngles())
|
||||||
-- wm:SetupBones()
|
wm:SetupBones()
|
||||||
-- end
|
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
|
||||||
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,56 +101,27 @@ 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
|
||||||
|
local vPoint = tr.HitPos
|
||||||
|
local effectdata = EffectData()
|
||||||
|
effectdata:SetStart( vStart )
|
||||||
function SWEP:FireCL( tr )
|
effectdata:SetOrigin( vPoint )
|
||||||
if CLIENT and IsFirstTimePredicted() then
|
effectdata:SetEntity( self )
|
||||||
do
|
effectdata:SetScale( 1025*12 )
|
||||||
local vStart = self.CWM:GetAttachment( 1 ).Pos
|
effectdata:SetFlags( 1 )
|
||||||
local vPoint = tr.HitPos
|
util.Effect( "Tracer", effectdata )
|
||||||
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
|
|
||||||
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