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
3c1bc0bb
Commit
3c1bc0bb
authored
9 years ago
by
TenPlus1
Browse files
Options
Downloads
Patches
Plain Diff
Code tidy
parent
849934c7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
init.lua
+14
-9
14 additions, 9 deletions
init.lua
with
14 additions
and
9 deletions
init.lua
+
14
−
9
View file @
3c1bc0bb
...
...
@@ -43,7 +43,7 @@ minetest.register_node("teleport_potion:portal", {
}
}
},
light_source
=
default
.
LIGHT_MAX
-
2
,
light_source
=
13
,
walkable
=
false
,
paramtype
=
"light"
,
pointable
=
false
,
...
...
@@ -59,11 +59,13 @@ minetest.register_node("teleport_potion:portal", {
-- remove portal after 10 seconds
on_timer
=
function
(
pos
)
minetest
.
sound_play
(
"portal_close"
,
{
pos
=
pos
,
gain
=
1
.
0
,
max_hear_distance
=
10
})
minetest
.
set_node
(
pos
,
{
name
=
"air"
})
end
,
})
...
...
@@ -97,6 +99,7 @@ minetest.register_node("teleport_potion:potion", {
meta
:
set_float
(
"z"
,
teleport
.
default
.
z
)
end
,
-- throw potion when used like tool
on_use
=
function
(
itemstack
,
user
)
throw_potion
(
itemstack
,
user
)
...
...
@@ -107,11 +110,6 @@ minetest.register_node("teleport_potion:potion", {
end
end
,
-- right-click to enter new coords
on_right_click
=
function
(
pos
,
placer
)
local
meta
=
minetest
.
get_meta
(
pos
)
end
,
-- check if coords ok then open portal, otherwise return potion
on_receive_fields
=
function
(
pos
,
formname
,
fields
,
sender
)
...
...
@@ -176,7 +174,9 @@ minetest.register_node("teleport_potion:pad", {
-- text entry formspec
meta
:
set_string
(
"formspec"
,
"field[text;;${text}]"
)
meta
:
set_string
(
"infotext"
,
"Enter teleport coords (e.g 200,20,-200)"
)
meta
:
set_string
(
"text"
,
teleport
.
default
.
x
..
","
..
teleport
.
default
.
y
..
","
..
teleport
.
default
.
z
)
meta
:
set_string
(
"text"
,
teleport
.
default
.
x
..
","
..
teleport
.
default
.
y
..
","
..
teleport
.
default
.
z
)
-- set default coords
meta
:
set_float
(
"x"
,
teleport
.
default
.
x
)
...
...
@@ -225,7 +225,9 @@ minetest.register_node("teleport_potion:pad", {
teleport
.
coordinates
=
function
(
str
)
if
not
str
or
str
==
""
then
return
nil
end
if
not
str
or
str
==
""
then
return
nil
end
-- get coords from string
local
x
,
y
,
z
=
string.match
(
str
,
"^(-?%d+),(-?%d+),(-?%d+)"
)
...
...
@@ -283,7 +285,10 @@ minetest.register_abm({
-- check objects inside pad/portal
local
objs
=
minetest
.
get_objects_inside_radius
(
pos
,
1
)
if
#
objs
==
0
then
return
end
if
#
objs
==
0
then
return
end
-- get coords from pad/portal
local
meta
=
minetest
.
get_meta
(
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