forked from mtcontrib/mobs_monster
		
	spider has new jump attack
This commit is contained in:
		
							
								
								
									
										17
									
								
								spider.lua
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								spider.lua
									
									
									
									
									
								
							@@ -103,6 +103,7 @@ mobs:register_mob("mobs_monster:spider", {
 | 
			
		||||
 | 
			
		||||
		return true -- run only once, false/nil runs every activation
 | 
			
		||||
	end,
 | 
			
		||||
 | 
			
		||||
	-- custom function to make spiders climb vertical facings
 | 
			
		||||
	do_custom = function(self, dtime)
 | 
			
		||||
 | 
			
		||||
@@ -157,6 +158,22 @@ mobs:register_mob("mobs_monster:spider", {
 | 
			
		||||
		v.y = self.jump_height
 | 
			
		||||
		mobs:set_animation(self, "jump")
 | 
			
		||||
		self.object:set_velocity(v)
 | 
			
		||||
	end,
 | 
			
		||||
 | 
			
		||||
	-- make spiders jump at you on attack
 | 
			
		||||
	custom_attack = function(self, pos)
 | 
			
		||||
 | 
			
		||||
		local vel = self.object:get_velocity()
 | 
			
		||||
 | 
			
		||||
		self.object:set_velocity({
 | 
			
		||||
			x = vel.x * self.run_velocity,
 | 
			
		||||
			y = self.jump_height * 1.5,
 | 
			
		||||
			z = vel.z * self.run_velocity
 | 
			
		||||
		})
 | 
			
		||||
 | 
			
		||||
		self.pausetimer = 0.5
 | 
			
		||||
 | 
			
		||||
		return true -- continue rest of attack function
 | 
			
		||||
	end
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user