Already-purring cats should not randomly meow

This commit is contained in:
Aaron Suen 2022-01-15 23:50:55 -05:00
parent 15dc658a59
commit 509beca433
2 changed files with 13 additions and 12 deletions

View File

@ -52,15 +52,6 @@ reg(5, "#e0c040", "#ff8000") -- light orange
reg(6, "#804000", "#402000") -- dark brown
reg(7, "#c0a080", "#806020") -- light brown
nodecore.register_ambiance({
label = modname .. " ambiance",
nodenames = {"group:" .. modname .. "_cat"},
interval = 5,
chance = 5,
sound_name = modname .. "_mew",
sound_gain = 0.5
})
function myapi.makecat(pos, param2)
nodecore.set_loud(pos, {
name = modname .. ":cat_" .. math_random(1, myapi.maxcatid),

16
pet.lua
View File

@ -57,16 +57,26 @@ nodecore.register_dnt({
action = purr
})
local function notpurring(pos) return not purring[hashpos(pos)] and {} end
nodecore.register_craft({
label = "pet cat",
action = "pummel",
toolgroups = {thumpy = 1},
indexkeys = {"group:" .. modname .. "_cat"},
check = function(pos)
return not purring[hashpos(pos)]
end,
check = notpurring,
nodes = {
{match = {groups = {[modname .. "_cat"] = true}}}
},
after = purr
})
nodecore.register_ambiance({
label = modname .. " ambiance",
nodenames = {"group:" .. modname .. "_cat"},
interval = 5,
chance = 5,
check = notpurring,
sound_name = modname .. "_mew",
sound_gain = 0.5
})