-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f315816
commit e152623
Showing
5 changed files
with
162 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
include( "shared.lua" ) | ||
|
||
function ENT:Initialize() | ||
self.smokeSpinSpeed = math.random( 60, 110 ) | ||
|
||
-- Create a RangedFeature to handle missile sounds | ||
self.missileSounds = Glide.CreateRangedFeature( self, 4000 ) | ||
self.missileSounds:SetActivateCallback( "ActivateSound" ) | ||
self.missileSounds:SetDeactivateCallback( "DeactivateSound" ) | ||
|
||
-- Assume we have one for now, to avoid issues with the lock-on warnings clientside | ||
self:SetHasTarget( true ) | ||
end | ||
|
||
function ENT:OnRemove() | ||
if self.missileSounds then | ||
self.missileSounds:Destroy() | ||
self.missileSounds = nil | ||
end | ||
end | ||
|
||
function ENT:ActivateSound() | ||
if not self.missileLoop then | ||
self.missileLoop = CreateSound( self, "glide/weapons/missile_loop.wav" ) | ||
self.missileLoop:SetSoundLevel( 80 ) | ||
self.missileLoop:Play() | ||
end | ||
end | ||
|
||
function ENT:DeactivateSound() | ||
if self.missileLoop then | ||
self.missileLoop:Stop() | ||
self.missileLoop = nil | ||
end | ||
end | ||
|
||
local Effect = util.Effect | ||
local EffectData = EffectData | ||
local CurTime = CurTime | ||
|
||
function ENT:Think() | ||
if self.missileSounds then | ||
self.missileSounds:Think() | ||
end | ||
|
||
if self:WaterLevel() > 0 then | ||
self.smokeSpinSpeed = nil | ||
|
||
elseif self.smokeSpinSpeed then | ||
local eff = EffectData() | ||
eff:SetOrigin( self:GetPos() ) | ||
eff:SetNormal( -self:GetForward() ) | ||
eff:SetColor( self.smokeSpinSpeed ) | ||
eff:SetScale( self:GetEffectiveness() ) | ||
Effect( "glide_missile", eff ) | ||
end | ||
|
||
self:SetNextClientThink( CurTime() + 0.02 ) | ||
|
||
return true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
AddCSLuaFile() | ||
|
||
ENT.Type = "anim" | ||
ENT.Base = "base_anim" | ||
ENT.PrintName = "Missile" | ||
|
||
ENT.Spawnable = false | ||
ENT.AdminOnly = false | ||
ENT.VJTag_ID_Danger = true | ||
|
||
ENT.PhysgunDisabled = true | ||
ENT.DoNotDuplicate = true | ||
ENT.DisableDuplicator = true | ||
|
||
function ENT:SetupDataTables() | ||
self:NetworkVar( "Bool", "HasTarget" ) | ||
self:NetworkVar( "Float", "Effectiveness" ) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters