Skip to content

Commit

Permalink
Vehicle spawn improvements
Browse files Browse the repository at this point in the history
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
robotboy655 committed Jan 20, 2015
1 parent 78560d8 commit c357619
Show file tree
Hide file tree
Showing 6 changed files with 197 additions and 164 deletions.
Empty file removed garrysmod/addons/addons.txt
Empty file.
13 changes: 12 additions & 1 deletion garrysmod/gamemodes/base/gamemode/animations.lua
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Empty file removed garrysmod/gamemodes/gamemodes.txt
Empty file.
8 changes: 7 additions & 1 deletion garrysmod/gamemodes/sandbox/gamemode/commands.lua
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c357619

Please sign in to comment.