Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mesecons
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
mesecons
Commits
1ff437b7
Commit
1ff437b7
authored
12 years ago
by
Anthony Zhang
Browse files
Options
Downloads
Patches
Plain Diff
Don't forget sticky movestones!
parent
5f9e655c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mesecons_movestones/init.lua
+13
-24
13 additions, 24 deletions
mesecons_movestones/init.lua
with
13 additions
and
24 deletions
mesecons_movestones/init.lua
+
13
−
24
View file @
1ff437b7
...
...
@@ -136,26 +136,6 @@ minetest.register_node("mesecons_movestones:sticky_movestone", {
action_on
=
function
(
pos
,
node
)
local
direction
=
mesecon
:
get_movestone_direction
(
pos
)
if
not
direction
then
return
end
local
checknode
=
{}
local
collpos
=
{
x
=
pos
.
x
,
y
=
pos
.
y
,
z
=
pos
.
z
}
repeat
-- Check if it collides with a stopper
collpos
=
mesecon
:
addPosRule
(
collpos
,
direction
)
checknode
=
minetest
.
env
:
get_node
(
collpos
)
if
mesecon
:
is_mvps_stopper
(
checknode
.
name
,
direction
)
then
return
end
until
checknode
.
name
==
"air"
or
checknode
.
name
==
"ignore"
or
not
(
minetest
.
registered_nodes
[
checknode
.
name
].
liquidtype
==
"none"
)
repeat
-- Check if it collides with a stopper (pull direction)
collpos
=
{
x
=
collpos
.
x
-
direction
.
x
,
y
=
collpos
.
y
-
direction
.
y
,
z
=
collpos
.
z
-
direction
.
z
}
checknode
=
minetest
.
env
:
get_node
(
collpos
)
if
mesecon
:
is_mvps_stopper
(
checknode
.
name
,
direction
)
then
return
end
until
checknode
.
name
==
"air"
or
checknode
.
name
==
"ignore"
or
not
(
minetest
.
registered_nodes
[
checknode
.
name
].
liquidtype
==
"none"
)
minetest
.
env
:
remove_node
(
pos
)
mesecon
:
update_autoconnect
(
pos
)
minetest
.
env
:
add_entity
(
pos
,
"mesecons_movestones:sticky_movestone_entity"
)
...
...
@@ -184,18 +164,27 @@ minetest.register_entity("mesecons_movestones:sticky_movestone_entity", {
on_step
=
function
(
self
,
dtime
)
local
pos
=
self
.
object
:
getpos
()
local
colp
=
pos
local
direction
=
mesecon
:
get_movestone_direction
(
colp
)
pos
.
x
,
pos
.
y
,
pos
.
z
=
math.floor
(
pos
.
x
),
math.floor
(
pos
.
y
),
math.floor
(
pos
.
z
)
local
direction
=
mesecon
:
get_movestone_direction
(
pos
)
if
not
direction
then
local
name
=
minetest
.
env
:
get_node
(
pos
).
name
if
name
~=
"air"
and
name
~=
"ignore"
and
minetest
.
registered_nodes
[
name
].
liquidtype
==
"none"
then
mesecon
:
mvps_push
(
pos
,
direction
,
MOVESTONE_MAXIMUM_PUSH
)
end
minetest
.
env
:
add_node
(
pos
,
{
name
=
"mesecons_movestones:sticky_movestone"
})
self
.
object
:
remove
()
return
end
self
.
object
:
setvelocity
({
x
=
direction
.
x
*
2
,
y
=
direction
.
y
*
2
,
z
=
direction
.
z
*
2
})
local
np
=
mesecon
:
addPosRule
(
pos
,
direction
)
if
not
mesecon
:
mvps_push
(
np
,
direction
,
MOVESTONE_MAXIMUM_PUSH
)
then
minetest
.
env
:
add_node
(
pos
,
{
name
=
"mesecons_movestones:sticky_movestone"
})
self
.
object
:
remove
()
return
end
mesecon
:
mvps_push
(
pos
,
direction
,
100
)
self
.
object
:
setvelocity
({
x
=
direction
.
x
*
2
,
y
=
direction
.
y
*
2
,
z
=
direction
.
z
*
2
}
)
--STICKY
mesecon
:
mvps_pull_all
(
pos
,
direction
)
...
...
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