~gpcf/advtrains-devel

Add setting to bypass coupler type checks when coupling v1 PROPOSED

Maverick2797: 1
 Add setting to bypass coupler type checks when coupling

 2 files changed, 4 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~gpcf/advtrains-devel/patches/55766/mbox | git am -3
Learn more about email & git

[PATCH] Add setting to bypass coupler type checks when coupling Export this patch

Allows a server to disable the coupler checks when multiple coupler types are present, making everything effectively a universal coupler
---
 advtrains/couple.lua       | 2 +-
 advtrains/settingtypes.txt | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/advtrains/couple.lua b/advtrains/couple.lua
index b6a445e..4102819 100644
--- a/advtrains/couple.lua
+++ b/advtrains/couple.lua
@@ -319,7 +319,7 @@ function advtrains.check_matching_coupler_types(t1, t1_front, t2, t2_front)
	--atdebug("CMCT: t1",t1_cplt,"t2",t2_cplt,"")

	-- if at least one of the trains has no couplers table, it always couples (fallback behavior and mode for universal shunters)
	if not t1_cplt or not t2_cplt then
	if minetest.settings:get_bool("advtrains_universal_couplers", false) or not t1_cplt or not t2_cplt then
		return true
	end

diff --git a/advtrains/settingtypes.txt b/advtrains/settingtypes.txt
index 2b627cb..a495d1e 100644
--- a/advtrains/settingtypes.txt
+++ b/advtrains/settingtypes.txt
@@ -61,3 +61,6 @@ advtrains_save_interval (Save Interval) int 60 20 3600
#    If enabled, trains only collide with nodes with "normal" drawtype.
advtrains_forgiving_collision (Forgiving Collision mode) bool false

#    Enable universal couplers for wagons
#    If enabled, wagons will bypass the checks that compare the coupler types when coupling.
advtrains_universal_couplers (Universal Couplers) bool false
\ No newline at end of file
-- 
2.46.0