Permalink
Browse files

Vehicle spawn improvements

Added Offset member to Vehicles list. ( For PHX seats )
Added Vehicle.SetVehicleClass & Vehicle.GetVehicleClass ( For PHX seat
animation fix )
Added PHX Seat with airboat animations
Remvoed addons/addons.txt & gamemodes/gamemodes.txt (These were useless)
  • Loading branch information...
1 parent 78560d8 commit c357619f5c57163bcd6fbd8c463eda25da158f36 @robotboy655 robotboy655 committed Jan 20, 2015
No changes.
@@ -129,8 +129,18 @@ function GM:HandlePlayerDriving( ply )
if ply:InVehicle() then
local pVehicle = ply:GetVehicle()
+
+ if ( !pVehicle.HandleAnimation ) then
+ local c = pVehicle:GetVehicleClass()
+ local t = list.Get( "Vehicles" )[ c ]
+ if ( t && t.Members && t.Members.HandleAnimation ) then
+ pVehicle.HandleAnimation = t.Members.HandleAnimation
+ else
+ pVehicle.HandleAnimation = true // Prevent this if block from trying to assign HandleAnimation again.
+ end
+ end
- if ( pVehicle.HandleAnimation != nil ) then
+ if ( isfunction( pVehicle.HandleAnimation ) ) then
local seq = pVehicle:HandleAnimation( ply )
if ( seq != nil ) then
@@ -213,6 +223,7 @@ function GM:UpdateAnimation( ply, velocity, maxseqgroundspeed )
-- Pass the vehicles steer param down to the player
local steer = Vehicle:GetPoseParameter( "vehicle_steer" )
steer = steer * 2 - 1 -- convert from 0..1 to -1..1
+ if ( Vehicle:GetClass() == "prop_vehicle_prisoner_pod" ) then steer = 0 end
ply:SetPoseParameter( "vehicle_steer", steer )
end
No changes.
@@ -770,6 +770,7 @@ local function MakeVehicle( Player, Pos, Ang, Model, Class, VName, VTable, data
Ent:Spawn()
Ent:Activate()
+ Ent:SetVehicleClass( VName )
Ent.VehicleName = VName
Ent.VehicleTable = VTable
@@ -812,8 +813,13 @@ function Spawn_Vehicle( Player, vname, tr )
Angles.pitch = 0
Angles.roll = 0
Angles.yaw = Angles.yaw + 180
+
+ local pos = tr.HitPos
+ if ( vehicle.Offset ) then
+ pos = pos + tr.HitNormal * vehicle.Offset
+ end
- local Ent = MakeVehicle( Player, tr.HitPos, Angles, vehicle.Model, vehicle.Class, vname, vehicle )
+ local Ent = MakeVehicle( Player, pos, Angles, vehicle.Model, vehicle.Class, vname, vehicle )
if ( !IsValid( Ent ) ) then return end
if ( vehicle.Members ) then
Oops, something went wrong.

0 comments on commit c357619

Please sign in to comment.