mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-16 21:33:46 +03:00
73 lines
3.2 KiB
Lua
73 lines
3.2 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 = "Gene Worm Biotoxin"
|
|
ENT.Author = "DrVrej"
|
|
ENT.Contact = "http://steamcommunity.com/groups/vrejgaming"
|
|
ENT.Information = "Projectiles for my addons"
|
|
ENT.Category = "Projectiles"
|
|
|
|
if CLIENT then
|
|
local Name = "Gene Worm Biotoxin"
|
|
local LangName = "obj_vj_hlrof_gw_biotoxin"
|
|
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/spitball_large.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 = 20 -- How much damage should it do when it hits something
|
|
ENT.DirectDamageType = DMG_ACID -- Damage type
|
|
ENT.DelayedRemove = 1.5 -- Change this to a number greater than 0 to delay the removal of the entity
|
|
ENT.SoundTbl_OnCollide = {}
|
|
ENT.SoundTbl_Idle = {}
|
|
|
|
-- Custom
|
|
ENT.Track_Enemy = NULL
|
|
ENT.Track_TrackTime = 0
|
|
ENT.Track_OrgPosition = Vector(0, 0, 0)
|
|
---------------------------------------------------------------------------------------------------------------------------------------------
|
|
function ENT:CustomPhysicsObjectOnInitialize(phys)
|
|
phys:Wake()
|
|
phys:SetMass(1)
|
|
phys:SetBuoyancyRatio(0)
|
|
phys:EnableDrag(false)
|
|
phys:EnableGravity(false)
|
|
end
|
|
---------------------------------------------------------------------------------------------------------------------------------------------
|
|
function ENT:CustomOnInitialize()
|
|
self:SetNoDraw(true)
|
|
|
|
ParticleEffectAttach("vj_hlr_geneworm_spit", PATTACH_ABSORIGIN_FOLLOW, self, 0)
|
|
end
|
|
---------------------------------------------------------------------------------------------------------------------------------------------
|
|
function ENT:CustomOnThink()
|
|
if CurTime() > self.Track_TrackTime then return end
|
|
if IsValid(self.Track_Enemy) then
|
|
if self.Track_Enemy:GetPos():Distance(self.Track_OrgPosition) > 500 then return end -- If enemy moves to far from org position, then stop tracking
|
|
local phys = self:GetPhysicsObject()
|
|
if IsValid(phys) then
|
|
phys:SetVelocity(self:CalculateProjectile("Line", self:GetPos(), self.Track_Enemy:GetPos() + self.Track_Enemy:OBBCenter(), 2000))
|
|
end
|
|
end
|
|
end |