Update API documentation to always use , add compatibility shim to mcl_minecarts.is_rail() and mcl_minecarts.ge_rail_direction()
This commit is contained in:
parent
e5b22731d6
commit
0c052e79b3
|
@ -77,7 +77,7 @@ Calculate the rail adjacency information for rail placement. Arguments are:
|
|||
- `ignore_neightbor_connections` - if true, don't check that a cart could leave
|
||||
the neighboring node from this direction.
|
||||
|
||||
`mcl_minecarts:is_rail(position, railtype)`
|
||||
`mcl_minecarts.is_rail(position, railtype)`
|
||||
|
||||
Determines if the node at `position` is a rail. If `railtype` is provided,
|
||||
determine if the node at `position` is that type of rail.
|
||||
|
@ -101,7 +101,7 @@ Converts the rail at `node_position`, if possible, another variant (curve, etc.)
|
|||
and rotates the node as needed so that rails connect together. `options` is
|
||||
passed thru to `mcl_minecarts.get_rail_connections()`
|
||||
|
||||
`mcl_minecarts:get_rail_direction(rail_position, cart_direction)`
|
||||
`mcl_minecarts.get_rail_direction(rail_position, cart_direction)`
|
||||
|
||||
Returns the next direction a cart traveling in the direction specified in `cart_direction`
|
||||
will travel from the rail located at `rail_position`.
|
||||
|
|
|
@ -53,7 +53,13 @@ function mcl_minecarts:velocity_to_dir(v)
|
|||
end
|
||||
end
|
||||
|
||||
function mcl_minecarts:is_rail(pos, railtype)
|
||||
function mcl_minecarts.is_rail(self, pos, railtype)
|
||||
-- Compatibility with mcl_minecarts:is_rail() usage
|
||||
if self ~= mcl_minecarts then
|
||||
railtype = pos
|
||||
pos = self
|
||||
end
|
||||
|
||||
local node_name = force_get_node(pos).name
|
||||
|
||||
if minetest.get_item_group(node_name, "rail") == 0 then
|
||||
|
@ -324,7 +330,13 @@ local function get_rail_direction_inner(pos, dir)
|
|||
|
||||
return dir
|
||||
end
|
||||
function mcl_minecarts:get_rail_direction(pos_, dir)
|
||||
function mcl_minecarts.get_rail_direction(self, pos_, dir)
|
||||
-- Compatibility with mcl_minecarts:get_rail_direction() usage
|
||||
if self ~= mcl_minecarts then
|
||||
dir = pos_
|
||||
pos_ = self
|
||||
end
|
||||
|
||||
local pos = vector.round(pos_)
|
||||
|
||||
-- diagonal direction handling
|
||||
|
|
Loading…
Reference in New Issue