diff --git a/depends.txt b/depends.txt deleted file mode 100644 index dc9465e..0000000 --- a/depends.txt +++ /dev/null @@ -1,4 +0,0 @@ -mana? -intllib? -doc? -doc_items? diff --git a/description.txt b/description.txt deleted file mode 100644 index e6f4db9..0000000 --- a/description.txt +++ /dev/null @@ -1 +0,0 @@ -Adds the “Mirror of Returning”, a magical item which teleports the user to a previously set location. diff --git a/init.lua b/init.lua index d1708db..2579dfb 100644 --- a/init.lua +++ b/init.lua @@ -1,9 +1,4 @@ -local S -if (minetest.get_modpath("intllib")) then - S = intllib.Getter() -else - S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end -end +local S = minetest.get_translator("returnmirror") local returnmirror = {} returnmirror.cost_teleport = 200 @@ -47,14 +42,14 @@ returnmirror.set_position_inactive = function(itemstack, user, pointed_thing) end end - local pos = user:getpos() + local pos = user:get_pos() if returnmirror.mana_check(user, returnmirror.cost_set) then local newitem = ItemStack("returnmirror:mirror_active") newitem:set_metadata(minetest.pos_to_string(pos)) - minetest.sound_play( {name="returnmirror_set", gain=1}, {pos=pos, max_hear_distance=12}) + minetest.sound_play( {name="returnmirror_set", gain=1}, {pos=pos, max_hear_distance=12}, true) return newitem else - minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=pos, max_hear_distance=18}) + minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=pos, max_hear_distance=18}, true) end end @@ -72,10 +67,10 @@ returnmirror.set_position_active = function(itemstack, user, pointed_thing) local pos = user:getpos() if returnmirror.mana_check(user, returnmirror.cost_set) then itemstack:set_metadata(minetest.pos_to_string(pos)) - minetest.sound_play( {name="returnmirror_set", gain=1}, {pos=pos, max_hear_distance=12}) + minetest.sound_play( {name="returnmirror_set", gain=1}, {pos=pos, max_hear_distance=12}, true) return itemstack else - minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=pos, max_hear_distance=18}) + minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=pos, max_hear_distance=18}, true) end end @@ -97,9 +92,10 @@ minetest.register_tool("returnmirror:mirror_inactive", { inventory_image = "returnmirror_mirror_inactive.png", wield_image = "returnmirror_mirror_inactive.png", tool_capabilities = {}, + groups = { disable_repair = 1 }, range = 2, on_use = function(itemstack, user, pointed_thing) - minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=user:getpos(), max_hear_distance=18}) + minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=user:getpos(), max_hear_distance=18}, true) end, on_place = returnmirror.set_position_inactive, on_secondary_use = returnmirror.set_position_inactive, @@ -112,6 +108,7 @@ minetest.register_tool("returnmirror:mirror_active", { inventory_image = "returnmirror_mirror_active.png", wield_image = "returnmirror_mirror_active.png", tool_capabilities = {}, + groups = { disable_repair = 1 }, range = 2, on_use = function(itemstack, user, pointed_thing) local dest_string = itemstack:get_metadata() @@ -121,7 +118,7 @@ minetest.register_tool("returnmirror:mirror_active", { if dest ~= nil then if returnmirror.mana_check(user, returnmirror.cost_teleport) then fail = false - 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}, true) minetest.add_particlespawner({ amount = 50, time = 0.1, @@ -136,7 +133,7 @@ minetest.register_tool("returnmirror:mirror_active", { texture = "returnmirror_particle_departure.png", }) user:setpos(dest) - minetest.sound_play( {name="returnmirror_teleport", gain=1}, {pos=dest, max_hear_distance=30}) + minetest.sound_play( {name="returnmirror_teleport", gain=1}, {pos=dest, max_hear_distance=30}, true) minetest.add_particlespawner({ amount = 100, time = 0.1, @@ -153,7 +150,7 @@ minetest.register_tool("returnmirror:mirror_active", { end end if fail then - minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=src, max_hear_distance=18}) + minetest.sound_play( {name="returnmirror_fail", gain=1}, {pos=src, max_hear_distance=18}, true) end end, on_place = returnmirror.set_position_active, diff --git a/locale/de.txt b/locale/de.txt deleted file mode 100644 index 14b1325..0000000 --- a/locale/de.txt +++ /dev/null @@ -1,5 +0,0 @@ -Mirror of Returning = Spiegel der Rückkehr -Rightclick to set the mirror's teleport location. Leftclick to immediately teleport back to the mirror's teleport location. = Rechtsklicken, um die Teleportationsposition des Spiegels zu setzen. Linksklicken, um eine sofortige Teleportation zur Teleportationsposition des Spiegels vorzunehmen. -Setting the teleport location costs @1 mana, teleporting costs @2 mana. = Das Setzen der Teleportationsposition kostet @1 Mana. Das Teleportieren kostet @2 Mana. -This item allows to teleport its user back to a previously set location. = Dieser Gegenstand ermöglicht es seinem Benutzer, sich zu einer zuvor gesetzen Position zurück zu teleportieren. -This item allows to teleport the user back to a previously set location, at the cost of mana. = Dieser Gegenstand ermöglicht es dem Benutzer, sich auf Kosten von Mana zu einer zuvor gesetzten Position zurück zu teleportieren. diff --git a/locale/returnmirror.de.tr b/locale/returnmirror.de.tr new file mode 100644 index 0000000..e76c78a --- /dev/null +++ b/locale/returnmirror.de.tr @@ -0,0 +1,6 @@ +# textdomain:returnmirror +Mirror of Returning=Spiegel der Rückkehr +Rightclick to set the mirror's teleport location. Leftclick to immediately teleport back to the mirror's teleport location.=Rechtsklicken, um die Teleportationsposition des Spiegels zu setzen. Linksklicken, um eine sofortige Teleportation zur Teleportationsposition des Spiegels vorzunehmen. +Setting the teleport location costs @1 mana, teleporting costs @2 mana.=Das Setzen der Teleportationsposition kostet @1 Mana. Das Teleportieren kostet @2 Mana. +This item allows to teleport its user back to a previously set location.=Dieser Gegenstand ermöglicht es seinem Benutzer, sich zu einer zuvor gesetzen Position zurück zu teleportieren. +This item allows to teleport the user back to a previously set location, at the cost of mana.=Dieser Gegenstand ermöglicht es dem Benutzer, sich auf Kosten von Mana zu einer zuvor gesetzten Position zurück zu teleportieren. diff --git a/locale/template.txt b/locale/template.txt index 7968120..a705d6d 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -1,5 +1,6 @@ -Mirror of Returning = -Rightclick to set the mirror's teleport location. Leftclick to immediately teleport back to the mirror's teleport location. = -Setting the teleport location costs @1 mana, teleporting costs @2 mana. = -This item allows to teleport its user back to a previously set location. = -This item allows to teleport the user back to a previously set location, at the cost of mana. = +# textdomain:returnmirror +Mirror of Returning= +Rightclick to set the mirror's teleport location. Leftclick to immediately teleport back to the mirror's teleport location.= +Setting the teleport location costs @1 mana, teleporting costs @2 mana.= +This item allows to teleport its user back to a previously set location.= +This item allows to teleport the user back to a previously set location, at the cost of mana.= diff --git a/mod.conf b/mod.conf index 1b12dc7..ab7aadd 100644 --- a/mod.conf +++ b/mod.conf @@ -1 +1,3 @@ name = returnmirror +description = Adds the “Mirror of Returning”, a magical item which teleports the user to a previously set location. +optional_depends = mana, doc, doc_items diff --git a/sounds/returnmirror_fail.ogg b/sounds/returnmirror_fail.ogg index 55c45cc..b9ac8e6 100644 Binary files a/sounds/returnmirror_fail.ogg and b/sounds/returnmirror_fail.ogg differ diff --git a/sounds/returnmirror_set.ogg b/sounds/returnmirror_set.ogg index 0335350..4d559c6 100644 Binary files a/sounds/returnmirror_set.ogg and b/sounds/returnmirror_set.ogg differ diff --git a/sounds/returnmirror_teleport.ogg b/sounds/returnmirror_teleport.ogg index 4886853..8ceffe8 100644 Binary files a/sounds/returnmirror_teleport.ogg and b/sounds/returnmirror_teleport.ogg differ