tidy code

This commit is contained in:
tenplus1 2024-07-28 10:32:30 +01:00
parent 9e89d3918d
commit 92c883ba75
2 changed files with 38 additions and 45 deletions

View file

@ -1,7 +1,7 @@
--= Teleport Potion mod by TenPlus1
-- Craft teleport potion or pad, use to bookmark location, place to open
-- Craft teleport potion or pad, use on node to bookmark location, place to open
-- portal or place pad, portals show a blue flame that you can walk into
-- before it closes (10 seconds), potions can also be thrown for local teleport.
@ -289,23 +289,24 @@ minetest.register_node("teleport_potion:potion", {
-- teleport potion recipe
if mcl then
minetest.register_craft({
output = "teleport_potion:potion",
recipe = {
{"", "mcl_core:diamond", ""},
{"mcl_core:diamond", "mcl_potions:glass_bottle", "mcl_core:diamond"},
{"", "mcl_core:diamond", ""}
}
})
minetest.register_craft({
output = "teleport_potion:potion",
recipe = {
{"", "mcl_core:diamond", ""},
{"mcl_core:diamond", "mcl_potions:glass_bottle", "mcl_core:diamond"},
{"", "mcl_core:diamond", ""}
}
})
else
minetest.register_craft({
output = "teleport_potion:potion",
recipe = {
{"", "default:diamond", ""},
{"default:diamond", "vessels:glass_bottle", "default:diamond"},
{"", "default:diamond", ""}
}
})
minetest.register_craft({
output = "teleport_potion:potion",
recipe = {
{"", "default:diamond", ""},
{"default:diamond", "vessels:glass_bottle", "default:diamond"},
{"", "default:diamond", ""}
}
})
end
--- Teleport pad
@ -357,8 +358,7 @@ minetest.register_node("teleport_potion:pad", {
meta:set_int("y", dest.y)
meta:set_int("z", dest.z)
meta:set_string("infotext", S("Pad Active (@1,@2,@3)",
dest.x, dest.y, dest.z))
meta:set_string("infotext", S("Pad Active (@1,@2,@3)", dest.x, dest.y, dest.z))
effect(pos, 20, "teleport_potion_particle.png", 0.5, 1.5, 1, 7, 15)
@ -453,23 +453,24 @@ end)
-- teleport pad recipe
if mcl then
minetest.register_craft({
output = "teleport_potion:pad",
recipe = {
{"teleport_potion:potion", "mcl_core:glass", "teleport_potion:potion"},
{"mcl_core:glass", "mesecons:redstone", "mcl_core:glass"},
{"teleport_potion:potion", "mcl_core:glass", "teleport_potion:potion"}
}
})
minetest.register_craft({
output = "teleport_potion:pad",
recipe = {
{"teleport_potion:potion", "mcl_core:glass", "teleport_potion:potion"},
{"mcl_core:glass", "mesecons:redstone", "mcl_core:glass"},
{"teleport_potion:potion", "mcl_core:glass", "teleport_potion:potion"}
}
})
else
minetest.register_craft({
output = "teleport_potion:pad",
recipe = {
{"teleport_potion:potion", "default:glass", "teleport_potion:potion"},
{"default:glass", "default:mese", "default:glass"},
{"teleport_potion:potion", "default:glass", "teleport_potion:potion"}
}
})
minetest.register_craft({
output = "teleport_potion:pad",
recipe = {
{"teleport_potion:potion", "default:glass", "teleport_potion:potion"},
{"default:glass", "default:mese", "default:glass"},
{"teleport_potion:potion", "default:glass", "teleport_potion:potion"}
}
})
end
-- check portal & pad, teleport any entities on top
@ -506,11 +507,7 @@ minetest.register_abm({
-- play sound on portal end
minetest.sound_play("portal_close", {
pos = pos,
gain = 1.0,
max_hear_distance = 5
}, true)
pos = pos, gain = 1.0, max_hear_distance = 5}, true)
pos.y = pos.y + 1
@ -525,10 +522,7 @@ minetest.register_abm({
-- play sound on destination end
minetest.sound_play("portal_close", {
pos = target_coords,
gain = 1.0,
max_hear_distance = 5
}, true)
pos = target_coords, gain = 1.0, max_hear_distance = 5}, true)
-- rotate player to look in pad placement direction
local rot = node.param2

View file

@ -1,5 +1,4 @@
name = teleport_potion
description = Adds craftable teleport potions (throwable) and teleport pads.
depends =
optional_depends = default, lucky_block, mcl_core
min_minetest_version = 5.0