From 4f241b06b1cb803099eff4bbc981fca6eb839340 Mon Sep 17 00:00:00 2001 From: "Y. Wang" Date: Mon, 22 Aug 2022 19:42:06 +0200 Subject: Report coordinates of wagons with unregistered prototypes Related issue: https://forum.minetest.net/viewtopic.php?p=414307#p414307 --- advtrains/trainlogic.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'advtrains') diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua index a0fdaa1..288e224 100644 --- a/advtrains/trainlogic.lua +++ b/advtrains/trainlogic.lua @@ -1053,7 +1053,16 @@ function advtrains.update_trainpart_properties(train_id, invert_flipstate) if data then local wagon = advtrains.wagon_prototypes[data.type or data.entity_name] if not wagon then - atwarn("Wagon '",data.type,"' couldn't be found. Please check that all required modules are loaded!") + local ent = advtrains.wagon_objects[w_id] + local pdesc + if ent then + pdesc = "at " .. minetest.pos_to_string(ent:get_pos()) + elseif train.last_pos then + pdesc = "near " .. minetest.pos_to_string(train.last_pos) + else + pdesc = "at an unknown location" + end + atwarn(string.format("Wagon %q %s could not be found. Please check that all required modules are loaded!", data.type, pdesc)) wagon = advtrains.wagon_prototypes["advtrains:wagon_placeholder"] end -- cgit v1.2.3