Files
VnUtest/garrysmod/addons/tacrp/lua/weapons/tacrp_ex_glock.lua
2026-03-31 10:27:04 +03:00

359 lines
9.4 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
SWEP.Base = "tacrp_base"
SWEP.Spawnable = true
AddCSLuaFile()
// names and stuff
SWEP.PrintName = "Glock 17"
SWEP.Category = "[FT] Оружие"
SWEP.SubCatTier = "4Consumer"
SWEP.SubCatType = "1Pistol"
SWEP.Description = "Polymer pistol with larger-than-standard capacity and a fast fire rate."
SWEP.Description_Quote = "Does not show up on airport metal detectors."
SWEP.Trivia_Caliber = "9x19mm"
SWEP.Trivia_Manufacturer = "Glock Ges.m.b.H"
SWEP.Trivia_Year = "1982"
SWEP.Faction = TacRP.FACTION_NEUTRAL
SWEP.Credits = "Assets: Twinke Masta \nSounds: Vunsunta \nAnimations: Tactical Intervention"
SWEP.ViewModel = "models/weapons/tacint_extras/v_glock_new.mdl"
SWEP.WorldModel = "models/weapons/tacint_extras/w_glock_new.mdl"
SWEP.Slot = 1
SWEP.BalanceStats = {
[TacRP.BALANCE_SBOX] = {
Damage_Max = 24,
Damage_Min = 12,
RecoilKick = 3,
},
[TacRP.BALANCE_TTT] = {
Damage_Max = 13,
Damage_Min = 5,
Range_Min = 500,
Range_Max = 1750,
RPM = 600,
RPMMultSemi = 1,
RecoilMaximum = 10,
RecoilDissipationRate = 10,
RecoilSpreadPenalty = 0.0045,
BodyDamageMultipliers = {
[HITGROUP_HEAD] = 2.5,
[HITGROUP_CHEST] = 1,
[HITGROUP_STOMACH] = 1,
[HITGROUP_LEFTARM] = 0.9,
[HITGROUP_RIGHTARM] = 0.9,
[HITGROUP_LEFTLEG] = 0.75,
[HITGROUP_RIGHTLEG] = 0.75,
[HITGROUP_GEAR] = 0.9
},
},
[TacRP.BALANCE_PVE] = {
Damage_Max = 7,
Damage_Min = 3,
HipFireSpreadPenalty = 0.012,
RecoilSpreadPenalty = 0.002,
},
[TacRP.BALANCE_OLDSCHOOL] = {
Description = "Lightweight polymer handgun with a high fire rate but below-average spread.",
HipFireSpreadPenalty = 0.01,
}
}
SWEP.TTTReplace = TacRP.TTTReplacePreset.Pistol
// "ballistics"
SWEP.Damage_Max = 18
SWEP.Damage_Min = 10
SWEP.Range_Min = 500 // distance for which to maintain maximum damage
SWEP.Range_Max = 1800 // distance at which we drop to minimum damage
SWEP.Penetration = 3 // units of metal this weapon can penetrate
SWEP.ArmorPenetration = 0.45
SWEP.ArmorBonus = 0.5
SWEP.MuzzleVelocity = 11000
SWEP.BodyDamageMultipliers = {
[HITGROUP_HEAD] = 4,
[HITGROUP_CHEST] = 1,
[HITGROUP_STOMACH] = 1,
[HITGROUP_LEFTARM] = 1,
[HITGROUP_RIGHTARM] = 1,
[HITGROUP_LEFTLEG] = 0.75,
[HITGROUP_RIGHTLEG] = 0.75,
[HITGROUP_GEAR] = 0.9
}
// misc. shooting
SWEP.Firemode = 1
SWEP.RPM = 550
SWEP.RPMMultSemi = 0.65
SWEP.Spread = 0.008
SWEP.RecoilResetInstant = false
SWEP.RecoilPerShot = 1
SWEP.RecoilMaximum = 4
SWEP.RecoilResetTime = 0.035
SWEP.RecoilDissipationRate = 16
SWEP.RecoilFirstShotMult = 1 // multiplier for the first shot's recoil amount
SWEP.RecoilVisualKick = 1.25
SWEP.RecoilKick = 4
SWEP.RecoilStability = 0.25
SWEP.RecoilSpreadPenalty = 0.005
SWEP.CanBlindFire = true
// handling
SWEP.MoveSpeedMult = 0.975
SWEP.ShootingSpeedMult = 0.9
SWEP.SightedSpeedMult = 0.8
SWEP.ReloadSpeedMult = 0.75
SWEP.AimDownSightsTime = 0.25
SWEP.SprintToFireTime = 0.25
SWEP.Sway = 1
SWEP.ScopedSway = 0.5
SWEP.FreeAimMaxAngle = 2.5
// hold types
SWEP.HoldType = "revolver"
SWEP.HoldTypeSprint = "normal"
SWEP.HoldTypeBlindFire = false
SWEP.GestureShoot = ACT_HL2MP_GESTURE_RANGE_ATTACK_PISTOL
SWEP.GestureReload = ACT_HL2MP_GESTURE_RELOAD_PISTOL
SWEP.PassiveAng = Angle(0, 0, 0)
SWEP.PassivePos = Vector(0, -2, -5)
SWEP.BlindFireAng = Angle(0, 5, 0)
SWEP.BlindFirePos = Vector(0, -2, -5)
SWEP.BlindFireSuicideAng = Angle(-125, 0, 45)
SWEP.BlindFireSuicidePos = Vector(25, 12, -5)
SWEP.SprintAng = Angle(0, 30, 0)
SWEP.SprintPos = Vector(2, 0, -12)
SWEP.SightAng = Angle(-0.01, 0.35, 0)
SWEP.SightPos = Vector(-3.3, 0, -3.35)
SWEP.CorrectivePos = Vector(0.02, -1, 0)
SWEP.CorrectiveAng = Angle(0.05, -0.05, 0)
SWEP.HolsterVisible = true
SWEP.HolsterSlot = TacRP.HOLSTER_SLOT_PISTOL
SWEP.HolsterPos = Vector(0, 3, -4)
SWEP.HolsterAng = Angle(90, 0, 0)
// reload
-- Устанавливаем размер магазина и начальное кол-во патрон на 0
SWEP.ClipSize = 18
SWEP.DefaultAmmo = 0
SWEP.Ammo = "pistol1"
-- Принудительное обнуление при создании (Initialize)
function SWEP:Initialize()
self.BaseClass.Initialize(self)
-- Обнуляем патроны внутри самого оружия
self:SetClip1(0)
-- Обнуляем резервные патроны у игрока через мгновение после спавна
if SERVER then
timer.Simple(0, function()
if IsValid(self) and IsValid(self:GetOwner()) then
self:GetOwner():SetAmmo(0, self:GetPrimaryAmmoType())
end
end)
end
end
SWEP.ReloadUpInTime = 0.85
SWEP.DropMagazineTime = 0.2
SWEP.ReloadTimeMult = 1.4
SWEP.DropMagazineModel = "models/weapons/tacint_extras/magazines/glock_new.mdl"
SWEP.DropMagazineImpact = "pistol"
// sounds
local path = "tacrp/weapons/p2000/p2000_"
local path2 = "tacrp_extras/glock/"
SWEP.Sound_Shoot = "^" .. path2 .. "fire-1new.wav"
SWEP.Sound_Shoot_Silenced = path2 .. "fire_silenced-1.wav"
SWEP.Vol_Shoot = 110
SWEP.ShootPitchVariance = 2.5 // amount to vary pitch by each shot
// effects
// the .qc attachment for the muzzle
SWEP.QCA_Muzzle = 1
SWEP.MuzzleEffect = "muzzleflash_pistol"
SWEP.EjectEffect = 1
// anims
SWEP.AnimationTranslationTable = {
["deploy"] = "draw",
["fire_iron"] = "shoot2",
["fire"] = {"shoot1", "shoot2", "shoot3"},
["blind_fire"] = {"blind_shoot1", "blind_shoot2", "blind_shoot3"},
["melee"] = {"melee1", "melee2"}
}
SWEP.ProceduralIronFire = {
vm_pos = Vector(0, -0.5, -0.6),
vm_ang = Angle(0, 2, 0),
t = 0.2,
tmax = 0.2,
bones = {
{
bone = "ValveBiped.slide",
pos = Vector(0, 0, -3),
t0 = 0,
t1 = 0.1,
},
{
bone = "ValveBiped.hammer",
ang = Angle(-15, 0, 0),
t0 = 0,
t1 = 0.15,
},
{
bone = "ValveBiped.Bip01_R_Finger1",
ang = Angle(0, -15, 0),
t0 = 0,
t1 = 0.15,
},
{
bone = "ValveBiped.Bip01_R_Finger11",
ang = Angle(-35, 0, 0),
t0 = 0,
t1 = 0.1,
},
},
}
SWEP.NoIdle = true --fixes animation bug, why was this set to false??
SWEP.ShootTimeMult = 0.45
SWEP.LastShot = true
// attachments
SWEP.Attachments = {
[1] = {
PrintName = "Optic",
Category = "optic_pistol",
Bone = "ValveBiped.slide",
WMBone = "Box01",
AttachSound = "tacrp/weapons/optic_on.wav",
DetachSound = "tacrp/weapons/optic_off.wav",
VMScale = 1,
WMScale = 1.4,
Pos_VM = Vector(0.21, 0, -0.15),
Ang_VM = Angle(0, 90, 180),
Pos_WM = Vector(0, -3, -1),
Ang_WM = Angle(0, -90, 0),
},
[2] = {
PrintName = "Muzzle",
Category = "silencer",
Bone = "ValveBiped.barrel_assembly",
WMBone = "Box01",
AttachSound = "tacrp/weapons/silencer_on.wav",
DetachSound = "tacrp/weapons/silencer_off.wav",
VMScale = 0.6,
WMScale = 0.6,
Pos_VM = Vector(-0.5, 0.25, 7.25),
Ang_VM = Angle(90, 0, 0),
Pos_WM = Vector(0.05, 8.9, -1.7),
Ang_WM = Angle(0, -90, 0),
},
[3] = {
PrintName = "Tactical",
Category = {"tactical", "tactical_zoom", "tactical_ebullet"},
Bone = "ValveBiped.p2000_rootbone",
WMBone = "Box01",
AttachSound = "tacrp/weapons/flashlight_on.wav",
DetachSound = "tacrp/weapons/flashlight_off.wav",
VMScale = 1,
WMScale = 1.3,
Pos_VM = Vector(-2.1, -0.21, 6.5),
Ang_VM = Angle(90, 0, 180),
Pos_WM = Vector(0.1, 5, -2.75),
Ang_WM = Angle(0, -90, 180),
},
[4] = {
PrintName = "Accessory",
Category = {"acc", "acc_extmag_smg", "acc_holster", "acc_brace"},
AttachSound = "tacrp/weapons/flashlight_on.wav",
DetachSound = "tacrp/weapons/flashlight_off.wav",
},
[5] = {
PrintName = "Bolt",
Category = {"bolt_automatic"},
AttachSound = "TacRP/weapons/flashlight_on.wav",
DetachSound = "TacRP/weapons/flashlight_off.wav",
},
[6] = {
PrintName = "Trigger",
Category = {"trigger_semi"},
AttachSound = "TacRP/weapons/flashlight_on.wav",
DetachSound = "TacRP/weapons/flashlight_off.wav",
},
[7] = {
PrintName = "Ammo",
Category = {"ammo_pistol"},
AttachSound = "TacRP/weapons/flashlight_on.wav",
DetachSound = "TacRP/weapons/flashlight_off.wav",
},
[8] = {
PrintName = "Perk",
Category = {"perk", "perk_melee", "perk_shooting", "perk_reload"},
AttachSound = "tacrp/weapons/flashlight_on.wav",
DetachSound = "tacrp/weapons/flashlight_off.wav",
},
}
local function addsound(name, spath)
sound.Add({
name = name,
channel = 16,
volume = 1.0,
sound = spath
})
end
addsound("tacint_extras_glock.clip_in", path .. "clip_in.wav")
addsound("tacint_extras_glock.clip_in-mid", path .. "clip_in-mid.wav")
addsound("tacint_extras_glock.clip_out", path2 .. "magout.mp3")
addsound("tacint_extras_glock.slide_action", path .. "slide_action.wav")
addsound("tacint_extras_glock.slide_shut", path .. "slide_shut.wav")
addsound("tacint_extras_glock.cock_hammer", path .. "cockhammer.wav")