mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-24 20:03:45 +01:00
Add check for unknown nodes.
* Check if node has a definition table before attempting to evaluate its attributes. * Define local variable to cache multiple accesses to `registered_nodes[]` and improve readability.
This commit is contained in:
parent
88f7a150c7
commit
818cbb2f48
@ -432,7 +432,8 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
|
||||
-- Slow down or speed up
|
||||
local acc = dir.y * -1.8
|
||||
local friction = 0.4
|
||||
local speed_mod = minetest.registered_nodes[minetest.get_node(pos).name]._rail_acceleration
|
||||
local ndef = minetest.registered_nodes[minetest.get_node(pos).name]
|
||||
local speed_mod = ndef and ndef._rail_acceleration
|
||||
|
||||
acc = acc - friction
|
||||
|
||||
@ -860,4 +861,4 @@ if has_mcl_wip then
|
||||
mcl_wip.register_wip_item("mcl_minecarts:furnace_minecart")
|
||||
mcl_wip.register_wip_item("mcl_minecarts:command_block_minecart")
|
||||
mcl_wip.register_wip_item("mcl_minecarts:hopper_minecart")
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user