Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
minetest_game
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
minetest_game
Commits
5870fd48
Commit
5870fd48
authored
7 years ago
by
SmallJoker
Committed by
paramat
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Carts: Replace old, deprecated function names
parent
47d6fbf8
Branches
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
mods/carts/cart_entity.lua
+13
-13
13 additions, 13 deletions
mods/carts/cart_entity.lua
with
13 additions
and
13 deletions
mods/carts/cart_entity.lua
+
13
−
13
View file @
5870fd48
...
...
@@ -57,8 +57,8 @@ function cart_entity:get_staticdata()
end
function
cart_entity
:
on_punch
(
puncher
,
time_from_last_punch
,
tool_capabilities
,
direction
)
local
pos
=
self
.
object
:
getpos
()
local
vel
=
self
.
object
:
getvelocity
()
local
pos
=
self
.
object
:
get
_
pos
()
local
vel
=
self
.
object
:
get
_
velocity
()
if
not
self
.
railtype
or
vector
.
equals
(
vel
,
{
x
=
0
,
y
=
0
,
z
=
0
})
then
local
node
=
minetest
.
get_node
(
pos
).
name
self
.
railtype
=
minetest
.
get_item_group
(
node
,
"connect_to_raillike"
)
...
...
@@ -81,7 +81,7 @@ function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities,
-- Detach driver and items
if
self
.
driver
then
if
self
.
old_pos
then
self
.
object
:
setpos
(
self
.
old_pos
)
self
.
object
:
set
_
pos
(
self
.
old_pos
)
end
local
player
=
minetest
.
get_player_by_name
(
self
.
driver
)
carts
:
manage_attachment
(
player
,
nil
)
...
...
@@ -99,7 +99,7 @@ function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities,
local
leftover
=
inv
:
add_item
(
"main"
,
"carts:cart"
)
-- If no room in inventory add a replacement cart to the world
if
not
leftover
:
is_empty
()
then
minetest
.
add_item
(
self
.
object
:
getpos
(),
leftover
)
minetest
.
add_item
(
self
.
object
:
get
_
pos
(),
leftover
)
end
end
self
.
object
:
remove
()
...
...
@@ -152,7 +152,7 @@ local function rail_sound(self, dtime)
self
.
sound_handle
=
nil
minetest
.
after
(
0
.
2
,
minetest
.
sound_stop
,
handle
)
end
local
vel
=
self
.
object
:
getvelocity
()
local
vel
=
self
.
object
:
get
_
velocity
()
local
speed
=
vector
.
length
(
vel
)
if
speed
>
0
then
self
.
sound_handle
=
minetest
.
sound_play
(
...
...
@@ -170,16 +170,16 @@ local function get_railparams(pos)
end
local
function
rail_on_step
(
self
,
dtime
)
local
vel
=
self
.
object
:
getvelocity
()
local
vel
=
self
.
object
:
get
_
velocity
()
if
self
.
punched
then
vel
=
vector
.
add
(
vel
,
self
.
velocity
)
self
.
object
:
setvelocity
(
vel
)
self
.
object
:
set
_
velocity
(
vel
)
self
.
old_dir
.
y
=
0
elseif
vector
.
equals
(
vel
,
{
x
=
0
,
y
=
0
,
z
=
0
})
then
return
end
local
pos
=
self
.
object
:
getpos
()
local
pos
=
self
.
object
:
get
_
pos
()
local
update
=
{}
-- stop cart if velocity vector flips
...
...
@@ -187,8 +187,8 @@ local function rail_on_step(self, dtime)
(
self
.
old_vel
.
x
*
vel
.
x
<
0
or
self
.
old_vel
.
z
*
vel
.
z
<
0
)
then
self
.
old_vel
=
{
x
=
0
,
y
=
0
,
z
=
0
}
self
.
old_pos
=
pos
self
.
object
:
setvelocity
(
vector
.
new
())
self
.
object
:
setacceleration
(
vector
.
new
())
self
.
object
:
set
_
velocity
(
vector
.
new
())
self
.
object
:
set
_
acceleration
(
vector
.
new
())
rail_on_step_event
(
get_railparams
(
pos
).
on_step
,
self
,
dtime
)
return
end
...
...
@@ -294,7 +294,7 @@ local function rail_on_step(self, dtime)
end
end
self
.
object
:
setacceleration
(
new_acc
)
self
.
object
:
set
_
acceleration
(
new_acc
)
self
.
old_pos
=
vector
.
new
(
pos
)
if
not
vector
.
equals
(
dir
,
{
x
=
0
,
y
=
0
,
z
=
0
})
then
self
.
old_dir
=
vector
.
new
(
dir
)
...
...
@@ -342,9 +342,9 @@ local function rail_on_step(self, dtime)
end
self
.
object
:
set_animation
(
anim
,
1
,
0
)
self
.
object
:
setvelocity
(
vel
)
self
.
object
:
set
_
velocity
(
vel
)
if
update
.
pos
then
self
.
object
:
setpos
(
pos
)
self
.
object
:
set
_
pos
(
pos
)
end
-- call event handler
...
...
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