diff options
author | Blockhead <jbis1337@hotmail.com> | 2020-08-16 06:05:11 +1000 |
---|---|---|
committer | Gabriel PĂ©rez-Cerezo <gabriel@gpcf.eu> | 2020-08-21 16:02:02 +0200 |
commit | 595f26b45010d8e18433daee1c35b12cc2a7eba5 (patch) | |
tree | b7142feeb7bc81386b295613e171333d74242ac1 /advtrains_train_track/init.lua | |
parent | b707f20ba20a7cd542b9ccc9c939f55a9b88400c (diff) | |
download | advtrains-595f26b45010d8e18433daee1c35b12cc2a7eba5.tar.gz advtrains-595f26b45010d8e18433daee1c35b12cc2a7eba5.tar.bz2 advtrains-595f26b45010d8e18433daee1c35b12cc2a7eba5.zip |
Deprecate old 4590 crossings
This is done with a task that runs once when the nodedb is loaded. A new
field of advtrains_ndb will keep a version integer to indicate migration
versions. This introduces verson 1, no version being equivalent to 0.
An LBM is also registered to replace the tracks in the world.
Diffstat (limited to 'advtrains_train_track/init.lua')
-rw-r--r-- | advtrains_train_track/init.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/advtrains_train_track/init.lua b/advtrains_train_track/init.lua index d6b8e52..d85f8a1 100644 --- a/advtrains_train_track/init.lua +++ b/advtrains_train_track/init.lua @@ -62,6 +62,25 @@ minetest.register_craft({ {'', '', 'advtrains:dtrack_placer'} } }) +-- Deprecate any rails using the old name scheme +minetest.register_lbm({ + label = "Upgrade legacy 4590 rails", + name = "advtrains_train_track:replace_legacy_4590", + nodenames = {"advtrains:dtrack_xing4590_st"}, + run_at_every_load = true, + action = function(pos, node) + minetest.log("actionPos!: " .. pos.x .. "," .. pos.y .. "," .. pos.z) + minetest.log("node!: " .. node.name .. "," .. node.param1 .. "," .. node.param2) + advtrains.ndb.swap_node(pos, + { + name="advtrains:dtrack_xing90plusx_45l", + param1=node.param1, + param2=node.param2, + }) + end +}) +-- This will replace any items left in the inventory +minetest.register_alias("advtrains:dtrack_xing4590_placer", "advtrains:dtrack_xing90plusx_placer") -- Diagonal -- This set of rail crossings is named based on the angle of each intersecting |