Re-add option for debugging features and add option to disable collisions
This commit is contained in:
parent
5ebadbd6ff
commit
b8a3ac038f
|
@ -79,21 +79,12 @@ function advtrains.print_concat_table(a)
|
|||
return str
|
||||
end
|
||||
|
||||
atprint=function(t, ...)
|
||||
local context=advtrains.atprint_context_tid
|
||||
if not context then return end
|
||||
local text=advtrains.print_concat_table({t, ...})
|
||||
advtrains.drb_record(context, text)
|
||||
end
|
||||
atprint=function() end
|
||||
atdebug=function() end
|
||||
atlog=function(t, ...)
|
||||
local text=advtrains.print_concat_table({t, ...})
|
||||
minetest.log("action", "[advtrains]"..text)
|
||||
end
|
||||
atdebug=function(t, ...)
|
||||
local text=advtrains.print_concat_table({t, ...})
|
||||
minetest.log("action", "[advtrains]"..text)
|
||||
minetest.chat_send_all("[advtrains]"..text)
|
||||
end
|
||||
atwarn=function(t, ...)
|
||||
local text=advtrains.print_concat_table({t, ...})
|
||||
minetest.log("warning", "[advtrains]"..text)
|
||||
|
@ -101,6 +92,21 @@ atwarn=function(t, ...)
|
|||
end
|
||||
sid=function(id) return string.sub(id, -6) end
|
||||
|
||||
if minetest.settings:get_bool("advtrains_enable_debugging") then
|
||||
atprint=function(t, ...)
|
||||
local context=advtrains.atprint_context_tid
|
||||
if not context then return end
|
||||
local text=advtrains.print_concat_table({t, ...})
|
||||
advtrains.drb_record(context, text)
|
||||
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
|
||||
|
||||
dofile(advtrains.modpath.."/helpers.lua");
|
||||
--dofile(advtrains.modpath.."/debugitems.lua");
|
||||
|
||||
|
@ -120,7 +126,6 @@ advtrains.meseconrules =
|
|||
{x=0, y=-2, z=0}}
|
||||
|
||||
|
||||
dofile(advtrains.modpath.."/debugringbuffer.lua")
|
||||
|
||||
dofile(advtrains.modpath.."/trainlogic.lua")
|
||||
dofile(advtrains.modpath.."/trainhud.lua")
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
# Disable the train collision behavior. Trains will never collide and just drive through each other.
|
||||
# Note that this makes coupling trains impossible, and introduces 'interesting' behavior with detector and ATC rails.
|
||||
# Also, it is very hard to separate two subway trains that are stuck inside each other, since it can be impossible to access the driver seat.
|
||||
advtrains_disable_collisions (Disable train collisions) bool false
|
||||
# Enable the debug ring buffer
|
||||
# This has no effect on the user experience, except decreased performance. Debug outputs are saved in a ring buffer to be printed when an error occurs.
|
||||
# You probably want to leave this setting set to false.
|
||||
advtrains_enable_debugging (Enable debugging) bool false
|
|
@ -780,6 +780,10 @@ function advtrains.trains_facing(train1, train2)
|
|||
end
|
||||
|
||||
function advtrains.collide_and_spawn_couple(id1, pos, id2, t1_is_backpos)
|
||||
if minetest.settings:get_bool("advtrains_disable_collisions") then
|
||||
return
|
||||
end
|
||||
|
||||
atprint("COLLISION: "..sid(id1).." and "..sid(id2).." at ",pos,", t1_is_backpos="..(t1_is_backpos and "true" or "false"))
|
||||
--TODO:
|
||||
local train1=advtrains.trains[id1]
|
||||
|
|
Loading…
Reference in New Issue