Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
teleport_potion
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
teleport_potion
Commits
718adac0
Commit
718adac0
authored
8 years ago
by
TenPlus1
Browse files
Options
Downloads
Patches
Plain Diff
Teleport pads now have descriptions added
parent
4f88bf11
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+1
-0
1 addition, 0 deletions
README.md
init.lua
+11
-6
11 additions, 6 deletions
init.lua
with
12 additions
and
6 deletions
README.md
+
1
−
0
View file @
718adac0
...
...
@@ -7,6 +7,7 @@ https://forum.minetest.net/viewtopic.php?f=9&t=9234
Changes:
-
0.7 - Can now enter descriptions for teleport pads e.g. (0,12,0,Home)
-
0.6 - Tweaked and tidied code, added map_generation_limit's
-
0.5 - Added throwable potions
-
0.4 - Code tidy and particle effects added
...
...
This diff is collapsed.
Click to expand it.
init.lua
+
11
−
6
View file @
718adac0
--= Teleport Potion mod 0.
6
by TenPlus1
--= Teleport Potion mod 0.
7
by TenPlus1
-- Create teleport potion or pad, place then right-click to enter coords
-- and step onto pad or walk into the blue portal light, portal closes after
...
...
@@ -15,7 +15,7 @@ local check_coordinates = function(str)
end
-- get coords from string
local
x
,
y
,
z
=
string.match
(
str
,
"^(-?%d+),(-?%d+),(-?%d+)"
)
local
x
,
y
,
z
,
desc
=
string.match
(
str
,
"^(-?%d+),(-?%d+),(-?%d+)
,?(.*)$
"
)
-- check coords
if
x
==
nil
or
string.len
(
x
)
>
6
...
...
@@ -37,7 +37,7 @@ local check_coordinates = function(str)
end
-- return ok coords
return
{
x
=
x
,
y
=
y
,
z
=
z
}
return
{
x
=
x
,
y
=
y
,
z
=
z
,
desc
=
desc
}
end
-- particle effects
...
...
@@ -210,7 +210,7 @@ minetest.register_node("teleport_potion:pad", {
local
meta
=
minetest
.
get_meta
(
pos
)
-- text entry formspec
meta
:
set_string
(
"formspec"
,
"field[text;Enter teleport coords (e.g. 200,20,-200);${text}]"
)
meta
:
set_string
(
"formspec"
,
"field[text;Enter teleport coords (e.g. 200,20,-200
,Home
);${text}]"
)
meta
:
set_string
(
"infotext"
,
"Right-click to enchant teleport location"
)
meta
:
set_string
(
"text"
,
pos
.
x
..
","
..
pos
.
y
..
","
..
pos
.
z
)
...
...
@@ -241,8 +241,13 @@ minetest.register_node("teleport_potion:pad", {
meta
:
set_int
(
"z"
,
coords
.
z
)
meta
:
set_string
(
"text"
,
fields
.
text
)
meta
:
set_string
(
"infotext"
,
"Pad Active ("
..
coords
.
x
..
","
..
coords
.
y
..
","
..
coords
.
z
..
")"
)
if
coords
.
desc
and
coords
.
desc
~=
""
then
meta
:
set_string
(
"infotext"
,
"Teleport to "
..
coords
.
desc
)
else
meta
:
set_string
(
"infotext"
,
"Pad Active ("
..
coords
.
x
..
","
..
coords
.
y
..
","
..
coords
.
z
..
")"
)
end
minetest
.
sound_play
(
"portal_open"
,
{
pos
=
pos
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment