mirror of
https://codeberg.org/tenplus1/teleport_potion.git
synced 2025-03-15 06:01:24 +00:00
Added support for glowing particles, better Intllib support
This commit is contained in:
parent
f865b67ade
commit
ca153f3f6a
1 changed files with 23 additions and 17 deletions
40
init.lua
40
init.lua
|
@ -7,28 +7,23 @@
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
local S
|
local S
|
||||||
|
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
S = intllib.Getter()
|
S = intllib.Getter()
|
||||||
else
|
else
|
||||||
S = function(s, a, ...)
|
S = function(s, a, ...) a = {a, ...}
|
||||||
if a == nil then
|
return s:gsub("@(%d+)", function(n)
|
||||||
return s
|
return a[tonumber(n)]
|
||||||
end
|
end)
|
||||||
a = {a, ...}
|
|
||||||
return s:gsub("(@?)@(%(?)(%d+)(%)?)",
|
|
||||||
function(e, o, n, c)
|
|
||||||
if e == "" then
|
|
||||||
return a[tonumber(n)] .. (o == "" and c or "")
|
|
||||||
else
|
|
||||||
return "@" .. o .. n .. c
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- max teleport distance
|
-- max teleport distance
|
||||||
local dist = tonumber(minetest.setting_get("map_generation_limit") or 31000)
|
local dist = tonumber(minetest.setting_get("map_generation_limit") or 31000)
|
||||||
|
|
||||||
|
|
||||||
local check_coordinates = function(str)
|
local check_coordinates = function(str)
|
||||||
|
|
||||||
if not str or str == "" then
|
if not str or str == "" then
|
||||||
|
@ -61,6 +56,7 @@ local check_coordinates = function(str)
|
||||||
return {x = x, y = y, z = z, desc = desc}
|
return {x = x, y = y, z = z, desc = desc}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- particle effects
|
-- particle effects
|
||||||
function tp_effect(pos)
|
function tp_effect(pos)
|
||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
|
@ -68,18 +64,20 @@ function tp_effect(pos)
|
||||||
time = 0.25,
|
time = 0.25,
|
||||||
minpos = pos,
|
minpos = pos,
|
||||||
maxpos = pos,
|
maxpos = pos,
|
||||||
minvel = {x = -2, y = -2, z = -2},
|
minvel = {x = -2, y = 1, z = -2},
|
||||||
maxvel = {x = 2, y = 2, z = 2},
|
maxvel = {x = 2, y = 2, z = 2},
|
||||||
minacc = {x = -4, y = -4, z = -4},
|
minacc = {x = 0, y = -2, z = 0},
|
||||||
maxacc = {x = 4, y = 4, z = 4},
|
maxacc = {x = 0, y = -4, z = 0},
|
||||||
minexptime = 0.1,
|
minexptime = 0.1,
|
||||||
maxexptime = 1,
|
maxexptime = 1,
|
||||||
minsize = 0.5,
|
minsize = 0.5,
|
||||||
maxsize = 1,
|
maxsize = 1.5,
|
||||||
texture = "particle.png",
|
texture = "particle.png",
|
||||||
|
glow = 15,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- teleport portal
|
-- teleport portal
|
||||||
minetest.register_node("teleport_potion:portal", {
|
minetest.register_node("teleport_potion:portal", {
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
|
@ -120,6 +118,7 @@ minetest.register_node("teleport_potion:portal", {
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- teleport potion
|
-- teleport potion
|
||||||
minetest.register_node("teleport_potion:potion", {
|
minetest.register_node("teleport_potion:potion", {
|
||||||
tiles = {"pad.png"},
|
tiles = {"pad.png"},
|
||||||
|
@ -194,6 +193,7 @@ minetest.register_node("teleport_potion:potion", {
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- teleport potion recipe
|
-- teleport potion recipe
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "teleport_potion:potion",
|
output = "teleport_potion:potion",
|
||||||
|
@ -204,6 +204,7 @@ minetest.register_craft({
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- teleport pad
|
-- teleport pad
|
||||||
minetest.register_node("teleport_potion:pad", {
|
minetest.register_node("teleport_potion:pad", {
|
||||||
tiles = {"padd.png", "padd.png^[transformFY"},
|
tiles = {"padd.png", "padd.png^[transformFY"},
|
||||||
|
@ -283,6 +284,7 @@ minetest.register_node("teleport_potion:pad", {
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- teleport pad recipe
|
-- teleport pad recipe
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'teleport_potion:pad',
|
output = 'teleport_potion:pad',
|
||||||
|
@ -293,6 +295,7 @@ minetest.register_craft({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- check portal & pad, teleport any entities on top
|
-- check portal & pad, teleport any entities on top
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label = "Potion/Pad teleportation",
|
label = "Potion/Pad teleportation",
|
||||||
|
@ -368,6 +371,7 @@ minetest.register_abm({
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- Throwable potion
|
-- Throwable potion
|
||||||
|
|
||||||
local potion_entity = {
|
local potion_entity = {
|
||||||
|
@ -426,6 +430,7 @@ end
|
||||||
|
|
||||||
minetest.register_entity("teleport_potion:potion_entity", potion_entity)
|
minetest.register_entity("teleport_potion:potion_entity", potion_entity)
|
||||||
|
|
||||||
|
|
||||||
function throw_potion(itemstack, player)
|
function throw_potion(itemstack, player)
|
||||||
|
|
||||||
local playerpos = player:getpos()
|
local playerpos = player:getpos()
|
||||||
|
@ -456,6 +461,7 @@ function throw_potion(itemstack, player)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- add lucky blocks
|
-- add lucky blocks
|
||||||
|
|
||||||
-- Teleport Potion mod
|
-- Teleport Potion mod
|
||||||
|
|
Loading…
Add table
Reference in a new issue