From 0aa0127e79487b20a7735bc316362a685536a5d2 Mon Sep 17 00:00:00 2001
From: YuRaNnNzZZ <medved609@yandex.ru>
Date: Fri, 3 Feb 2023 19:41:01 +0300
Subject: [PATCH] 4.7.5.2

---
 CHANGELOG.md                                  |  5 +++++
 .../documentation/tfa_attachment_template.lua | 21 +++++++++++++++++++
 lua/tfa/documentation/tfa_hooks_custom.lua    |  9 ++++++++
 3 files changed, 35 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 92d37fe..07b26ff 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,9 @@
 # This is an archive of changelog messages from `tfa_loader.lua`.
+## 4.7.5.2
+* Expanded stencil sights with pre and post draw functions (with attachments support and hook to stop reticles from drawing)
+* Fixed missing thirdperson animations/sounds in singleplayer
+* Fixed unscoping on rechamber when weapon doesn't require it
+
 ## 4.7.5.1
 * Fixed keys from keybinds tab not being capitalized properly in the hint
 * Melee damage now follows the global damage multiplier and randomization rules
diff --git a/lua/tfa/documentation/tfa_attachment_template.lua b/lua/tfa/documentation/tfa_attachment_template.lua
index d3ac8c1..ee9f8ae 100644
--- a/lua/tfa/documentation/tfa_attachment_template.lua
+++ b/lua/tfa/documentation/tfa_attachment_template.lua
@@ -69,6 +69,27 @@ function ATTACHMENT:CustomBulletCallback(wep, attacker, trace, dmginfo)
 end
 ]]--
 
+--[[
+-- Called before stencil sight reticle is drawn
+function ATTACHMENT:PreDrawStencilSight(wep, vm, ply, sightVElementTable)
+	-- 3D rendering context from PostDrawViewModel
+	-- https://wiki.facepunch.com/gmod/3D_Rendering_Functions
+
+	-- return true -- to prevent SWEP:PreDrawStencilSight from being called
+	-- return false -- to stop reticle from drawing
+end
+]]--
+
+--[[
+-- Called right after stencil sight reticle is drawn
+function ATTACHMENT:PostDrawStencilSight(wep, vm, ply, sightVElementTable)
+	-- 3D rendering context from PostDrawViewModel
+	-- https://wiki.facepunch.com/gmod/3D_Rendering_Functions
+
+	-- return true -- to prevent SWEP:PostDrawStencilSight from being called
+end
+]]--
+
 if not TFA_ATTACHMENT_ISUPDATING then
 	TFAUpdateAttachments()
 end
diff --git a/lua/tfa/documentation/tfa_hooks_custom.lua b/lua/tfa/documentation/tfa_hooks_custom.lua
index f4467a0..602647a 100644
--- a/lua/tfa/documentation/tfa_hooks_custom.lua
+++ b/lua/tfa/documentation/tfa_hooks_custom.lua
@@ -744,6 +744,15 @@ GM:TFA_PostDrawKeyBindHint(Weapon weapon, number x, number y, number alpha, tabl
 --     5. table rawKeysTable
 --     6. table keyStrings
 
+boolean GM:TFA_ShouldDrawStencilSight(Weapon weapon)
+-- Hook name: TFA_ShouldDrawStencilSight
+-- Description: Called when weapon is trying to draw stencil sight reticle
+-- State: Client
+-- Arguments:
+--     1. Weapon weapon
+-- Returns:
+--     1. boolean - Return false to prevent reticle from drawing
+
 
 
 ---------------------------------------