Single image custom crosshair

- Added support for a single image custom crosshair. Also included a hollow circle PNG creators can use.
- Fixed that one could still melee while sprinting if ShootWhileSprint was set to false.
This commit is contained in:
MokaAkashiya85 2024-06-15 14:30:49 +02:00
parent d437da2617
commit eb0076663c
4 changed files with 11 additions and 8 deletions

View File

@ -177,14 +177,15 @@ function SWEP:DoDrawCrosshair(x, y)
local size = self.CustomCrosshairSize or 40
-- surface.DrawTexturedRect(x - (dotsize / 2) - gap - prong - ARC9.ScreenScale(11), y - (dotsize / 2) - ARC9.ScreenScale(7), size, size) -- Left
surface.DrawTexturedRectRotated(x - (dotsize / 2) - gap - ARC9.ScreenScale(11), y - (dotsize / 2), size, size, 0) -- Left
surface.DrawTexturedRectRotated(x - (dotsize / 2) + gap + ARC9.ScreenScale(11), y - (dotsize / 2), size, size, 180) -- Right
surface.DrawTexturedRectRotated(x - (dotsize / 2), y - (dotsize / 2) - gap - prong - ARC9.ScreenScale(7), size, size, -90) -- Top
surface.DrawTexturedRectRotated(x - (dotsize / 2), y + (dotsize / 2) + gap + ARC9.ScreenScale(10), size, size, 90) -- Bottom
if self.CustomCrosshairSingle then
surface.DrawTexturedRectRotated(x, y, size + gap, size + gap, 0) -- Central
else
surface.DrawTexturedRectRotated(x - (dotsize / 2) - gap - ARC9.ScreenScale(11), y - (dotsize / 2), size, size, 0) -- Left
surface.DrawTexturedRectRotated(x - (dotsize / 2) + gap + ARC9.ScreenScale(11), y - (dotsize / 2), size, size, 180) -- Right
surface.DrawTexturedRectRotated(x - (dotsize / 2), y - (dotsize / 2) - gap - prong - ARC9.ScreenScale(7), size, size, -90) -- Top
surface.DrawTexturedRectRotated(x - (dotsize / 2), y + (dotsize / 2) + gap + ARC9.ScreenScale(10), size, size, 90) -- Bottom
end
elseif self:GetProcessedValue("MissileCrosshair", true) then
-- local dotcount = 4

View File

@ -268,6 +268,7 @@ function SWEP:PrimaryAttack()
if self:GetCustomize() then return end
if processedValue(self,"Bash", true) and owner:KeyDown(IN_USE) and !self:GetInSights() then
if self:GetIsSprinting() and !self.ShootWhileSprint then return end
self:MeleeAttack()
self:SetNeedTriggerPress(true)
return

View File

@ -125,6 +125,7 @@ SWEP.MissileCrosshair = false -- Force the missile launcher crosshair
SWEP.ForceStandardCrosshair = nil -- Force default + or T crosshair no matter what!
SWEP.CustomCrosshair = false -- Enables custom crosshair use.
SWEP.CustomCrosshairSingle = false -- Enables a single image to be used as the custom crosshair.
SWEP.CustomCrosshairMaterial = "" -- Point towards a file to use as the custom crosshair.
SWEP.CustomCrosshairSize = 40 -- Changes the custom crosshair size. (Default 40)

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB