mirror of
				https://codeberg.org/tenplus1/mobs_animal.git
				synced 2025-11-04 09:15:33 +01:00 
			
		
		
		
	protect/capture returns added
This commit is contained in:
		@@ -50,9 +50,9 @@ mobs:register_mob("mobs_animal:bunny", {
 | 
				
			|||||||
	on_rightclick = function(self, clicker)
 | 
						on_rightclick = function(self, clicker)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		-- feed or tame
 | 
							-- feed or tame
 | 
				
			||||||
		if mobs:feed_tame(self, clicker, 4, true, true) then
 | 
							if mobs:feed_tame(self, clicker, 4, true, true) then return end
 | 
				
			||||||
			return
 | 
							if mobs:protect(self, clicker) then return end
 | 
				
			||||||
		end
 | 
							if mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) then return end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		-- Monty Python tribute
 | 
							-- Monty Python tribute
 | 
				
			||||||
		local item = clicker:get_wielded_item()
 | 
							local item = clicker:get_wielded_item()
 | 
				
			||||||
@@ -73,9 +73,6 @@ mobs:register_mob("mobs_animal:bunny", {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		end
 | 
							end
 | 
				
			||||||
 | 
					 | 
				
			||||||
		mobs:protect(self, clicker)
 | 
					 | 
				
			||||||
		mobs:capture_mob(self, clicker, 30, 50, 80, false, nil)
 | 
					 | 
				
			||||||
	end,
 | 
						end,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	attack_type = "dogfight",
 | 
						attack_type = "dogfight",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -52,12 +52,9 @@ mobs:register_mob("mobs_animal:chicken", {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	on_rightclick = function(self, clicker)
 | 
						on_rightclick = function(self, clicker)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if mobs:feed_tame(self, clicker, 8, true, true) then
 | 
							if mobs:feed_tame(self, clicker, 8, true, true) then return end
 | 
				
			||||||
			return
 | 
							if mobs:protect(self, clicker) then return end
 | 
				
			||||||
		end
 | 
							if mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) then return end
 | 
				
			||||||
 | 
					 | 
				
			||||||
		mobs:protect(self, clicker)
 | 
					 | 
				
			||||||
		mobs:capture_mob(self, clicker, 30, 50, 80, false, nil)
 | 
					 | 
				
			||||||
	end,
 | 
						end,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	do_custom = function(self, dtime)
 | 
						do_custom = function(self, dtime)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										9
									
								
								cow.lua
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								cow.lua
									
									
									
									
									
								
							@@ -59,9 +59,9 @@ mobs:register_mob("mobs_animal:cow", {
 | 
				
			|||||||
	on_rightclick = function(self, clicker)
 | 
						on_rightclick = function(self, clicker)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		-- feed or tame
 | 
							-- feed or tame
 | 
				
			||||||
		if mobs:feed_tame(self, clicker, 8, true, true) then
 | 
							if mobs:feed_tame(self, clicker, 8, true, true) then return end
 | 
				
			||||||
			return
 | 
							if mobs:protect(self, clicker) then return end
 | 
				
			||||||
		end
 | 
							if mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) then return end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		local tool = clicker:get_wielded_item()
 | 
							local tool = clicker:get_wielded_item()
 | 
				
			||||||
		local name = clicker:get_player_name()
 | 
							local name = clicker:get_player_name()
 | 
				
			||||||
@@ -96,9 +96,6 @@ mobs:register_mob("mobs_animal:cow", {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		end
 | 
							end
 | 
				
			||||||
 | 
					 | 
				
			||||||
		mobs:protect(self, clicker)
 | 
					 | 
				
			||||||
		mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
 | 
					 | 
				
			||||||
	end,
 | 
						end,
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,12 +45,9 @@ mobs:register_mob("mobs_animal:kitten", {
 | 
				
			|||||||
	view_range = 8,
 | 
						view_range = 8,
 | 
				
			||||||
	on_rightclick = function(self, clicker)
 | 
						on_rightclick = function(self, clicker)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if mobs:feed_tame(self, clicker, 4, true, true) then
 | 
							if mobs:feed_tame(self, clicker, 4, true, true) then return end
 | 
				
			||||||
			return
 | 
							if mobs:protect(self, clicker) then return end
 | 
				
			||||||
		end
 | 
							if mobs:capture_mob(self, clicker, 50, 50, 90, false, nil) then return end
 | 
				
			||||||
 | 
					 | 
				
			||||||
		mobs:protect(self, clicker)
 | 
					 | 
				
			||||||
		mobs:capture_mob(self, clicker, 50, 50, 90, false, nil)
 | 
					 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,12 +50,9 @@ mobs:register_mob("mobs_animal:penguin", {
 | 
				
			|||||||
	on_rightclick = function(self, clicker)
 | 
						on_rightclick = function(self, clicker)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		-- feed or tame
 | 
							-- feed or tame
 | 
				
			||||||
		if mobs:feed_tame(self, clicker, 4, false, true) then
 | 
							if mobs:feed_tame(self, clicker, 4, false, true) then return end
 | 
				
			||||||
			return
 | 
							if mobs:protect(self, clicker) then return end
 | 
				
			||||||
		end
 | 
							if mobs:capture_mob(self, clicker, 5, 50, 80, false, nil) then return end
 | 
				
			||||||
 | 
					 | 
				
			||||||
		mobs:protect(self, clicker)
 | 
					 | 
				
			||||||
		mobs:capture_mob(self, clicker, 5, 50, 80, false, nil)
 | 
					 | 
				
			||||||
	end,
 | 
						end,
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -168,10 +168,10 @@ for _, col in ipairs(all_colours) do
 | 
				
			|||||||
			end
 | 
								end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			-- protect mod with mobs:protector item
 | 
								-- protect mod with mobs:protector item
 | 
				
			||||||
			mobs:protect(self, clicker)
 | 
								if mobs:protect(self, clicker) then return end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			--are we capturing?
 | 
								--are we capturing?
 | 
				
			||||||
			mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
 | 
								if mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) then return end
 | 
				
			||||||
		end
 | 
							end
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -48,12 +48,9 @@ mobs:register_mob("mobs_animal:pumba", {
 | 
				
			|||||||
	},
 | 
						},
 | 
				
			||||||
	on_rightclick = function(self, clicker)
 | 
						on_rightclick = function(self, clicker)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if mobs:feed_tame(self, clicker, 8, true, true) then
 | 
							if mobs:feed_tame(self, clicker, 8, true, true) then return end
 | 
				
			||||||
			return
 | 
							if mobs:protect(self, clicker) then return end
 | 
				
			||||||
		end
 | 
							if mobs:capture_mob(self, clicker, 0, 5, 50, false, nil) then return end
 | 
				
			||||||
 | 
					 | 
				
			||||||
		mobs:protect(self, clicker)
 | 
					 | 
				
			||||||
		mobs:capture_mob(self, clicker, 0, 5, 50, false, nil)
 | 
					 | 
				
			||||||
	end,
 | 
						end,
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user