master
runs 2020-05-25 22:39:25 +02:00
parent 564660c5d0
commit 9a117859f0
7 changed files with 27 additions and 22 deletions

View File

@ -12,7 +12,7 @@ petz.create_pet = function(placer, itemstack, pet_name, pos)
local self = mob:get_luaentity()
if self.is_wild == false and not(self.owner) then --not monster and not owner
mokapi.set_owner(self, placer:get_player_name()) --set owner
petz.do_tame(self)
petz.after_tame(self)
end
itemstack:take_item() -- since mob is unique we remove egg once spawned
return self
@ -53,7 +53,7 @@ petz.check_capture_items = function(self, wielded_item_name, clicker, check_inv_
return
end
local capture_item_type
if wielded_item_name == "mobs:lasso" or wielded_item_name == "petz:lasso" then
if wielded_item_name == petz.settings.lasso then
capture_item_type = "lasso"
elseif (wielded_item_name == "mobs:net") or (wielded_item_name == "fireflies:bug_net") then
capture_item_type = "net"

View File

@ -49,7 +49,7 @@ petz.do_feed = function(self)
self.fed = mobkit.remember(self, "fed", true)
end
petz.do_tame = function(self)
petz.after_tame = function(self)
petz.insert_tamed_by_owner(self)
if petz.settings.tamagochi_mode == true then
self.init_tamagochi_timer = true
@ -78,7 +78,7 @@ petz.tame_whip= function(self, hitter)
if self.lashing_count >= petz.settings.lashing_tame_count then
self.lashing_count = mobkit.remember(self, "lashing_count", 0) --reset to 0
mokapi.set_owner(self, hitter:get_player_name())
petz.do_tame(self)
petz.after_tame(self)
minetest.chat_send_player(self.owner, S("The").." "..S(petz.first_to_upper(self.type)).." "..S("has been tamed."))
mobkit.clear_queue_high(self) -- do not attack
end

View File

@ -135,7 +135,8 @@ function petz.set_initial_properties(self, staticdata, dtime_s)
--
--1. NEW MOBS
--
if mobkit.recall(self, "set_vars") == nil and captured_mob == false then --set some vars
--dtime_s == 0 differenciates between loaded and new created mobs
if dtime_s == 0 and captured_mob == false then --set some vars
--Mob Specific
--Lamb
if self.type == "lamb" then --set a random color

View File

@ -37,7 +37,7 @@ petz.on_rightclick = function(self, clicker)
--If feeded
elseif mokapi.feed(self, clicker, petz.settings.tamagochi_feed_hunger_rate, S("@1 at full health (@2)", S(petz.first_to_upper(self.type)), tostring(self.hp)), "moaning") then
if mokapi.tame(self, 5, player_name, S("@1 has been tamed!", S(petz.first_to_upper(self.type))), {max = petz.settings.max_tamed_by_owner, count= petz.count_tamed_by_owner(player_name), msg = S("You cannot tame more petz! (@1 max.)", tostring(petz.settings.max_tamed_by_owner))}) then
petz.do_tame(self)
petz.after_tame(self)
end
if self.tamed== true then
petz.update_nametag(self)
@ -57,7 +57,7 @@ petz.on_rightclick = function(self, clicker)
end
if self.owner== nil or self.owner== "" or (not(is_owner) and petz.settings.rob_mobs == true) then
mokapi.set_owner(self, player_name)
petz.do_tame(self)
petz.after_tame(self)
end
petz.capture(self, clicker, true)
minetest.chat_send_player("singleplayer", S("Your").." "..S(pet_name).." "..S("has been captured")..".")

View File

@ -299,21 +299,23 @@ minetest.register_craft({
}
})
-- Lasso
minetest.register_tool("petz:lasso", {
description = S("Lasso"),
inventory_image = "petz_lasso.png",
groups = {flammable = 2, lasso = 1},
})
if petz.settings.lasso == "petz:lasso" then
-- Lasso
minetest.register_tool("petz:lasso", {
description = S("Lasso"),
inventory_image = "petz_lasso.png",
groups = {flammable = 2, lasso = 1},
})
minetest.register_craft({
output = "petz:lasso",
recipe = {
{"farming:string", "farming:string", "farming:string"},
{"farming:string", "", "farming:string"},
{"", "farming:string", ""},
}
})
minetest.register_craft({
output = "petz:lasso",
recipe = {
{"farming:string", "farming:string", "farming:string"},
{"farming:string", "", "farming:string"},
{"", "farming:string", ""},
}
})
end
-- Saddle
@ -417,7 +419,7 @@ for i=1, 2 do
props.textures = {ent_ref.textures[texture_no]}
ent:set_properties(props)
end
--petz.do_tame(moth)
--petz.after_tame(moth)
end,
})
end

View File

@ -20,6 +20,7 @@ tamagochi_safe_nodes = petz:yellow_paving,petz:gray_graving_stone
type_api = mobkit
##Capture Mobs
lasso = petz:lasso
rob_mobs = false
##Capture Mobs

View File

@ -27,6 +27,7 @@ petz.settings.igniter_damage = tonumber(settings:get("igniter_damage")) --lava &
--API Type
petz.settings.type_api = settings:get("type_api", "mobs_redo")
--Capture Mobs
petz.settings.lasso = settings:get("lasso", "petz:lasso")
petz.settings.rob_mobs = settings:get_bool("rob_mobs", false)
--Look at
petz.settings.look_at = settings:get_bool("look_at", true)