Files
wnsrc/lua/weapons/weapon_vj_ar3_hl2/shared.lua

205 lines
8.0 KiB
Lua
Raw Permalink Normal View History

2024-08-04 23:54:45 +03:00
--[[
| 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/
--]]
if (!file.Exists("autorun/vj_base_autorun.lua","LUA")) then return end
---------------------------------------------------------------------------------------------------------------------------------------------
SWEP.Base = "weapon_vj_base"
SWEP.PrintName = "AR3"
SWEP.Author = "Comrade Communist"
SWEP.Contact = "http://steamcommunity.com/groups/vrejgaming"
SWEP.Purpose = "This weapon is made for Players and NPCs"
SWEP.Instructions = "Controls are like a regular weapon."
SWEP.Category = "VJ Base"
-- Client Settings ---------------------------------------------------------------------------------------------------------------------------------------------
if (CLIENT) then
SWEP.Slot = 2 -- Which weapon slot you want your SWEP to be in? (1 2 3 4 5 6)
SWEP.SlotPos = 4 -- Which part of that slot do you want the SWEP to be in? (1 2 3 4 5 6)
SWEP.UseHands = true
end
-- NPC Settings ---------------------------------------------------------------------------------------------------------------------------------------------
SWEP.NPC_NextPrimaryFire = 0.5 -- Next time it can use primary fire
SWEP.NPC_TimeUntilFire = 0.01 -- How much time until the bullet/projectile is fired?
SWEP.NPC_TimeUntilFireExtraTimers = {0.1,0.2,0.3,0.4,0.5,0.6} -- Extra timers, which will make the gun fire again! | The seconds are counted after the self.NPC_TimeUntilFire!
-- Main Settings ---------------------------------------------------------------------------------------------------------------------------------------------
SWEP.ViewModel = "models/weapons/c_ar3.mdl"
SWEP.WorldModel = "models/weapons/w_ar3.mdl"
SWEP.HoldType = "smg"
SWEP.Spawnable = true
SWEP.AdminSpawnable = false
SWEP.NPC_CustomSpread = 0.3
-- Primary Fire ---------------------------------------------------------------------------------------------------------------------------------------------
SWEP.Primary.Damage = math.random(9,12) -- Damage
SWEP.Primary.Force = 1 -- Force applied on the object the bullet hits
SWEP.Primary.ClipSize = 300 -- Max amount of bullets per clip
SWEP.Primary.Delay = 0.01 -- Time until it can shoot again
SWEP.Primary.TracerType = "AirboatGunTracer" -- Tracer type (Examples: AR2, laster, 9mm)
SWEP.Primary.Automatic = true -- Is it automatic?
SWEP.Primary.Ammo = "AR2" -- Ammo type
SWEP.Primary.Sound = {"Weapon_AR2.NPC_Single"}
SWEP.Primary.HasDistantSound = true -- Does it have a distant sound when the gun is shot?
SWEP.Primary.DistantSound = {"Weapon_AR2.NPC_Single"}
SWEP.PrimaryEffects_MuzzleParticles = {"vj_rifle_full_blue"}
SWEP.PrimaryEffects_SpawnShells = false
SWEP.PrimaryEffects_DynamicLightColor = Color(0, 31, 225)
-- Reload Settings ---------------------------------------------------------------------------------------------------------------------------------------------
SWEP.HasReloadSound = false -- Does it have a reload sound? Remember even if this is set to false, the animation sound will still play!
SWEP.ReloadSound = "weapons/ar2/ar2_reload.wav"
SWEP.Reload_TimeUntilAmmoIsSet = 0.8 -- Time until ammo is set to the weapon
SWEP.Reload_TimeUntilFinished = 1.8 -- How much time until the player can play idle animation, shoot, etc.
-- Idle Settings ---------------------------------------------------------------------------------------------------------------------------------------------
SWEP.HasIdleAnimation = true -- Does it have a idle animation?
SWEP.AnimTbl_Idle = {ACT_VM_IDLE}
SWEP.NextIdle_Deploy = 0.01 -- How much time until it plays the idle animation after the weapon gets deployed
SWEP.NextIdle_PrimaryAttack = 0.01 -- How much time until it plays the idle animation after attacking(Primary)
function SWEP:CustomOnThink()
if self.Owner.SquadName == "resistance" then
if self.Owner.FollowingPlayer == false then
self.Owner.AnimTbl_IdleStand = {ACT_IDLE}
self.Owner.AnimTbl_Run = {ACT_RUN_RPG}
self.Owner.AnimTbl_Walk = {ACT_WALK_RIFLE_RELAXED}
end
if self.Owner.FollowingPlayer == true then
self.Owner.AnimTbl_IdleStand = {ACT_IDLE}
self.Owner.AnimTbl_Run = {ACT_RUN_RPG}
self.Owner.AnimTbl_Walk = {ACT_WALK_RPG_RELAXED}
end
end
if self.Owner.SquadName == "metrocop" then
if self.Owner.FollowingPlayer == false then
self.Owner.AnimTbl_IdleStand = {ACT_IDLE_SMG1}
self.Owner.AnimTbl_Run = {ACT_RUN_RIFLE}
self.Owner.AnimTbl_Walk = {ACT_WALK_RIFLE}
end
if self.Owner.FollowingPlayer == true then
self.Owner.AnimTbl_IdleStand = {ACT_IDLE_SMG1}
self.Owner.AnimTbl_Run = {ACT_WALK_RIFLE}
self.Owner.AnimTbl_Walk = {ACT_WALK_RIFLE}
end
end
if self.Owner.SquadName == "combine" then
if self.Owner.FollowingPlayer == false then
self.Owner.AnimTbl_IdleStand = {ACT_IDLE_SMG1}
self.Owner.AnimTbl_Run = {ACT_RUN_RIFLE}
self.Owner.AnimTbl_Walk = {ACT_WALK_RIFLE}
end
if self.Owner.FollowingPlayer == true then
self.Owner.AnimTbl_IdleStand = {ACT_IDLE_ANGRY_SMG1}
self.Owner.AnimTbl_Run = {ACT_RUN_RIFLE}
self.Owner.AnimTbl_Walk = {ACT_WALK_RIFLE}
end
end
if self.Owner.SquadName == "combine_elit" then
if self.Owner.FollowingPlayer == false then
self.Owner.AnimTbl_IdleStand = {ACT_IDLE_SMG1}
self.Owner.AnimTbl_Run = {ACT_RUN_RIFLE}
self.Owner.AnimTbl_Walk = {ACT_WALK_RIFLE}
end
if self.Owner.FollowingPlayer == true then
self.Owner.AnimTbl_IdleStand = {ACT_IDLE_ANGRY_SMG1}
self.Owner.AnimTbl_Run = {ACT_RUN_RIFLE}
self.Owner.AnimTbl_Walk = {ACT_WALK_RIFLE}
end
end
if self.Owner.SquadName == "combine_nova" then
if self.Owner.FollowingPlayer == false then
self.Owner.AnimTbl_IdleStand = {ACT_IDLE_SMG1}
self.Owner.AnimTbl_Run = {ACT_RUN_RIFLE}
self.Owner.AnimTbl_Walk = {ACT_IDLE_SMG1}
end
if self.Owner.FollowingPlayer == true then
self.Owner.AnimTbl_IdleStand = {ACT_IDLE_ANGRY_SMG1}
self.Owner.AnimTbl_Run = {ACT_RUN_RIFLE}
self.Owner.AnimTbl_Walk = {ACT_WALK_RIFLE}
end
end
if self.Owner.SquadName == "metrocops" then
if self.Owner.FollowingPlayer == false then
self.Owner.AnimTbl_Run = {ACT_RUN}
self.Owner.AnimTbl_IdleStand = {ACT_IDLE}
self.Owner.AnimTbl_Walk = {ACT_IDLE}
end
if self.Owner.FollowingPlayer == true then
self.Owner.AnimTbl_IdleStand = {ACT_IDLE_SMG1}
self.Owner.AnimTbl_Run = {ACT_RUN_RIFLE}
self.Owner.AnimTbl_Walk = {ACT_WALK_RIFLE}
end
end
end
function SWEP:PrimaryAttackEffects()
local vjeffectmuz = EffectData()
vjeffectmuz:SetOrigin(self.Owner:GetShootPos())
vjeffectmuz:SetEntity(self.Weapon)
vjeffectmuz:SetStart(self.Owner:GetShootPos())
vjeffectmuz:SetNormal(self.Owner:GetAimVector())
vjeffectmuz:SetAttachment(1)
vjeffectmuz:SetMagnitude(0)
util.Effect("VJ_Weapon_RifleMuzzle1",vjeffectmuz)
if GetConVarNumber("vj_wep_nobulletshells") == 0 then
if !self.Owner:IsPlayer() then
local vjeffect = EffectData()
vjeffect:SetEntity(self.Weapon)
vjeffect:SetOrigin(self.Owner:GetShootPos())
vjeffect:SetNormal(self.Owner:GetAimVector())
vjeffect:SetAttachment(1)
util.Effect("VJ_Weapon_RifleShell1",vjeffect) end
end
if (SERVER) then
if GetConVarNumber("vj_wep_nomuszzleflash") == 0 then
local FireLight1 = ents.Create("light_dynamic")
FireLight1:SetKeyValue("brightness", "2")
if self.Owner:IsPlayer() then
FireLight1:SetKeyValue("distance", "200") else FireLight1:SetKeyValue("distance", "150") end
FireLight1:SetLocalPos(self.Owner:GetShootPos() +self:GetForward()*40 + self:GetUp()*-40)
FireLight1:SetLocalAngles(self:GetAngles())
FireLight1:Fire("Color", "255 150 60")
FireLight1:SetParent(self)
FireLight1:Spawn()
FireLight1:Activate()
FireLight1:Fire("TurnOn", "", 0)
self:DeleteOnRemove(FireLight1)
timer.Simple(0.07,function() if self:IsValid() then FireLight1:Remove() end end)
end
end
end
function SWEP:CustomOnPrimaryAttack_BulletCallback(attacker,tr,dmginfo)
local dm = math.random(1,2)
if ( dm == 1 ) then
dmginfo:SetDamageType(DMG_BLAST)
elseif ( dm == 2 ) then
dmginfo:SetDamageType(DMG_AIRBOAT)
else
end
end