mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 21:53:46 +03:00
158 lines
11 KiB
Lua
158 lines
11 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/
|
||
|
|
--]]
|
||
|
|
|
||
|
|
AddCSLuaFile("shared.lua")
|
||
|
|
include('shared.lua')
|
||
|
|
/*-----------------------------------------------
|
||
|
|
*** 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.
|
||
|
|
-----------------------------------------------*/
|
||
|
|
ENT.Model = {"models/vj_hlr/hl1/icky.mdl"} -- The game will pick a random model from the table when the SNPC is spawned | Add as many as you want
|
||
|
|
ENT.StartHealth = 200
|
||
|
|
ENT.HullType = HULL_LARGE
|
||
|
|
ENT.TurningUseAllAxis = true -- If set to true, angles will not be restricted to y-axis, it will change all axes (plural axis)
|
||
|
|
ENT.MovementType = VJ_MOVETYPE_AQUATIC -- How does the SNPC move?
|
||
|
|
ENT.Aquatic_SwimmingSpeed_Calm = 80 -- The speed it should swim with, when it's wandering, moving slowly, etc. | Basically walking compared to ground SNPCs
|
||
|
|
ENT.Aquatic_SwimmingSpeed_Alerted = 500 -- The speed it should swim with, when it's chasing an enemy, moving away quickly, etc. | Basically running compared to ground SNPCs
|
||
|
|
ENT.Aquatic_AnimTbl_Calm = {ACT_WALK} -- Animations it plays when it's wandering around while idle
|
||
|
|
ENT.Aquatic_AnimTbl_Alerted = {ACT_RUN} -- Animations it plays when it's moving while alerted
|
||
|
|
ENT.VJC_Data = {
|
||
|
|
ThirdP_Offset = Vector(-25, 0, 0), -- The offset for the controller when the camera is in third person
|
||
|
|
FirstP_Bone = "Bip01 Head", -- If left empty, the base will attempt to calculate a position for first person
|
||
|
|
FirstP_Offset = Vector(12, 0, 5), -- The offset for the controller when the camera is in first person
|
||
|
|
FirstP_ShrinkBone = false, -- Should the bone shrink? Useful if the bone is obscuring the player's view
|
||
|
|
}
|
||
|
|
---------------------------------------------------------------------------------------------------------------------------------------------
|
||
|
|
ENT.VJ_NPC_Class = {"CLASS_XEN"} -- NPCs with the same class with be allied to each other
|
||
|
|
ENT.BloodColor = "Yellow" -- The blood type, this will determine what it should use (decal, particle, etc.)
|
||
|
|
ENT.CustomBlood_Particle = {"vj_hlr_blood_yellow"}
|
||
|
|
ENT.CustomBlood_Decal = {"VJ_HLR_Blood_Yellow"} -- Decals to spawn when it's damaged
|
||
|
|
ENT.HasBloodPool = false -- Does it have a blood pool?
|
||
|
|
ENT.HasMeleeAttack = true -- Should the SNPC have a melee attack?
|
||
|
|
ENT.MeleeAttackDamage = 35
|
||
|
|
ENT.MeleeAttackDamageType = DMG_ALWAYSGIB -- Type of Damage
|
||
|
|
ENT.AnimTbl_MeleeAttack = {ACT_MELEE_ATTACK1, ACT_MELEE_ATTACK2} -- Melee Attack Animations
|
||
|
|
ENT.TimeUntilMeleeAttackDamage = false -- This counted in seconds | This calculates the time until it hits something
|
||
|
|
ENT.MeleeAttackDistance = 50 -- How close does it have to be until it attacks?
|
||
|
|
ENT.MeleeAttackDamageDistance = 120 -- How far does the damage go?
|
||
|
|
ENT.HasDeathAnimation = true -- Does it play an animation when it dies?
|
||
|
|
ENT.AnimTbl_Death = {ACT_HOVER, ACT_DIEVIOLENT, ACT_DIESIMPLE} -- Death Animations
|
||
|
|
-- ====== Flinching Code ====== --
|
||
|
|
ENT.CanFlinch = 1 -- 0 = Don't flinch | 1 = Flinch at any damage | 2 = Flinch only from certain damages
|
||
|
|
ENT.AnimTbl_Flinch = {ACT_BIG_FLINCH} -- If it uses normal based animation, use this
|
||
|
|
-- ====== Sound File Paths ====== --
|
||
|
|
-- Leave blank if you don't want any sounds to play
|
||
|
|
ENT.SoundTbl_Idle = {"vj_hlr/hl1_npc/ichy/ichy_idle1.wav","vj_hlr/hl1_npc/ichy/ichy_idle2.wav","vj_hlr/hl1_npc/ichy/ichy_idle3.wav","vj_hlr/hl1_npc/ichy/ichy_idle4.wav"}
|
||
|
|
ENT.SoundTbl_Alert = {"vj_hlr/hl1_npc/ichy/ichy_alert1.wav","vj_hlr/hl1_npc/ichy/ichy_alert2.wav","vj_hlr/hl1_npc/ichy/ichy_alert3.wav"}
|
||
|
|
ENT.SoundTbl_CombatIdle = {"vj_hlr/hl1_npc/ichy/ichy_alert1.wav","vj_hlr/hl1_npc/ichy/ichy_alert2.wav","vj_hlr/hl1_npc/ichy/ichy_alert3.wav"}
|
||
|
|
ENT.SoundTbl_BeforeMeleeAttack = {"vj_hlr/hl1_npc/ichy/ichy_attack1.wav","vj_hlr/hl1_npc/ichy/ichy_attack2.wav"}
|
||
|
|
ENT.SoundTbl_MeleeAttack = {"vj_hlr/hl1_npc/ichy/ichy_bite1.wav","vj_hlr/hl1_npc/ichy/ichy_bite2.wav"}
|
||
|
|
ENT.SoundTbl_Pain = {"vj_hlr/hl1_npc/ichy/ichy_pain1.wav","vj_hlr/hl1_npc/ichy/ichy_pain2.wav","vj_hlr/hl1_npc/ichy/ichy_pain3.wav","vj_hlr/hl1_npc/ichy/ichy_pain5.wav"}
|
||
|
|
ENT.SoundTbl_Death = {"vj_hlr/hl1_npc/ichy/ichy_die1.wav","vj_hlr/hl1_npc/ichy/ichy_die2.wav","vj_hlr/hl1_npc/ichy/ichy_die3.wav","vj_hlr/hl1_npc/ichy/ichy_die4.wav"}
|
||
|
|
|
||
|
|
ENT.GeneralSoundPitch1 = 100
|
||
|
|
|
||
|
|
-- Custom
|
||
|
|
ENT.Icky_BlinkingT = 0
|
||
|
|
---------------------------------------------------------------------------------------------------------------------------------------------
|
||
|
|
function ENT:CustomOnInitialize()
|
||
|
|
self:SetCollisionBounds(Vector(40, 40 , 60), Vector(-40, -40, 0))
|
||
|
|
end
|
||
|
|
---------------------------------------------------------------------------------------------------------------------------------------------
|
||
|
|
function ENT:CustomOnAcceptInput(key, activator, caller, data)
|
||
|
|
//print(key)
|
||
|
|
if key == "mm_tasty" then
|
||
|
|
self:MeleeAttackCode()
|
||
|
|
end
|
||
|
|
end
|
||
|
|
---------------------------------------------------------------------------------------------------------------------------------------------
|
||
|
|
function ENT:CustomOnThink()
|
||
|
|
-- Blinking system
|
||
|
|
if !self.Dead && CurTime() > self.Icky_BlinkingT then
|
||
|
|
self:SetSkin(4)
|
||
|
|
timer.Simple(0.2, function() if IsValid(self) then self:SetSkin(3) end end)
|
||
|
|
timer.Simple(0.3, function() if IsValid(self) then self:SetSkin(2) end end)
|
||
|
|
timer.Simple(0.4, function() if IsValid(self) then self:SetSkin(3) end end)
|
||
|
|
timer.Simple(0.5, function()
|
||
|
|
if IsValid(self) then
|
||
|
|
if IsValid(self:GetEnemy()) then
|
||
|
|
self:SetSkin(0)
|
||
|
|
else
|
||
|
|
self:SetSkin(1)
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end)
|
||
|
|
self.Icky_BlinkingT = CurTime() + math.Rand(2, 3.5)
|
||
|
|
end
|
||
|
|
end
|
||
|
|
---------------------------------------------------------------------------------------------------------------------------------------------
|
||
|
|
function ENT:CustomOnMeleeAttack_AfterChecks(hitEnt)
|
||
|
|
-- Increase its health when it deals damage (Up to 2x its max health)
|
||
|
|
-- If the enemy is less health than its melee attack, then use the enemy's health as the addition
|
||
|
|
self:SetHealth(math.Clamp(self:Health() + ((self.MeleeAttackDamage > hitEnt:Health() and hitEnt:Health()) or self.MeleeAttackDamage), self:Health(), self:GetMaxHealth()*2))
|
||
|
|
end
|
||
|
|
---------------------------------------------------------------------------------------------------------------------------------------------
|
||
|
|
function ENT:SetUpGibesOnDeath(dmginfo, hitgroup)
|
||
|
|
self.HasDeathSounds = false
|
||
|
|
if self.HasGibDeathParticles == true then
|
||
|
|
local effectBlood = EffectData()
|
||
|
|
effectBlood:SetOrigin(self:GetPos() + self:OBBCenter())
|
||
|
|
effectBlood:SetColor(VJ_Color2Byte(Color(255,221,35)))
|
||
|
|
effectBlood:SetScale(120)
|
||
|
|
util.Effect("VJ_Blood1",effectBlood)
|
||
|
|
|
||
|
|
local bloodspray = EffectData()
|
||
|
|
bloodspray:SetOrigin(self:GetPos() + self:OBBCenter())
|
||
|
|
bloodspray:SetScale(8)
|
||
|
|
bloodspray:SetFlags(3)
|
||
|
|
bloodspray:SetColor(1)
|
||
|
|
util.Effect("bloodspray",bloodspray)
|
||
|
|
util.Effect("bloodspray",bloodspray)
|
||
|
|
|
||
|
|
local effectdata = EffectData()
|
||
|
|
effectdata:SetOrigin(self:GetPos() + self:OBBCenter())
|
||
|
|
effectdata:SetScale(1)
|
||
|
|
util.Effect("StriderBlood",effectdata)
|
||
|
|
util.Effect("StriderBlood",effectdata)
|
||
|
|
end
|
||
|
|
|
||
|
|
self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib1.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(1,0,20))})
|
||
|
|
self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib2.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(2,0,20))})
|
||
|
|
self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib3.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(3,0,20))})
|
||
|
|
self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib4.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(4,0,20))})
|
||
|
|
self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib1.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,1,20))})
|
||
|
|
self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib2.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,2,20))})
|
||
|
|
self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib3.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,3,20))})
|
||
|
|
self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib4.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,4,20))})
|
||
|
|
self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib1.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,5,20))})
|
||
|
|
self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib2.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(1,1,20))})
|
||
|
|
self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib3.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(1,2,20))})
|
||
|
|
self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib4.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(2,1,20))})
|
||
|
|
self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib5.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(2,2,20))})
|
||
|
|
self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib6.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(3,2,20))})
|
||
|
|
self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib7.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(2,3,20))})
|
||
|
|
self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib8.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(1,3,20))})
|
||
|
|
self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib9.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(3,1,20))})
|
||
|
|
self:CreateGibEntity("obj_vj_gib","models/vj_hlr/gibs/agib10.mdl",{BloodType="Yellow",BloodDecal="VJ_HLR_Blood_Yellow",Pos=self:LocalToWorld(Vector(0,0,20))})
|
||
|
|
return true -- Return to true if it gibbed!
|
||
|
|
end
|
||
|
|
---------------------------------------------------------------------------------------------------------------------------------------------
|
||
|
|
function ENT:CustomGibOnDeathSounds(dmginfo, hitgroup)
|
||
|
|
VJ_EmitSound(self, "vj_gib/default_gib_splat.wav", 90, 100)
|
||
|
|
return false
|
||
|
|
end
|
||
|
|
---------------------------------------------------------------------------------------------------------------------------------------------
|
||
|
|
local gibs = {"models/vj_hlr/gibs/agib1.mdl", "models/vj_hlr/gibs/agib2.mdl", "models/vj_hlr/gibs/agib3.mdl", "models/vj_hlr/gibs/agib4.mdl", "models/vj_hlr/gibs/agib1.mdl", "models/vj_hlr/gibs/agib2.mdl", "models/vj_hlr/gibs/agib3.mdl", "models/vj_hlr/gibs/agib4.mdl"}
|
||
|
|
--
|
||
|
|
function ENT:CustomOnDeath_AfterCorpseSpawned(dmginfo, hitgroup, corpseEnt)
|
||
|
|
corpseEnt:SetSkin(2)
|
||
|
|
VJ_HLR_ApplyCorpseEffects(self, corpseEnt, nil, {ExtraGibs = gibs})
|
||
|
|
end
|