diff options
author | Gabriel PĂ©rez-Cerezo <gabriel@gpcf.eu> | 2017-08-04 01:05:37 +0200 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2017-08-15 14:35:42 +0200 |
commit | 9826161a146c214382b451ace9cd52a3f7f5bbce (patch) | |
tree | 313c54fd2ccea0b9984efe4a8d1474bc7963c45b | |
parent | c894dee7ef8e43ddca1965e57b5d746b83f4e5b4 (diff) | |
download | advtrains-9826161a146c214382b451ace9cd52a3f7f5bbce.tar.gz advtrains-9826161a146c214382b451ace9cd52a3f7f5bbce.tar.bz2 advtrains-9826161a146c214382b451ace9cd52a3f7f5bbce.zip |
Added command to reroute trains
-rw-r--r-- | advtrains/advtrains/init.lua | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/advtrains/advtrains/init.lua b/advtrains/advtrains/init.lua index 74990e7..301ff89 100644 --- a/advtrains/advtrains/init.lua +++ b/advtrains/advtrains/init.lua @@ -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, +}) + |