forked from mtcontrib/witchcraft
Fix crash and other things
- Fix crash nalc/nalc-server-mods#101 - Fix issue infinite spawn mobs nalc/nalc-server-mods#90 - Fix brewing stand for non compatible potions nalc/nalc-server-mods#100
This commit is contained in:
commit
e1a9f5fc6f
@ -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,
|
||||
})
|
||||
|
13
depends.txt
13
depends.txt
@ -1,13 +0,0 @@
|
||||
default
|
||||
vessels
|
||||
tnt
|
||||
fire
|
||||
playereffects
|
||||
player_monoids?
|
||||
farming?
|
||||
lightning?
|
||||
pmobs?
|
||||
hud_hunger?
|
||||
hunger_ng?
|
||||
moreplants?
|
||||
horror?
|
14
init.lua
14
init.lua
@ -466,7 +466,7 @@ minetest.register_craft({
|
||||
output = 'witchcraft:splash_green',
|
||||
recipe = {
|
||||
{'vessels:glass_fragments'},
|
||||
{'witchcraft:potion_green'},
|
||||
{'witchcraft:potion_green2'},
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
@ -3167,7 +3167,7 @@ minetest.register_node("witchcraft:potion_ggreen", {
|
||||
})
|
||||
local mtime = minetest.get_timeofday()
|
||||
if mtime >= 0.25 and mtime <= 0.75 then
|
||||
user:override_day_night_ratio(-mtime+0.5)
|
||||
user:override_day_night_ratio(math.min(math.max(-mtime+0.5, 0), 1))
|
||||
minetest.after(10, function()
|
||||
user:override_day_night_ratio(nil)
|
||||
end)
|
||||
@ -3391,7 +3391,7 @@ minetest.register_node("witchcraft:potion_blue2_2", {
|
||||
function lightchange(person, duration)
|
||||
local mtime = minetest.get_timeofday()
|
||||
if mtime <= 0.25 or mtime >= 0.75 then
|
||||
person:override_day_night_ratio(mtime+0.5)
|
||||
person:override_day_night_ratio(math.min(math.max(mtime+0.5, 0), 1))
|
||||
minetest.after(duration, function()
|
||||
person:override_day_night_ratio(nil)
|
||||
end)
|
||||
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user