--[[ | 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/ --]] /*-------------------------------------------------- *** Copyright (c) 2012-2023 by DrVrej, All rights reserved. *** No parts of this code or any of its contents may be reproduced, copied, modified or adapted, without the prior written consent of the author, unless otherwise indicated for stand-alone materials. --------------------------------------------------*/ AddCSLuaFile() ENT.Type = "anim" ENT.Base = "obj_vj_projectile_base" ENT.PrintName = "Crossbow Bolt" ENT.Author = "Cpt. Hazama" ENT.Contact = "http://steamcommunity.com/groups/vrejgaming" ENT.Information = "Projectiles for my addons" ENT.Category = "Projectiles" if CLIENT then local Name = "Crossbow Bolt" local LangName = "obj_vj_hlr1_crossbowbolt" language.Add(LangName, Name) killicon.Add(LangName,"HUD/killicons/default",Color(255,80,0,255)) language.Add("#"..LangName, Name) killicon.Add("#"..LangName,"HUD/killicons/default",Color(255,80,0,255)) end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ if !SERVER then return end ENT.Model = {"models/vj_hlr/hl1/crossbow_bolt.mdl"} -- The models it should spawn with | Picks a random one from the table ENT.DoesDirectDamage = true -- Should it do a direct damage when it hits something? ENT.DirectDamage = 50 -- How much damage should it do when it hits something ENT.DirectDamageType = DMG_SLASH -- Damage type ENT.DecalTbl_DeathDecals = {"Impact.Concrete"} ENT.SoundTbl_OnCollide = {"vj_hlr/hl1_weapon/crossbow/xbow_hit1.wav"} --------------------------------------------------------------------------------------------------------------------------------------------- function ENT:CustomPhysicsObjectOnInitialize(phys) phys:SetMass(1) phys:EnableGravity(false) phys:EnableDrag(false) phys:SetBuoyancyRatio(0) end --------------------------------------------------------------------------------------------------------------------------------------------- function ENT:CustomOnPhysicsCollide(data, phys) if IsValid(data.HitEntity) then self.SoundTbl_OnCollide = {"vj_hlr/hl1_weapon/crossbow/xbow_hitbod1.wav","vj_hlr/hl1_weapon/crossbow/xbow_hitbod2.wav"} else local spike = ents.Create("prop_dynamic") spike:SetModel("models/vj_hlr/hl1/crossbow_bolt.mdl") spike:SetPos(data.HitPos + data.HitNormal + self:GetForward()*-20) spike:SetAngles(self:GetAngles()) spike:Activate() spike:Spawn() timer.Simple(6,function() if IsValid(spike) then spike:Remove() end end) end end