Added command to reroute trains

This commit is contained in:
Gabriel Pérez-Cerezo 2017-08-04 01:05:37 +02:00 committed by orwell96
parent c894dee7ef
commit 9826161a14
1 changed files with 16 additions and 2 deletions

View File

@ -382,5 +382,19 @@ minetest.register_chatcommand("at_empty_seats",
reload_saves()
end)
end,
privs = {train_operator=true}, -- Require the "privs" privilege to run
})
})
-- This chat command solves another problem: Trains getting randomly stuck.
minetest.register_chatcommand("at_reroute",
{
params = "",
description = "Delete all train routes, force them to recalculate",
privs = {train_operator=true}, -- Only train operator is required, since this is relatively safe.
func = function(name, param)
return advtrains.pcall(function()
atwarn("Train routes will be recalculated now")
advtrains.save(false)
reload_saves()
end)
end,
})