Garry's Mod

Garry's Mod

Not enough ratings
Glide // Blackterio's Glide Extra Functions
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Vehicle
Addon Tags: Roleplay, Scenic, Realism
File Size
Posted
11.483 KB
19 Jul @ 9:30pm
1 Change Note ( view )

Subscribe to download
Glide // Blackterio's Glide Extra Functions

In 4 collections by Blackterio
Blackterio's Vehicles
86 items
Vehiculos Argentinos
48 items
Vehiculos Argentinos (GLIDE)
15 items
Blackterio's Glide Vehicles
22 items
Description
This adds extra functions for developers to use in Glide vehicles:

- Pedals (throttle, brake and a simulated clutch)
- Speedometer
- Tachometer
- Fuel gauge (only visual for now)
- Temp gauge (only visual for now)
- Oil pressure gauge (works with the engine's RPM)
- Wipers ( Stormfox , Stormfox 2 or GWeather is needed )



Users need to subscribe to this addon if they want to see these extra functions, in case they don't choose to do it, they simply won't see anything of these animations.




This next code needs to be written at the start of your LUA file:

AddCSLuaFile() AddCSLuaFile() -- Load Blackterio's Glide Extra Functions LUA file local function LoadExtraFunctions() local paths = { "autorun/shared/blackterio_extra_functions.lua", "lua/autorun/shared/blackterio_extra_functions.lua", "blackterio_extra_functions.lua" } for _, path in ipairs(paths) do if file.Exists(path, "LUA") then if SERVER then AddCSLuaFile(path) end include(path) return true end end return false end local extraFunctionsLoaded = LoadExtraFunctions() local ItHasExtraFunctions = true -- with this you can activate the custom extra functions on this vehicle (pedals, gauges, etc)

After this, you need to define the base class of your vehicle. This is an example with a vehicle of the type "car":

DEFINE_BASECLASS( "base_glide_car" ) -- strictly necessary if you wanna make support for custom anims (for example speedometers or tachometers) Check Glide's Github [github.com] to check all the base types

These next codes need to be written in the CLIENT section of your LUA file:

function ENT:Initialize() BaseClass.Initialize(self) -- Extra functions activator self.HasExtraFunctions = ItHasExtraFunctions end

-- Extra functions (animations) function ENT:OnUpdateAnimations() if BlackterioExtraFunctions and extraFunctionsLoaded then if self.HasExtraFunctions then -- Use a custom configuration for this vehicle in particular, or use the default configuration -- I highly recommend using a custom one BlackterioExtraFunctions:UpdateAnimations(self, self.AnimationConfig) -- Optional: Configure special parameters for this vehicle self.AnimationConfig = BlackterioExtraFunctions:CreateConfig({ -- Activate/deactivate functions pedals = true, clutch = true, speedo = true, fuel = true, tacho = true, oil = true, temp = true, battery = true, wipers = true, -- Pedals lerp pedalLerpRate = 0.2, -- Clutch duration (lerp) clutchDuration = 0.4, -- RPM calibration rpmCalibration = -0.04, -- Speedometer calibration and multiplier speedCalibration = 50, speedMultiplier = 0.4, -- Fuel lerp fuelLerpRate = 0.09, -- Oil lerp and max value oilLerpRate = 0.5, oilMaxValue = 0.9, oilMinValue = 0.5, -- Temperature lerp and max value tempLerpRate = 0.0005, tempMaxValue = 0.7, -- Battery lerp and max value batteryLerpRate = 0.09, batteryMaxValue = 0.5, -- Wiper Speed wiperSpeed = 0.3, --[[ Pose parameters names. You can change them if they're different than these ones poseParameters = { gas = "gas", brake = "brake", clutch = "clutch", speedo = "speedo", tacho = "tacho", fuel = "fuel", oil = "oil", temp = "temp", battery = "battery", wipers1 = "wipers1", wipers2 = "wipers2", wipers3 = "wipers3", wipers4 = "wipers4" } ]] }) else BaseClass.OnUpdateAnimations(self) end else BaseClass.OnUpdateAnimations(self) end end



You can activate or deactivate functions as you wish. You can also choose to not specify any custom lerp or calibration values, but it's not really recommended.



The recommended names for the pose parameters of your animations are the ones that are specified by default, but if you want, you can assign a different name for them if that's needed.



I also recommend making animations with a maximum of 3 frames. You can make them with more, but it will need a more precise assignment of the lerp values. Except with the wipers animation, it's better if you make it with 10 frames




At the time of this addon's upload, all my vehicles will have support for this (will update them all very soon)

2 Comments
madval26 20 Jul @ 2:18am 
Wait a second, you're the person that made a Simfphys Polaris V8
Hana 19 Jul @ 11:07pm 
dale