From 25a335203f81fb80effed30f74aed2ed7d488837 Mon Sep 17 00:00:00 2001 From: Gabriel PĂ©rez-Cerezo Date: Sun, 1 Dec 2019 12:25:06 +0100 Subject: Allow painting coupled wagons --- advtrains/wagons.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'advtrains') diff --git a/advtrains/wagons.lua b/advtrains/wagons.lua index 4dbe85c..040c1e4 100644 --- a/advtrains/wagons.lua +++ b/advtrains/wagons.lua @@ -173,10 +173,6 @@ function wagon:on_punch(puncher, time_from_last_punch, tool_capabilities, direct minetest.chat_send_player(puncher:get_player_name(), attrans("This wagon is owned by @1, you can't destroy it.", data.owner)); return end - if #(self:train().trainparts)>1 then - minetest.chat_send_player(puncher:get_player_name(), attrans("Wagon needs to be decoupled from other wagons in order to destroy it.")); - return - end if self.custom_may_destroy then if not self.custom_may_destroy(self, puncher, time_from_last_punch, tool_capabilities, direction) then @@ -189,6 +185,10 @@ function wagon:on_punch(puncher, time_from_last_punch, tool_capabilities, direct self:set_livery(puncher, itemstack, data) return end + if #(self:train().trainparts)>1 then + minetest.chat_send_player(puncher:get_player_name(), attrans("Wagon needs to be decoupled from other wagons in order to destroy it.")); + return + end local pc=puncher:get_player_control() if not pc.sneak then -- cgit v1.2.3