add sborka

This commit is contained in:
2026-03-31 10:27:04 +03:00
commit f5e5f56c84
2345 changed files with 382127 additions and 0 deletions

View File

@@ -0,0 +1,143 @@
local matBeam = Material("cable/rope")
function DrawRopeKnives()
for k,ent in pairs(ents.FindByClass("sent_rope_knife")) do
if LocalPlayer():GetPos():Distance( ent:GetPos() ) > 16000 then continue end
if !ent:GetNWBool("Stuck") and !ent:GetNWBool("Useless") and IsValid(ent:GetNWEntity("Owner")) then
local att = ent:GetNWEntity("Owner"):GetAttachment(ent:GetNWEntity("Owner"):LookupAttachment("anim_attachment_RH"))
if !att then continue end
local pos = att.Pos
render.SetMaterial(matBeam)
render.DrawBeam(ent:GetPos(), pos, 2, 0, 1, Color(255,255,255))
elseif ent:GetNWBool("Stuck") then
local pos = ent:GetPos()
local line = {}
line.start = pos
line.endpos = pos + Vector(0,0,-16000)
line.filter = {ent}
for k,ply in pairs(player.GetAll()) do
table.insert(line.filter, ply)
end
local tr = util.TraceLine( line )
render.SetMaterial(matBeam)
render.DrawBeam(pos, tr.HitPos, 2, 0, 1, Color(255,255,255))
end
end
end
hook.Add("PostDrawOpaqueRenderables","DrawRopeKnives",DrawRopeKnives)
hook.Add( "ShouldDrawLocalPlayer", "DrawClimbPlayer", function()
if IsValid(LocalPlayer():GetNWEntity("ClimbingEnt")) and LocalPlayer():GetMoveType() == MOVETYPE_CUSTOM and GetConVarString( "gk_thirdperson" ) == "1" and GetConVarString( "gk_forcefirstperson" ) == "0" then return true end
end )
function FollowClimbHead( ply, pos, angle, fov )
if ( !ply:IsValid() or !ply:Alive() or ply:GetViewEntity() != ply ) then return end
if ply:InVehicle() or !IsValid(ply:GetNWEntity("ClimbingEnt")) or ply:GetMoveType() ~= MOVETYPE_CUSTOM or GetConVarString( "gk_thirdperson" ) == "0" or GetConVarString( "gk_forcefirstperson" ) == "1" then return end
pos = pos - angle:Forward()*64
local view = {}
view.origin = pos
view.angles = angle
view.fov = fov
return view
end
hook.Add( "CalcView", "RopeKnifeFollowHead", FollowClimbHead )
function RopeKnifeAnimation( ply, velocity, maxseqgroundspeed )
if IsValid(ply:GetNWEntity("ClimbingEnt")) and ply:GetMoveType() == MOVETYPE_CUSTOM then
local speed = ply:GetNWInt("MoveSpeed")
if ply:GetNWEntity("ClimbingEnt"):GetNWBool("MultiAngle") then
ply:SetRenderAngles( ply:GetNWVector("ClimbNormal"):Angle() )
else
ply:SetRenderAngles( ply:GetNWEntity("ClimbingEnt"):GetNWVector("HitNormal"):Angle() )
end
ply.CalcSeqOverride = ply:LookupSequence( "zombie_climb_loop" )
ply:SetSequence( ply.CalcSeqOverride )
ply:SetPlaybackRate( speed/180 )
return true
end
end
hook.Add("UpdateAnimation", "RopeKnifeAnimation", RopeKnifeAnimation)
surface.CreateFont("RopeKnifeHUD", {
font = "Roboto",
size = 20,
weight = 800,
antialias = true
})
local function HUDTimer()
if not IsValid(LocalPlayer()) then return end
local foundHook = nil
local climbingEnt = LocalPlayer():GetNWEntity("ClimbingEnt")
if IsValid(climbingEnt) then
foundHook = climbingEnt
else
for k, v in pairs(ents.FindByClass("sent_rope_knife")) do
if v:GetNWEntity("Owner") == LocalPlayer() and v:GetNWBool("Stuck") then
foundHook = v
break
end
end
end
if IsValid(foundHook) then
local time = foundHook:GetNWFloat("ExpirationTime", 0)
local timeLeft = math.ceil(time - CurTime())
if time > 0 and timeLeft > 0 then
local w, h = ScrW(), ScrH()
local boxW, boxH = 300, 50
local x, y = w/2 - boxW/2, h - 140
local themeColor = Color(0, 120, 50, 230) -- Brighter Tactical Green
local accentGreen = Color(100, 255, 150, 255) -- Very Bright Green
local textColor = Color(200, 255, 200, 255) -- Light Green for text
-- Tactical Border
surface.SetDrawColor(themeColor)
surface.DrawOutlinedRect(x, y, boxW, boxH, 2)
-- Background Alpha (Slightly more transparent)
draw.RoundedBox(0, x + 2, y + 2, boxW - 4, boxH - 4, Color(0, 0, 0, 200))
-- Grid Lines (Visual detail)
surface.SetDrawColor(themeColor.r, themeColor.g, themeColor.b, 40)
for i = 0, boxW, 25 do surface.DrawLine(x + i, y, x + i, y + boxH) end
-- Status Indicator (Simplified and centered)
local text = "Исчезнет через: " .. timeLeft .. " сек."
draw.SimpleText(text, "RopeKnifeHUD", w/2, y + 10, accentGreen, TEXT_ALIGN_CENTER)
-- Segmented Progress Bar
local segments = 10
local segW = (boxW - 30) / segments
local activeSegs = math.ceil((timeLeft / 60) * segments)
for i = 0, segments - 1 do
local segX = x + 15 + i * segW
local col = (i < activeSegs) and themeColor or Color(40, 40, 40, 200)
draw.RoundedBox(0, segX + 1, y + 32, segW - 2, 6, col)
end
-- Corner Accents
surface.SetDrawColor(255, 255, 255, 50)
surface.DrawRect(x, y, 4, 1) surface.DrawRect(x, y, 1, 4)
surface.DrawRect(x + boxW - 4, y, 4, 1) surface.DrawRect(x + boxW - 1, y, 1, 4)
surface.DrawRect(x, y + boxH - 1, 4, 1) surface.DrawRect(x, y + boxH - 4, 1, 4)
surface.DrawRect(x + boxW - 4, y + boxH - 1, 4, 1) surface.DrawRect(x + boxW - 1, y + boxH - 4, 1, 4)
end
end
end
hook.Add("HUDPaint", "RopeKnifeTimerHUD", HUDTimer)

