mirror of
				https://codeberg.org/tenplus1/mobs_animal.git
				synced 2025-10-31 15:45:22 +01:00 
			
		
		
		
	added ability to protect tamed animals
This commit is contained in:
		| @@ -73,6 +73,7 @@ mobs:register_mob("mobs_animal:bunny", { | |||||||
| 			return | 			return | ||||||
| 		end | 		end | ||||||
|  |  | ||||||
|  | 		mobs:protect(self, clicker) | ||||||
| 		mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) | 		mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) | ||||||
| 	end, | 	end, | ||||||
|  |  | ||||||
|   | |||||||
| @@ -56,6 +56,7 @@ mobs:register_mob("mobs_animal:chicken", { | |||||||
| 			return | 			return | ||||||
| 		end | 		end | ||||||
|  |  | ||||||
|  | 		mobs:protect(self, clicker) | ||||||
| 		mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) | 		mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) | ||||||
| 	end, | 	end, | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								cow.lua
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								cow.lua
									
									
									
									
									
								
							| @@ -59,6 +59,7 @@ mobs:register_mob("mobs_animal:cow", { | |||||||
| 		end | 		end | ||||||
|  |  | ||||||
| 		local tool = clicker:get_wielded_item() | 		local tool = clicker:get_wielded_item() | ||||||
|  | 		local name = clicker:get_player_name() | ||||||
|  |  | ||||||
| 		-- milk cow with empty bucket | 		-- milk cow with empty bucket | ||||||
| 		if tool:get_name() == "bucket:bucket_empty" then | 		if tool:get_name() == "bucket:bucket_empty" then | ||||||
| @@ -69,7 +70,7 @@ mobs:register_mob("mobs_animal:cow", { | |||||||
| 			end | 			end | ||||||
|  |  | ||||||
| 			if self.gotten == true then | 			if self.gotten == true then | ||||||
| 				minetest.chat_send_player(clicker:get_player_name(), | 				minetest.chat_send_player(name, | ||||||
| 					S("Cow already milked!")) | 					S("Cow already milked!")) | ||||||
| 				return | 				return | ||||||
| 			end | 			end | ||||||
| @@ -91,6 +92,7 @@ mobs:register_mob("mobs_animal:cow", { | |||||||
| 			return | 			return | ||||||
| 		end | 		end | ||||||
|  |  | ||||||
|  | 		mobs:protect(self, clicker) | ||||||
| 		mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) | 		mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) | ||||||
| 	end, | 	end, | ||||||
| }) | }) | ||||||
|   | |||||||
| @@ -48,6 +48,7 @@ mobs:register_mob("mobs_animal:kitten", { | |||||||
| 			return | 			return | ||||||
| 		end | 		end | ||||||
|  |  | ||||||
|  | 		mobs:protect(self, clicker) | ||||||
| 		mobs:capture_mob(self, clicker, 50, 50, 90, false, nil) | 		mobs:capture_mob(self, clicker, 50, 50, 90, false, nil) | ||||||
| 	end | 	end | ||||||
| }) | }) | ||||||
|   | |||||||
| @@ -165,6 +165,9 @@ for _, col in pairs(all_colours) do | |||||||
| 				return | 				return | ||||||
| 			end | 			end | ||||||
|  |  | ||||||
|  | 			-- protect mod with mobs:protector item | ||||||
|  | 			mobs:protect(self, clicker) | ||||||
|  |  | ||||||
| 			--are we capturing? | 			--are we capturing? | ||||||
| 			mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) | 			mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) | ||||||
| 		end | 		end | ||||||
|   | |||||||
| @@ -51,6 +51,7 @@ mobs:register_mob("mobs_animal:pumba", { | |||||||
| 			return | 			return | ||||||
| 		end | 		end | ||||||
|  |  | ||||||
|  | 		mobs:protect(self, clicker) | ||||||
| 		mobs:capture_mob(self, clicker, 0, 5, 50, false, nil) | 		mobs:capture_mob(self, clicker, 0, 5, 50, false, nil) | ||||||
| 	end, | 	end, | ||||||
| }) | }) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user