1
0
Fork 0

recovery compass

csm-enabled
chmodsayshello 2022-12-01 21:13:41 +01:00
parent 588425df73
commit ab031daa5a
33 changed files with 27 additions and 1 deletions

View File

@ -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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB