add sborka
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
-----------------------------------------
|
||||
-- MEDKIT_BACKPACK (MILITARY RP)
|
||||
-- Собственность Олега Закона и Scripty
|
||||
-----------------------------------------
|
||||
local mdl = "models/v92/bf2/weapons/handheld/medikit_w.mdl"
|
||||
local bags = {}
|
||||
|
||||
-- Настраиваемые конвары для отладки
|
||||
CreateClientConVar("v92_med_back_right", "3", true, false)
|
||||
CreateClientConVar("v92_med_back_forward", "3", true, false)
|
||||
CreateClientConVar("v92_med_back_up", "3", true, false)
|
||||
|
||||
CreateClientConVar("v92_med_rot_right", "7", true, false)
|
||||
CreateClientConVar("v92_med_rot_up", "0", true, false)
|
||||
CreateClientConVar("v92_med_rot_forward", "90", true, false)
|
||||
|
||||
CreateClientConVar("v92_med_bone", "ValveBiped.Bip01_Spine2", true, false)
|
||||
|
||||
local function GetOffsets()
|
||||
local cRight = GetConVar("v92_med_back_right")
|
||||
local cForward = GetConVar("v92_med_back_forward")
|
||||
local cUp = GetConVar("v92_med_back_up")
|
||||
|
||||
local right = cRight and cRight:GetFloat() or 0
|
||||
local forward = cForward and cForward:GetFloat() or 0
|
||||
local up = cUp and cUp:GetFloat() or 0
|
||||
|
||||
return right, forward, up
|
||||
end
|
||||
|
||||
local function GetRotations()
|
||||
local cR = GetConVar("v92_med_rot_right")
|
||||
local cU = GetConVar("v92_med_rot_up")
|
||||
local cF = GetConVar("v92_med_rot_forward")
|
||||
|
||||
local r = cR and cR:GetFloat() or 0
|
||||
local u = cU and cU:GetFloat() or 0
|
||||
local f = cF and cF:GetFloat() or 0
|
||||
|
||||
return r, u, f
|
||||
end
|
||||
|
||||
local medikitRenderData = {}
|
||||
|
||||
hook.Add("PostPlayerDraw", "V92_Medikit_Draw", function(ply)
|
||||
if not IsValid(ply) or not ply:Alive() then return end
|
||||
|
||||
-- Не рисуем на себе в первом лице
|
||||
if ply == LocalPlayer() and not ply:ShouldDrawLocalPlayer() then
|
||||
return
|
||||
end
|
||||
|
||||
local boneName = GetConVar("v92_med_bone"):GetString() or "ValveBiped.Bip01_Spine2"
|
||||
|
||||
-- Проверяем наличие аптечки
|
||||
local hasBag = false
|
||||
for _, ent in ipairs(ents.FindByClass("v92_bf2_medikit_ent")) do
|
||||
if ent:GetNWBool("V92_Medikit_IsAttached", false)
|
||||
and ent:GetNWEntity("V92_Medikit_AttachedPlayer") == ply then
|
||||
hasBag = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if not hasBag then
|
||||
if IsValid(bags[ply]) then bags[ply]:Remove() end
|
||||
bags[ply] = nil
|
||||
return
|
||||
end
|
||||
|
||||
if not IsValid(bags[ply]) then
|
||||
bags[ply] = ClientsideModel(mdl, RENDERGROUP_OPAQUE)
|
||||
bags[ply]:SetNoDraw(true)
|
||||
end
|
||||
|
||||
local bag = bags[ply]
|
||||
|
||||
ply:SetupBones()
|
||||
|
||||
local bone = ply:LookupBone(boneName)
|
||||
if not bone then return end
|
||||
|
||||
local m = ply:GetBoneMatrix(bone)
|
||||
if not m then return end
|
||||
|
||||
local pos = m:GetTranslation()
|
||||
local ang = m:GetAngles()
|
||||
|
||||
-- Смещения
|
||||
local rightOff, forwardOff, upOff = GetOffsets()
|
||||
local rotRight, rotUp, rotForward = GetRotations()
|
||||
|
||||
ang:RotateAroundAxis(ang:Right(), rotRight)
|
||||
ang:RotateAroundAxis(ang:Up(), rotUp)
|
||||
ang:RotateAroundAxis(ang:Forward(), rotForward)
|
||||
|
||||
pos = pos + ang:Right() * rightOff + ang:Forward() * forwardOff + ang:Up() * upOff
|
||||
|
||||
bag:SetPos(pos)
|
||||
bag:SetAngles(ang)
|
||||
bag:DrawModel()
|
||||
end)
|
||||
|
||||
hook.Add("PlayerDisconnected", "V92_Medikit_Cleanup", function(ply)
|
||||
if bags[ply] then
|
||||
bags[ply]:Remove()
|
||||
bags[ply] = nil
|
||||
end
|
||||
end)
|
||||
|
||||
hook.Add("PlayerDeath", "V92_Medikit_CleanupDeath", function(ply)
|
||||
if bags[ply] then
|
||||
bags[ply]:Remove()
|
||||
bags[ply] = nil
|
||||
end
|
||||
end)
|
||||
-----------------------------------------
|
||||
-- MEDKIT_BACKPACK (MILITARY RP)
|
||||
-- Собственность Олега Закона и Scripty
|
||||
-----------------------------------------
|
||||
@@ -0,0 +1,111 @@
|
||||
-----------------------------------------
|
||||
-- MEDKIT_BACKPACK (MILITARY RP)
|
||||
-- Собственность Олега Закона и Scripty
|
||||
-----------------------------------------
|
||||
AddCSLuaFile()
|
||||
|
||||
concommand.Add("VNT_Support_Torch_Toggle", function(ply,cmd,args)
|
||||
bTorch = !bTorch
|
||||
if bTorch then
|
||||
|
||||
GetConVar("VNT_Support_Torch_Vanilla"):SetBool( 0 )
|
||||
ply:AllowFlashlight( true )
|
||||
print( "flashlight enabled" )
|
||||
|
||||
else
|
||||
|
||||
GetConVar("VNT_Support_Torch_Vanilla"):SetBool( 1 )
|
||||
if SERVER then ply:Flashlight( false ) end
|
||||
ply:AllowFlashlight( false )
|
||||
print( "flashlight disabled" )
|
||||
|
||||
end end , nil , "(TOGGLE) Toggle the requirement to use the flashlight weapon." , { FCVAR_REPLICATED, FCVAR_ARCHIVE } )
|
||||
if !ConVarExists("VNT_Support_Torch_Vanilla") then CreateConVar("VNT_Support_Torch_Vanilla" , 1 , { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "INTERNAL VALUE, DO NOT USE DIRECTLY" , 0 , 1 ) end
|
||||
|
||||
if !ConVarExists("VNT_Support_MineVehicle_PlaceDelay") then CreateConVar("VNT_Support_MineVehicle_PlaceDelay", 5 , { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "(INT) Delay between uses of the Anti-Vehicle Mine" , 1 , 30 ) end
|
||||
if !ConVarExists("VNT_Support_MineVehicle_Radius") then CreateConVar("VNT_Support_MineVehicle_Radius", 128 , { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "(INT) Radius of the Anti-Vehicle Mine" , 5 , 128 ) end
|
||||
|
||||
if !ConVarExists("VNT_Support_MinePersonnel_PlaceDelay") then CreateConVar("VNT_Support_MinePersonnel_PlaceDelay", 5 , { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "(INT) Delay between uses of the Anti-Personnel Mine" , 1 , 30 ) end
|
||||
if !ConVarExists("VNT_Support_MinePersonnel_Radius") then CreateConVar("VNT_Support_MinePersonnel_Radius", 128 , { FCVAR_REPLICATED, FCVAR_ARCHIVE } , "(INT) Radius of the Anti-Personnel Mine" , 5 , 128 ) end
|
||||
|
||||
local function vntSupportSWepsOptions( Panel )
|
||||
|
||||
Panel:ClearControls()
|
||||
|
||||
Panel:AddControl( "Header", {
|
||||
Text = "Support Weapons" ,
|
||||
Description =[[Добро пожаловать на фт тим!
|
||||
]],
|
||||
} )
|
||||
|
||||
-----------------------------------------------------
|
||||
-----------------------------------------------------
|
||||
-- Torch
|
||||
-----------------------------------------------------
|
||||
-----------------------------------------------------
|
||||
|
||||
Panel:AddControl( "Checkbox", {
|
||||
["label"] = "Toggle Vanilla Flashlight",
|
||||
["Command"] = "VNT_Support_Torch_Toggle",
|
||||
["Type"] = "bool"
|
||||
} )
|
||||
|
||||
Panel:AddControl( "Header", {
|
||||
["text"] = "M15 Anti-Vehicle Mines" ,
|
||||
["Description"] =[[M15 Options
|
||||
These control the M15 Anti-Vehicle mines.
|
||||
]],
|
||||
} )
|
||||
|
||||
Panel:AddControl( "Slider", {
|
||||
["label"] = "Mine Place Delay",
|
||||
["Command"] = "VNT_Support_MineVehicle_PlaceDelay",
|
||||
["Type"] = "int",
|
||||
["min"] = "1",
|
||||
["max"] = "30"
|
||||
} )
|
||||
|
||||
Panel:AddControl( "Slider", {
|
||||
["label"] = "Find Radius",
|
||||
["Command"] = "VNT_Support_MineVehicle_Radius",
|
||||
["Type"] = "int",
|
||||
["min"] = "5",
|
||||
["max"] = "128"
|
||||
} )
|
||||
|
||||
Panel:AddControl( "Header", {
|
||||
["text"] = "M18 Anti-Personnel Mines" ,
|
||||
["Description"] =[[M18 Options
|
||||
These control the M18 Anti-Personnel mines.
|
||||
]],
|
||||
} )
|
||||
|
||||
Panel:AddControl( "Slider", {
|
||||
["label"] = "Mine Place Delay",
|
||||
["Command"] = "VNT_Support_MinePersonnel_PlaceDelay",
|
||||
["Type"] = "int",
|
||||
["min"] = "1",
|
||||
["max"] = "30"
|
||||
} )
|
||||
|
||||
Panel:AddControl( "Slider", {
|
||||
["label"] = "Find Radius",
|
||||
["Command"] = "VNT_Support_MinePersonnel_Radius",
|
||||
["Type"] = "int",
|
||||
["min"] = "5",
|
||||
["max"] = "128"
|
||||
} )
|
||||
|
||||
end
|
||||
|
||||
local function vntSupportSWepsIndex() spawnmenu.AddToolMenuOption( "Options", "V92", "Support Equipment", "Support Equipment", "", "", vntSupportSWepsOptions ) end
|
||||
hook.Add( "PopulateToolMenu", "vntSupportSWepsIndex", vntSupportSWepsIndex )
|
||||
|
||||
if SERVER then
|
||||
resource.AddWorkshop( "635210663" ) -- Support Equipment
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
-- MEDKIT_BACKPACK (MILITARY RP)
|
||||
-- Собственность Олега Закона и Scripty
|
||||
-----------------------------------------
|
||||
Reference in New Issue
Block a user