Make dependency on Mana mod optional
This commit is contained in:
parent
32f59bd4ff
commit
dc5d58ceb9
|
@ -1 +1 @@
|
||||||
mana
|
mana?
|
||||||
|
|
18
init.lua
18
init.lua
|
@ -1,6 +1,12 @@
|
||||||
returnmirror = {}
|
returnmirror = {}
|
||||||
returnmirror.cost = 100
|
returnmirror.cost = 100
|
||||||
|
|
||||||
|
if minetest.get_modpath("mana") ~= nil then
|
||||||
|
returnmirror.mana = true
|
||||||
|
else
|
||||||
|
returnmirror.mana = false
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_tool("returnmirror:returnmirror", {
|
minetest.register_tool("returnmirror:returnmirror", {
|
||||||
description = "Mirror of Returning",
|
description = "Mirror of Returning",
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
|
@ -11,7 +17,17 @@ minetest.register_tool("returnmirror:returnmirror", {
|
||||||
local dest_string = itemstack:get_metadata()
|
local dest_string = itemstack:get_metadata()
|
||||||
local dest = minetest.string_to_pos(dest_string)
|
local dest = minetest.string_to_pos(dest_string)
|
||||||
if dest ~= nil then
|
if dest ~= nil then
|
||||||
if mana.subtract(user:get_player_name(), returnmirror.cost) then
|
local allowed
|
||||||
|
if returnmirror.mana then
|
||||||
|
if mana.subtract(user:get_player_name(), returnmirror.cost) then
|
||||||
|
allowed = true
|
||||||
|
else
|
||||||
|
allowed = false
|
||||||
|
end
|
||||||
|
else
|
||||||
|
allowed = true
|
||||||
|
end
|
||||||
|
if allowed then
|
||||||
local src = user:getpos()
|
local src = user:getpos()
|
||||||
minetest.sound_play( {name="returnmirror_teleport", gain=1}, {pos=src, max_hear_distance=30})
|
minetest.sound_play( {name="returnmirror_teleport", gain=1}, {pos=src, max_hear_distance=30})
|
||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
|
|
Loading…
Reference in New Issue