diff --git a/mods/ITEMS/mcl_compass/init.lua b/mods/ITEMS/mcl_compass/init.lua index 9ec1ba074b..589fdf8c82 100644 --- a/mods/ITEMS/mcl_compass/init.lua +++ b/mods/ITEMS/mcl_compass/init.lua @@ -16,6 +16,13 @@ local compass_types = { tt = S("Points to a lodestone"), longdesc = S("Lodestone compasses resemble regular compasses, but they point to a specific lodestone."), usagehelp = S("A Lodestone compass can be made from an ordinary compass by using it on a lodestone. After becoming a lodestone compass, it always points to its linked lodestone, provided that they are in the same dimension. If not in the same dimension, the lodestone compass spins randomly, similarly to a regular compass when outside the overworld. A lodestone compass can be relinked with another lodestone."), + }, + { + name = "compass_recovery", + desc = S("Recovery Compass"), + tt = S("Points to your last death Location"), + longdesc = S("Recovery Compasses are compasses that point to your last death location"), + usagehelp = S("Recovery Compasses always point to the location of your last death, in case you haven't died yet, it will just randomly spin around"), } } @@ -182,7 +189,7 @@ minetest.register_globalstep(function(dtime) inv = player:get_inventory() for j, stack in pairs(inv:get_list("main")) do compass_nr = get_item_group(stack:get_name(), "compass") - if compass_nr ~= 0 then + if compass_nr ~= 0 and not string_find(stack:get_name(), "_recovery") then -- check if current compass image still matches true orientation compass_frame = get_compass_frame(pos, dir, stack) if compass_nr - 1 ~= compass_frame then @@ -195,6 +202,16 @@ minetest.register_globalstep(function(dtime) end inv:set_stack("main", j, stack) end + else + local meta = player:get_meta() + local posstring = meta:get_string("mcl_compass:recovery_pos") + if not posstring or posstring == "" then + stack:set_name("mcl_compass:"..random_frame .. "_recovery") + else + local targetpos = minetest.string_to_pos(posstring) + stack:set_name("mcl_compass:"..get_compass_angle(pos,targetpos,dir).."_recovery") + end + inv:set_stack("main",j,stack) end end end @@ -213,6 +230,9 @@ for _, item in pairs(compass_types) do elseif item.name == "compass_lodestone" then name_fmt = "mcl_compass:%d_lodestone" img_fmt = "mcl_compass_compass_%02d.png^[colorize:purple:50" + elseif item.name == "compass_recovery" then + name_fmt = "mcl_compass:%d_recovery" + img_fmt = "mcl_compass_recovery_compass_%02d.png" end for i = 0, compass_frames - 1 do local itemstring = string.format(name_fmt, i) @@ -289,3 +309,9 @@ minetest.register_craft({ {"mcl_core:stonebrickcarved", "mcl_core:stonebrickcarved", "mcl_core:stonebrickcarved"} } }) + +--set recovery meta +minetest.register_on_dieplayer(function(player) + local meta = player:get_meta(); + meta:set_string("mcl_compass:recovery_pos",minetest.pos_to_string(player:get_pos())) +end) \ No newline at end of file diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_00.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_00.png new file mode 100644 index 0000000000..c728101802 Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_00.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_01.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_01.png new file mode 100644 index 0000000000..e5a5d82b79 Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_01.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_02.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_02.png new file mode 100644 index 0000000000..6488b7e3a7 Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_02.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_03.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_03.png new file mode 100644 index 0000000000..4696c87150 Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_03.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_04.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_04.png new file mode 100644 index 0000000000..594092651b Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_04.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_05.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_05.png new file mode 100644 index 0000000000..9d0963cfba Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_05.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_06.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_06.png new file mode 100644 index 0000000000..a2f675fac9 Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_06.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_07.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_07.png new file mode 100644 index 0000000000..1356e696aa Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_07.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_08.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_08.png new file mode 100644 index 0000000000..8690c1b155 Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_08.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_09.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_09.png new file mode 100644 index 0000000000..d13c518e76 Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_09.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_10.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_10.png new file mode 100644 index 0000000000..48ed5bcaaf Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_10.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_11.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_11.png new file mode 100644 index 0000000000..edbcfdb87c Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_11.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_12.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_12.png new file mode 100644 index 0000000000..7d24d84f36 Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_12.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_13.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_13.png new file mode 100644 index 0000000000..eee649a78c Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_13.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_14.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_14.png new file mode 100644 index 0000000000..f584f347d3 Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_14.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_15.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_15.png new file mode 100644 index 0000000000..ab5c6ad8c5 Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_15.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_16.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_16.png new file mode 100644 index 0000000000..bb2cf0049e Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_16.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_17.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_17.png new file mode 100644 index 0000000000..a06e85185f Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_17.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_18.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_18.png new file mode 100644 index 0000000000..441d58488f Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_18.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_19.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_19.png new file mode 100644 index 0000000000..98f88ed018 Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_19.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_20.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_20.png new file mode 100644 index 0000000000..d46801d27f Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_20.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_21.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_21.png new file mode 100644 index 0000000000..cea8ade478 Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_21.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_22.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_22.png new file mode 100644 index 0000000000..b6e55140c9 Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_22.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_23.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_23.png new file mode 100644 index 0000000000..0463fc7045 Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_23.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_24.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_24.png new file mode 100644 index 0000000000..210858af12 Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_24.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_25.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_25.png new file mode 100644 index 0000000000..6db230bb0b Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_25.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_26.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_26.png new file mode 100644 index 0000000000..6d86189a74 Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_26.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_27.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_27.png new file mode 100644 index 0000000000..90cceda726 Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_27.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_28.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_28.png new file mode 100644 index 0000000000..c325929cf4 Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_28.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_29.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_29.png new file mode 100644 index 0000000000..86bec378a1 Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_29.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_30.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_30.png new file mode 100644 index 0000000000..5e59db8732 Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_30.png differ diff --git a/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_31.png b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_31.png new file mode 100644 index 0000000000..ec95a2bdb1 Binary files /dev/null and b/mods/ITEMS/mcl_compass/textures/mcl_compass_recovery_compass_31.png differ