Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.10 KB | None | 0 0
  1. local Job = {}
  2. Job.ID = 23
  3. Job.Enum = "JOB_GARBAGE"
  4. Job.TeamColor = Color( 255, 100, 160, 255 )
  5. Job.Name = "Sanitation Worker"
  6. Job.Pay = {
  7.     { PlayTime = 0, Pay = 25 },
  8.     { PlayTime = 4 *(60 *60), Pay = 35 },
  9.     { PlayTime = 12 *(60 *60), Pay = 50 },
  10.     { PlayTime = 24 *(60 *60), Pay = 120 },
  11. }
  12. Job.PayPerLoad = 75
  13. Job.PlayerCap = GM.Config.Job_GarbageWorker_PlayerCap or { Min = 2, MinStart = 8, Max = 6, MaxEnd = 60 }
  14. Job.CarID = "garbage_truck"
  15. Job.ParkingLotPos = GM.Config.GarbageWorkerParkingZone
  16. Job.CarSpawns = GM.Config.GarbageWorkerCarSpawns
  17. Job.TruckVolume = 5000 *4
  18. Job.TruckFxPos = Vector( -5.698053, -154, 80.042198 )
  19. Job.FxSounds = {
  20.     "ambient/materials/cupdrop.wav",
  21.     "ambient/materials/platedrop3.wav",
  22.     "ambient/materials/platedrop2.wav",
  23.     "ambient/materials/platedrop1.wav",
  24.     "ambient/materials/cartrap_rope3.wav",
  25.     "ambient/materials/cartrap_rope2.wav",
  26.     "ambient/materials/cartrap_rope1.wav",
  27.     "ambient/materials/rock1.wav",
  28.     "ambient/materials/rock2.wav",
  29.     "ambient/materials/rock3.wav",
  30.     "physics/glass/glass_bottle_break1.wav",
  31.     "physics/glass/glass_bottle_break2.wav",
  32.     "physics/wood/wood_box_break1.wav",
  33.     "physics/wood/wood_box_break2.wav",
  34.     "physics/plastic/plastic_barrel_break2.wav",
  35.     "physics/plastic/plastic_barrel_break1.wav",
  36.     "physics/cardboard/cardboard_box_break1.wav",
  37.     "physics/cardboard/cardboard_box_break2.wav",
  38. }
  39. function Job:OnPlayerJoinJob( pPlayer )
  40. end
  41. function Job:OnPlayerQuitJob( pPlayer )
  42. end
  43. local TEX_GRADIENT_LEFT = surface.GetTextureID( "gui/gradient" )
  44. local TEX_GRADIENT_DOWN = surface.GetTextureID( "gui/gradient_down" )
  45. local MAT_INCIN_ICON = Material( "icon16/lorry_go.png", "" )
  46. local colBg = Color( 40, 40, 40, 255 )
  47. local colBar = Color( 100, 60, 60, 255 )
  48. local hint
  49. hook.Add( "HUDPaint", "GarbageJobHUD", function()
  50.     if GAMEMODE.Jobs:GetPlayerJobID( LocalPlayer() ) ~= JOB_GARBWORKER then return end
  51.     local truck = LocalPlayer():GetVehicle()
  52.     if not IsValid( truck ) then return end
  53.     local frac = math.Clamp( truck:GetNWInt("GarbVolume", 0) /Job.TruckVolume, 0, 1 )
  54.     local wide, tall = 300, 20
  55.     local x, y = ScrW() -325, ScrH() -280
  56.     surface.SetDrawColor( colBg )
  57.     surface.DrawRect( x +1, y +1, wide -2, tall -2 )
  58.     if (wide -2) *frac > 0 then
  59.         surface.SetDrawColor( colBar )
  60.         surface.DrawRect( x +1, y +1, (wide -2) *frac, tall -2 )
  61.         surface.SetTexture( TEX_GRADIENT_DOWN )
  62.         surface.SetDrawColor(
  63.             math.max( 0, colBar.r -100 ),
  64.             math.max( 0, colBar.g -100 ),
  65.             math.max( 0, colBar.b -100 ),
  66.             255
  67.         )
  68.         local half = (tall -2) /2 -1
  69.         surface.DrawTexturedRect( x +1, y +1, (wide -2) *frac, half )
  70.         surface.DrawTexturedRectRotated( x +1 +((wide -1) *frac) /2, y +tall -(half /2), (wide -2) *frac, half, 180 )
  71.     end
  72.     surface.SetDrawColor( 0, 0, 0, 255 )
  73.     surface.DrawRect( x, y, wide, 1 ) --top
  74.     surface.DrawRect( x, y, 1, tall ) --left side
  75.     surface.DrawRect( x +wide -1, y, 1, tall ) --right side
  76.     surface.DrawRect( x, y +tall -1, wide, 1 ) --bottom
  77.     draw.SimpleText(
  78.         "Garbage Volume: ".. truck:GetNWInt("GarbVolume", 0).. "/".. Job.TruckVolume,
  79.         "Trebuchet18",
  80.         x +5,
  81.         y +1,
  82.         color_white,
  83.         TEXT_ALIGN_LEFT,
  84.         TEXT_ALIGN_TOP
  85.     )
  86.     if frac >= 1 then
  87.         if not hint and GAMEMODE.Config.GarbageWorkerDumpPos:Distance( LocalPlayer():GetPos() ) <= 400 then
  88.             hint = true
  89.             GAMEMODE.HUD:AddNote( "Back up to the incinerator and hold right click to empty your tuck.", NOTIFY_HINT, 10 )
  90.         end
  91.         local pos = GAMEMODE.Config.GarbageWorkerDumpPos:ToScreen()
  92.         local iconSize = 16
  93.         surface.SetMaterial( MAT_INCIN_ICON )
  94.         surface.SetDrawColor( 255, 255, 255, 255 )
  95.         surface.DrawTexturedRect( pos.x -(iconSize /2), pos.y -iconSize, iconSize, iconSize )
  96.         draw.SimpleText(
  97.             "Return to the incinerator!",
  98.             "Trebuchet24",
  99.             pos.x,
  100.             pos.y,
  101.             color_white,
  102.             TEXT_ALIGN_CENTER,
  103.             TEXT_ALIGN_TOP
  104.         )
  105.         local num, unit = GAMEMODE.Util:ConvertUnitsToM( GAMEMODE.Config.GarbageWorkerDumpPos:Distance(LocalPlayer():GetPos()) )
  106.         draw.SimpleText(
  107.             num.. unit,
  108.             "Trebuchet24",
  109.             pos.x,
  110.             pos.y +18,
  111.             color_white,
  112.             TEXT_ALIGN_CENTER,
  113.             TEXT_ALIGN_TOP
  114.         )
  115.     else
  116.         hint = false
  117.     end
  118. end )
  119. GM.Jobs:Register( Job )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement