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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user