mirror of
				https://github.com/chev2/gmod-addons.git
				synced 2025-10-30 06:31:35 +00:00 
			
		
		
		
	Fix nokia phone IED infinite explosion bug
This commit is contained in:
		
							parent
							
								
									c5dfdbc9fd
								
							
						
					
					
						commit
						b2da8bd22e
					
				
					 1 changed files with 12 additions and 9 deletions
				
			
		|  | @ -17,13 +17,16 @@ AddCSLuaFile("shared.lua") | ||||||
| function ENT:Initialize() | function ENT:Initialize() | ||||||
| 	local soundtables = {["song02"] = 23.61, ["song03"] = 37.26, ["song04"] = 13.5, ["song05"] = 14.91, ["song06"] = 19.88} | 	local soundtables = {["song02"] = 23.61, ["song03"] = 37.26, ["song04"] = 13.5, ["song05"] = 14.91, ["song06"] = 19.88} | ||||||
| 	local rlength, rsound = table.Random(soundtables) | 	local rlength, rsound = table.Random(soundtables) | ||||||
| 	self.nsound = CreateSound(self, "chev/arabicnokiaphone/"..rsound..".ogg") | 
 | ||||||
| 	if self.nsound then | 	self.MUSIC_VOLUME = 0.6 | ||||||
| 		self.nsound:PlayEx(0.4, 100) | 
 | ||||||
|  | 	self.NokiaMusic = CreateSound(self, "chev/arabicnokiaphone/"..rsound..".ogg") | ||||||
|  | 	if self.NokiaMusic then | ||||||
|  | 		self.NokiaMusic:PlayEx(self.MUSIC_VOLUME, 100) | ||||||
| 		timer.Create("LoopNokiaSound", rlength, 0, function() | 		timer.Create("LoopNokiaSound", rlength, 0, function() | ||||||
| 			if self.nsound then | 			if self.NokiaMusic then | ||||||
| 				self.nsound:Stop() | 				self.NokiaMusic:Stop() | ||||||
| 				self.nsound:PlayEx(0.4, 100) | 				self.NokiaMusic:PlayEx(self.MUSIC_VOLUME, 100) | ||||||
| 			end | 			end | ||||||
| 		end) | 		end) | ||||||
| 	end | 	end | ||||||
|  | @ -65,7 +68,7 @@ function ENT:Explosion() | ||||||
| 	if not IsValid(self) then return end | 	if not IsValid(self) then return end | ||||||
| 	if not IsValid(self.Owner) then | 	if not IsValid(self.Owner) then | ||||||
| 		timer.Remove("LoopNokiaSound") | 		timer.Remove("LoopNokiaSound") | ||||||
| 		self.nsound:Stop() | 		self.NokiaMusic:Stop() | ||||||
| 		self.Entity:Remove() | 		self.Entity:Remove() | ||||||
| 		return | 		return | ||||||
| 	end | 	end | ||||||
|  | @ -84,11 +87,11 @@ function ENT:Explosion() | ||||||
| 	util.BlastDamage(self.Entity, self.Owner, self.Entity:GetPos(), 500, 170) | 	util.BlastDamage(self.Entity, self.Owner, self.Entity:GetPos(), 500, 170) | ||||||
| 	util.ScreenShake(self.Entity:GetPos(), 3000, 255, 2.25, 2000) | 	util.ScreenShake(self.Entity:GetPos(), 3000, 255, 2.25, 2000) | ||||||
| 	 | 	 | ||||||
| 	self.Entity:EmitSound("ambient/explosions/explode_" .. math.random(1, 4) .. ".wav", self.Entity:GetPos(), 100, 100 ) | 	self.Entity:EmitSound("ambient/explosions/explode_" .. math.random(1, 4) .. ".wav", 100, 100, 1, CHAN_AUTO) | ||||||
| 	local scorchstart = self.Entity:GetPos() + ((Vector(0,0,1)) * 5) | 	local scorchstart = self.Entity:GetPos() + ((Vector(0,0,1)) * 5) | ||||||
| 	local scorchend = self.Entity:GetPos() + ((Vector(0,0,-1)) * 5) | 	local scorchend = self.Entity:GetPos() + ((Vector(0,0,-1)) * 5) | ||||||
| 	timer.Remove("LoopNokiaSound") | 	timer.Remove("LoopNokiaSound") | ||||||
| 	self.nsound:Stop() | 	self.NokiaMusic:Stop() | ||||||
| 	self.Entity:Remove() | 	self.Entity:Remove() | ||||||
| 	util.Decal("Scorch", scorchstart, scorchend) | 	util.Decal("Scorch", scorchstart, scorchend) | ||||||
| 	 | 	 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Chev
						Chev