remove depracated api calls
parent
8bf4186b09
commit
b7bae0a45d
|
@ -24,7 +24,7 @@ function cart_func:velocity_to_dir(v)
|
||||||
end
|
end
|
||||||
|
|
||||||
function cart_func:is_rail(p)
|
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")
|
return minetest.get_item_group(nn, "connect_to_raillike") == minetest.raillike_group("rail")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
8
init.lua
8
init.lua
|
@ -279,7 +279,7 @@ function cart:on_step(dtime)
|
||||||
if dir.y == 0 then
|
if dir.y == 0 then
|
||||||
if math.abs(self.velocity.x) < 0.1 and math.abs(self.velocity.z) < 0.1 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
|
-- 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 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
|
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 = {
|
self.velocity = {
|
||||||
|
@ -372,7 +372,7 @@ function cart:on_step(dtime)
|
||||||
dir = cart_func:velocity_to_dir(self.velocity)
|
dir = cart_func:velocity_to_dir(self.velocity)
|
||||||
|
|
||||||
-- Accelerate or decelerate the cart according to the pitch and acceleration of the rail node
|
-- 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
|
if not a then
|
||||||
a = 0
|
a = 0
|
||||||
end
|
end
|
||||||
|
@ -484,13 +484,13 @@ minetest.register_craftitem("vcarts:cart", {
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if cart_func:is_rail(pointed_thing.under) then
|
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
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
elseif cart_func:is_rail(pointed_thing.above) then
|
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
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue