mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 21:53:46 +03:00
Upload
This commit is contained in:
66
gamemodes/darkrp/plugins/ln_firstperson/cl_hooks.lua
Normal file
66
gamemodes/darkrp/plugins/ln_firstperson/cl_hooks.lua
Normal file
@@ -0,0 +1,66 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
-- Called when the player's view needs to be calculated.
|
||||
function PLUGIN:CalcView(client, origin, angles, fov)
|
||||
local view = {}
|
||||
local eyeAtt = client:GetAttachment(client:LookupAttachment("eyes"))
|
||||
local forwardVec = client:GetAimVector()
|
||||
local FT = FrameTime()
|
||||
|
||||
if (!ix.option.Get("enableImmersiveFirstPerson", true) or !client:Alive() or client:InVehicle() or !eyeAtt) then
|
||||
return
|
||||
end
|
||||
|
||||
if (!CurView) then
|
||||
CurView = angles
|
||||
else
|
||||
CurView = LerpAngle(math.Clamp(FT * (35 * (1 - math.Clamp(ix.option.Get("smoothScale", 0.7), 0, 0.9))), 0, 1), CurView, angles + Angle(0, 0, eyeAtt.Ang.r * 0.1))
|
||||
end
|
||||
|
||||
if (eyeAtt) then
|
||||
view.angles = CurView
|
||||
view.fov = fov
|
||||
|
||||
return view
|
||||
end
|
||||
end
|
||||
|
||||
-- Called when the HUD needs to be painted.
|
||||
function PLUGIN:HudPaint()
|
||||
local tr, pos
|
||||
local td = {}
|
||||
|
||||
if (!ix.option.Get("customCrosshair", true)) then
|
||||
return
|
||||
end
|
||||
|
||||
client = LocalPlayer()
|
||||
|
||||
if (!ix.option.Get("enableImmersiveFirstPerson", true) or !client:Alive()) then
|
||||
return
|
||||
end
|
||||
|
||||
td.start = client:GetShootPos()
|
||||
td.endpos = td.start + client:GetAimVector() * 3000
|
||||
td.filter = client
|
||||
|
||||
tr = util.TraceLine(td)
|
||||
pos = tr.HitPos:ToScreen()
|
||||
|
||||
surface.SetDrawColor(0, 0, 0, 125)
|
||||
surface.DrawRect(pos.x - 2, pos.y - 1, 5, 5)
|
||||
|
||||
surface.SetDrawColor(255, 255, 255, 150)
|
||||
surface.DrawRect(pos.x - 1, pos.y, 3, 3)
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
LANGUAGE = {
|
||||
optEnableImmersiveFirstPerson = "Enable Immersive First Person",
|
||||
optdEnableImmersiveFirstPerson = "Whether Immersive First Person should be enabled.",
|
||||
|
||||
optSmoothScale = "Smooth Scale",
|
||||
optdSmoothScale = "The scale of which the mouse movement will be smoothened.",
|
||||
|
||||
optCustomCrosshair = "Enable Custom Crosshair",
|
||||
optdCustomCrosshair = "Whether or not to replace the default crosshair."
|
||||
}
|
||||
25
gamemodes/darkrp/plugins/ln_firstperson/sh_options.lua
Normal file
25
gamemodes/darkrp/plugins/ln_firstperson/sh_options.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
ix.option.Add("enableImmersiveFirstPerson", ix.type.bool, true, {
|
||||
category = "First Person"
|
||||
})
|
||||
|
||||
ix.option.Add("smoothScale", ix.type.number, 0.7, {
|
||||
category = "First Person",
|
||||
min = 0,
|
||||
max = 0.9,
|
||||
decimals = 1
|
||||
})
|
||||
|
||||
ix.option.Add("customCrosshair", ix.type.bool, true, {
|
||||
category = "First Person"
|
||||
})
|
||||
17
gamemodes/darkrp/plugins/ln_firstperson/sh_plugin.lua
Normal file
17
gamemodes/darkrp/plugins/ln_firstperson/sh_plugin.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
PLUGIN.name = "LN | Immersive First Person Perspective"
|
||||
PLUGIN.description = "Adds an immersive 'smooth' first person view."
|
||||
PLUGIN.author = "Aspect™"
|
||||
|
||||
ix.util.Include("sh_options.lua")
|
||||
ix.util.Include("cl_hooks.lua")
|
||||
Reference in New Issue
Block a user