diff --git a/lua/effects/glide_tire_roll.lua b/lua/effects/glide_tire_roll.lua index ba8c63eb..7cfc48d5 100644 --- a/lua/effects/glide_tire_roll.lua +++ b/lua/effects/glide_tire_roll.lua @@ -7,14 +7,16 @@ function EFFECT:Init( data ) local velocity = data:GetStart() local matId = data:GetSurfaceProp() local scale = Clamp( data:GetScale(), 0.1, 10 ) + local vehicle = data:GetEntity() local emitter = ParticleEmitter( origin, false ) if not IsValid( emitter ) then return end if surfaceFX[matId] then - self:DoSurface( emitter, origin, velocity, scale, surfaceFX[matId] ) + local up = vehicle:GetUp() + self:DoSurface( emitter, origin, velocity, scale, up, surfaceFX[matId] ) else - self:DoSmoke( emitter, origin, velocity, scale, data:GetEntity() ) + self:DoSmoke( emitter, origin, velocity, scale, vehicle ) end emitter:Finish() @@ -34,9 +36,12 @@ local Config = Glide.Config local debrisGravity = Vector( 0, 0, 0 ) local debrisVelocity = Vector( 0, 0, 0 ) -function EFFECT:DoSurface( emitter, origin, velocity, scale, fx ) +function EFFECT:DoSurface( emitter, origin, velocity, scale, up, fx ) local p local lifetime = fx.lifetime * ( Config.reduceTireParticles and 0.4 or 1 ) + local col = render.GetSurfaceColor( origin + up, origin - up ) + if col.x >= 255 then return end + col = col * 255 for _ = 1, 5 do p = emitter:Add( fx.mat, origin ) @@ -59,7 +64,8 @@ function EFFECT:DoSurface( emitter, origin, velocity, scale, fx ) p:SetAirResistance( fx.resistance or 50 ) p:SetGravity( debrisGravity ) p:SetVelocity( debrisVelocity ) - p:SetLighting( true ) + p:SetColor( col.x, col.y, col.z ) + p:SetLighting( false ) p:SetCollide( true ) end end diff --git a/lua/effects/glide_tire_slip_forward.lua b/lua/effects/glide_tire_slip_forward.lua index a3906278..94a6db68 100644 --- a/lua/effects/glide_tire_slip_forward.lua +++ b/lua/effects/glide_tire_slip_forward.lua @@ -7,14 +7,16 @@ function EFFECT:Init( data ) local matId = data:GetSurfaceProp() local scale = Clamp( data:GetScale(), 0.1, 15 ) local normal = data:GetNormal() + local vehicle = data:GetEntity() local emitter = ParticleEmitter( origin, false ) if not IsValid( emitter ) then return end if surfaceFX[matId] then - self:DoSurface( emitter, origin, scale, normal, surfaceFX[matId] ) + local up = vehicle:GetUp() + self:DoSurface( emitter, origin, scale, normal, up, surfaceFX[matId] ) else - self:DoSmoke( emitter, origin, scale, normal, data:GetEntity() ) + self:DoSmoke( emitter, origin, scale, normal, vehicle ) end emitter:Finish() @@ -34,9 +36,12 @@ local Config = Glide.Config local debrisGravity = Vector( 0, 0, 0 ) local debrisVelocity = Vector( 0, 0, 0 ) -function EFFECT:DoSurface( emitter, origin, scale, normal, fx ) +function EFFECT:DoSurface( emitter, origin, scale, normal, up, fx ) local p local lifetime = fx.lifetime * ( Config.reduceTireParticles and 0.4 or 1 ) + local col = render.GetSurfaceColor( origin + up, origin - up ) + if col.x >= 255 then return end + col = col * 255 for _ = 1, 5 do p = emitter:Add( fx.mat, origin ) @@ -59,7 +64,8 @@ function EFFECT:DoSurface( emitter, origin, scale, normal, fx ) p:SetAirResistance( 50 ) p:SetGravity( debrisGravity ) p:SetVelocity( debrisVelocity * scale * RandomFloat( 0.3, 1.0 ) ) - p:SetLighting( true ) + p:SetColor( col.x, col.y, col.z ) + p:SetLighting( false ) p:SetCollide( true ) end end diff --git a/lua/glide/client/ranged_feature.lua b/lua/glide/client/ranged_feature.lua index 9a09799d..cc01150a 100644 --- a/lua/glide/client/ranged_feature.lua +++ b/lua/glide/client/ranged_feature.lua @@ -69,7 +69,7 @@ function RangedFeature:Think() self.lastDistance = dist if self.isActive then - if dist > self.deactivateDist or isDormant then + if ( dist > self.deactivateDist and not ent.isLocalPlayerInVehicle ) or isDormant then self:Deactivate() end diff --git a/lua/glide/client/skid_marks.lua b/lua/glide/client/skid_marks.lua index ba79211d..6ee6cffd 100644 --- a/lua/glide/client/skid_marks.lua +++ b/lua/glide/client/skid_marks.lua @@ -49,16 +49,27 @@ function SkidHandler:AddPiece( lastQuadId, pos, forward, normal, width, strength local right = normal:Cross( forward ) local lastQuad = quads[lastQuadId] + local color = render.GetSurfaceColor( pos, ray.HitPos - normal ):ToColor() quads[i] = { pos + right * width, -- [1] 1st vertex pos - right * width, -- [2] 2nd vertex lastQuad and lastQuad[2] or pos, -- [3] 3rd vertex lastQuad and lastQuad[1] or pos, -- [4] 4th vertex - 55 + 200 * strength, -- [5] Alpha + ColorAlpha( color, 55 + 200 * strength ), -- [5] Color + Alpha RealTime() + Config.skidmarkTimeLimit -- [6] Lifetime } + if #quads <= 1 then return i end + + if lastQuad then + lastQuad[5]:Lerp( color, 0.5 ) + end + + local ind = (i) % #quads + local alpha = quads[ind+1][5] + alpha.a = alpha.a * 0.9 + return i end @@ -66,8 +77,6 @@ local Min = math.min local SetMaterial = render.SetMaterial local DrawQuad = render.DrawQuad -local color = Color( 255, 255, 255 ) - function SkidHandler:Draw( t ) SetMaterial( self.material ) @@ -79,8 +88,8 @@ function SkidHandler:Draw( t ) timeLeft = q[6] - t if timeLeft > 0 then - color.a = q[5] * Min( timeLeft * 0.5, 1 ) - DrawQuad( q[1], q[2], q[3], q[4], color ) + q[5].a = q[5].a * Min( timeLeft * 0.5, 1 ) + DrawQuad( q[1], q[2], q[3], q[4], q[5] ) end end end diff --git a/lua/glide/server/events.lua b/lua/glide/server/events.lua index bdbc6a37..02948d96 100644 --- a/lua/glide/server/events.lua +++ b/lua/glide/server/events.lua @@ -51,7 +51,6 @@ hook.Add( "PlayerEnteredVehicle", "Glide.OnEnterSeat", function( ply, seat ) ply.IsUsingGlideVehicle = true ply:SetNWEntity( "GlideVehicle", parent ) ply:SetNWInt( "GlideSeatIndex", seatIndex ) - ply:DrawShadow( false ) -- Make sure the player knows about their current vehicle/seat Glide.StartCommand( Glide.CMD_SET_CURRENT_VEHICLE, false ) @@ -80,7 +79,6 @@ hook.Add( "PlayerLeaveVehicle", "Glide.OnExitSeat", function( ply ) ply.IsUsingGlideVehicle = false ply:SetNWEntity( "GlideVehicle", NULL ) ply:SetNWInt( "GlideSeatIndex", 0 ) - ply:DrawShadow( true ) -- Make sure the player knows that they aren't on a vehicle anymore Glide.StartCommand( Glide.CMD_SET_CURRENT_VEHICLE, false ) diff --git a/materials/glide/effects/tire_particles/dirt.vmt b/materials/glide/effects/tire_particles/dirt.vmt index 56d474f0..8c0a8dce 100644 --- a/materials/glide/effects/tire_particles/dirt.vmt +++ b/materials/glide/effects/tire_particles/dirt.vmt @@ -4,5 +4,5 @@ "$vertexcolor" "1" "$vertexalpha" "1" "$translucent" "1" - "$color" "[ 0.5 0.4 0.2 ]" + "$color" "[ 1.0 1.0 1.0 ]" } \ No newline at end of file diff --git a/materials/glide/effects/tire_particles/grass_debris.vmt b/materials/glide/effects/tire_particles/grass_debris.vmt index 75b0922a..ecefa50f 100644 --- a/materials/glide/effects/tire_particles/grass_debris.vmt +++ b/materials/glide/effects/tire_particles/grass_debris.vmt @@ -4,5 +4,5 @@ "$vertexcolor" "1" "$vertexalpha" "1" "$translucent" "1" - "$color" "[ 2.0 3.0 1.0 ]" + "$color" "[ 1.0 1.0 1.0 ]" } \ No newline at end of file diff --git a/materials/glide/effects/tire_particles/sand.vmt b/materials/glide/effects/tire_particles/sand.vmt index 4cd00700..8c0a8dce 100644 --- a/materials/glide/effects/tire_particles/sand.vmt +++ b/materials/glide/effects/tire_particles/sand.vmt @@ -4,5 +4,5 @@ "$vertexcolor" "1" "$vertexalpha" "1" "$translucent" "1" - "$color" "[ 2.3 1.8 1.4 ]" + "$color" "[ 1.0 1.0 1.0 ]" } \ No newline at end of file diff --git a/materials/glide/effects/tire_particles/snow.vmt b/materials/glide/effects/tire_particles/snow.vmt index 543ce272..5fff9238 100644 --- a/materials/glide/effects/tire_particles/snow.vmt +++ b/materials/glide/effects/tire_particles/snow.vmt @@ -3,5 +3,5 @@ "$basetexture" "particle/particle_composite" "$vertexcolor" "1" "$vertexalpha" "1" - "$color" "[ 15.0 15.0 15.0 ]" + "$color" "[ 1.0 1.0 1.0 ]" } \ No newline at end of file diff --git a/materials/glide/skidmarks/roll_dirt.vtf b/materials/glide/skidmarks/roll_dirt.vtf deleted file mode 100644 index c4bb34ee..00000000 Binary files a/materials/glide/skidmarks/roll_dirt.vtf and /dev/null differ diff --git a/materials/glide/skidmarks/roll_dirt2.vtf b/materials/glide/skidmarks/roll_dirt2.vtf new file mode 100644 index 00000000..9b06c1a1 Binary files /dev/null and b/materials/glide/skidmarks/roll_dirt2.vtf differ