diff options
-rw-r--r-- | advtrains/wagons.lua | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/advtrains/wagons.lua b/advtrains/wagons.lua index 14bb58a..536c8d4 100644 --- a/advtrains/wagons.lua +++ b/advtrains/wagons.lua @@ -13,7 +13,20 @@ local GETOFF_TP_DELAY = 0.5 local IGNORE_WORLD = advtrains.IGNORE_WORLD advtrains.wagons = {} -advtrains.wagon_prototypes = {} +advtrains.wagon_alias = {} +advtrains.wagon_prototypes = setmetatable({}, { + __index = function(t, k) + local rtn_val = rawget(t, k) + if rtn_val ~= nil then + return rtn_val + end + local alias = advtrains.wagon_alias[k] + if alias then + return rawget(t, alias) + end + return nil + end +}) advtrains.wagon_objects = {} local unload_wgn_range = advtrains.wagon_load_range + 32 @@ -1326,6 +1339,10 @@ function advtrains.get_wagon_prototype(data) return wt, advtrains.wagon_prototypes[wt] end +function advtrains.register_wagon_alias(src, dst) + advtrains.wagon_alias[src] = dst +end + function advtrains.standard_inventory_formspec(self, pname, invname) --[[minetest.chat_send_player(pname, string.format("self=%s, pname=%s, invname=%s", self, pname, invname)) for k,v in pairs(self) do |