From 7507dbba3ae566a6175ad0f63bb599144534e4ee Mon Sep 17 00:00:00 2001
From: orwell96 <orwell@bleipb.de>
Date: Tue, 9 Jan 2018 22:04:25 +0100
Subject: Add train_operator privilege check on discouple

---
 advtrains/wagons.lua | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/advtrains/wagons.lua b/advtrains/wagons.lua
index 42466f3..0506a22 100644
--- a/advtrains/wagons.lua
+++ b/advtrains/wagons.lua
@@ -1105,6 +1105,10 @@ function wagon:reattach_all()
 end
 
 function wagon:safe_decouple(pname)
+	if not minetest.check_player_privs(pname, "train_operator") then
+		minetest.chat_send_player(pname, "Missing train_operator privilege")
+		return false
+	end
 	if self.dcpl_lock then
 		minetest.chat_send_player(pname, "Couple is locked (ask owner or admin to unlock it)")
 		return false
-- 
cgit v1.2.3