forked from mtcontrib/mobs_redo
		
	Separated dogshoot timers for different shoot/fight timings
This commit is contained in:
		
							
								
								
									
										6
									
								
								api.lua
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								api.lua
									
									
									
									
									
								
							| @@ -1266,7 +1266,10 @@ local dogswitch = function(self, dtime) | ||||
|  | ||||
| 	self.dogshoot_count = self.dogshoot_count + dtime | ||||
|  | ||||
| 	if self.dogshoot_count > self.dogshoot_count_max then | ||||
| 	if (self.dogshoot_switch == 1 | ||||
| 	and self.dogshoot_count > self.dogshoot_count_max) | ||||
| 	or (self.dogshoot_switch == 2 | ||||
| 	and self.dogshoot_count > self.dogshoot_count2_max) then | ||||
|  | ||||
| 		self.dogshoot_count = 0 | ||||
|  | ||||
| @@ -2389,6 +2392,7 @@ minetest.register_entity(name, { | ||||
| 	dogshoot_switch = def.dogshoot_switch, | ||||
| 	dogshoot_count = 0, | ||||
| 	dogshoot_count_max = def.dogshoot_count_max or 5, | ||||
| 	dogshoot_count2_max = def.dogshoot_count2_max, | ||||
| 	attack_animals = def.attack_animals or false, | ||||
| 	specific_attack = def.specific_attack, | ||||
|  | ||||
|   | ||||
							
								
								
									
										3
									
								
								api.txt
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								api.txt
									
									
									
									
									
								
							| @@ -82,7 +82,8 @@ This functions registers a new mob as a Minetest entity. | ||||
|             'explode' follows player in range and will flash and explode when in reach | ||||
|             'dogshoot' shoots arrows when in range and one on one attack when in reach | ||||
|         'dogshoot_switch' allows switching between shoot and dogfight modes inside dogshoot using timer (1 = shoot, 2 = dogfight) | ||||
|         'dogshoot_count_max' number of seconds before switching above modes. | ||||
|         'dogshoot_count_max' number of seconds before switching to dogfight mode. | ||||
|         'dogshoot_count2_max' number of seconds before switching back to shoot mode. | ||||
|         'custom_attack' is a function that is called when mob is in range to attack player, parameters are (self, to_attack) | ||||
|         'double_melee_attack' if false then api will choose randomly between 'punch' and 'punch2' attack animations | ||||
|         'on_blast' is called when TNT explodes near mob, function uses (object, damage) and returns (do_damage, do_knockback, drops) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user