forked from mtcontrib/minetest_returnmirror
		
	Use new doc_items data format
This commit is contained in:
		@@ -1,3 +1,4 @@
 | 
			
		||||
mana?
 | 
			
		||||
intllib?
 | 
			
		||||
doc?
 | 
			
		||||
doc_items?
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										32
									
								
								init.lua
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								init.lua
									
									
									
									
									
								
							@@ -60,8 +60,21 @@ returnmirror.set_position_active = function(itemstack, user, pointed_thing)
 | 
			
		||||
	end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
local longdesc, usagehelp
 | 
			
		||||
if minetest.get_modpath("doc_items") then
 | 
			
		||||
	usagehelp = S("Rightclick to set the mirror's teleport location. Leftclick to immediately teleport back to the mirror's teleport location.")
 | 
			
		||||
	if minetest.get_modpath("mana") ~= nil then
 | 
			
		||||
		longdesc = S("This item allows to teleport the user back to a previously set location, at the cost of mana.")
 | 
			
		||||
		usagehelp = usagehelp .. " " .. string.format(S("Setting the teleport location costs %d mana, teleporting costs %d mana."), returnmirror.cost_set, returnmirror.cost_teleport)
 | 
			
		||||
	else
 | 
			
		||||
		longdesc = S("This item allows to teleport its user back to a previously set location.")
 | 
			
		||||
	end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
minetest.register_tool("returnmirror:mirror_inactive", {
 | 
			
		||||
	description = S("Mirror of Returning"),
 | 
			
		||||
	x_doc_items_longdesc = longdesc,
 | 
			
		||||
	x_doc_items_usagehelp = usagehelp,
 | 
			
		||||
	inventory_image = "returnmirror_mirror_inactive.png",
 | 
			
		||||
	wield_image = "returnmirror_mirror_inactive.png",
 | 
			
		||||
	tool_capabilities = {},
 | 
			
		||||
@@ -75,6 +88,7 @@ minetest.register_tool("returnmirror:mirror_inactive", {
 | 
			
		||||
 | 
			
		||||
minetest.register_tool("returnmirror:mirror_active", {
 | 
			
		||||
	description = S("Mirror of Returning"),
 | 
			
		||||
	x_doc_items_create_entry = false,
 | 
			
		||||
	stack_max = 1,
 | 
			
		||||
	inventory_image = "returnmirror_mirror_active.png",
 | 
			
		||||
	wield_image = "returnmirror_mirror_active.png",
 | 
			
		||||
@@ -130,22 +144,6 @@ minetest.register_tool("returnmirror:mirror_active", {
 | 
			
		||||
 | 
			
		||||
minetest.register_alias("returnmirror:mirror_inactive", "returnmirror:returnmirror")
 | 
			
		||||
 | 
			
		||||
if minetest.get_modpath("doc_items") ~= nil then
 | 
			
		||||
	local longdesc, usagehelp
 | 
			
		||||
	usagehelp = S("Rightclick to set the mirror's teleport location. Leftclick to immediately teleport back to the mirror's teleport location.")
 | 
			
		||||
	if minetest.get_modpath("mana") ~= nil then
 | 
			
		||||
		longdesc = S("This item allows to teleport the user back to a previously set location, at the cost of mana.")
 | 
			
		||||
		usagehelp = usagehelp .. " " .. string.format(S("Setting the teleport location costs %d mana, teleporting costs %d mana."), returnmirror.cost_set, returnmirror.cost_teleport)
 | 
			
		||||
	else
 | 
			
		||||
		longdesc = S("This item allows to teleport its user back to a previously set location.")
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	doc.sub.items.set_items_longdesc({
 | 
			
		||||
		["returnmirror:mirror_inactive"] = longdesc,
 | 
			
		||||
	})
 | 
			
		||||
	doc.sub.items.set_items_usagehelp({
 | 
			
		||||
		["returnmirror:mirror_inactive"] = usagehelp
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
if minetest.get_modpath("doc") ~= nil then
 | 
			
		||||
	doc.add_entry_alias("tools", "returnmirror:mirror_inactive", "returnmirror:mirror_active")
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user