Cats can be "brushed" with a rake too

This allows for automated cat petting once
again, but not trivially like before.  Provision for
the tool, AND activation timing, is needed now.
This commit is contained in:
Aaron Suen 2023-05-20 09:51:37 -04:00
parent e4835417b5
commit 97a04d8a5e

41
pet.lua
View File

@ -153,20 +153,27 @@ function myapi.notpurring(pos)
return not purrtime and {}
end
local petgroups = minetest.registered_items[""].tool_capabilities.groupcaps.cuddly and {cuddly = 1} or {thumpy = 1}
nodecore.register_craft({
label = "pet cat",
action = "pummel",
toolgroups = petgroups,
indexkeys = {"group:" .. modname .. "_face"},
check = function(pos)
return myapi.notpurring(pos) and playernear(pos)
end,
nodes = {
{match = {
groups = {[modname .. "_cat"] = true},
stacked = false
}}
},
after = purrstart
})
local petdef = {
label = "pet cat",
action = "pummel",
indexkeys = {"group:" .. modname .. "_face"},
check = function(pos)
return myapi.notpurring(pos) and playernear(pos)
end,
nodes = {
{match = {
groups = {[modname .. "_cat"] = true},
stacked = false
}}
},
after = purrstart
}
nodecore.register_craft(nodecore.underride({
toolgroups = minetest.registered_items[""].tool_capabilities.groupcaps.cuddly
and {cuddly = 1} or {thumpy = 1},
}, petdef))
nodecore.register_craft(nodecore.underride({
wield = {groups = {rakey = true}},
consumewield = 1,
duration = 2
}, petdef))