This commit is contained in:
lifestorm
2024-08-04 23:54:45 +03:00
parent 8064ba84d8
commit 6a58f406b1
7522 changed files with 4011896 additions and 15 deletions

View File

@@ -0,0 +1,330 @@
--[[
| 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' )
include( 'outputs.lua' )
FRAG_GRENADE_BLIP_FREQUENCY_HL2R = 1.0
FRAG_GRENADE_BLIP_FAST_FREQUENCY_HL2R = 0.3
FRAG_GRENADE_GRACE_TIME_AFTER_PICKUP_HL2R = 1.5
FRAG_GRENADE_WARN_TIME_HL2R = 1.5
GRENADE_COEFFICIENT_OF_RESTITUTION_HL2R = 0.2;
local sk_plr_dmg_fraggrenade = 125;
local sk_npc_dmg_fraggrenade = 75;
local sk_fraggrenade_radius = 250;
GRENADE_MODEL_HL2R = "models/weapons/tfa_hl2r/w_grenade_thrown.mdl"
GLOW_CREATED_HL2R = FALSE;
function ENT:GetShakeAmplitude() return 25.0; end
function ENT:GetShakeRadius() return 750.0; end
// Damage accessors.
function ENT:GetDamage()
return self.m_flDamage;
end
function ENT:GetDamageRadius()
return self.m_DmgRadius;
end
function ENT:SetDamage(flDamage)
self.m_flDamage = flDamage;
end
function ENT:SetDamageRadius(flDamageRadius)
self.m_DmgRadius = flDamageRadius;
end
// Bounce sound accessors.
function ENT:SetBounceSound( pszBounceSound )
self.m_iszBounceSound = tostring( pszBounceSound );
end
function ENT:BlipSound()
local efdata = EffectData()
efdata:SetEntity(self)
efdata:SetFlags(1) -- regular beep
util.Effect("tfa_hl2r_frag_beeplight", efdata)
self.Entity:EmitSound( self.Sound.Blip );
end
// UNDONE: temporary scorching for PreAlpha - find a less sleazy permenant solution.
function ENT:Explode( pTrace, bitsDamageType )
if !( CLIENT ) then
self.Entity:SetModel( "" );//invisible
self.Entity:SetColor( color_transparent );
self.Entity:SetSolid( SOLID_NONE );
self.m_takedamage = DAMAGE_NO;
local vecAbsOrigin = self.Entity:GetPos();
local contents = util.PointContents ( vecAbsOrigin );
if ( pTrace.Fraction != 1.0 ) then
local vecNormal = pTrace.HitNormal;
local pdata = pTrace.MatType;
util.BlastDamage( self.Entity, // don't apply cl_interp delay
self:GetOwner(),
self.Entity:GetPos(),
self.m_DmgRadius,
self.m_flDamage );
else
util.BlastDamage( self.Entity, // don't apply cl_interp delay
self:GetOwner(),
self.Entity:GetPos(),
self.m_DmgRadius,
self.m_flDamage );
end
self:DoExplodeEffect();
self:OnExplode( pTrace );
self.Entity:EmitSound( self.Sound.Explode );
self.Touch = function( ... ) return end;
self.Entity:SetSolid( SOLID_NONE );
self.Entity:SetVelocity( self:GetPos() );
// Because the grenade is zipped out of the world instantly, the EXPLOSION sound that it makes for
// the AI is also immediately destroyed. For this reason, we now make the grenade entity inert and
// throw it away in 1/10th of a second instead of right away. Removing the grenade instantly causes
// intermittent bugs with env_microphones who are listening for explosions. They will 'randomly' not
// hear explosion sounds when the grenade is removed and the SoundEnt thinks (and removes the sound)
// before the env_microphone thinks and hears the sound.
SafeRemoveEntityDelayed( self.Entity, 0.1 );
end
end
function ENT:Detonate()
local tr;
local vecSpot;// trace starts here!
self.Think = function( ... ) return end;
if self:WaterLevel() < 3 then
local explode = ents.Create( "info_particle_system" )
explode:SetKeyValue( "effect_name", "hl2r_explosion_grenade_noaftersmoke" )
explode:SetOwner( self.Owner )
explode:SetPos( self:GetPos() )
explode:Spawn()
explode:Activate()
explode:Fire( "start", "", 0 )
explode:Fire( "kill", "", 30 )
end
vecSpot = self.Entity:GetPos() + Vector ( 0 , 0 , 8 );
tr = {};
tr.start = vecSpot;
tr.endpos = vecSpot + Vector ( 0, 0, -32 );
tr.mask = MASK_SHOT_HULL;
tr.filter = self.Entity;
tr.collision = COLLISION_GROUP_NONE;
tr = util.TraceLine ( tr);
if( tr.StartSolid ) then
// Since we blindly moved the explosion origin vertically, we may have inadvertently moved the explosion into a solid,
// in which case nothing is going to be harmed by the grenade's explosion because all subsequent traces will startsolid.
// If this is the case, we do the downward trace again from the actual origin of the grenade. (sjb) 3/8/2007 (for ep2_outland_09)
tr = {};
tr.start = self.Entity:GetPos();
tr.endpos = self.Entity:GetPos() + Vector( 0, 0, -32);
tr.mask = MASK_SHOT_HULL;
tr.filter = self.Entity;
tr.collision = COLLISION_GROUP_NONE;
tr = util.TraceLine( tr );
end
tr = self:Explode( tr, DMG_BLAST );
if ( self:GetShakeAmplitude() ) then
util.ScreenShake( self.Entity:GetPos(), self:GetShakeAmplitude(), 150.0, 1.0, self:GetShakeRadius() );
end
end
/*---------------------------------------------------------
Name: Initialize
---------------------------------------------------------*/
function ENT:Initialize()
self.m_hThrower = NULL;
self.m_hOriginalThrower = NULL;
self.m_bIsLive = false;
self.m_DmgRadius = 100;
self.m_flDetonateTime = CurTime() + GRENADE_TIMER_HL2R;
self.m_flWarnAITime = CurTime() + GRENADE_TIMER_HL2R - FRAG_GRENADE_WARN_TIME_HL2R;
self.m_bHasWarnedAI = false;
self:Precache( );
self.Entity:SetModel( GRENADE_MODEL_HL2R );
if( self:GetOwner() && self:GetOwner():IsPlayer() ) then
self.m_flDamage = sk_plr_dmg_fraggrenade;
self.m_DmgRadius = sk_fraggrenade_radius;
else
self.m_flDamage = sk_npc_dmg_fraggrenade;
self.m_DmgRadius = sk_fraggrenade_radius;
end
self.m_takedamage = DAMAGE_YES;
self.m_iHealth = 1;
self.Entity:SetCollisionBounds( -Vector(4,4,4), Vector(4,4,4) );
self:CreateVPhysics();
self:BlipSound();
self.m_flNextBlipTime = CurTime() + FRAG_GRENADE_BLIP_FREQUENCY_HL2R;
self.m_combineSpawned = false;
self.m_punted = false;
self:CreateEffects();
self:OnInitialize();
self.BaseClass:Initialize();
end
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
function ENT:OnRestore()
// If we were primed and ready to detonate, put FX on us.
if (self.m_flDetonateTime > 0) then
self:CreateEffects();
end
self.BaseClass:OnRestore();
end
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
function ENT:CreateEffects()
local nAttachment = self:LookupAttachment( "fuse" );
// Start up the eye trail
self.m_pGlowTrail = util.SpriteTrail( self.Entity, nAttachment, self.Trail.Color, true, self.Trail.StartWidth, self.Trail.EndWidth, self.Trail.LifeTime, 1 / ( self.Trail.StartWidth + self.Trail.EndWidth ) * 0.5, self.Trail.Material );
end
function ENT:CreateVPhysics()
// Create the object in the physics system
self.Entity:PhysicsInit( SOLID_VPHYSICS, 0, false );
local Phys = self:GetPhysicsObject()
if ( Phys ) then
Phys:SetMaterial( "grenade" )
end
return true;
end
function ENT:Precache()
util.PrecacheModel( GRENADE_MODEL_HL2R );
util.PrecacheSound( self.Sound.Blip );
util.PrecacheModel( "sprites/redglow1.vmt" );
util.PrecacheModel( self.Trail.Material );
util.PrecacheSound( self.Sound.Explode );
end
function ENT:SetTimer( detonateDelay, warnDelay )
self.m_flDetonateTime = CurTime() + detonateDelay;
self.m_flWarnAITime = CurTime() + warnDelay;
self.Entity:NextThink( CurTime() );
self:CreateEffects();
end
function ENT:Think()
self:OnThink()
if( CurTime() > self.m_flDetonateTime ) then
self:Detonate();
return;
end
if( !self.m_bHasWarnedAI && CurTime() >= self.m_flWarnAITime ) then
self.m_bHasWarnedAI = true;
end
if( CurTime() > self.m_flNextBlipTime ) then
self:BlipSound();
if( self.m_bHasWarnedAI ) then
self.m_flNextBlipTime = CurTime() + FRAG_GRENADE_BLIP_FAST_FREQUENCY_HL2R;
else
self.m_flNextBlipTime = CurTime() + FRAG_GRENADE_BLIP_FREQUENCY_HL2R;
end
end
self.Entity:NextThink( CurTime() + 0.1 );
end
function ENT:SetVelocity( velocity, angVelocity )
local pPhysicsObject = self:GetPhysicsObject();
if ( pPhysicsObject ) then
pPhysicsObject:AddVelocity( velocity );
pPhysicsObject:AddAngleVelocity( angVelocity );
end
end
/*---------------------------------------------------------
Name: OnTakeDamage
---------------------------------------------------------*/
function ENT:OnTakeDamage( dmginfo )
// Manually apply vphysics because BaseCombatCharacter takedamage doesn't call back to CBaseEntity OnTakeDamage
self.Entity:TakePhysicsDamage( dmginfo );
// Grenades only suffer blast damage and burn damage.
if( !(dmginfo:GetDamageType() == bit.bor( DMG_BLAST, DMG_BURN) ) ) then
return 0;
end
return self.BaseClass:OnTakeDamage( dmginfo );
end

View File

@@ -0,0 +1,84 @@
--[[
| 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/
--]]
ENT.Sound = {}
ENT.Sound.Blip = "TFA_HL2R_Grenade.Beep"
ENT.Sound.Explode = "BaseGrenade.Explode"
ENT.Trail = {}
ENT.Trail.Color = Color( 255, 0, 0, 255 )
ENT.Trail.Material = "sprites/bluelaser1.vmt"
ENT.Trail.StartWidth = 8.0
ENT.Trail.EndWidth = 1.0
ENT.Trail.LifeTime = 0.5
// Nice helper function, this does all the work.
/*---------------------------------------------------------
Name: DoExplodeEffect
---------------------------------------------------------*/
function ENT:DoExplodeEffect()
local info = EffectData();
info:SetEntity( self.Entity );
info:SetOrigin( self.Entity:GetPos() );
if self:WaterLevel() >= 3 then
util.Effect("WaterSurfaceExplosion", info)
end
--util.Effect( "Explosion", info );
self:EmitSound("BaseExplosionEffect.Sound")
util.Effect("tfa_hl2r_fx_explosion_dlight", info)
end
/*---------------------------------------------------------
Name: OnExplode
Desc: The grenade has just exploded.
---------------------------------------------------------*/
function ENT:OnExplode( pTrace )
local Pos1 = pTrace.HitPos + pTrace.HitNormal
local Pos2 = pTrace.HitPos - pTrace.HitNormal
util.Decal( "Scorch", Pos1, Pos2 );
end
/*---------------------------------------------------------
Name: OnInitialize
---------------------------------------------------------*/
function ENT:OnInitialize()
end
/*---------------------------------------------------------
Name: StartTouch
---------------------------------------------------------*/
function ENT:StartTouch( entity )
end
/*---------------------------------------------------------
Name: EndTouch
---------------------------------------------------------*/
function ENT:EndTouch( entity )
end
/*---------------------------------------------------------
Name: Touch
---------------------------------------------------------*/
function ENT:Touch( entity )
end
/*---------------------------------------------------------
Name: OnThink
---------------------------------------------------------*/
function ENT:OnThink()
end

View File

@@ -0,0 +1,17 @@
--[[
| 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/
--]]
ENT.Type = "anim"
ENT.Base = "base_anim"
ENT.PrintName = ""
ENT.Author = ""
ENT.Spawnable = false
ENT.AdminSpawnable = false

View File

@@ -0,0 +1,176 @@
--[[
| 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' )
include( 'outputs.lua' )
MAX_AR2_NO_COLLIDE_TIME = 0.2
AR2_GRENADE_MAX_DANGER_RADIUS = 300
// Moved to HL2_SharedGameRules because these are referenced by shared AmmoDef functions
local sk_plr_dmg_smg1_grenade = 100;
local sk_npc_dmg_smg1_grenade = 50;
local sk_max_smg1_grenade = 3;
local sk_smg1_grenade_radius = 250;
/*---------------------------------------------------------
Name: Initialize
---------------------------------------------------------*/
function ENT:Initialize()
self:Precache( );
self.Entity:SetModel( "models/Items/AR2_Grenade.mdl");
self.Entity:PhysicsInit( SOLID_VPHYSICS );
self.Entity:SetMoveCollide( MOVECOLLIDE_FLY_BOUNCE );
// Hits everything but debris
self.Entity:SetCollisionGroup( COLLISION_GROUP_PROJECTILE );
self.Entity:GetPhysicsObject():SetBuoyancyRatio( 0 )
self.Entity:SetCollisionBounds(Vector(-3, -3, -3), Vector(3, 3, 3));
// self.Entity:SetCollisionBounds(Vector(0, 0, 0), Vector(0, 0, 0));
self.Entity:NextThink( CurTime() + 0.1 );
if( self:GetOwner() && self:GetOwner():IsPlayer() ) then
self.m_flDamage = sk_plr_dmg_smg1_grenade;
else
self.m_flDamage = sk_npc_dmg_smg1_grenade;
end
self.m_DmgRadius = sk_smg1_grenade_radius;
self.m_takedamage = DAMAGE_YES;
self.m_bIsLive = true;
self.m_iHealth = 1;
self.Entity:SetGravity( 400 / 600 ); // use a lower gravity for grenades to make them easier to see
self.Entity:SetFriction( 0.8 );
self.Entity:SetSequence( 0 );
self.m_fDangerRadius = 100;
self.m_fSpawnTime = CurTime();
ParticleEffectAttach("rocket_smoke_trail", PATTACH_ABSORIGIN_FOLLOW, self, 0)
self:OnInitialize();
end
//-----------------------------------------------------------------------------
// Purpose: The grenade has a slight delay before it goes live. That way the
// person firing it can bounce it off a nearby wall. However if it
// hits another character it blows up immediately
// Input :
// Output :
//-----------------------------------------------------------------------------
function ENT:Think()
self:OnThink()
self.Entity:NextThink( CurTime() + 0.05 );
if (!self.m_bIsLive) then
// Go live after a short delay
if (self.m_fSpawnTime + MAX_AR2_NO_COLLIDE_TIME < CurTime()) then
self.m_bIsLive = true;
end
end
// If I just went solid and my velocity is zero, it means I'm resting on
// the floor already when I went solid so blow up
if (self.m_bIsLive) then
if (self.Entity:GetVelocity():Length() == 0.0 ||
self.Entity:GetGroundEntity() != NULL ) then
// self:Detonate();
end
end
// The old way of making danger sounds would scare the crap out of EVERYONE between you and where the grenade
// was going to hit. The radius of the danger sound now 'blossoms' over the grenade's lifetime, making it seem
// dangerous to a larger area downrange than it does from where it was fired.
if( self.m_fDangerRadius <= AR2_GRENADE_MAX_DANGER_RADIUS ) then
self.m_fDangerRadius = self.m_fDangerRadius + ( AR2_GRENADE_MAX_DANGER_RADIUS * 0.05 );
end
end
/*---------------------------------------------------------
Name: PhysicsCollide
---------------------------------------------------------*/
function ENT:PhysicsCollide( data, physobj )
self:Touch( data.HitEntity )
self.PhysicsCollide = function( ... ) return end
end
function ENT:Detonate()
if (!self.m_bIsLive) then
return;
end
self.m_bIsLive = false;
self.m_takedamage = DAMAGE_NO;
if(self.m_hSmokeTrail) then
self.m_hSmokeTrail:Remove();
self.m_hSmokeTrail = NULL;
end
self:DoExplodeEffect()
local vecForward = self.Entity:GetVelocity();
vecForward = VectorNormalize(vecForward);
local tr;
tr = {};
tr.start = self.Entity:GetPos();
tr.endpos = self.Entity:GetPos() + 60*vecForward;
tr.mask = MASK_SHOT;
tr.filter = self;
tr.collision = COLLISION_GROUP_NONE;
tr = util.TraceLine ( tr);
self:OnExplode( tr );
if self:WaterLevel() < 3 then
local explode = ents.Create( "info_particle_system" )
explode:SetKeyValue( "effect_name", "hl2r_explosion_grenade_noaftersmoke" )
explode:SetOwner( self.Owner )
explode:SetPos( self:GetPos() )
explode:Spawn()
explode:Activate()
explode:Fire( "start", "", 0 )
explode:Fire( "kill", "", 30 )
end
self:EmitSound( self.Sound.Explode );
self:EmitSound( self.Sound.ExplodeR );
util.ScreenShake( self.Entity:GetPos(), 25.0, 150.0, 1.0, 750, SHAKE_START );
util.BlastDamage ( self.Entity, self:GetOwner(), self.Entity:GetPos(), self.m_DmgRadius, self.m_flDamage );
self.Entity:Remove();
end
function ENT:Precache()
util.PrecacheModel("models/Items/AR2_Grenade.mdl");
end

View File

@@ -0,0 +1,101 @@
--[[
| 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/
--]]
ENT.Sound = {}
ENT.Sound.Explode = "BaseGrenade.Explode"
ENT.Sound.ExplodeR = "TFA_HL2R_BaseGrenade.Explode"
// Nice helper function, this does all the work.
/*---------------------------------------------------------
Name: DoExplodeEffect
---------------------------------------------------------*/
function ENT:DoExplodeEffect()
local info = EffectData();
info:SetEntity( self.Entity );
info:SetOrigin( self.Entity:GetPos() );
if self:WaterLevel() >= 3 then
util.Effect("WaterSurfaceExplosion", info)
end
--util.Effect( "Explosion", info );
util.Effect("tfa_hl2r_fx_explosion_dlight", info)
end
/*---------------------------------------------------------
Name: OnExplode
Desc: The grenade has just exploded.
---------------------------------------------------------*/
function ENT:OnExplode( pTrace )
if ((pTrace.Entity != game.GetWorld()) || (pTrace.HitBox != 0)) then
// non-world needs smaller decals
if( pTrace.Entity && !pTrace.Entity:IsNPC() ) then
util.Decal( "SmallScorch", pTrace.HitPos + pTrace.HitNormal, pTrace.HitPos - pTrace.HitNormal );
end
else
util.Decal( "Scorch", pTrace.HitPos + pTrace.HitNormal, pTrace.HitPos - pTrace.HitNormal );
end
end
/*---------------------------------------------------------
Name: OnInitialize
---------------------------------------------------------*/
function ENT:OnInitialize()
end
/*---------------------------------------------------------
Name: StartTouch
---------------------------------------------------------*/
function ENT:StartTouch( entity )
end
/*---------------------------------------------------------
Name: EndTouch
---------------------------------------------------------*/
function ENT:EndTouch( entity )
end
function ENT:Touch( pOther )
assert( pOther );
if ( pOther:GetSolid() == SOLID_NONE ) then
return;
end
// If I'm live go ahead and blow up
if (self.m_bIsLive) then
self:Detonate();
else
// If I'm not live, only blow up if I'm hitting an chacter that
// is not the owner of the weapon
local pBCC = pOther;
if (pBCC && self.Entity:GetOwner() != pBCC) then
self.m_bIsLive = true;
self:Detonate();
end
end
end
/*---------------------------------------------------------
Name: OnThink
---------------------------------------------------------*/
function ENT:OnThink()
end
function ENT:OnRemove()
end

View File

@@ -0,0 +1,19 @@
--[[
| 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/
--]]
ENT.Type = "anim"
ENT.Base = "base_anim"
ENT.PrintName = ""
ENT.Author = ""
ENT.Spawnable = false
ENT.AdminSpawnable = false

View File

@@ -0,0 +1,66 @@
--[[
| 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 SERVER then AddCSLuaFile("shared.lua") end
ENT.Type = "anim"
ENT.PrintName = "HL2 MMod RPG Laser Spot"
ENT.Author = "Upset"
function ENT:SetupDataTables()
self:NetworkVar("Bool", 0, "DrawLaser")
end
if SERVER then
function ENT:Initialize()
self:DrawShadow(false)
end
function ENT:Suspend(flSuspendTime)
self:SetDrawLaser(false)
timer.Simple(flSuspendTime, function()
if self and IsValid(self) then
self:Revive()
end
end)
end
function ENT:Revive()
self:SetDrawLaser(true)
end
else
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
local laser = Material("sprites/redglow1")
function ENT:DrawTranslucent()
if !self:GetDrawLaser() then return end
local owner = self:GetOwner()
if !owner or !IsValid(owner) or !owner:Alive() then return end
local tr = owner:GetEyeTrace()
local pos = tr.HitPos
local norm = tr.HitNormal
local scale = 16.0 + math.Rand(-4.0, 4.0)
render.SetMaterial(laser)
render.DrawSprite(pos + norm * 3 - EyeVector() * 4, 1 * scale, 1 * scale, Color(255,255,255,255))
end
function ENT:Think()
local owner = self:GetOwner()
if IsValid(owner) then
self:SetRenderBoundsWS(LocalPlayer():EyePos(), owner:GetEyeTrace().HitPos)
end
end
end

View File

@@ -0,0 +1,21 @@
--[[
| 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/
--]]
include("shared.lua")
function ENT:Draw()
if CurTime() > self:GetNWFloat("HideTime", CurTime() + 1) then
self:DrawModel()
end
end
function ENT:IsTranslucent()
return true
end

View File

@@ -0,0 +1,142 @@
--[[
| 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("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
ENT.Damage = 100
ENT.Prime = 0.03
ENT.Delay = 30
ENT.HideDelay = 0.0
function ENT:Initialize()
local mdl = self:GetModel()
if not mdl or mdl == "" or mdl == "models/error.mdl" then
self:SetModel("models/weapons/tfa_hl2r/w_missile_launch.mdl")
end
self:PhysicsInit(SOLID_VPHYSICS)
--self:PhysicsInitSphere((self:OBBMaxs() - self:OBBMins()):Length() / 4, "metal")
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
local phys = self:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
end
self:SetFriction(self.Delay)
self.killtime = CurTime() + self.Delay
self:DrawShadow(true)
self.StartTime = CurTime()
self:EmitSound( "TFA_HL2R_RPG.Loop" )
self:SetUseType(SIMPLE_USE)
self.HasIdle = true
timer.Simple(0.1, function()
if IsValid(self) then
self:SetOwner()
end
end)
self:SetNWFloat("HideTime",CurTime() + self.HideDelay )
self.HP = math.random(30, 60)
end
function ENT:Think()
if self.killtime < CurTime() then
return false
end
self:NextThink(CurTime())
return true
end
local effectdata, shake
function ENT:Explode()
if not IsValid(self.Owner) then
self:Remove()
return
end
effectdata = EffectData()
effectdata:SetOrigin(self:GetPos())
effectdata:SetScale(5)
effectdata:SetMagnitude(5)
util.Effect("HelicopterMegaBomb", effectdata)
util.Effect("Explosion", effectdata)
self.Damage = self.mydamage or self.Damage
util.BlastDamage(self, self.Owner, self:GetPos(), 512, self.Damage )
shake = ents.Create("env_shake")
shake:SetOwner(self.Owner)
shake:SetPos(self:GetPos())
shake:SetKeyValue("amplitude", tostring(self.Damage * 20)) -- Power of the shake
shake:SetKeyValue("radius", tostring( 768 ) ) -- Radius of the shake
shake:SetKeyValue("duration", tostring( self.Damage / 200 )) -- Time of shake
shake:SetKeyValue("frequency", "255") -- How har should the screenshake be
shake:SetKeyValue("spawnflags", "4") -- Spawnflags(In Air)
shake:Spawn()
shake:Activate()
shake:Fire("StartShake", "", 0)
self:EmitSound("TFA_INS2_RPG7.2")
self:Remove()
end
function ENT:PhysicsCollide(data, phys)
if data.Speed > 60 and CurTime() > self.StartTime + self.Prime then
timer.Simple(0,function()
if IsValid(self) then
self:Explode()
end
end)
else
self.Prime = math.huge
if self.HasIdle then
self:StopSound("TFA_HL2R_RPG.Loop")
self.HasIdle = false
self:SetNWFloat("HideTime", -1 )
end
end
--[[elseif self:GetOwner() ~= self then
self.Prime = math.huge
self:StopSound("TFA_INS2_RPG7.Loop")
self:SetOwner(self)
end
]]--
end
function ENT:OnRemove()
if self.HasIdle then
self:StopSound("TFA_HL2R_RPG.Loop")
self.HasIdle = false
end
end
function ENT:Use(activator, caller)
if activator:IsPlayer() and self.WeaponClass and activator:GetWeapon(self.WeaponClass) then
activator:GiveAmmo(1, activator:GetWeapon(self.WeaponClass):GetPrimaryAmmoType(), false)
self:Remove()
end
end
function ENT:OnTakeDamage( dmg )
if dmg:GetInflictor() == self or dmg:GetAttacker() == self then return end
if self.Exploded then return end
if self.HP > 0 and self.HP - dmg:GetDamage() <= 0 then
self.Exploded = true
self:Explode()
end
self.HP = self.HP - dmg:GetDamage()
dmg:SetAttacker(self)
dmg:SetInflictor(self)
self:TakePhysicsDamage( dmg )
end

View File

@@ -0,0 +1,18 @@
--[[
| 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/
--]]
ENT.Type = "anim"
ENT.PrintName = "Contact Explosive"
ENT.Author = ""
ENT.Contact = ""
ENT.Purpose = ""
ENT.Instructions = ""
ENT.DoNotDuplicate = true
ENT.DisableDuplicator = true

View File

@@ -0,0 +1,18 @@
--[[
| 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/
--]]
include('shared.lua')
function ENT:Draw()
self:DrawModel()
end
function ENT:OnRemove()
end

View File

@@ -0,0 +1,176 @@
--[[
| 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("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
ENT.Model = Model("models/weapons/tfa_hl2r/w_missile.mdl")
ENT.ModelLaunch = Model("models/weapons/tfa_hl2r/w_missile_launch.mdl")
ENT.Sprite = "sprites/animglow01.vmt"
ENT.FlySound = "Missile.Ignite"
function ENT:Initialize()
self:SetMoveType(MOVETYPE_FLYGRAVITY)
self:SetMoveCollide(MOVECOLLIDE_FLY_BOUNCE)
self:SetSolid(SOLID_BBOX)
self:SetModel(self.ModelLaunch)
self:SetCollisionBounds(Vector(), Vector())
local angAngs = self:GetAngles()
angAngs.x = angAngs.x - 30
local vecFwd = angAngs:Forward()
self:SetLocalVelocity(vecFwd * 250)
local svgravity = cvars.Number("sv_gravity", 800)
if svgravity != 0 then
local gravityMul = 400 / svgravity
self:SetGravity(gravityMul)
end
self:NextThink(CurTime() + .4)
self.radius = 300
end
function ENT:Touch(pOther)
if !pOther:IsSolid() or pOther:GetClass() == "hornet" then
return
end
self:Explode(pOther)
end
function ENT:Explode(ent)
if self.didHit then return end
local vecDir = self:GetForward()
local tr = util.TraceLine({
start = self:GetPos(),
endpos = self:GetPos() + vecDir * 16,
mask = MASK_SHOT,
filter = self
})
self:SetSolid(SOLID_NONE)
if tr.Fraction == 1.0 || !tr.HitSky then
local pos, norm = tr.HitPos, tr.HitNormal
local explosion = EffectData()
explosion:SetOrigin(pos)
explosion:SetNormal(norm)
if self:WaterLevel() >= 3 then
util.Effect("WaterSurfaceExplosion", explosion)
else
local explode = ents.Create( "info_particle_system" )
explode:SetKeyValue( "effect_name", "hl2r_explosion_rpg" )
explode:SetOwner( self.Owner )
explode:SetPos( self:GetPos() )
explode:Spawn()
explode:Activate()
explode:Fire( "start", "", 0 )
explode:Fire( "kill", "", 30 )
end
util.Decal("Scorch", pos - vecDir + norm, pos + vecDir)
local dlighteff = EffectData()
dlighteff:SetEntity(self)
dlighteff:SetOrigin(self:GetPos())
util.Effect("hl2r_fx_explosion_dlight", dlighteff)
self:EmitSound("TFA_HL2R_RPG.Explode")
self:EmitSound("BaseExplosionEffect.Sound")
local owner = IsValid(self.Owner) and self.Owner or self
local dmg = DamageInfo()
dmg:SetInflictor(self)
dmg:SetAttacker(owner)
dmg:SetDamage(self.dmg)
dmg:SetDamageType(bit.bor(DMG_BLAST, DMG_AIRBOAT))
util.BlastDamageInfo(dmg, tr.HitPos, self.radius)
end
self.didHit = true
--self:RemoveEffects(EF_BRIGHTLIGHT)
self:StopSound(self.FlySound)
self:SetLocalVelocity(Vector())
self:SetMoveType(MOVETYPE_NONE)
self:AddEffects(EF_NODRAW)
if self.glow and IsValid(self.glow) then self.glow:Remove() end
self:Remove()
end
function ENT:Think()
if self.didHit then return end
if !self.m_flIgniteTime then
self:SetMoveType(MOVETYPE_FLY)
self:SetModel(self.Model)
ParticleEffectAttach("hl2r_weapon_rpg_smoketrail", PATTACH_ABSORIGIN_FOLLOW, self, 0)
--self:AddEffects(EF_BRIGHTLIGHT)
self:EmitSound(self.FlySound)
-- self.glow = ents.Create("env_sprite")
-- local glow = self.glow
-- glow:SetKeyValue("rendercolor", "255 192 64")
-- glow:SetKeyValue("GlowProxySize", "2")
-- glow:SetKeyValue("HDRColorScale", "1")
-- glow:SetKeyValue("renderfx", "15")
-- glow:SetKeyValue("rendermode", "3")
-- glow:SetKeyValue("renderamt", "255")
-- glow:SetKeyValue("model", self.Sprite)
-- glow:SetKeyValue("scale", ".08")
-- glow:Spawn()
-- glow:SetParent(self)
-- glow:SetPos(self:GetPos())
--ParticleEffectAttach("rocket_smoke_trail", PATTACH_ABSORIGIN_FOLLOW, self, 0)
--ParticleEffectAttach("weapon_rpg_smoketrail", PATTACH_ABSORIGIN_FOLLOW, self, 0)
ParticleEffectAttach("hl2r_weapon_rpg_smoketrail", PATTACH_ABSORIGIN_FOLLOW, self, 0)
--util.SpriteTrail( self.Entity, 0, Color( 165, 165, 165 ), false, 8, 16, 0.5, 1 / ( 165 ), "trails/smoke.vmt" )
self.m_flIgniteTime = CurTime()
self.vecTarget = self:GetForward()
self:NextThink(CurTime() + 0.1)
end
if self.bGuiding then
local spot = IsValid(self.pLauncher) and !self.pLauncher:GetSprinting() and self.pLauncher:GetSpotEntity() or NULL
local vecDir = Vector()
if IsValid(spot) and spot:GetOwner() == self:GetOwner() and spot:GetDrawLaser() then
local tr = util.TraceLine({
start = self:GetPos(),
endpos = spot:GetPos(),
filter = {self, self.Owner, spot}
})
if tr.Fraction >= 0.90 then
vecDir = spot:GetPos() - self:GetPos()
vecDir = vecDir:GetNormalized()
self.vecTarget = vecDir
end
end
end
self:SetAngles(self.vecTarget:Angle())
local flSpeed = self:GetVelocity():Length()
self:SetLocalVelocity(self:GetVelocity() * 0.2 + self.vecTarget * (flSpeed * 0.8 + 400))
if self:WaterLevel() == 3 then
if self:GetVelocity():Length() > 300 then
self:SetLocalVelocity(self:GetVelocity():GetNormalized() * 300)
end
else
if self:GetVelocity():Length() > 2000 then
self:SetLocalVelocity(self:GetVelocity():GetNormalized() * 2000)
end
end
self:NextThink(CurTime() + .1)
return true
end
function ENT:OnRemove()
self:StopSound(self.FlySound)
end

View File

@@ -0,0 +1,13 @@
--[[
| 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/
--]]
ENT.Type = "anim"
ENT.PrintName = "HL2 MMod RPG Rocket"
ENT.Author = "Upset"

View File

@@ -0,0 +1,152 @@
--[[
| 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/
--]]
-- Most code from mad cow, some from me
-- .phy of the crossbow_bolt made by Silver Spirit
AddCSLuaFile()
ENT.Type = "anim"
ENT.Base = "base_anim"
ENT.PrintName = "CrossbowBolt"
ENT.Author = "Worshipper/Zerf"
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
ENT.Damage = 100
ENT.LifeTime = 4
ENT.Model = "models/crossbow_bolt.mdl"
function ENT:OnRemove()
end
function ENT:PhysicsUpdate()
end
if SERVER then
function ENT:Initialize()
self:SetModel(self.Model)
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:DrawShadow(false)
-- Wake the physics object up. It's time to have fun!
local phys = self:GetPhysicsObject()
if IsValid(phys) then
phys:EnableGravity(false)
phys:EnableDrag(true)
phys:SetMass(2)
phys:Wake()
phys:AddGameFlag(FVPHYSICS_NO_IMPACT_DMG)
phys:AddGameFlag(FVPHYSICS_NO_NPC_IMPACT_DMG)
phys:AddGameFlag(FVPHYSICS_PENETRATING)
end
-- local trail = util.SpriteTrail(self, 0, Color(255, 255, 255, 30), true, 2, 0, 3, 1 / (5.38) * 0.5, "trails/smoke.vmt")
self.Moving = true
end
--[[
function ENT:PhysicsUpdate(phys)
local vel = Vector(0, 0, ((-9.81 * phys:GetMass()) * 0.65))
phys:ApplyForceCenter(vel)
end
--]]
function ENT:Impact(ent, normal, pos)
if not IsValid(self) then return end
local info
local tr = {}
tr.start = self:GetPos()
tr.filter = {self, self.Owner}
tr.endpos = pos
tr = util.TraceLine(tr)
if tr.HitSky then self:Remove() return end
if not ent:IsPlayer() and not ent:IsNPC() then
local effectdata = EffectData()
effectdata:SetOrigin(pos - normal * 10)
effectdata:SetEntity(self)
effectdata:SetStart(pos)
effectdata:SetNormal(normal)
util.Effect("Impact", effectdata)
end
if IsValid(ent) then
local d = DamageInfo()
d:SetDamage( 100 )
d:SetAttacker( self.Owner )
d:SetDamageType( DMG_NEVERGIB )
--ent:TakeDamage(100, self.Owner)
ent:TakeDamageInfo(d)
self:EmitSound("Weapon_Crossbow.BoltHitBody")
self:Remove()
return
end
self:EmitSound("Weapon_Crossbow.BoltHitWorld")
-- We've hit a prop, so let's weld to it. Also embed this in the object for looks
self:SetPos(pos - normal * 10)
-- self:SetAngles(normal:Angle())
if not IsValid(ent) then
self:GetPhysicsObject():EnableMotion(false)
end
timer.Simple(self.LifeTime, function()
if IsValid(self) then self:Remove() end
end)
end
function ENT:PhysicsCollide(data, phys, dmg)
if self.Moving then
self.Moving = false
phys:Sleep()
self:Impact(data.HitEntity, data.HitNormal, data.HitPos)
end
end
function ENT:Think()
local phys = self:GetPhysicsObject()
local ang = self:GetForward() * 100000
local up = self:GetUp() * -800
local force = ang + up
phys:ApplyForceCenter(force)
if (self.HitWeld) then
self.HitWeld = false
constraint.Weld(self.HitEnt, self, 0, 0, 0, true)
end
end
end
if CLIENT then
function ENT:Initialize()
self:DrawShadow(false)
end
function ENT:IsTranslucent()
return true
end
function ENT:Draw()
self:DrawModel()
end
end

View File

@@ -0,0 +1,328 @@
--[[
| 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' )
include( 'outputs.lua' )
FRAG_GRENADE_BLIP_FREQUENCY = 1.0
FRAG_GRENADE_BLIP_FAST_FREQUENCY = 0.3
FRAG_GRENADE_GRACE_TIME_AFTER_PICKUP = 1.5
FRAG_GRENADE_WARN_TIME = 1.5
GRENADE_COEFFICIENT_OF_RESTITUTION = 0.2;
local sk_plr_dmg_fraggrenade = 125;
local sk_npc_dmg_fraggrenade = 75;
local sk_fraggrenade_radius = 250;
GRENADE_MODEL = "models/items/grenadeammo.mdl"
GLOW_CREATED = FALSE;
function ENT:GetShakeAmplitude() return 25.0; end
function ENT:GetShakeRadius() return 750.0; end
// Damage accessors.
function ENT:GetDamage()
return self.m_flDamage;
end
function ENT:GetDamageRadius()
return self.m_DmgRadius;
end
function ENT:SetDamage(flDamage)
self.m_flDamage = flDamage;
end
function ENT:SetDamageRadius(flDamageRadius)
self.m_DmgRadius = flDamageRadius;
end
// Bounce sound accessors.
function ENT:SetBounceSound( pszBounceSound )
self.m_iszBounceSound = tostring( pszBounceSound );
end
function ENT:BlipSound()
local efdata = EffectData()
efdata:SetEntity(self)
efdata:SetFlags(1) -- regular beep
util.Effect("mmod_frag_beeplight", efdata)
self.Entity:EmitSound( self.Sound.Blip );
end
// UNDONE: temporary scorching for PreAlpha - find a less sleazy permenant solution.
function ENT:Explode( pTrace, bitsDamageType )
if !( CLIENT ) then
self.Entity:SetModel( "" );//invisible
self.Entity:SetColor( color_transparent );
self.Entity:SetSolid( SOLID_NONE );
self.m_takedamage = DAMAGE_NO;
local vecAbsOrigin = self.Entity:GetPos();
local contents = util.PointContents ( vecAbsOrigin );
if ( pTrace.Fraction != 1.0 ) then
local vecNormal = pTrace.HitNormal;
local pdata = pTrace.MatType;
util.BlastDamage( self.Entity, // don't apply cl_interp delay
self:GetOwner(),
self.Entity:GetPos(),
self.m_DmgRadius,
self.m_flDamage );
else
util.BlastDamage( self.Entity, // don't apply cl_interp delay
self:GetOwner(),
self.Entity:GetPos(),
self.m_DmgRadius,
self.m_flDamage );
end
self:DoExplodeEffect();
self:OnExplode( pTrace );
self.Entity:EmitSound( self.Sound.Explode );
self.Touch = function( ... ) return end;
self.Entity:SetSolid( SOLID_NONE );
self.Entity:SetVelocity( self:GetPos() );
// Because the grenade is zipped out of the world instantly, the EXPLOSION sound that it makes for
// the AI is also immediately destroyed. For this reason, we now make the grenade entity inert and
// throw it away in 1/10th of a second instead of right away. Removing the grenade instantly causes
// intermittent bugs with env_microphones who are listening for explosions. They will 'randomly' not
// hear explosion sounds when the grenade is removed and the SoundEnt thinks (and removes the sound)
// before the env_microphone thinks and hears the sound.
SafeRemoveEntityDelayed( self.Entity, 0.1 );
end
end
function ENT:Detonate()
local tr;
local vecSpot;// trace starts here!
self.Think = function( ... ) return end;
local explode = ents.Create( "info_particle_system" )
explode:SetKeyValue( "effect_name", "hl2mmod_explosion_grenade_noaftersmoke" )
explode:SetOwner( self.Owner )
explode:SetPos( self:GetPos() )
explode:Spawn()
explode:Activate()
explode:Fire( "start", "", 0 )
explode:Fire( "kill", "", 30 )
vecSpot = self.Entity:GetPos() + Vector ( 0 , 0 , 8 );
tr = {};
tr.start = vecSpot;
tr.endpos = vecSpot + Vector ( 0, 0, -32 );
tr.mask = MASK_SHOT_HULL;
tr.filter = self.Entity;
tr.collision = COLLISION_GROUP_NONE;
tr = util.TraceLine ( tr);
if( tr.StartSolid ) then
// Since we blindly moved the explosion origin vertically, we may have inadvertently moved the explosion into a solid,
// in which case nothing is going to be harmed by the grenade's explosion because all subsequent traces will startsolid.
// If this is the case, we do the downward trace again from the actual origin of the grenade. (sjb) 3/8/2007 (for ep2_outland_09)
tr = {};
tr.start = self.Entity:GetPos();
tr.endpos = self.Entity:GetPos() + Vector( 0, 0, -32);
tr.mask = MASK_SHOT_HULL;
tr.filter = self.Entity;
tr.collision = COLLISION_GROUP_NONE;
tr = util.TraceLine( tr );
end
tr = self:Explode( tr, DMG_BLAST );
if ( self:GetShakeAmplitude() ) then
util.ScreenShake( self.Entity:GetPos(), self:GetShakeAmplitude(), 150.0, 1.0, self:GetShakeRadius() );
end
end
/*---------------------------------------------------------
Name: Initialize
---------------------------------------------------------*/
function ENT:Initialize()
self.m_hThrower = NULL;
self.m_hOriginalThrower = NULL;
self.m_bIsLive = false;
self.m_DmgRadius = 100;
self.m_flDetonateTime = CurTime() + GRENADE_TIMER;
self.m_flWarnAITime = CurTime() + GRENADE_TIMER - FRAG_GRENADE_WARN_TIME;
self.m_bHasWarnedAI = false;
self:Precache( );
self.Entity:SetModel( GRENADE_MODEL );
if( self:GetOwner() && self:GetOwner():IsPlayer() ) then
self.m_flDamage = sk_plr_dmg_fraggrenade;
self.m_DmgRadius = sk_fraggrenade_radius;
else
self.m_flDamage = sk_npc_dmg_fraggrenade;
self.m_DmgRadius = sk_fraggrenade_radius;
end
self.m_takedamage = DAMAGE_YES;
self.m_iHealth = 1;
self.Entity:SetCollisionBounds( -Vector(4,4,4), Vector(4,4,4) );
self:CreateVPhysics();
self:BlipSound();
self.m_flNextBlipTime = CurTime() + FRAG_GRENADE_BLIP_FREQUENCY;
self.m_combineSpawned = false;
self.m_punted = false;
self:CreateEffects();
self:OnInitialize();
self.BaseClass:Initialize();
end
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
function ENT:OnRestore()
// If we were primed and ready to detonate, put FX on us.
if (self.m_flDetonateTime > 0) then
self:CreateEffects();
end
self.BaseClass:OnRestore();
end
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
function ENT:CreateEffects()
local nAttachment = self:LookupAttachment( "fuse" );
// Start up the eye trail
self.m_pGlowTrail = util.SpriteTrail( self.Entity, nAttachment, self.Trail.Color, true, self.Trail.StartWidth, self.Trail.EndWidth, self.Trail.LifeTime, 1 / ( self.Trail.StartWidth + self.Trail.EndWidth ) * 0.5, self.Trail.Material );
end
function ENT:CreateVPhysics()
// Create the object in the physics system
self.Entity:PhysicsInit( SOLID_VPHYSICS, 0, false );
local Phys = self:GetPhysicsObject()
if ( Phys ) then
Phys:SetMaterial( "grenade" )
end
return true;
end
function ENT:Precache()
util.PrecacheModel( GRENADE_MODEL );
util.PrecacheSound( self.Sound.Blip );
util.PrecacheModel( "sprites/redglow1.vmt" );
util.PrecacheModel( self.Trail.Material );
util.PrecacheSound( self.Sound.Explode );
end
function ENT:SetTimer( detonateDelay, warnDelay )
self.m_flDetonateTime = CurTime() + detonateDelay;
self.m_flWarnAITime = CurTime() + warnDelay;
self.Entity:NextThink( CurTime() );
self:CreateEffects();
end
function ENT:Think()
self:OnThink()
if( CurTime() > self.m_flDetonateTime ) then
self:Detonate();
return;
end
if( !self.m_bHasWarnedAI && CurTime() >= self.m_flWarnAITime ) then
self.m_bHasWarnedAI = true;
end
if( CurTime() > self.m_flNextBlipTime ) then
self:BlipSound();
if( self.m_bHasWarnedAI ) then
self.m_flNextBlipTime = CurTime() + FRAG_GRENADE_BLIP_FAST_FREQUENCY;
else
self.m_flNextBlipTime = CurTime() + FRAG_GRENADE_BLIP_FREQUENCY;
end
end
self.Entity:NextThink( CurTime() + 0.1 );
end
function ENT:SetVelocity( velocity, angVelocity )
local pPhysicsObject = self:GetPhysicsObject();
if ( pPhysicsObject ) then
pPhysicsObject:AddVelocity( velocity );
pPhysicsObject:AddAngleVelocity( angVelocity );
end
end
/*---------------------------------------------------------
Name: OnTakeDamage
---------------------------------------------------------*/
function ENT:OnTakeDamage( dmginfo )
// Manually apply vphysics because BaseCombatCharacter takedamage doesn't call back to CBaseEntity OnTakeDamage
self.Entity:TakePhysicsDamage( dmginfo );
// Grenades only suffer blast damage and burn damage.
if( !(dmginfo:GetDamageType() == bit.bor( DMG_BLAST, DMG_BURN) ) ) then
return 0;
end
return self.BaseClass:OnTakeDamage( dmginfo );
end

View File

@@ -0,0 +1,80 @@
--[[
| 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/
--]]
ENT.Sound = {}
ENT.Sound.Blip = "Grenade.Blip"
ENT.Sound.Explode = "BaseGrenade.Explode"
ENT.Trail = {}
ENT.Trail.Color = Color( 255, 0, 0, 255 )
ENT.Trail.Material = "sprites/bluelaser1.vmt"
ENT.Trail.StartWidth = 8.0
ENT.Trail.EndWidth = 1.0
ENT.Trail.LifeTime = 0.5
// Nice helper function, this does all the work.
/*---------------------------------------------------------
Name: DoExplodeEffect
---------------------------------------------------------*/
function ENT:DoExplodeEffect()
local info = EffectData();
info:SetEntity( self.Entity );
info:SetOrigin( self.Entity:GetPos() );
util.Effect( "Explosion", info );
self:EmitSound("BaseExplosionEffect.Sound")
-- util.Effect("mmod_fx_explosion_dlight", info)
end
/*---------------------------------------------------------
Name: OnExplode
Desc: The grenade has just exploded.
---------------------------------------------------------*/
function ENT:OnExplode( pTrace )
local Pos1 = pTrace.HitPos + pTrace.HitNormal
local Pos2 = pTrace.HitPos - pTrace.HitNormal
util.Decal( "Scorch", Pos1, Pos2 );
end
/*---------------------------------------------------------
Name: OnInitialize
---------------------------------------------------------*/
function ENT:OnInitialize()
end
/*---------------------------------------------------------
Name: StartTouch
---------------------------------------------------------*/
function ENT:StartTouch( entity )
end
/*---------------------------------------------------------
Name: EndTouch
---------------------------------------------------------*/
function ENT:EndTouch( entity )
end
/*---------------------------------------------------------
Name: Touch
---------------------------------------------------------*/
function ENT:Touch( entity )
end
/*---------------------------------------------------------
Name: OnThink
---------------------------------------------------------*/
function ENT:OnThink()
end

View File

@@ -0,0 +1,17 @@
--[[
| 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/
--]]
ENT.Type = "anim"
ENT.Base = "base_anim"
ENT.PrintName = ""
ENT.Author = ""
ENT.Spawnable = false
ENT.AdminSpawnable = false

View File

@@ -0,0 +1,174 @@
--[[
| 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' )
include( 'outputs.lua' )
MAX_AR2_NO_COLLIDE_TIME = 0.2
AR2_GRENADE_MAX_DANGER_RADIUS = 300
// Moved to HL2_SharedGameRules because these are referenced by shared AmmoDef functions
local sk_plr_dmg_smg1_grenade = 100;
local sk_npc_dmg_smg1_grenade = 50;
local sk_max_smg1_grenade = 3;
local sk_smg1_grenade_radius = 250;
/*---------------------------------------------------------
Name: Initialize
---------------------------------------------------------*/
function ENT:Initialize()
self:Precache( );
self.Entity:SetModel( "models/Items/AR2_Grenade.mdl");
self.Entity:PhysicsInit( SOLID_VPHYSICS );
self.Entity:SetMoveCollide( MOVECOLLIDE_FLY_BOUNCE );
// Hits everything but debris
self.Entity:SetCollisionGroup( COLLISION_GROUP_PROJECTILE );
self.Entity:GetPhysicsObject():SetBuoyancyRatio( 0 )
self.Entity:SetCollisionBounds(Vector(-3, -3, -3), Vector(3, 3, 3));
// self.Entity:SetCollisionBounds(Vector(0, 0, 0), Vector(0, 0, 0));
self.Entity:NextThink( CurTime() + 0.1 );
if( self:GetOwner() && self:GetOwner():IsPlayer() ) then
self.m_flDamage = sk_plr_dmg_smg1_grenade;
else
self.m_flDamage = sk_npc_dmg_smg1_grenade;
end
self.m_DmgRadius = sk_smg1_grenade_radius;
self.m_takedamage = DAMAGE_YES;
self.m_bIsLive = true;
self.m_iHealth = 1;
self.Entity:SetGravity( 400 / 600 ); // use a lower gravity for grenades to make them easier to see
self.Entity:SetFriction( 0.8 );
self.Entity:SetSequence( 0 );
self.m_fDangerRadius = 100;
self.m_fSpawnTime = CurTime();
ParticleEffectAttach("hl2mmod_weapon_smg_grenadetrail", PATTACH_ABSORIGIN_FOLLOW, self, 0)
self:OnInitialize();
end
//-----------------------------------------------------------------------------
// Purpose: The grenade has a slight delay before it goes live. That way the
// person firing it can bounce it off a nearby wall. However if it
// hits another character it blows up immediately
// Input :
// Output :
//-----------------------------------------------------------------------------
function ENT:Think()
self:OnThink()
self.Entity:NextThink( CurTime() + 0.05 );
if (!self.m_bIsLive) then
// Go live after a short delay
if (self.m_fSpawnTime + MAX_AR2_NO_COLLIDE_TIME < CurTime()) then
self.m_bIsLive = true;
end
end
// If I just went solid and my velocity is zero, it means I'm resting on
// the floor already when I went solid so blow up
if (self.m_bIsLive) then
if (self.Entity:GetVelocity():Length() == 0.0 ||
self.Entity:GetGroundEntity() != NULL ) then
// self:Detonate();
end
end
// The old way of making danger sounds would scare the crap out of EVERYONE between you and where the grenade
// was going to hit. The radius of the danger sound now 'blossoms' over the grenade's lifetime, making it seem
// dangerous to a larger area downrange than it does from where it was fired.
if( self.m_fDangerRadius <= AR2_GRENADE_MAX_DANGER_RADIUS ) then
self.m_fDangerRadius = self.m_fDangerRadius + ( AR2_GRENADE_MAX_DANGER_RADIUS * 0.05 );
end
end
/*---------------------------------------------------------
Name: PhysicsCollide
---------------------------------------------------------*/
function ENT:PhysicsCollide( data, physobj )
self:Touch( data.HitEntity )
self.PhysicsCollide = function( ... ) return end
end
function ENT:Detonate()
if (!self.m_bIsLive) then
return;
end
self.m_bIsLive = false;
self.m_takedamage = DAMAGE_NO;
if(self.m_hSmokeTrail) then
self.m_hSmokeTrail:Remove();
self.m_hSmokeTrail = NULL;
end
self:DoExplodeEffect()
local vecForward = self.Entity:GetVelocity();
vecForward = VectorNormalize(vecForward);
local tr;
tr = {};
tr.start = self.Entity:GetPos();
tr.endpos = self.Entity:GetPos() + 60*vecForward;
tr.mask = MASK_SHOT;
tr.filter = self;
tr.collision = COLLISION_GROUP_NONE;
tr = util.TraceLine ( tr);
if self:WaterLevel() < 3 then
local explode = ents.Create( "info_particle_system" )
explode:SetKeyValue( "effect_name", "hl2mmod_explosion_grenade_noaftersmoke" )
explode:SetOwner( self.Owner )
explode:SetPos( self:GetPos() )
explode:Spawn()
explode:Activate()
explode:Fire( "start", "", 0 )
explode:Fire( "kill", "", 30 )
end
self:OnExplode( tr );
self.Entity:EmitSound( self.Sound.Explode );
util.ScreenShake( self.Entity:GetPos(), 25.0, 150.0, 1.0, 750, SHAKE_START );
util.BlastDamage ( self.Entity, self:GetOwner(), self.Entity:GetPos(), self.m_DmgRadius, self.m_flDamage );
self.Entity:Remove();
end
function ENT:Precache()
util.PrecacheModel("models/Items/AR2_Grenade.mdl");
end

View File

@@ -0,0 +1,96 @@
--[[
| 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/
--]]
ENT.Sound = {}
ENT.Sound.Explode = "BaseGrenade.Explode"
// Nice helper function, this does all the work.
/*---------------------------------------------------------
Name: DoExplodeEffect
---------------------------------------------------------*/
function ENT:DoExplodeEffect()
local info = EffectData();
info:SetEntity( self.Entity );
info:SetOrigin( self.Entity:GetPos() );
if self:WaterLevel() >= 3 then
util.Effect("WaterSurfaceExplosion", info)
end
self:EmitSound("BaseExplosionEffect.Sound")
util.Effect("mmod_fx_explosion_dlight", info, true)
end
/*---------------------------------------------------------
Name: OnExplode
Desc: The grenade has just exploded.
---------------------------------------------------------*/
function ENT:OnExplode( pTrace )
if ((pTrace.Entity != game.GetWorld()) || (pTrace.HitBox != 0)) then
// non-world needs smaller decals
if( pTrace.Entity && !pTrace.Entity:IsNPC() ) then
util.Decal( "SmallScorch", pTrace.HitPos + pTrace.HitNormal, pTrace.HitPos - pTrace.HitNormal );
end
else
util.Decal( "Scorch", pTrace.HitPos + pTrace.HitNormal, pTrace.HitPos - pTrace.HitNormal );
end
end
/*---------------------------------------------------------
Name: OnInitialize
---------------------------------------------------------*/
function ENT:OnInitialize()
end
/*---------------------------------------------------------
Name: StartTouch
---------------------------------------------------------*/
function ENT:StartTouch( entity )
end
/*---------------------------------------------------------
Name: EndTouch
---------------------------------------------------------*/
function ENT:EndTouch( entity )
end
function ENT:Touch( pOther )
assert( pOther );
if ( pOther:GetSolid() == SOLID_NONE ) then
return;
end
// If I'm live go ahead and blow up
if (self.m_bIsLive) then
self:Detonate();
else
// If I'm not live, only blow up if I'm hitting an chacter that
// is not the owner of the weapon
local pBCC = pOther;
if (pBCC && self.Entity:GetOwner() != pBCC) then
self.m_bIsLive = true;
self:Detonate();
end
end
end
/*---------------------------------------------------------
Name: OnThink
---------------------------------------------------------*/
function ENT:OnThink()
end

View File

@@ -0,0 +1,19 @@
--[[
| 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/
--]]
ENT.Type = "anim"
ENT.Base = "base_anim"
ENT.PrintName = ""
ENT.Author = ""
ENT.Spawnable = false
ENT.AdminSpawnable = false

View File

@@ -0,0 +1,66 @@
--[[
| 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 SERVER then AddCSLuaFile("shared.lua") end
ENT.Type = "anim"
ENT.PrintName = "HL2 MMod RPG Laser Spot"
ENT.Author = "Upset"
function ENT:SetupDataTables()
self:NetworkVar("Bool", 0, "DrawLaser")
end
if SERVER then
function ENT:Initialize()
self:DrawShadow(false)
end
function ENT:Suspend(flSuspendTime)
self:SetDrawLaser(false)
timer.Simple(flSuspendTime, function()
if self and IsValid(self) then
self:Revive()
end
end)
end
function ENT:Revive()
self:SetDrawLaser(true)
end
else
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
local laser = Material("sprites/redglow1")
function ENT:DrawTranslucent()
if !self:GetDrawLaser() then return end
local owner = self:GetOwner()
if !owner or !IsValid(owner) or !owner:Alive() then return end
local tr = owner:GetEyeTrace()
local pos = tr.HitPos
local norm = tr.HitNormal
local scale = 16.0 + math.Rand(-4.0, 4.0)
render.SetMaterial(laser)
render.DrawSprite(pos + norm * 3 - EyeVector() * 4, 1 * scale, 1 * scale, Color(255,255,255,255))
end
function ENT:Think()
local owner = self:GetOwner()
if IsValid(owner) then
self:SetRenderBoundsWS(LocalPlayer():EyePos(), owner:GetEyeTrace().HitPos)
end
end
end

View File

@@ -0,0 +1,21 @@
--[[
| 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/
--]]
include("shared.lua")
function ENT:Draw()
if CurTime() > self:GetNWFloat("HideTime", CurTime() + 1) then
self:DrawModel()
end
end
function ENT:IsTranslucent()
return true
end

View File

@@ -0,0 +1,142 @@
--[[
| 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("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
ENT.Damage = 100
ENT.Prime = 0.03
ENT.Delay = 30
ENT.HideDelay = 0.0
function ENT:Initialize()
local mdl = self:GetModel()
if not mdl or mdl == "" or mdl == "models/error.mdl" then
self:SetModel("models/weapons/tfa_mmod/w_missile_launch.mdl")
end
self:PhysicsInit(SOLID_VPHYSICS)
--self:PhysicsInitSphere((self:OBBMaxs() - self:OBBMins()):Length() / 4, "metal")
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
local phys = self:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
end
self:SetFriction(self.Delay)
self.killtime = CurTime() + self.Delay
self:DrawShadow(true)
self.StartTime = CurTime()
self:EmitSound( "TFA_MMOD.RPG.Loop" )
self:SetUseType(SIMPLE_USE)
self.HasIdle = true
timer.Simple(0.1, function()
if IsValid(self) then
self:SetOwner()
end
end)
self:SetNWFloat("HideTime",CurTime() + self.HideDelay )
self.HP = math.random(30, 60)
end
function ENT:Think()
if self.killtime < CurTime() then
return false
end
self:NextThink(CurTime())
return true
end
local effectdata, shake
function ENT:Explode()
if not IsValid(self.Owner) then
self:Remove()
return
end
effectdata = EffectData()
effectdata:SetOrigin(self:GetPos())
effectdata:SetScale(5)
effectdata:SetMagnitude(5)
util.Effect("HelicopterMegaBomb", effectdata)
util.Effect("Explosion", effectdata)
self.Damage = self.mydamage or self.Damage
util.BlastDamage(self, self.Owner, self:GetPos(), 512, self.Damage )
shake = ents.Create("env_shake")
shake:SetOwner(self.Owner)
shake:SetPos(self:GetPos())
shake:SetKeyValue("amplitude", tostring(self.Damage * 20)) -- Power of the shake
shake:SetKeyValue("radius", tostring( 768 ) ) -- Radius of the shake
shake:SetKeyValue("duration", tostring( self.Damage / 200 )) -- Time of shake
shake:SetKeyValue("frequency", "255") -- How har should the screenshake be
shake:SetKeyValue("spawnflags", "4") -- Spawnflags(In Air)
shake:Spawn()
shake:Activate()
shake:Fire("StartShake", "", 0)
self:EmitSound("TFA_INS2_RPG7.2")
self:Remove()
end
function ENT:PhysicsCollide(data, phys)
if data.Speed > 60 and CurTime() > self.StartTime + self.Prime then
timer.Simple(0,function()
if IsValid(self) then
self:Explode()
end
end)
else
self.Prime = math.huge
if self.HasIdle then
self:StopSound("TFA_MMOD.RPG.Loop")
self.HasIdle = false
self:SetNWFloat("HideTime", -1 )
end
end
--[[elseif self:GetOwner() ~= self then
self.Prime = math.huge
self:StopSound("TFA_INS2_RPG7.Loop")
self:SetOwner(self)
end
]]--
end
function ENT:OnRemove()
if self.HasIdle then
self:StopSound("TFA_MMOD.RPG.Loop")
self.HasIdle = false
end
end
function ENT:Use(activator, caller)
if activator:IsPlayer() and self.WeaponClass and activator:GetWeapon(self.WeaponClass) then
activator:GiveAmmo(1, activator:GetWeapon(self.WeaponClass):GetPrimaryAmmoType(), false)
self:Remove()
end
end
function ENT:OnTakeDamage( dmg )
if dmg:GetInflictor() == self or dmg:GetAttacker() == self then return end
if self.Exploded then return end
if self.HP > 0 and self.HP - dmg:GetDamage() <= 0 then
self.Exploded = true
self:Explode()
end
self.HP = self.HP - dmg:GetDamage()
dmg:SetAttacker(self)
dmg:SetInflictor(self)
self:TakePhysicsDamage( dmg )
end

View File

@@ -0,0 +1,18 @@
--[[
| 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/
--]]
ENT.Type = "anim"
ENT.PrintName = "Contact Explosive"
ENT.Author = ""
ENT.Contact = ""
ENT.Purpose = ""
ENT.Instructions = ""
ENT.DoNotDuplicate = true
ENT.DisableDuplicator = true

View File

@@ -0,0 +1,34 @@
--[[
| 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/
--]]
include('shared.lua')
local Mat=Material("models/shiny")
local Glow=Material("sprites/mat_jack_basicglow")
language.Add("ent_rpgrocket","RPG")
function ENT:Initialize()
self.PrettyModel=ClientsideModel("models/Weapons/w_bullet.mdl")
self.PrettyModel:SetPos(self:GetPos()+self:GetUp()*1.25)
self.PrettyModel:SetAngles(self:GetAngles())
self.PrettyModel:SetParent(self)
self.PrettyModel:SetNoDraw(true)
self.PrettyModel:SetModelScale(2,0)
end
function ENT:Draw()
self:DrawModel()
if(self:GetDTBool(0))then
local Pos=self:GetPos()
local Back=-self:GetRight()
render.SetMaterial(Glow)
render.DrawSprite(Pos+Back*20,100,100,Color(255,220,190,255))
end
end
function ENT:OnRemove()
--eat a dick
end

View File

@@ -0,0 +1,144 @@
--[[
| 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/
--]]
--gernaaaayud
--By Jackarunda
AddCSLuaFile('cl_init.lua')
AddCSLuaFile('shared.lua')
include('shared.lua')
ENT.MotorPower=2500
function ENT:Initialize()
self.Owner = self:GetOwner()
self.rockettime = CurTime() + 10
self.Entity:SetModel("models/weapons/tfa_mmod/w_missile_launch.mdl")
self.Entity:PhysicsInit(SOLID_VPHYSICS)
self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
self.Entity:SetSolid(SOLID_VPHYSICS)
self.Entity:SetCollisionGroup(COLLISION_GROUP_NONE)
self.Entity:SetUseType(SIMPLE_USE)
local phys = self.Entity:GetPhysicsObject()
if phys:IsValid() then
phys:Wake()
phys:SetMass(7)
--phys:EnableGravity(false)
phys:EnableDrag(false)
end
self:Fire("enableshadow","",0)
self.Exploded=false
self.ExplosiveMul=0.5
self.MotorFired=false
self.Engaged=false
self:SetModelScale(1,0)
self:SetColor(Color(255,255,255))
self.InitialAng=self:GetAngles()
timer.Simple(0,function()
if(IsValid(self))then
self:FireMotor()
end
end)
local Settins=physenv.GetPerformanceSettings()
if(Settins.MaxVelocity<3000)then
Settins.MaxVelocity=3000
physenv.SetPerformanceSettings(Settins)
end
--if not(self.InitialVel)then self.InitialVel=Vector(0,0,0) end
end
function ENT:FireMotor()
self.Entity:EmitSound("TFA_MMOD.RPG.Loop")
if(self.MotorFired)then return end
self.MotorFired=true
--sound.Play("snd_jack_missilemotorfire.wav",self:GetPos(),85,110)
--sound.Play("snd_jack_missilemotorfire.wav",self:GetPos()+Vector(0,0,1),88,110)
self:SetDTBool(0,true)
self.Engaged=true
end
function ENT:PhysicsCollide(data,physobj)
if((data.Speed>80)and(data.DeltaTime>.2))then
self:Detonate()
end
end
function ENT:OnTakeDamage(dmginfo)
self.Entity:TakePhysicsDamage(dmginfo)
end
function ENT:Think()
if(self.Exploded)then return end
if not(self.Engaged)then
self:GetPhysicsObject():EnableGravity(false)
self:SetAngles(self.InitialAng)
--self:GetPhysicsObject():SetVelocity(self.InitialVel)
end
if(self.MotorFired)then
--local Flew=EffectData()
--Flew:SetOrigin(self:GetPos()-self:GetRight()*20)
--Flew:SetNormal(-self:GetRight())
--Flew:SetScale(2)
--util.Effect("eff_jack_rocketthrust",Flew)
local Flew=EffectData()
Flew:SetOrigin(self:GetPos()-self:GetRight()*20)
Flew:SetNormal(-self:GetRight())
Flew:SetScale(0.5)
util.Effect("eff_jack_rocketthrust",Flew)
local effdat = EffectData()
effdat:SetOrigin( self:GetPos() )
effdat:SetNormal( -self:GetForward() )
effdat:SetScale( 1 )
local SelfPos=self:GetPos()
local Phys=self:GetPhysicsObject()
Phys:EnableGravity(false)
Phys:ApplyForceCenter(self:GetRight()*self.MotorPower)
self.MotorPower=self.MotorPower+2000
if(self.MotorPower>=2000)then self.MotorPower=2000 end
end
if self.rockettime < CurTime() then
self:Detonate()
end
self:NextThink(CurTime()+.025)
return true
end
function ENT:OnRemove()
--pff
end
function ENT:Detonate()
self.Entity:StopSound( "TFA_MMOD.RPG.Loop" )
self.Entity:SetOwner(self.RPGOwner)
if(self.Exploding)then return end
self.Exploding=true
local SelfPos=self:GetPos()
local Pos=SelfPos
if(true)then
/*- EFFECTS -*/
util.ScreenShake(SelfPos,99999,99999,1,750)
--ParticleEffect("pcf_jack_airsplode_medium",SelfPos,self:GetAngles())
for key,thing in pairs(ents.FindInSphere(SelfPos,500))do
if((thing:IsNPC())and(self:Visible(thing)))then
if(table.HasValue({"npc_strider","npc_combinegunship","npc_helicopter","npc_turret_floor","npc_turret_ground","npc_turret_ceiling"},thing:GetClass()))then
thing:SetHealth(1)
thing:Fire("selfdestruct","",.5)
end
end
end
util.BlastDamage(self.Entity,self.RPGOwner,SelfPos,250,3000)
for i=0,40 do
local Trayuss=util.QuickTrace(SelfPos,VectorRand()*200,{self.Entity})
if(Trayuss.Hit)then
util.Decal("Scorch",Trayuss.HitPos+Trayuss.HitNormal,Trayuss.HitPos-Trayuss.HitNormal)
end
end
local Boom=EffectData()
Boom:SetOrigin(SelfPos)
Boom:SetScale(1)
util.Effect("eff_jack_lightboom",Boom,true,true)
self.Entity:Remove()
end
end
function ENT:Use(activator,caller)
--lol dude
end

View File

@@ -0,0 +1,17 @@
--[[
| 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/
--]]
ENT.Type = "anim"
ENT.PrintName = "Rocket-Propelled Grenade"
ENT.Author = "Jackarunda"
ENT.Category = "Jackarunda's Explosives"
ENT.Information = "goes zoom outta the rocket launcher and blows shit up"
ENT.Spawnable = false
ENT.AdminSpawnable = false

View File

@@ -0,0 +1,18 @@
--[[
| 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/
--]]
include('shared.lua')
function ENT:Draw()
self:DrawModel()
end
function ENT:OnRemove()
end

View File

@@ -0,0 +1,175 @@
--[[
| 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("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
ENT.Model = Model("models/weapons/w_missile.mdl")
ENT.ModelLaunch = Model("models/weapons/w_missile_launch.mdl")
ENT.Sprite = "sprites/animglow01.vmt"
ENT.FlySound = "Missile.Ignite"
function ENT:Initialize()
self:SetMoveType(MOVETYPE_FLYGRAVITY)
self:SetMoveCollide(MOVECOLLIDE_FLY_BOUNCE)
self:SetSolid(SOLID_BBOX)
self:SetModel(self.ModelLaunch)
self:SetCollisionBounds(Vector(), Vector())
local angAngs = self:GetAngles()
angAngs.x = angAngs.x - 30
local vecFwd = angAngs:Forward()
self:SetLocalVelocity(vecFwd * 250)
local svgravity = cvars.Number("sv_gravity", 800)
if svgravity != 0 then
local gravityMul = 400 / svgravity
self:SetGravity(gravityMul)
end
self:NextThink(CurTime() + .4)
self.radius = 300
end
function ENT:Touch(pOther)
if !pOther:IsSolid() or pOther:GetClass() == "hornet" then
return
end
self:Explode(pOther)
end
function ENT:Explode(ent)
if self.didHit then return end
local vecDir = self:GetForward()
local tr = util.TraceLine({
start = self:GetPos(),
endpos = self:GetPos() + vecDir * 16,
mask = MASK_SHOT,
filter = self
})
self:SetSolid(SOLID_NONE)
if tr.Fraction == 1.0 || !tr.HitSky then
local pos, norm = tr.HitPos, tr.HitNormal
local explosion = EffectData()
explosion:SetOrigin(pos)
explosion:SetNormal(norm)
if self:WaterLevel() >= 3 then
util.Effect("WaterSurfaceExplosion", explosion)
else
local explode = ents.Create( "info_particle_system" )
explode:SetKeyValue( "effect_name", "hl2mmod_explosion_rpg" )
explode:SetOwner( self.Owner )
explode:SetPos( self:GetPos() )
explode:Spawn()
explode:Activate()
explode:Fire( "start", "", 0 )
explode:Fire( "kill", "", 30 )
end
util.Decal("Scorch", pos - vecDir + norm, pos + vecDir)
local dlighteff = EffectData()
dlighteff:SetEntity(self)
dlighteff:SetOrigin(self:GetPos())
util.Effect("mmod_fx_explosion_dlight", dlighteff)
self:EmitSound("BaseExplosionEffect.Sound")
local owner = IsValid(self.Owner) and self.Owner or self
local dmg = DamageInfo()
dmg:SetInflictor(self)
dmg:SetAttacker(owner)
dmg:SetDamage(self.dmg)
dmg:SetDamageType(bit.bor(DMG_BLAST, DMG_AIRBOAT))
util.BlastDamageInfo(dmg, tr.HitPos, self.radius)
end
self.didHit = true
--self:RemoveEffects(EF_BRIGHTLIGHT)
self:StopSound(self.FlySound)
self:SetLocalVelocity(Vector())
self:SetMoveType(MOVETYPE_NONE)
self:AddEffects(EF_NODRAW)
if self.glow and IsValid(self.glow) then self.glow:Remove() end
self:Remove()
end
function ENT:Think()
if self.didHit then return end
if !self.m_flIgniteTime then
self:SetMoveType(MOVETYPE_FLY)
self:SetModel(self.Model)
ParticleEffectAttach("hl2mmod_weapon_rpg_smoketrail", PATTACH_ABSORIGIN_FOLLOW, self, 0)
--self:AddEffects(EF_BRIGHTLIGHT)
self:EmitSound(self.FlySound)
-- self.glow = ents.Create("env_sprite")
-- local glow = self.glow
-- glow:SetKeyValue("rendercolor", "255 192 64")
-- glow:SetKeyValue("GlowProxySize", "2")
-- glow:SetKeyValue("HDRColorScale", "1")
-- glow:SetKeyValue("renderfx", "15")
-- glow:SetKeyValue("rendermode", "3")
-- glow:SetKeyValue("renderamt", "255")
-- glow:SetKeyValue("model", self.Sprite)
-- glow:SetKeyValue("scale", ".08")
-- glow:Spawn()
-- glow:SetParent(self)
-- glow:SetPos(self:GetPos())
--ParticleEffectAttach("rocket_smoke_trail", PATTACH_ABSORIGIN_FOLLOW, self, 0)
--ParticleEffectAttach("weapon_rpg_smoketrail", PATTACH_ABSORIGIN_FOLLOW, self, 0)
ParticleEffectAttach("hl2mmod_weapon_rpg_smoketrail", PATTACH_ABSORIGIN_FOLLOW, self, 0)
--util.SpriteTrail( self.Entity, 0, Color( 165, 165, 165 ), false, 8, 16, 0.5, 1 / ( 165 ), "trails/smoke.vmt" )
self.m_flIgniteTime = CurTime()
self.vecTarget = self:GetForward()
self:NextThink(CurTime() + 0.1)
end
if self.bGuiding then
local spot = IsValid(self.pLauncher) and !self.pLauncher:GetSprinting() and self.pLauncher:GetSpotEntity() or NULL
local vecDir = Vector()
if IsValid(spot) and spot:GetOwner() == self:GetOwner() and spot:GetDrawLaser() then
local tr = util.TraceLine({
start = self:GetPos(),
endpos = spot:GetPos(),
filter = {self, self.Owner, spot}
})
if tr.Fraction >= 0.90 then
vecDir = spot:GetPos() - self:GetPos()
vecDir = vecDir:GetNormalized()
self.vecTarget = vecDir
end
end
end
self:SetAngles(self.vecTarget:Angle())
local flSpeed = self:GetVelocity():Length()
self:SetLocalVelocity(self:GetVelocity() * 0.2 + self.vecTarget * (flSpeed * 0.8 + 400))
if self:WaterLevel() == 3 then
if self:GetVelocity():Length() > 300 then
self:SetLocalVelocity(self:GetVelocity():GetNormalized() * 300)
end
else
if self:GetVelocity():Length() > 2000 then
self:SetLocalVelocity(self:GetVelocity():GetNormalized() * 2000)
end
end
self:NextThink(CurTime() + .1)
return true
end
function ENT:OnRemove()
self:StopSound(self.FlySound)
end

View File

@@ -0,0 +1,13 @@
--[[
| 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/
--]]
ENT.Type = "anim"
ENT.PrintName = "HL2 MMod RPG Rocket"
ENT.Author = "Upset"

View File

@@ -0,0 +1,74 @@
--[[
| 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()
ENT.Type = "anim"
ENT.Base = "base_anim"
ENT.Spawnable = false
function ENT:Draw()
self:DrawModel()
end
function ENT:Initialize()
if SERVER then
self:SetModel( "models/weapons/tfa_hdtf/w_m67.mdl" )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
self:PhysicsInit( SOLID_VPHYSICS )
self:SetCollisionGroup( COLLISION_GROUP_NONE )
self:DrawShadow( false )
end
self:EmitSound("TFA_CSGO_HEGrenade.Throw")
self.ExplodeTimer = CurTime() + 1.5
end
function ENT:Think()
if SERVER and self.ExplodeTimer <= CurTime() then
self:Explode()
self:Remove()
end
end
function ENT:PhysicsCollide( data )
if SERVER and data.Speed > 150 then
self:EmitSound( "TFA_CSGO_HEGrenade.Bounce" )
end
end
function ENT:OnRemove()
end
function ENT:Explode()
if SERVER then
local explode = ents.Create( "info_particle_system" )
explode:SetKeyValue( "effect_name", "explosion_hegrenade_brief" )
explode:SetOwner( self.Owner )
explode:SetPos( self:GetPos() )
explode:Spawn()
explode:Activate()
explode:Fire( "start", "", 0 )
explode:Fire( "kill", "", 15 )
local explode2 = ents.Create( "info_particle_system" )
explode2:SetKeyValue( "effect_name", "explosion_hegrenade_interior" )
explode2:SetOwner( self.Owner )
explode2:SetPos( self:GetPos() )
explode2:Spawn()
explode2:Activate()
explode2:Fire( "start", "", 0 )
explode2:Fire( "kill", "", 15 )
self:EmitSound( "TFA_CSGO_BaseGrenade.Explode" )
end
util.BlastDamage( self, self.Owner, self:GetPos(), 350, 98 )
local spos = self:GetPos()
local trs = util.TraceLine({start=spos + Vector(0,0,64), endpos=spos + Vector(0,0,-32), filter=self})
util.Decal("Scorch", trs.HitPos + trs.HitNormal, trs.HitPos - trs.HitNormal)
end

View File

@@ -0,0 +1,99 @@
--[[
| 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()
ENT.Type = "anim"
ENT.Base = "base_anim"
ENT.Spawnable = false
ENT.AdminSpawnable = false
ENT.Damage = 1
function ENT:Draw()
end
function ENT:Initialize()
self.Damage = 1
self:SetNWBool("extinguished",false)
if SERVER then
self:SetModel( "models/weapons/tfa_csgo/w_eq_incendiarygrenade_thrown.mdl" )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_NONE )
self:SetCollisionGroup( COLLISION_GROUP_DEBRIS )
self:DrawShadow( false )
self:CreateFires()
end
self:NextThink( CurTime() )
end
function ENT:CreateFires()
for i = 1, 20 do
local fire = ents.Create("info_particle_system")
if (i < 2) then
fire:SetKeyValue("effect_name","molotov_fire_main_gm")
else
fire:SetKeyValue("effect_name","molotov_fire_child_gm")
end
local pos = self:GetPos()
//fire:SetPos( Vector( pos.x + 100 * math.sin( math.rad( i * 20 ) ), pos.y + 100 * math.cos( math.rad( i * 20 ) ), pos.z ) )
fire:SetPos( Vector( pos.x + math.Rand(0, 144) * math.sin( math.rad( i * math.Rand( 0, 180 ) ) ), pos.y + math.Rand(0, 144) * math.cos( math.rad( i * math.Rand( 0, 180 ) ) ), pos.z ) )
fire:SetAngles( self:GetAngles() )
fire:SetParent( self )
fire:Spawn()
fire:Activate()
fire:Fire("Start","",0)
fire:Fire("Kill", "",8)
end
self.nextFires = CurTime() + 6
end
function ENT:Think()
if SERVER then
for k, v in pairs( ents.FindInSphere( self:GetPos(), 150 ) ) do
if v:IsPlayer() or v:IsNPC() then
-- If player did not take the damage in TBC then deal it for 1 second and then stop
if (!self.damageReceivers or self.damageReceivers and !self.damageReceivers[v]) then
damage = DamageInfo()
damage:SetDamage( math.random( 3, 7 ) )
damage:SetAttacker( self:GetOwner() )
damage:SetInflictor( self:GetCreator() )
damage:SetDamageType( DMG_BURN )
v:TakeDamageInfo( damage )
if (self.damageReceivers and self.damageReceivers[v] == nil) then
self.damageReceivers[v] = false
timer.Simple(1, function()
if (IsValid(self) and IsValid(v)) then
self.damageReceivers[v] = true
end
end)
end
end
end
end
if (self.nextFires and CurTime() > self.nextFires) then
self:CreateFires()
end
end
if self:GetNWBool("extinguished",true) then
if not self.PlayedSound then
self:EmitSound("TFA_CSGO_Molotov.Extinguish")
self.PlayedSound = true
end
if SERVER then
SafeRemoveEntity( self )
end
end
self:NextThink( CurTime() + math.Rand( 0.2, 0.7 ) )
end

View File

@@ -0,0 +1,47 @@
--[[
| 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()
ENT.Type = "anim"
ENT.Base = "base_anim"
ENT.Spawnable = false
ENT.AdminSpawnable = false
function ENT:Draw()
end
function ENT:Initialize()
self:SetNWBool("extinguished",false)
if SERVER then
self:SetModel( "models/weapons/tfa_csgo/w_eq_incendiarygrenade_thrown.mdl" )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_NONE )
self:SetCollisionGroup( COLLISION_GROUP_DEBRIS )
self:DrawShadow( false )
end
ParticleEffect( "molotov_explosion", self:GetPos(), self:GetAngles() )
self:EmitSound( "TFA_CSGO_Inferno.Loop" )
end
function ENT:Think()
if self:GetNWBool("extinguished",true) then
//ParticleEffect( "extinguish_fire", self:GetPos(), self:GetAngles() )
if SERVER then
self:Remove()
end
end
end
function ENT:OnRemove()
self:EmitSound( "TFA_CSGO_Inferno.FadeOut" )
self:StopSound( "TFA_CSGO_Inferno.Loop" )
end

View File

@@ -0,0 +1,27 @@
--[[
| 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/
--]]
include('shared.lua')
/*---------------------------------------------------------
Draw
---------------------------------------------------------*/
function ENT:Draw()
self.Entity:DrawModel()
end
/*---------------------------------------------------------
IsTranslucent
---------------------------------------------------------*/
function ENT:IsTranslucent()
return true
end

View File

@@ -0,0 +1,173 @@
--[[
| 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( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')
function ENT:Initialize()
self:SetModel("models/weapons/arccw_go/w_eq_flashbang_thrown.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
--self:PhysicsInitSphere( ( self:OBBMaxs() - self:OBBMins() ):Length()/4, "metal" )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
self:DrawShadow( false )
self:SetCollisionGroup( COLLISION_GROUP_NONE )
self:EmitSound("TFA_CSGO_Flashbang.Throw")
local curTime = CurTime()
self.timeleft = curTime + 2 -- HOW LONG BEFORE EXPLOSION
self.removeTime = curTime + 30
self:Think()
end
function ENT:Think()
local curTime = CurTime()
if self.timeleft < curTime and !self.deactivated then
self:Explosion()
end
if (self.removeTime < curTime and !self.noRemove) then
SafeRemoveEntity(self)
end
self:NextThink( curTime )
return true
end
function ENT:EntityFacingFactor( theirent )
local dir = theirent:EyeAngles():Forward()
local facingdir = (self:GetPos() - (theirent.GetShootPos and theirent:GetShootPos() or theirent:GetPos())):GetNormalized()
return (facingdir:Dot(dir)+1)/2
end
function ENT:EntityFacingUs( theirent )
local dir = theirent:EyeAngles():Forward()
local facingdir = (self:GetPos()-(theirent.GetShootPos and theirent:GetShootPos() or theirent:GetPos())):GetNormalized()
if facingdir:Dot(dir)>-0.25 then return true end
end
function ENT:Explosion()
self:EmitSound("TFA_CSGO_FLASHGRENADE.BOOM")
local tr = {}
tr.start = self:GetPos()
tr.mask = MASK_SOLID
for _, v in ipairs(player.GetAll()) do
tr.endpos = v:GetShootPos()
tr.filter = { self, v, v:GetActiveWeapon() }
local traceres = util.TraceLine(tr)
if !traceres.Hit or traceres.Fraction>=1 or traceres.Fraction<=0 then
local factor = self:EntityFacingFactor(v)
local distance = v:GetShootPos():Distance(self:GetPos())
v:SetNWFloat("TFACSGO_LastFlash", CurTime())
v:SetNWEntity("TFACSGO_LastFlashBy", self:GetOwner())
v:SetNWFloat("TFACSGO_FlashDistance", distance)
v:SetNWFloat("TFACSGO_FlashFactor", factor)
hook.Run("PlayerFlashed", v, self:GetOwner(), self, distance, factor)
if v:GetNWFloat("TFACSGO_FlashDistance",distance) < 1500 and v:GetNWFloat("FlashFactor",factor) < tr.endpos:Distance(self:GetPos(v)) then
if v:GetNWFloat("TFACSGO_FlashDistance",distance) < 1000 then
v:SetDSP( 37 , false )
elseif v:GetNWFloat("TFACSGO_FlashDistance",distance) < 800 then
v:SetDSP( 36 , false )
elseif v:GetNWFloat("TFACSGO_FlashDistance",distance) < 600 then
v:SetDSP( 35, false )
end
end
end
end
--[[
for _, v in ipairs(ents.GetAll()) do
if v:IsNPC() and self:EntityFacingUs(v) then
tr.endpos = v.GetShootPos and v:GetShootPos() or v:GetPos()
tr.filter = { self, v, v.GetActiveWeapon and v:GetActiveWeapon() or v}
local traceres = util.TraceLine(tr)
if !traceres.Hit or traceres.Fraction>=1 or traceres.Fraction<=0 then
local flashdistance = tr.endpos:Distance(self:GetPos())
local flashtime = CurTime()
local distancefac = ( 1-math.Clamp((flashdistance-csgo_flashdistance+csgo_flashdistancefade)/csgo_flashdistancefade,0,1) )
local intensity = ( 1-math.Clamp(((CurTime()-flashtime)/distancefac-csgo_flashtime+csgo_flashfade)/csgo_flashfade,0,1) )
if intensity>0.8 then
v:SetNWFloat("TFACSGO_LastFlash", CurTime())
v:SetNWEntity("TFACSGO_LastFlashBy", self:GetOwner())
v:SetNWFloat("TFACSGO_FlashDistance", v:GetShootPos():Distance(self:GetPos()))
v:SetNWFloat("TFACSGO_FlashFactor", self:EntityFacingFactor(v))
if v.ClearSchedule then
v:ClearSchedule()
end
if v.SetEnemy then
v:SetEnemy(nil)
end
if v.AddEntityRelationship and IsValid(self.Owner) then
local oldrel = v.GetRelationship and v:GetRelationship(self.Owner) or ( ( IsFriendEntityName( v:GetClass() ) and !game.GetMap()=="gm_raid" ) and D_LI or D_HT )
v:AddEntityRelationship( self.Owner, D_NU, 99)
timer.Simple(csgo_flashtime/2, function()
if IsValid(v) and v:IsNPC() and IsValid(self) and IsValid(self.Owner) then
v:AddEntityRelationship( self.Owner, oldrel, 99)
end
end)
end
if v.ClearEnemyMemory then
v:ClearEnemyMemory()
end
end
end
end
end
]]
self.deactivated = true
end
/*---------------------------------------------------------
OnTakeDamage
---------------------------------------------------------*/
function ENT:OnTakeDamage( dmginfo )
end
/*---------------------------------------------------------
Use
---------------------------------------------------------*/
function ENT:Use( activator, caller, type, value )
end
/*---------------------------------------------------------
StartTouch
---------------------------------------------------------*/
function ENT:StartTouch( entity )
end
/*---------------------------------------------------------
EndTouch
---------------------------------------------------------*/
function ENT:EndTouch( entity )
end
/*---------------------------------------------------------
Touch
---------------------------------------------------------*/
function ENT:Touch( entity )
end

View File

@@ -0,0 +1,44 @@
--[[
| 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/
--]]
ENT.Type = "anim"
ENT.PrintName = "explosive Grenade"
ENT.Author = ""
ENT.Contact = ""
ENT.Purpose = ""
ENT.Instructions = ""
ENT.DoNotDuplicate = true
ENT.DisableDuplicator = true
/*---------------------------------------------------------
OnRemove
---------------------------------------------------------*/
function ENT:OnRemove()
end
/*---------------------------------------------------------
PhysicsUpdate
---------------------------------------------------------*/
function ENT:PhysicsUpdate()
end
/*---------------------------------------------------------
PhysicsCollide
---------------------------------------------------------*/
function ENT:PhysicsCollide(data,phys)
if data.Speed > 60 then
self.Entity:EmitSound(Sound("TFA_CSGO_SmokeGrenade.Bounce"))
local impulse = (data.OurOldVelocity - 2 * data.OurOldVelocity:Dot(data.HitNormal) * data.HitNormal)*0.25
phys:ApplyForceCenter(impulse)
end
end

View File

@@ -0,0 +1,74 @@
--[[
| 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()
ENT.Type = "anim"
ENT.Base = "base_anim"
ENT.Spawnable = false
function ENT:Draw()
self:DrawModel()
end
function ENT:Initialize()
if SERVER then
self:SetModel( "models/weapons/tfa_csgo/w_eq_fraggrenade_thrown.mdl" )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
self:PhysicsInit( SOLID_VPHYSICS )
self:SetCollisionGroup( COLLISION_GROUP_NONE )
self:DrawShadow( false )
end
self:EmitSound("TFA_CSGO_HEGrenade.Throw")
self.ExplodeTimer = CurTime() + 1.5
end
function ENT:Think()
if SERVER and self.ExplodeTimer <= CurTime() then
self:Explode()
self:Remove()
end
end
function ENT:PhysicsCollide( data )
if SERVER and data.Speed > 150 then
self:EmitSound( "TFA_CSGO_HEGrenade.Bounce" )
end
end
function ENT:OnRemove()
end
function ENT:Explode()
if SERVER then
local explode = ents.Create( "info_particle_system" )
explode:SetKeyValue( "effect_name", "explosion_hegrenade_brief" )
explode:SetOwner( self.Owner )
explode:SetPos( self:GetPos() )
explode:Spawn()
explode:Activate()
explode:Fire( "start", "", 0 )
explode:Fire( "kill", "", 15 )
local explode2 = ents.Create( "info_particle_system" )
explode2:SetKeyValue( "effect_name", "explosion_hegrenade_interior" )
explode2:SetOwner( self.Owner )
explode2:SetPos( self:GetPos() )
explode2:Spawn()
explode2:Activate()
explode2:Fire( "start", "", 0 )
explode2:Fire( "kill", "", 15 )
self:EmitSound( "TFA_CSGO_BaseGrenade.Explode" )
end
util.BlastDamage( self, self.Owner, self:GetPos(), 354, 98 )
local spos = self:GetPos()
local trs = util.TraceLine({start=spos + Vector(0,0,64), endpos=spos + Vector(0,0,-32), filter=self})
util.Decal("Scorch", trs.HitPos + trs.HitNormal, trs.HitPos - trs.HitNormal)
end

View File

@@ -0,0 +1,122 @@
--[[
| 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()
ENT.Type = "anim"
ENT.Base = "base_anim"
ENT.Spawnable = false
function ENT:Draw()
self:DrawModel()
end
function ENT:Initialize()
if SERVER then
self:SetModel( "models/weapons/arccw_go/w_eq_incendiarygrenade_thrown.mdl" )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
self:PhysicsInit( SOLID_VPHYSICS )
self:SetCollisionGroup( COLLISION_GROUP_NONE )
self:DrawShadow( false )
self.fireEntities = {}
end
self:EmitSound("TFA_CSGO_IncGrenade.Throw")
self.ActiveTimer = CurTime() + 1.5
self.IgniteEnd = 0
self.IgniteEndTimer = CurTime()
self.IgniteStage = 0
self.IgniteStageTimer = CurTime()
ParticleEffectAttach("incgrenade_thrown_trail",PATTACH_POINT_FOLLOW,self,1)
self:PhysicsInitSphere( 8 )
end
function ENT:PhysicsCollide(data, phys)
if (SERVER and self.ActiveTimer > CurTime() or data.Speed >= 150) then
self:EmitSound("TFA_CSGO_SmokeGrenade.Bounce")
end
local ang = data.HitNormal:Angle()
ang.p = math.abs(ang.p)
ang.y = math.abs(ang.y)
ang.r = math.abs(ang.r)
if (ang.p > 90 or ang.p < 60) then
self.Entity:EmitSound(Sound("TFA_CSGO_SmokeGrenade.Bounce"))
local impulse = (data.OurOldVelocity - 2 * data.OurOldVelocity:Dot(data.HitNormal) * data.HitNormal) * 0.25
phys:ApplyForceCenter(impulse)
else
if (SERVER) then
local delayedTrigger = false
local client = self.Owner
for k, v in pairs(ents.FindInSphere(self:GetPos(), 150)) do
if (v:IsPlayer() or v:IsNPC()) then
hook.Run("InitializeGrenade", client, self, true)
delayedTrigger = true
break
end
end
local molotovfire = ents.Create("arccw_go_fire")
molotovfire:SetPos(self:GetPos())
molotovfire:SetOwner(self.Owner)
molotovfire:Spawn()
if (!self.noRemove) then
SafeRemoveEntityDelayed(molotovfire, 8)
end
table.insert(self.fireEntities, molotovfire)
ParticleEffectAttach("fire_large_01", PATTACH_ABSORIGIN_FOLLOW, molotovfire, 0)
-- Schedule the removal of physics and collision settings after a short delay
timer.Simple(0.1, function()
if (IsValid(self)) then
self:SetMoveType(MOVETYPE_NONE)
self:SetSolid(SOLID_NONE)
self:PhysicsInit(SOLID_NONE)
self:SetCollisionGroup(COLLISION_GROUP_NONE)
self:SetRenderMode(RENDERMODE_TRANSALPHA)
self:SetColor(Color(255, 255, 255, 0))
self:DrawShadow(false)
self:StopParticles()
end
end)
end
self:EmitSound("TFA_CSGO_IncGrenade.Start")
self.IgniteEnd = 1
self.IgniteEndTimer = CurTime() + 7
self.IgniteStage = 1
self.IgniteStageTimer = CurTime() + 0.1
end
if (!self.noRemove) then
SafeRemoveEntityDelayed(self, 8)
end
end
function ENT:OnRemove()
if (self.fireEntities and !table.IsEmpty(self.fireEntities)) then
for k, v in pairs(self.fireEntities) do
if (IsValid(v)) then
v:Remove()
end
end
end
if (timer.Exists("GrenadesCleanup"..self:EntIndex())) then
timer.Remove("GrenadesCleanup"..self:EntIndex())
end
end

View File

@@ -0,0 +1,92 @@
--[[
| 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()
ENT.Type = "anim"
ENT.Base = "base_anim"
ENT.Spawnable = false
function ENT:Draw()
self:DrawModel()
end
function ENT:Initialize()
if SERVER then
self:SetModel( "models/weapons/tfa_csgo/w_eq_molotov_thrown.mdl" )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
self:PhysicsInit( SOLID_VPHYSICS )
self:SetCollisionGroup( COLLISION_GROUP_NONE )
self:DrawShadow( false )
end
self:EmitSound("TFA_CSGO_Inferno.Throw")
self:EmitSound("TFA_CSGO_Inferno.IgniteStart")
self.ActiveTimer = CurTime() + 1.5
self.IgniteEnd = 0
self.IgniteEndTimer = CurTime()
self.IgniteStage = 0
self.IgniteStageTimer = CurTime()
ParticleEffectAttach("weapon_molotov_thrown",PATTACH_POINT_FOLLOW,self,1)
self:PhysicsInitSphere( 8 )
end
function ENT:PhysicsCollide( data,phys )
if SERVER and self.ActiveTimer > CurTime() || data.Speed >= 150 then
self:EmitSound(Sound("GlassBottle.ImpactHard"))
end
local ang = data.HitNormal:Angle()
ang.p = math.abs( ang.p )
ang.y = math.abs( ang.y )
ang.r = math.abs( ang.r )
if ang.p > 90 or ang.p < 60 then
self:EmitSound(Sound("GlassBottle.ImpactHard"))
local impulse = (data.OurOldVelocity - 2 * data.OurOldVelocity:Dot(data.HitNormal) * data.HitNormal)*0.25
phys:ApplyForceCenter(impulse)
else
if SERVER then
local molotovfire = ents.Create( "tfa_csgo_fire_2" )
molotovfire:SetPos( self:GetPos() )
molotovfire:SetOwner( self.Owner )
molotovfire:Spawn()
SafeRemoveEntityDelayed(molotovfire, 8)
local molotovfire = ents.Create( "tfa_csgo_fire_1" )
local pos = self:GetPos()
molotovfire:SetPos( self:GetPos() )
molotovfire:SetOwner( self.Owner )
molotovfire:SetCreator( self )
molotovfire:Spawn()
SafeRemoveEntityDelayed(molotovfire, 8)
self:SetMoveType( MOVETYPE_NONE )
self:SetSolid( SOLID_NONE )
self:PhysicsInit( SOLID_NONE )
self:SetCollisionGroup( COLLISION_GROUP_NONE )
self:SetRenderMode( RENDERMODE_TRANSALPHA )
self:SetColor( Color( 255, 255, 255, 0 ) )
self:DrawShadow( false )
self:StopParticles()
end
self:EmitSound("TFA_CSGO_Inferno.Start")
self.IgniteEnd = 1
self.IgniteEndTimer = CurTime() + 7
self.IgniteStage = 1
self.IgniteStageTimer = CurTime() + 0.1
end
SafeRemoveEntityDelayed(self, 8)
end
function ENT:OnRemove()
if (timer.Exists("GrenadesCleanup"..self:EntIndex())) then
timer.Remove("GrenadesCleanup"..self:EntIndex())
end
end

View File

@@ -0,0 +1,230 @@
--[[
| 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 (CLIENT) then
local EFFECT = {}
--Thanks Inconceivable/Generic Default
function EFFECT:Init(data)
self.Entity = data:GetEntity()
pos = data:GetOrigin()
self.Emitter = ParticleEmitter(pos)
local cloud = ents.CreateClientside( "arccw_smoke" )
if !IsValid(cloud) then return end
cloud:SetPos(pos)
cloud:Spawn()
-- for i = 1, 100 do
-- local particle = self.Emitter:Add("arccw/particle/particle_smokegrenade", pos)
-- if (particle) then
-- particle:SetVelocity(VectorRand():GetNormalized() * math.Rand(150, 300))
-- if i <= 5 then
-- particle:SetDieTime(25)
-- else
-- particle:SetDieTime(math.Rand(20, 25))
-- end
-- particle:SetStartAlpha(math.Rand(150, 255))
-- particle:SetEndAlpha(0)
-- particle:SetStartSize(44)
-- particle:SetEndSize(144)
-- particle:SetRoll(math.Rand(0, 360))
-- particle:SetRollDelta(math.Rand(-1, 1) / 3)
-- particle:SetColor(65, 65, 65)
-- particle:SetAirResistance(100)
-- particle:SetCollide(true)
-- particle:SetBounce(1)
-- end
-- end
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end
effects.Register(EFFECT, "tfa_csgo_smokenade")
end
AddCSLuaFile()
ENT.Type = "anim"
ENT.Base = "base_anim"
ENT.PrintName = "Smoke Grenade"
ENT.Author = ""
ENT.Information = ""
ENT.Spawnable = false
ENT.AdminSpawnable = false
ENT.BounceSound = Sound("TFA_CSGO_SmokeGrenade.Bounce")
ENT.ExplodeSound = Sound("TFA_CSGO_BaseSmokeEffect.Sound")
function ENT:Draw()
self:DrawModel()
end
function ENT:Initialize()
if SERVER then
self:SetModel( "models/weapons/arccw_go/w_eq_smokegrenade_thrown.mdl" )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
self:PhysicsInit( SOLID_VPHYSICS )
self:SetCollisionGroup( COLLISION_GROUP_NONE )
self:DrawShadow( false )
self.Delay = CurTime() + 3
self.NextParticle = 0
self.ParticleCount = 0
self.First = true
self.IsDetonated = false
end
self:EmitSound("TFA_CSGO_SmokeGrenade.Throw")
end
function ENT:PhysicsCollide(data, physobj)
if SERVER then
self.HitP = data.HitPos
self.HitN = data.HitNormal
if self:GetVelocity():Length() > 60 then
self:EmitSound(self.BounceSound)
end
if self:GetVelocity():Length() < 5 then
self:SetMoveType(MOVETYPE_NONE)
end
for k, v in pairs( ents.FindInSphere( self:GetPos(), 155 ) ) do
if v:GetClass() == "tfa_csgo_fire_1" or v:GetClass() == "tfa_csgo_fire_2" and self.IsDetonated == false then
self:Detonate(self,self:GetPos())
self.IsDetonated = true
end
end
end
end
function ENT:Think()
if SERVER then
local curTime = CurTime()
if curTime > self.Delay then
if self.IsDetonated == false then
self:Detonate(self,self:GetPos())
self.IsDetonated = true
end
end
if (self.nextSmoke and curTime > self.nextSmoke) then
self:CreateSmoke()
end
end
for k, v in pairs (ents.GetAll()) do
local SmokeHidden2 = v:GetNWBool( "IsInsideSmoke", false )
if IsValid(v) and v:IsPlayer() or v:IsNPC() and v.SmokeHidden2 != nil or v.SmokeHidden2 == true then
v:SetNWBool("IsInsideSmoke", false)
v:RemoveFlags(FL_NOTARGET)
end
end
if self.IsDetonated then
for k, v in pairs( ents.FindInSphere( self:GetPos(), 155 ) ) do
if (v:GetClass("tfa_csgo_fire_1") or v:GetClass("tfa_csgo_fire_2")) and v:IsValid() then
v:SetNWBool("extinguished",true)
end
if v:GetNWBool("extinguished",true) and self.ParticleCreated == false then
//ParticleEffect( "extinguish_fire", self:GetPos(), self:GetAngles() )
self.ExtinguishParticleCreated = true
end
if IsValid(v) and v:IsPlayer() or v:IsNPC() then
local SmokeHidden = v:GetNWBool( "IsInsideSmoke", false )
if v.SmokeHidden != false or v.SmokeHidden == nil then
v:SetNWBool("IsInsideSmoke", true)
v:AddFlags(FL_NOTARGET)
end
end
if IsValid(v) and v:IsNPC() and v.SmokeHidden == true then
if v.OldProfiecency == nil then
v.OldProfiecency = v:GetCurrentWeaponProficiency()
end
v:SetCurrentWeaponProficiency(WEAPON_PROFICIENCY_POOR)
v:ClearSchedule()
v:SetState(NPC_STATE_ALERT)
end
end
end
end
function ENT:Detonate(self,pos)
self.ParticleCreated = false
self.ExtinguishParticleCreated = false
if SERVER then
if not self:IsValid() then return end
self:SetNWBool("IsDetonated",true)
self:EmitSound(self.ExplodeSound)
self:CreateSmoke(pos)
end
if self.ParticleCreated != true then
ParticleEffectAttach("explosion_child_smoke03e",PATTACH_ABSORIGIN_FOLLOW,self,0)
ParticleEffectAttach("explosion_child_core06b",PATTACH_POINT_FOLLOW,self,0)
ParticleEffectAttach("explosion_child_smoke07b",PATTACH_ABSORIGIN_FOLLOW,self,0)
ParticleEffectAttach("explosion_child_smoke07c",PATTACH_POINT_FOLLOW,self,0)
ParticleEffectAttach("explosion_child_distort01c",PATTACH_POINT_FOLLOW,self,0)
self.ParticleCreated = true
end
for k, v in pairs( ents.FindInSphere( self:GetPos(), 155 ) ) do
if (v:GetClass("tfa_csgo_fire_1") or v:GetClass("tfa_csgo_fire_2")) and v:IsValid() then
v:SetNWBool("extinguished",true)
end
if v:GetNWBool("extinguished",true) and self.ParticleCreated == false then
//ParticleEffect( "extinguish_fire", self:GetPos(), self:GetAngles() )
self.ExtinguishParticleCreated = true
end
end
self:SetMoveType( MOVETYPE_NONE )
if SERVER and !self.noRemove then
SafeRemoveEntityDelayed(self, 60)
end
end
function ENT:CreateSmoke(pos)
local gas = EffectData()
gas:SetOrigin(pos or self:GetPos())
gas:SetEntity(self.Owner) //i dunno, just use it!
util.Effect("tfa_csgo_smokenade", gas)
self.nextSmoke = CurTime() + 20
end
function ENT:OnRemove()
for k, v in pairs (ents.GetAll()) do
local SmokeHidden = v:GetNWBool( "IsInsideSmoke", false )
if v:IsPlayer() or v:IsNPC() and v.SmokeHidden2 != nil or v.SmokeHidden2 == true then
v:SetNWBool("IsInsideSmoke", false)
v:RemoveFlags(FL_NOTARGET)
end
if v:IsNPC() and v.OldProfiecency != nil then
v:SetCurrentWeaponProficiency(v.OldProfiecency)
end
end
if (timer.Exists("GrenadesCleanup"..self:EntIndex())) then
timer.Remove("GrenadesCleanup"..self:EntIndex())
end
end

View File

@@ -0,0 +1,232 @@
--[[
| 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/
--]]
include("shared.lua")
function ENT:Think()
local CT = CurTime()
local FT = FrameTime()
local attach = self:LookupAttachment("Wick")
local data = self:GetAttachment(attach)
local attpos,attangs
attpos = data.Pos
attangs = data.Ang
if self:GetNWBool("Fused") then
ParticleEffect("weapon_sensorgren_beeplight",attpos,attangs,self)
self.ParticleCreated = true
self:StopParticles()
if self.FuseTime then
if self.FuseTime <= CT then
if not self.NextBeep then
self.DetonateTime = CT + 1.5
self.NextBeep = 0
end
self.NextBeep = self.NextBeep - FT * 6
self:StopParticles()
self.ParticleCreated = false
if self.NextBeep <= 0 and self.ParticleCreated == false then
self.NextBeep = 1
end
end
else
self.FuseTime = CT + 0.65
self:StopParticles()
end
end
end
local tr, col = {}, Color(255, 25, 25)
local glow = Material("tfa_csgo/sprites/flare_sprite_02")
function ENT:Draw()
local ply = LocalPlayer()
local attach = self:LookupAttachment("Wick")
local data = self:GetAttachment(attach)
local attpos,attangs
attpos = data.Pos
attangs = data.Ang
self:DrawModel()
local CT = CurTime()
if self.NextBeep then
if self.NextBeep > 0 then
tr.start = self:GetPos()
tr.endpos = ply:EyePos()
tr.mask = MASK_SOLID
tr.filter = { self, ply, ply:GetActiveWeapon() }
local trace = util.TraceLine(tr)
local fraction = trace.Fraction
if self.DetonateTime > CT then
self:StopParticles()
end
end
end
end
local TFA_HaloManager = {}
TFA_HaloManager.EVENT_NAME = "TFA_SONAR"
-- Taken from Sakarias88's Intelligent HUD
local function GetEntityAABB(ent)
local mins = ent:OBBMins()
local maxs = ent:OBBMaxs()
local pos = {
ent:LocalToWorld(Vector(maxs.x, maxs.y, maxs.z)):ToScreen(),
ent:LocalToWorld(Vector(maxs.x, mins.y, maxs.z)):ToScreen(),
ent:LocalToWorld(Vector(maxs.x, maxs.y, mins.z)):ToScreen(),
ent:LocalToWorld(Vector(maxs.x, mins.y, mins.z)):ToScreen(),
ent:LocalToWorld(Vector(mins.x, maxs.y, maxs.z)):ToScreen(),
ent:LocalToWorld(Vector(mins.x, mins.y, maxs.z)):ToScreen(),
ent:LocalToWorld(Vector(mins.x, maxs.y, mins.z)):ToScreen(),
ent:LocalToWorld(Vector(mins.x, mins.y, mins.z)):ToScreen()
}
local minX = pos[1].x
local minY = pos[1].y
local maxX = pos[1].x
local maxY = pos[1].y
for k = 2, 8 do
if pos[k].x > maxX then
maxX = pos[k].x
end
if pos[k].y > maxY then
maxY = pos[k].y
end
if pos[k].x < minX then
minX = pos[k].x
end
if pos[k].y < minY then
minY = pos[k].y
end
end
return Vector(minX, minY), Vector(maxX, maxY)
end
local function TFA_SONAR_CREATE_HALOS(len, ply)
local entnum = net.ReadInt(14)
for i = 1, entnum do
TFA_HaloManager:Add(net.ReadEntity(), 3)
end
end
net.Receive("TFA_CSGO_SONAR_EXPLODE", TFA_SONAR_CREATE_HALOS)
function TFA_HaloManager:Add(ent, t)
if not IsValid(ent) then return end
table.insert(self, {ent = ent, t = CurTime() + t})
self:Enable()
end
local _ents = {}
local halo_color = Color(255, 0, 0)
function TFA_HaloManager:Enable()
local events = hook.GetTable()
local tab = events["PreDrawHalos"]
if tab and not tab[self.EVENT_NAME] or not tab then
hook.Add("PreDrawHalos", self.EVENT_NAME, function()
self:DrawHalo()
end)
end
local tab = events["PostDrawOpaqueRenderables"]
if tab and not tab[self.EVENT_NAME] or not tab then
hook.Add("PostDrawOpaqueRenderables", self.EVENT_NAME, function()
self:Draw()
end)
end
end
function TFA_HaloManager:Disable()
hook.Remove("PreDrawHalos", self.EVENT_NAME)
hook.Remove("PostDrawOpaqueRenderables", self.EVENT_NAME)
end
local mat1 = Material("models/debug/debugwhite")
function TFA_HaloManager:Draw()
for k, v in ipairs(self) do
if not IsValid(v.ent) then self[k] = nil continue end
render.ClearStencil()
render.SetStencilEnable(true)
render.SetStencilWriteMask(255)
render.SetStencilTestMask(255)
render.SetStencilReferenceValue(1)
render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_ALWAYS)
render.SetStencilFailOperation(STENCILOPERATION_KEEP)
render.SetStencilPassOperation(STENCILOPERATION_REPLACE)
render.SetStencilZFailOperation(STENCILOPERATION_REPLACE)
v.ent:DrawModel()
render.SetStencilCompareFunction(STENCILCOMPARISONFUNCTION_EQUAL)
local mins, maxs = GetEntityAABB(v.ent)
cam.Start2D()
local health = v.ent:Health()
local maxHealth = v.ent:GetMaxHealth()
local mul = math.Clamp(health / maxHealth, 0, 1)
local x = mins.x
local y = mins.y + (maxs.y - mins.y) * mul
local w = maxs.x - x
local h = maxs.y - y
surface.SetDrawColor(255, 0, 0, 32)
surface.DrawRect(x, y, w, h)
cam.End2D()
render.SetStencilEnable(false)
end
end
function TFA_HaloManager:DrawHalo()
local CT = CurTime()
for i = 1, #_ents do
_ents[i] = nil
end
for k, v in ipairs(self) do
if (not IsValid(v.ent) or v.ent:Health() <= 0) or v.t <= CT then
table.remove(self, k)
else
table.insert(_ents, v.ent)
end
end
halo.Add(_ents, halo_color, 2, 2, 2, true, true )
if #self <= 0 then
self:Disable()
end
end

View File

@@ -0,0 +1,140 @@
--[[
| 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("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
util.AddNetworkString("TFA_CSGO_SONAR_EXPLODE")
local function EntityFacingFactor(ent1, ent2)
local dir = ent2:EyeAngles():Forward()
local facingdir = (ent1:GetPos() - (ent2.EyePos and ent2:EyePos() or ent2:GetPos())):GetNormalized()
return (facingdir:Dot(dir) + 1) / 2
end
local tr = {}
function ENT:Detonate()
local origin = self:GetPos()
if IsValid(self.Owner) then
local _ents = ents.FindInSphere(origin, self.FindRadius)
local tab = {}
for _, v in ipairs(_ents) do
if v:IsNPC() or v:IsPlayer() and v ~= self.Owner then
table.insert(tab, v)
end
end
if #tab <= 0 then return end
net.Start("TFA_CSGO_SONAR_EXPLODE", true)
net.WriteInt(#tab, 14)
for i = 1, #tab do
net.WriteEntity(tab[i])
end
net.Send(self.Owner)
end
tr.start = origin
tr.mask = MASK_SOLID
for k, v in ipairs(player.GetAll()) do
tr.endpos = v:EyePos()
tr.filter = { self, v, v:GetActiveWeapon() }
local trace = util.TraceLine(tr)
if not trace.Hit or trace.Fraction >= 1 or trace.Fraction <= 0 then
v:SetNWFloat("TFACSGO_LastFlash", CurTime() - 4)
v:SetNWFloat("TFACSGO_FlashDistance", tr.endpos:Distance(origin))
v:SetNWFloat("TFACSGO_FlashFactor", EntityFacingFactor(self, v) * 0.5)
end
end
self:EmitSound("TFA_CSGO_Sensor.Detonate")
local explode = ents.Create( "info_particle_system" )
explode:SetKeyValue( "effect_name", "weapon_sensorgren_detonate" )
explode:SetOwner( self.Owner )
explode:SetPos( self:GetPos() )
explode:Spawn()
explode:Activate()
explode:Fire( "start", "", 0 )
explode:Fire( "kill", "", 30 )
SafeRemoveEntity(self)
end
function ENT:Fuse(ent)
if SERVER then
self.WeldEnt = constraint.Weld(self, ent, 0, 0, 0, true, false)
self:EmitSound("TFA_CSGO_Sensor.Activate")
timer.Simple(3, function()
if IsValid(self) then
self:StopParticles()
self:Detonate()
end
end)
end
end
function ENT:PhysicsCollide(data, physObj)
if not self:GetNWBool("Fused") then
if data.HitEntity then
if not (data.HitEntity:IsNPC() or data.HitEntity:IsPlayer()) then
self:SetNWBool("Fused", true)
timer.Simple(0, function()
if IsValid(self) then
self:EmitSound("TFA_CSGO_Sensor.Land")
self:Fuse(data.HitEntity)
end
end)
end
end
end
orient_angles(physObj,data)
end
function ENT:OnRemove()
if (timer.Exists("GrenadesCleanup"..self:EntIndex())) then
timer.Remove("GrenadesCleanup"..self:EntIndex())
end
end
function orient_angles(obj, data) --this function juts takes in the hitnormal of the collision and rotates the angles accordingly
if data.HitNormal.z < -.5 then
obj:SetAngles((data.HitNormal + Vector(0,90,0) ):Angle())
return
end
if data.HitNormal.z > .5 then
obj:SetAngles((data.HitNormal + Vector(-90,0,0) ):Angle())
return
end
if data.HitNormal.y < -.5 then
obj:SetAngles((data.HitNormal + Vector(0,0,90) ):Angle())
return
end
if data.HitNormal.y > .5 then
obj:SetAngles((data.HitNormal + Vector(0,0,90) ):Angle())
return
end
if data.HitNormal.x < -.5 then
obj:SetAngles((data.HitNormal + Vector(0,0,90) ):Angle())
return
end
if data.HitNormal.x > .5 then
obj:SetAngles((data.HitNormal + Vector(0,0,90) ):Angle())
return
end
end

View File

@@ -0,0 +1,43 @@
--[[
| 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/
--]]
ENT.Type = "anim"
ENT.Spawnable = false
ENT.FindRadius = 250
ENT.Model = "models/weapons/tfa_csgo/w_eq_sensorgrenade_thrown.mdl"
function ENT:Initialize()
if SERVER then
self:SetModel(self.Model)
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetCollisionGroup(COLLISION_GROUP_NONE)
self:DrawShadow( false )
local phys = self:GetPhysicsObject()
if IsValid(phys) then
phys:Wake()
end
end
self:EmitSound("TFA_CSGO_HEGrenade.Throw")
end
function ENT:Use(activator, caller)
return false
end
function ENT:OnRemove()
return false
end