Fix issue infinite spawn mobs nalc/nalc-server-mods#90

Fix issue craft splash potion(not sure, confirm if it's good) nalc/nalc-server-mods#89
Fix issue brewing stand accept but disapear wrong potion nalc/nalc-server-mods#100
This commit is contained in:
Crabman77 2022-07-11 00:36:56 +02:00
parent dcdf6b3a9b
commit 44c2a84c6e
2 changed files with 14 additions and 2 deletions

View File

@ -38,13 +38,17 @@ minetest.register_node("witchcraft:brewing_stand", {
on_rightclick = function(pos, node, clicker, item, _)
local wield_item = item:get_name()
local new_item = wield_item.."_2"
if minetest.get_item_group(wield_item, "potion") ~= 0 then
local player_name = clicker:get_player_name()
if not player_name then return end
if minetest.get_item_group(wield_item, "potion") ~= 0 and minetest.registered_items[new_item] ~= nil then
minetest.set_node(pos, {name="witchcraft:brewing_stand_active", param2=node.param2})
item:take_item()
minetest.after(30, function()
minetest.set_node(pos, {name="witchcraft:brewing_stand_unready", param2=node.param2})
minetest.add_item(pos, new_item)
end)
else
minetest.chat_send_player(player_name, "Sorry, it's not a potion/not upgradable!")
end
end,
})

View File

@ -466,7 +466,7 @@ minetest.register_craft({
output = 'witchcraft:splash_green',
recipe = {
{'vessels:glass_fragments'},
{'witchcraft:potion_green'},
{'witchcraft:potion_green2'},
}
})
minetest.register_craft({
@ -3537,6 +3537,10 @@ minetest.register_node("witchcraft:pentagram", {
on_rightclick = function(pos, node, _)
if minetest.get_modpath("mobs") then
minetest.after(0.5, function()
local node = minetest.get_node(pos)
if node.name ~= "witchcraft:pentagram" then
return
end
minetest.set_node(pos, {name="witchcraft:portal", param2=node.param2})
minetest.add_particlespawner({
amount = 25,
@ -3579,6 +3583,10 @@ minetest.register_node("witchcraft:portal", {
},
on_construct = function(pos, node, _)
minetest.after(1, function()
local node = minetest.get_node(pos)
if node.name ~= "witchcraft:portal" then
return
end
if minetest.get_modpath("mobs_animal") and minetest.get_modpath("mobs_monster") then
if math.random(2) > 1 then
minetest.add_entity(pos, "mobs_monster:oerkki")