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

409 lines
10 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 = "Karabiner 98k"
SWEP.AbbrevName = "Kar98k"
SWEP.Category = "[FT] Оружие"
SWEP.SubCatTier = "5Value"
SWEP.SubCatType = "6Marksman Rifle"
SWEP.Description = "Antique bolt-action rifle with an enduring design. Powerful up close, but is essentially obsolete on the modern battlefield."
SWEP.Description_Quote = "\"Do you want total war?\""
SWEP.Trivia_Caliber = "7.92x57mm Mauser"
SWEP.Trivia_Manufacturer = "Mauser"
SWEP.Trivia_Year = "1935"
SWEP.Faction = TacRP.FACTION_MILITIA
SWEP.Credits = [[
Model: Day of Defeat: Source, edited by 8Z
Texture: Cafe Rev., rascal, 5hifty
Sound: rzen1th
Animations: speedonerd
]]
SWEP.ViewModel = "models/weapons/tacint_extras/v_k98.mdl"
SWEP.WorldModel = "models/weapons/tacint_extras/w_k98.mdl"
SWEP.Slot = 2
SWEP.SlotAlt = 3
SWEP.BalanceStats = {
[TacRP.BALANCE_SBOX] = {
Damage_Max = 80,
Damage_Min = 55,
HipFireSpreadPenalty = 0.03,
Spread = 0.002,
RPM = 50,
ShootTimeMult = 0.75,
BodyDamageMultipliers = {
[HITGROUP_HEAD] = 3,
[HITGROUP_CHEST] = 1,
[HITGROUP_STOMACH] = 1.25,
[HITGROUP_LEFTARM] = 0.75,
[HITGROUP_RIGHTARM] = 0.75,
[HITGROUP_LEFTLEG] = 0.5,
[HITGROUP_RIGHTLEG] = 0.5,
[HITGROUP_GEAR] = 0.5
},
},
[TacRP.BALANCE_TTT] = {
Damage_Max = 70,
Damage_Min = 30,
Range_Min = 500,
Range_Max = 4000,
RPM = 35,
ShootTimeMult = 1.1,
Spread = 0.001,
BodyDamageMultipliers = {
[HITGROUP_HEAD] = 4,
[HITGROUP_CHEST] = 1.25,
[HITGROUP_STOMACH] = 1,
[HITGROUP_LEFTARM] = 0.75,
[HITGROUP_RIGHTARM] = 0.75,
[HITGROUP_LEFTLEG] = 0.5,
[HITGROUP_RIGHTLEG] = 0.5,
[HITGROUP_GEAR] = 0.5
},
},
[TacRP.BALANCE_PVE] = {
Damage_Max = 50,
Damage_Min = 30,
},
[TacRP.BALANCE_OLDSCHOOL] = {
HipFireSpreadPenalty = 0.01,
}
}
SWEP.TTTReplace = TacRP.TTTReplacePreset.SniperRifle
// "ballistics"
SWEP.Damage_Max = 85
SWEP.Damage_Min = 46
SWEP.Range_Min = 300
SWEP.Range_Max = 2800
SWEP.Penetration = 12
SWEP.ArmorPenetration = 0.8
SWEP.ArmorBonus = 1
SWEP.BodyDamageMultipliers = {
[HITGROUP_HEAD] = 2,
[HITGROUP_CHEST] = 1,
[HITGROUP_STOMACH] = 1,
[HITGROUP_LEFTARM] = 0.75,
[HITGROUP_RIGHTARM] = 0.75,
[HITGROUP_LEFTLEG] = 0.5,
[HITGROUP_RIGHTLEG] = 0.5,
[HITGROUP_GEAR] = 0.5
}
SWEP.MuzzleVelocity = 32000
// misc. shooting
SWEP.Firemode = 1
SWEP.FiremodeName = "Bolt-Action" // only used externally for firemode name distinction
SWEP.RPM = 45
SWEP.Spread = 0.004 // WW2 rifles weren't all that accurate...
SWEP.HipFireSpreadPenalty = 0.04
SWEP.PeekPenaltyFraction = 0.3
SWEP.RecoilPerShot = 1
SWEP.RecoilMaximum = 1
SWEP.RecoilResetTime = 0.2
SWEP.RecoilDissipationRate = 1
SWEP.RecoilFirstShotMult = 1 // multiplier for the first shot's recoil amount
SWEP.RecoilVisualKick = 5
SWEP.RecoilKick = 5
SWEP.RecoilSpreadPenalty = 0 // extra spread per one unit of recoil
SWEP.CanBlindFire = true
// handling
SWEP.MoveSpeedMult = 0.85
SWEP.ShootingSpeedMult = 0.75
SWEP.SightedSpeedMult = 0.55
SWEP.ReloadSpeedMult = 0.3
SWEP.AimDownSightsTime = 0.34
SWEP.SprintToFireTime = 0.4
SWEP.Sway = 1
SWEP.ScopedSway = 0.1
SWEP.FreeAimMaxAngle = 7
// hold types
SWEP.HoldType = "ar2"
SWEP.HoldTypeSprint = "passive"
SWEP.HoldTypeBlindFire = false
SWEP.HoldTypeNPC = "shotgun"
SWEP.GestureShoot = ACT_HL2MP_GESTURE_RANGE_ATTACK_CROSSBOW
SWEP.GestureReload = ACT_HL2MP_GESTURE_RELOAD_SHOTGUN
SWEP.PassiveAng = Angle(0, 2, 0)
SWEP.PassivePos = Vector(0, 1, -0.5)
SWEP.BlindFireAng = Angle(0, 0, -45)
SWEP.BlindFirePos = Vector(1, 0, 5)
SWEP.BlindFireLeftAng = Angle(75, 0, -20)
SWEP.BlindFireLeftPos = Vector(8, 10, -2)
SWEP.BlindFireRightAng = Angle(-75, 0, -45)
SWEP.BlindFireRightPos = Vector(-9, 17, -5)
SWEP.BlindFireSuicideAng = Angle(0, 115, 0)
SWEP.BlindFireSuicidePos = Vector(-4.5, 25, -45)
SWEP.SprintAng = Angle(30, -15, 0)
SWEP.SprintPos = Vector(2, 4.5, 0.75)
SWEP.SightAng = Angle(0, 0.4, 0)
SWEP.SightPos = Vector(-4.72, 1, 2.15)
SWEP.CorrectivePos = Vector(0.05, 0, 0.2)
SWEP.CorrectiveAng = Angle(0.1, -0.3, 0)
SWEP.CustomizePos = Vector(4, 3, -1.5)
SWEP.CustomizeAng = Angle(30, 15, 0)
SWEP.HolsterVisible = true
SWEP.HolsterSlot = TacRP.HOLSTER_SLOT_BACK2
SWEP.HolsterPos = Vector(5, 4, -6)
SWEP.HolsterAng = Angle(0, 0, 0)
// scope
SWEP.Scope = true
SWEP.ScopeFOV = 90 / 1.25
// reload
-- Устанавливаем размер магазина и начальное кол-во патрон на 0
SWEP.ClipSize = 5
SWEP.DefaultAmmo = 0
SWEP.Ammo = "ar2"
-- Принудительное обнуление при создании (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.Ammo_Expanded = "ti_rifle"
SWEP.ShotgunReload = true
SWEP.ShotgunThreeload = false
SWEP.ShotgunFullCancel = true
SWEP.ShotgunNoReverseStart = true
SWEP.ReloadTimeMult = 0.8
SWEP.ShootTimeMult = 0.65
SWEP.DropMagazineModel = false
SWEP.ShotgunUpInTime = 2.3
SWEP.ReloadUpInTime = 2.2
SWEP.BulletBodygroups = {
[1] = {1, 1},
[2] = {1, 0},
}
// sounds
// local path = "TacRP/weapons/spr/"
local path1 = "tacint_extras/k98/"
SWEP.Sound_Shoot = "^" .. path1 .. "scout_fire-1.wav"
SWEP.Sound_Shoot_Silenced = "TacRP/weapons/ak47/ak47_fire_silenced-1.wav"
SWEP.Vol_Shoot = 130
SWEP.ShootPitchVariance = 2.5 // amount to vary pitch by each shot
// effects
// the .qc attachment for the muzzle
SWEP.QCA_Muzzle = 1
// ditto for shell
SWEP.QCA_Eject = 2
SWEP.MuzzleEffect = "muzzleflash_1"
SWEP.EjectEffect = 2
SWEP.EjectDelay = 0.7
// anims
SWEP.AnimationTranslationTable = {
["deploy"] = "draw",
["fire"] = {"shoot1", "shoot2"},
["blind_idle"] = "idle",
["blind_dryfire"] = "dryfire",
["blind_fire"] = "shoot1",
["reload"] = "reload",
["reload_finish"] = "reload_end",
["reload_clip"] = "reload_clip",
["melee"] = {"melee1", "melee2"},
--["melee"] = "melee_bayonet",
["dryfire"] = "dryfire",
["jam"] = "reload_end"
}
// attachments
SWEP.AttachmentElements = {
["optic"] = {
BGs_VM = {
{2, 1}
},
BGs_WM = {
{1, 1}
},
},
["optic_clip"] = {
BGs_VM = {
{2, 0}
},
BGs_WM = {
{1, 0}
},
},
["scope"] = {
BGs_VM = {
{2, 2}
},
BGs_WM = {
{1, 2},
{2, 1}
},
},
}
SWEP.Attachments = {
[1] = {
PrintName = "Top",
Category = {"optic_cqb_nookp7", "optic_okp7", "optic_medium", "optic_kar98", "stripper_clip"},
WMBone = "Bone02",
Bone = "k98_root",
AttachSound = "TacRP/weapons/optic_on.wav",
DetachSound = "TacRP/weapons/optic_off.wav",
InstalledElements = {"optic"},
VMScale = 0.9,
Pos_VM = Vector(0.05, -2.8, 7),
Ang_VM = Angle(90, 0, -90),
Pos_WM = Vector(0, 1.25, -5.6),
Ang_WM = Angle(0, 0, 180),
},
[2] = {
PrintName = "Muzzle",
Category = "silencer",
WMBone = "Bone02",
Bone = "k98_root",
AttachSound = "TacRP/weapons/silencer_on.wav",
DetachSound = "TacRP/weapons/silencer_off.wav",
VMScale = 0.75,
WMScale = 0.75,
Pos_VM = Vector(-0.03, -1.45, 34),
Pos_WM = Vector(25.5, 1.2, -4.9),
Ang_VM = Angle(90, 0, -90),
Ang_WM = Angle(0, 0, 180),
},
[3] = {
PrintName = "Tactical",
Category = {"tactical", "tactical_zoom"},
WMBone = "Bone02",
Bone = "k98_root",
AttachSound = "TacRP/weapons/flashlight_on.wav",
DetachSound = "TacRP/weapons/flashlight_off.wav",
InstalledElements = {"tactical"},
Pos_VM = Vector(-0.5, -1, 22),
Pos_WM = Vector(8, 2, -4),
Ang_VM = Angle(90, 0, 0),
Ang_WM = Angle(0, 0, 90),
},
[4] = {
PrintName = "Accessory",
Category = {"acc", "acc_sling", "acc_duffle", "acc_bipod"},
AttachSound = "TacRP/weapons/flashlight_on.wav",
DetachSound = "TacRP/weapons/flashlight_off.wav",
},
[5] = {
PrintName = "Bolt",
Category = {"bolt_manual"},
AttachSound = "TacRP/weapons/flashlight_on.wav",
DetachSound = "TacRP/weapons/flashlight_off.wav",
},
[6] = {
PrintName = "Trigger",
Category = {"trigger_manual"},
AttachSound = "TacRP/weapons/flashlight_on.wav",
DetachSound = "TacRP/weapons/flashlight_off.wav",
},
[7] = {
PrintName = "Ammo",
Category = {"ammo_rifle"},
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 = CHAN_AUTO,
volume = 1.0,
sound = spath
})
end
addsound("tacint_extras_k98.Clip_Out", path1 .. "magout.wav")
addsound("tacint_extras_k98.Clip_In", path1 .. "magin.wav")
addsound("tacint_extras_k98.CockBack", path1 .. "boltback.wav")
addsound("tacint_extras_k98.CockForward", path1 .. "boltforward.wav")
addsound("tacint_extras_k98.safety", path1 .. "magrelease.wav")
addsound("tacint_extras_k98.InsertShell", path1 .. "roundinsert.wav")
addsound("tacint_extras_k98.ClipIn", path1 .. "clipin2.wav")
addsound("tacint_extras_k98.ClipIn2", path1 .. "roundinsert_clip.wav")
addsound("tacint_extras_k98.bolt_up", path1 .. "boltup.wav")
addsound("tacint_extras_k98.bolt_down", path1 .. "boltdown.wav")
--addsound("tacint_extras_k98.bolt_up", path1 .. "boltlatch.wav")
--addsound("tacint_extras_k98.bolt_down", path1 .. "boltrelease.wav")