Updated stations HUD UI

master
E. Almqvist 5 years ago
parent e9bbc4e442
commit d4454e9bc7
  1. 52
      entities/entities/q_crafting_station/cl_init.lua
  2. 3
      gamemode/settings/sv_crafting_stations_locations.lua

@ -20,41 +20,47 @@ local barW, barH
local scale = Quantum.Client.ResolutionScale local scale = Quantum.Client.ResolutionScale
local padding = 10 * scale local padding = 10 * scale
local txtAlpha = 0
local plDist
function ENT:Draw() function ENT:Draw()
stationTbl = Quantum.Station.Get( self:GetNWInt( "q_station_id" ) ) stationTbl = Quantum.Station.Get( self:GetNWInt( "q_station_id" ) )
stationName = stationTbl.name
self:DrawModel() if( stationTbl ) then
stationName = stationTbl.name
if( stationTbl.showname == true ) then self:DrawModel()
pos, ang = self:GetPos(), self:GetAngles()
p, q = self:GetRenderBounds() if( stationTbl.showname == true ) then
mdlHeight = q.z - p.z pos, ang = self:GetPos(), self:GetAngles()
pos = pos + ang:Up() * (mdlHeight + 20) p, q = self:GetRenderBounds()
mdlHeight = q.z - p.z
-- rotate around axis pos = pos + ang:Up() * (mdlHeight + 20)
ang:RotateAroundAxis( ang:Forward(), 90 )
ang:RotateAroundAxis( ang:Right(), 90 )
ang.y = LocalPlayer():EyeAngles().y - 90 -- rotate around axis
ang:RotateAroundAxis( ang:Forward(), 90 )
ang:RotateAroundAxis( ang:Right(), 90 )
cam.Start3D2D( pos, ang, 0.15 ) ang.y = LocalPlayer():EyeAngles().y - 90
surface.SetTextColor( Color( 255, 255, 255 ) )
surface.SetFont( "q_title" )
txtW, txtH = surface.GetTextSize( stationName )
barW, barH = txtW + padding, txtH + padding -- distance calc
plDist = LocalPlayer():GetPos():Distance( self:GetPos() )
txtAlpha = Lerp( plDist/400, 255, 0 )
surface.SetDrawColor( 0, 0, 0, 150 ) if( txtAlpha > 0 ) then
surface.DrawRect( -barW/2, -padding/2, barW, barH ) cam.Start3D2D( pos, ang, 0.15 )
surface.SetTextColor( Color( 255, 255, 255, txtAlpha ) )
surface.SetFont( "q_title" )
txtW, txtH = surface.GetTextSize( stationName )
surface.SetDrawColor( 255, 255, 255, 255 ) barW, barH = txtW + padding, txtH + padding
surface.DrawOutlinedRect( -barW/2, -padding/2, barW, barH )
surface.SetTextPos( -txtW/2, 0 ) surface.SetTextPos( -txtW/2, 0 )
surface.DrawText( stationName ) surface.DrawText( stationName )
cam.End3D2D() cam.End3D2D()
end
end
end end
end end

@ -5,5 +5,4 @@
-- \ \ / ____ \| | | | | | | | __/ (__| | | | / / -- \ \ / ____ \| | | | | | | | __/ (__| | | | / /
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/ -- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
Quantum.Server.Station.Register( "barrel", Vector( 747.13494873047, 10483.685546875, 7168.0317382813 ), Angle( 0, -118.23150634766, 0 ) ) Quantum.Server.Station.Register( "barrel", Vector( 3815.68359375, -1565.5415039063, -129.41325378418 ), Angle( 0, 173.51203918457, 0 ) )
Quantum.Server.Station.Register( "barrel2", Vector( 885.861328125, 10542.946289063, 7168.03125 ), Angle( 0, -118.23150634766, 0 ) )
Loading…
Cancel
Save