remove depracated api calls
parent
8bf4186b09
commit
b7bae0a45d
|
@ -24,7 +24,7 @@ function cart_func:velocity_to_dir(v)
|
|||
end
|
||||
|
||||
function cart_func:is_rail(p)
|
||||
local nn = minetest.env:get_node(p).name
|
||||
local nn = minetest.get_node(p).name
|
||||
return minetest.get_item_group(nn, "connect_to_raillike") == minetest.raillike_group("rail")
|
||||
end
|
||||
|
||||
|
|
8
init.lua
8
init.lua
|
@ -279,7 +279,7 @@ function cart:on_step(dtime)
|
|||
if dir.y == 0 then
|
||||
if math.abs(self.velocity.x) < 0.1 and math.abs(self.velocity.z) < 0.1 then
|
||||
-- Start the cart if powered from mesecons
|
||||
local a = tonumber(minetest.env:get_meta(pos):get_string("cart_acceleration"))
|
||||
local a = tonumber(minetest.get_meta(pos):get_string("cart_acceleration"))
|
||||
if a and a ~= 0 then
|
||||
if self.pre_stop_dir and cart_func.v3:equal(self:get_rail_direction(self.object:getpos(), self.pre_stop_dir), self.pre_stop_dir) then
|
||||
self.velocity = {
|
||||
|
@ -372,7 +372,7 @@ function cart:on_step(dtime)
|
|||
dir = cart_func:velocity_to_dir(self.velocity)
|
||||
|
||||
-- Accelerate or decelerate the cart according to the pitch and acceleration of the rail node
|
||||
local a = tonumber(minetest.env:get_meta(pos):get_string("cart_acceleration"))
|
||||
local a = tonumber(minetest.get_meta(pos):get_string("cart_acceleration"))
|
||||
if not a then
|
||||
a = 0
|
||||
end
|
||||
|
@ -484,13 +484,13 @@ minetest.register_craftitem("vcarts:cart", {
|
|||
return
|
||||
end
|
||||
if cart_func:is_rail(pointed_thing.under) then
|
||||
minetest.env:add_entity(pointed_thing.under, "vcarts:cart")
|
||||
minetest.add_entity(pointed_thing.under, "vcarts:cart")
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
elseif cart_func:is_rail(pointed_thing.above) then
|
||||
minetest.env:add_entity(pointed_thing.above, "vcarts:cart")
|
||||
minetest.add_entity(pointed_thing.above, "vcarts:cart")
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue