From 19a74cfee471aa39f8f10e16bb32464e8cdc6374 Mon Sep 17 00:00:00 2001 From: Dave Devil's Date: Thu, 12 Mar 2015 04:49:33 +0100 Subject: [PATCH] Poulet domesticable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Faire que les poulets soient domesticable/tamed comme les moutons/vaches (mais avec 4 wheat et non 8, le clique droit pose problème car déjà utilisé) --- mods/mobs/chicken.lua | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/mods/mobs/chicken.lua b/mods/mobs/chicken.lua index f54bce5f..6cdf26fb 100755 --- a/mods/mobs/chicken.lua +++ b/mods/mobs/chicken.lua @@ -41,15 +41,33 @@ mobs:register_mob("mobs:chicken", { }, follow = "farming:wheat", view_range = 8, - on_rightclick = function(self, clicker) - if clicker:is_player() and clicker:get_inventory() then - clicker:get_inventory():add_item("main", "mobs:chicken") - self.object:remove() - end - end, + sounds = { random = "mobs_chicken", }, + on_rightclick = function(self, clicker) + local tool = clicker:get_wielded_item() + if tool:get_name() == "farming:wheat" then + if not minetest.setting_getbool("creative_mode") then + tool:take_item(1) + clicker:set_wielded_item(tool) + end + self.food = (self.food or 0) + 1 + if self.food >= 4 then + -- I dont know what do you want she make + self.food = 0 + self.tamed = true + minetest.sound_play("mobs_chicken", {object = self.object,gain = 1.0,max_hear_distance = 32,loop = false,}) + end + return tool + else + if clicker:is_player() and clicker:get_inventory() then + clicker:get_inventory():add_item("main", "mobs:chicken") + self.object:remove() + end + end + + end, jump = true, step = 1, blood_texture = "mobs_blood.png",