View File

@@ -0,0 +1,131 @@
hook.Add("Move","RopeKnifeMove", function(ply,mv,cmd)
local ent = ply:GetNWEntity("ClimbingEnt")
if IsValid( ent ) and ply:GetMoveType() == MOVETYPE_CUSTOM then
local deltaTime = FrameTime()
local pos = mv:GetOrigin()
local targetpos = ply:GetNWEntity("ClimbingEnt"):GetPos()
local maxspeed = ply:GetMaxSpeed()*0.6
local forward = mv:GetForwardSpeed()/10000
local vel = mv:GetVelocity()
ply:SetNWInt("MoveSpeed", forward*maxspeed)
local newVelocity = (Vector(0,0,1)*forward*maxspeed)
local newOrigin = pos + newVelocity * deltaTime
if mv:KeyDown(IN_JUMP) and SERVER then
ply:SetMoveType( MOVETYPE_WALK )
ply:SetGroundEntity( NULL )
ply:SetNWEntity("ClimbingEnt", NULL)
ply:DrawViewModel(true)
ply:DrawWorldModel(true)
-- Give a small boost
mv:SetVelocity( ply:GetForward() * -50 + Vector(0,0,200) )
-- Multi-use: Hook remains until its global 60s timer finishes
return true
end
if pos.z >= targetpos.z + 50 and SERVER then
ply:SetMoveType( MOVETYPE_WALK )
ply:SetGroundEntity( NULL )
ply:SetNWEntity("ClimbingEnt", NULL)
ply:DrawViewModel(true)
ply:DrawWorldModel(true)
-- Multi-use: Hook remains until its global 60s timer finishes
end
if pos.z <= ent:GetNWVector("DownHit").z + 5 and ply:KeyDown(IN_BACK) and SERVER then
newOrigin = newOrigin - ply:GetNWEntity("ClimbingEnt"):GetNWVector("HitNormal"):Angle():Forward()*18
ply:SetMoveType( MOVETYPE_WALK )
ply:SetGroundEntity( NULL )
ply:SetNWEntity("ClimbingEnt", NULL)
ply:DrawViewModel(true)
ply:DrawWorldModel(true)
-- Multi-use: Hook remains until its global 60s timer finishes
end
mv:SetVelocity( newVelocity )
mv:SetOrigin( newOrigin )
return true;
end
end)
function RopeKnifeThink( ply )
if IsValid(ply:GetNWEntity("ClimbingEnt")) then
if ply:GetMoveType() == MOVETYPE_CUSTOM then
local wep = ply:GetActiveWeapon()
if IsValid(wep) and GetConVar( "gk_enableshooting" ):GetBool() == false then
wep:SetNextPrimaryFire(CurTime() + 0.5)
ply:DrawViewModel(false)
if SERVER then
ply:DrawWorldModel(false)
end
end
elseif SERVER then
ply:SetNWEntity("ClimbingEnt", NULL)
ply:DrawViewModel(true)
ply:DrawWorldModel(true)
end
end
end
hook.Add("PlayerPostThink", "RopeKnifeThink", RopeKnifeThink)
function PlayerDieClimb( victim, weapon, killer )
-- Multi-use: Hook remains until its global 60s timer finishes
victim:SetNWEntity("ClimbingEnt", NULL)
end
hook.Add( "PlayerDeath", "PlayerClimbDeath", PlayerDieClimb )
CreateConVar("gk_enableshooting", "0", {FCVAR_ARCHIVE})
CreateConVar("gk_forcefirstperson", "0", {FCVAR_ARCHIVE})
CreateConVar("gk_enabledamage", "1", {FCVAR_ARCHIVE})
if CLIENT then
if GetConVar("gk_thirdperson") == nil then
CreateClientConVar("gk_thirdperson", "1", true, true)
end
if GetConVar("gk_ropemat") == nil then
CreateClientConVar("gk_ropemat", "", true, true)
end
end
local function GKSettingsPanel(panel)
panel:ClearControls()
panel:AddControl("CheckBox", {
Label = "Thirdperson",
Command = "gk_thirdperson"
})
end
local function GKAdminSettingsPanel(panel)
panel:ClearControls()
panel:AddControl("CheckBox", {
Label = "Shoot while climbing",
Command = "gk_enableshooting"
})
panel:AddControl("CheckBox", {
Label = "Enable grapple damage",
Command = "gk_enabledamage"
})
panel:AddControl("CheckBox", {
Label = "Force First-person",
Command = "gk_forcefirstperson"
})
end
local function PopulateGKMenu()
spawnmenu.AddToolMenuOption("Options", "Grappling Knife", "Grappling Knife", "Settings", "", "", GKSettingsPanel)
spawnmenu.AddToolMenuOption("Options", "Grappling Knife", "Admin Grappling Knife", "Admin Settings", "", "", GKAdminSettingsPanel)
end
hook.Add("PopulateToolMenu", "GK Cvars", PopulateGKMenu)