From 4b45fc42c10cd0eae66577dcaf309d337411c22a Mon Sep 17 00:00:00 2001 From: cale Date: Sun, 10 Apr 2016 11:51:52 +0200 Subject: [PATCH] you need to feed pets to tame them --- mods/pets/init.lua | 16 +++++++++++----- mods/wolf/init.lua | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/mods/pets/init.lua b/mods/pets/init.lua index 5d88312..139eb9a 100644 --- a/mods/pets/init.lua +++ b/mods/pets/init.lua @@ -34,11 +34,17 @@ function pets.register_pet(name, def) if pets.players_pets[clicker:get_player_name()] then cmsg.push_message_player(clicker, "[pet] You already have a pet!") else - pets.players_pets[clicker:get_player_name()] = name - cmsg.push_message_player(clicker, "[pet] + ".. def.description) - self.pl = clicker - pets.players_pets[clicker:get_player_name()] = name - pets.save_pets() + if clicker:get_wielded_item():get_name() == (def.food or "farming:wheat_seeds") then + local wielded_item = clicker:get_wielded_item() + wielded_item:take_item() + clicker:set_wielded_item(wielded_item) + + pets.players_pets[clicker:get_player_name()] = name + cmsg.push_message_player(clicker, "[pet] + ".. def.description) + self.pl = clicker + pets.players_pets[clicker:get_player_name()] = name + pets.save_pets() + end end end, diff --git a/mods/wolf/init.lua b/mods/wolf/init.lua index 0f98289..bce0d09 100644 --- a/mods/wolf/init.lua +++ b/mods/wolf/init.lua @@ -8,4 +8,5 @@ pets.register_pet("wolf:wolf", { walk = {x=80, y=100}, sit = {x=0, y=80} }, + food = "fishing:fish", })