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
|
||||
local S
|
||||
|
||||
if minetest.get_modpath("intllib") then
|
||||
S = intllib.Getter()
|
||||
else
|
||||
S = function(s, a, ...)
|
||||
if a == nil then
|
||||
return s
|
||||
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)
|
||||
S = function(s, a, ...) a = {a, ...}
|
||||
return s:gsub("@(%d+)", function(n)
|
||||
return a[tonumber(n)]
|
||||
end)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
-- max teleport distance
|
||||
local dist = tonumber(minetest.setting_get("map_generation_limit") or 31000)
|
||||
|
||||
|
||||
local check_coordinates = function(str)
|
||||
|
||||
if not str or str == "" then
|
||||
|
@ -61,6 +56,7 @@ local check_coordinates = function(str)
|
|||
return {x = x, y = y, z = z, desc = desc}
|
||||
end
|
||||
|
||||
|
||||
-- particle effects
|
||||
function tp_effect(pos)
|
||||
minetest.add_particlespawner({
|
||||
|
@ -68,18 +64,20 @@ function tp_effect(pos)
|
|||
time = 0.25,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x = -2, y = -2, z = -2},
|
||||
minvel = {x = -2, y = 1, z = -2},
|
||||
maxvel = {x = 2, y = 2, z = 2},
|
||||
minacc = {x = -4, y = -4, z = -4},
|
||||
maxacc = {x = 4, y = 4, z = 4},
|
||||
minacc = {x = 0, y = -2, z = 0},
|
||||
maxacc = {x = 0, y = -4, z = 0},
|
||||
minexptime = 0.1,
|
||||
maxexptime = 1,
|
||||
minsize = 0.5,
|
||||
maxsize = 1,
|
||||
maxsize = 1.5,
|
||||
texture = "particle.png",
|
||||
glow = 15,
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
-- teleport portal
|
||||
minetest.register_node("teleport_potion:portal", {
|
||||
drawtype = "plantlike",
|
||||
|
@ -120,6 +118,7 @@ minetest.register_node("teleport_potion:portal", {
|
|||
end,
|
||||
})
|
||||
|
||||
|
||||
-- teleport potion
|
||||
minetest.register_node("teleport_potion:potion", {
|
||||
tiles = {"pad.png"},
|
||||
|
@ -194,6 +193,7 @@ minetest.register_node("teleport_potion:potion", {
|
|||
end,
|
||||
})
|
||||
|
||||
|
||||
-- teleport potion recipe
|
||||
minetest.register_craft({
|
||||
output = "teleport_potion:potion",
|
||||
|
@ -204,6 +204,7 @@ minetest.register_craft({
|
|||
},
|
||||
})
|
||||
|
||||
|
||||
-- teleport pad
|
||||
minetest.register_node("teleport_potion:pad", {
|
||||
tiles = {"padd.png", "padd.png^[transformFY"},
|
||||
|
@ -283,6 +284,7 @@ minetest.register_node("teleport_potion:pad", {
|
|||
end,
|
||||
})
|
||||
|
||||
|
||||
-- teleport pad recipe
|
||||
minetest.register_craft({
|
||||
output = 'teleport_potion:pad',
|
||||
|
@ -293,6 +295,7 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
|
||||
-- check portal & pad, teleport any entities on top
|
||||
minetest.register_abm({
|
||||
label = "Potion/Pad teleportation",
|
||||
|
@ -368,6 +371,7 @@ minetest.register_abm({
|
|||
end
|
||||
})
|
||||
|
||||
|
||||
-- Throwable potion
|
||||
|
||||
local potion_entity = {
|
||||
|
@ -426,6 +430,7 @@ end
|
|||
|
||||
minetest.register_entity("teleport_potion:potion_entity", potion_entity)
|
||||
|
||||
|
||||
function throw_potion(itemstack, player)
|
||||
|
||||
local playerpos = player:getpos()
|
||||
|
@ -456,6 +461,7 @@ function throw_potion(itemstack, player)
|
|||
|
||||
end
|
||||
|
||||
|
||||
-- add lucky blocks
|
||||
|
||||
-- Teleport Potion mod
|
||||
|
|
Loading…
Add table
Reference in a new issue