From 79da249c3d32769f7f3821292d479e6e44fdcb31 Mon Sep 17 00:00:00 2001 From: orwell96 Date: Tue, 9 Jan 2018 21:30:56 +0100 Subject: Add bord computer to trains Features: - couple/decouple trains from a driver stand - new couple lock system (owner based, overridable by 'train_remove' privilege) - all train operators can now change the inside/outside text, allows for multilines Accessible via right-click menu or by pressing Sneak+Jump keys --- advtrains/init.lua | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'advtrains/init.lua') diff --git a/advtrains/init.lua b/advtrains/init.lua index 4834a45..d5ef693 100644 --- a/advtrains/init.lua +++ b/advtrains/init.lua @@ -80,6 +80,10 @@ function advtrains.print_concat_table(a) else str=str.."false" end + elseif type(t)=="function" then + str=str.."" + elseif type(t)=="userdata" then + str=str.."" else str=str..t end @@ -90,7 +94,6 @@ function advtrains.print_concat_table(a) end atprint=function() end -atdebug=function() end atlog=function(t, ...) local text=advtrains.print_concat_table({t, ...}) minetest.log("action", "[advtrains]"..text) @@ -102,12 +105,12 @@ atwarn=function(t, ...) end sid=function(id) if id then return string.sub(id, -6) end end ---TEMP +--ONLY use this function for temporary debugging. for consistent debug prints use atprint atdebug=function(t, ...) - local text=advtrains.print_concat_table({t, ...}) - minetest.log("action", "[advtrains]"..text) - minetest.chat_send_all("[advtrains]"..text) - end + local text=advtrains.print_concat_table({t, ...}) + minetest.log("action", "[advtrains]"..text) + minetest.chat_send_all("[advtrains]"..text) +end if minetest.settings:get_bool("advtrains_enable_debugging") then atprint=function(t, ...) @@ -118,11 +121,6 @@ if minetest.settings:get_bool("advtrains_enable_debugging") then --atlog("@@",advtrains.atprint_context_tid,t,...) end - atdebug=function(t, ...) - local text=advtrains.print_concat_table({t, ...}) - minetest.log("action", "[advtrains]"..text) - minetest.chat_send_all("[advtrains]"..text) - end dofile(advtrains.modpath.."/debugringbuffer.lua") end @@ -271,7 +269,8 @@ advtrains.avt_save = function(remove_players_from_wagons) local v=advtrains.save_keys(train, { "last_pos", "last_pos_prev", "movedir", "velocity", "tarvelocity", "trainparts", "savedpos_off_track_index_offset", "recently_collided_with_env", - "atc_brake_target", "atc_wait_finish", "atc_command", "atc_delay", "door_open" + "atc_brake_target", "atc_wait_finish", "atc_command", "atc_delay", "door_open", + "text_outside", "text_inside", "couple_lck_front", "couple_lck_back" }) --then invalidate if train.index then -- cgit v1.2.3