mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-16 13:23:46 +03:00
99 lines
4.7 KiB
Lua
99 lines
4.7 KiB
Lua
--[[
|
|
| 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 = "40mm Grenade"
|
|
ENT.Author = "DrVrej"
|
|
ENT.Contact = "http://steamcommunity.com/groups/vrejgaming"
|
|
ENT.Information = "Projectiles for my addons"
|
|
ENT.Category = "VJ Base"
|
|
|
|
ENT.VJ_IsDetectableDanger = true
|
|
|
|
if CLIENT then
|
|
local Name = "40mm Grenade"
|
|
local LangName = "obj_vj_hlr1_grenade_40mm"
|
|
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/weapons/grenade.mdl"} -- The models it should spawn with | Picks a random one from the table
|
|
|
|
ENT.DoesRadiusDamage = true -- Should it do a blast damage when it hits something?
|
|
ENT.RadiusDamageRadius = 150 -- How far the damage go? The farther away it's from its enemy, the less damage it will do | Counted in world units
|
|
ENT.RadiusDamage = 80 -- How much damage should it deal? Remember this is a radius damage, therefore it will do less damage the farther away the entity is from its enemy
|
|
ENT.RadiusDamageUseRealisticRadius = true -- Should the damage decrease the farther away the enemy is from the position that the projectile hit?
|
|
ENT.RadiusDamageType = DMG_BLAST -- Damage type
|
|
ENT.RadiusDamageForce = 90 -- Put the force amount it should apply | false = Don't apply any force
|
|
ENT.DecalTbl_DeathDecals = {"VJ_HLR_Scorch"} -- Decals that paint when the projectile dies | It picks a random one from this table
|
|
ENT.SoundTbl_OnRemove = {"vj_hlr/hl1_weapon/explosion/explode3.wav","vj_hlr/hl1_weapon/explosion/explode4.wav","vj_hlr/hl1_weapon/explosion/explode5.wav"}
|
|
ENT.OnRemoveSoundLevel = 100
|
|
---------------------------------------------------------------------------------------------------------------------------------------------
|
|
function ENT:CustomOnPreInitialize()
|
|
if GetConVar("vj_hlr_hd"):GetInt() == 1 && VJ.HLR_HD_INSTALLED && self:GetClass() == "obj_vj_hlr1_grenade_40mm" then
|
|
self.Model = "models/vj_hlr/weapons/grenade_hd.mdl"
|
|
end
|
|
end
|
|
---------------------------------------------------------------------------------------------------------------------------------------------
|
|
function ENT:CustomPhysicsObjectOnInitialize(phys)
|
|
phys:Wake()
|
|
phys:SetMass(1)
|
|
phys:EnableGravity(true)
|
|
phys:EnableDrag(false)
|
|
phys:SetBuoyancyRatio(0)
|
|
phys:AddAngleVelocity(Vector(0,math.random(300,400),0))
|
|
end
|
|
---------------------------------------------------------------------------------------------------------------------------------------------
|
|
function ENT:DeathEffects(data, phys)
|
|
local spr = ents.Create("env_sprite")
|
|
spr:SetKeyValue("model","vj_hl/sprites/zerogxplode.vmt")
|
|
spr:SetKeyValue("GlowProxySize","2.0")
|
|
spr:SetKeyValue("HDRColorScale","1.0")
|
|
spr:SetKeyValue("renderfx","14")
|
|
spr:SetKeyValue("rendermode","5")
|
|
spr:SetKeyValue("renderamt","255")
|
|
spr:SetKeyValue("disablereceiveshadows","0")
|
|
spr:SetKeyValue("mindxlevel","0")
|
|
spr:SetKeyValue("maxdxlevel","0")
|
|
spr:SetKeyValue("framerate","15.0")
|
|
spr:SetKeyValue("spawnflags","0")
|
|
spr:SetKeyValue("scale","4")
|
|
spr:SetPos(self:GetPos() + Vector(0,0,90))
|
|
spr:Spawn()
|
|
spr:Fire("Kill","",0.9)
|
|
//timer.Simple(0.9,function() if IsValid(spr) then spr:Remove() end end)
|
|
|
|
VJ_EmitSound(self, "vj_hlr/hl1_weapon/explosion/debris"..math.random(1,3)..".wav", 80, 100)
|
|
VJ_EmitSound(self, "vj_hlr/hl1_weapon/explosion/explode"..math.random(3,5).."_dist.wav", 140, 100)
|
|
light = ents.Create("light_dynamic")
|
|
light:SetKeyValue("brightness", "4")
|
|
light:SetKeyValue("distance", "300")
|
|
light:SetLocalPos(self:GetPos())
|
|
light:SetLocalAngles( self:GetAngles() )
|
|
light:Fire("Color", "255 150 0")
|
|
light:SetParent(self)
|
|
light:Spawn()
|
|
light:Activate()
|
|
light:Fire("TurnOn", "", 0)
|
|
self:DeleteOnRemove(light)
|
|
util.ScreenShake(self:GetPos(), 100, 200, 1, 2500)
|
|
end |