@@ -25,6 +25,7 @@ if CLIENT
2525
2626 bg : Material " au/gui/tasks/clearasteroids/base.png" , " smooth"
2727 kil : Material " au/gui/tasks/clearasteroids/weapons_explosion.png" , " smooth"
28+ reticle : Material " au/gui/tasks/clearasteroids/weapons_reticle.png"
2829 }
2930
3031 ROTATION_MATRIX = Matrix !
@@ -35,7 +36,7 @@ if CLIENT
3536
3637 with base
3738 \ Setup with parent = vgui. Create " Panel"
38- max_size = ScrH ! * 0.7
39+ max_size = ScrH ! * 0.85
3940 \ SetSize max_size, max_size
4041 . Paint = ( _, w, h) ->
4142 surface. SetMaterial ASSETS . bg
@@ -55,8 +56,56 @@ if CLIENT
5556 \ SetMouseInputEnabled true
5657 . OnMousePressed = ->
5758 surface. PlaySound SOUNDS . fire
59+ \ UpdateReticle !
5860
5961 nextSpawn = CurTime ! + math.random !
62+
63+ reticleSize = inner_max_size * 0.175
64+ reticlePosX = inner_max_size / 2
65+ reticlePosY = inner_max_size / 2
66+ beamWidth = inner_max_size * 0.0175
67+
68+ . UpdateReticle = ->
69+ reticlePosX, reticlePosY = \ LocalCursorPos !
70+
71+ . PaintOver = ->
72+ beamOriginY = inner_max_size
73+
74+ surface. SetDrawColor 35 , 110 , 70
75+ surface. DisableClipping true
76+ for i = 1 , 2
77+ beamOriginX = if i == 1
78+ 0
79+ else
80+ inner_max_size
81+
82+ dx = reticlePosX - beamOriginX
83+ dy = reticlePosY - beamOriginY
84+
85+ theta = math.deg math.atan2 dy, dx
86+ length = math.sqrt dy* dy + dx* dx
87+
88+ ltsx, ltsy = \ LocalToScreen 0 , 0
89+ vec = Vector ltsx + beamOriginX, ltsy + beamOriginY, 0
90+
91+ m = with ROTATION_MATRIX
92+ \ Identity !
93+ \ Translate vec
94+ \ Rotate Angle 0 , 270 + theta, 0
95+ \ Translate - vec
96+
97+ cam. PushModelMatrix ROTATION_MATRIX , true
98+ surface. DrawRect beamOriginX - beamWidth / 2 , beamOriginY,
99+ beamWidth, length
100+ cam. PopModelMatrix !
101+
102+ surface. DisableClipping false
103+
104+ surface. SetDrawColor 255 , 255 , 255
105+ surface. SetMaterial ASSETS . reticle
106+ surface. DrawTexturedRect reticlePosX - reticleSize / 2 , reticlePosY - reticleSize / 2 ,
107+ reticleSize, reticleSize
108+
60109 . Think = ->
61110 if asteroidCount < 3 and CurTime ! > nextSpawn
62111 nextSpawn = CurTime ! + math.random !
@@ -95,6 +144,7 @@ if CLIENT
95144 \ Remove !
96145
97146 . OnMousePressed = ->
147+ innerPanel\ UpdateReticle !
98148 destroyed += 1
99149 if @GetCurrentStep ! <= taskTable. Count
100150 base\ Submit @GetCurrentStep ! == taskTable. Count
@@ -140,11 +190,14 @@ if CLIENT
140190
141191 render. SetScissorRect 0 , 0 , 0 , 0 , false
142192
143- label = with \ Add " DLabel "
193+ label = with \ Add " DOutlinedLabel "
144194 \ SetFont " NMW AU PlaceholderText"
145195 \ SetContentAlignment 5
146196 \ Dock BOTTOM
197+ \ SetTall max_size * 0.05
147198 \ SizeToContents !
199+ \ SetZPos 9001
200+ \ SetMouseInputEnabled false
148201 . Think = ->
149202 \ SetText TRANSLATE ( " task.clearAsteroids.destroyed" ) destroyed
150203 \ Popup !
0 commit comments