From 2da11c5a49f39a6b55c411510f44f2f3676efc3a Mon Sep 17 00:00:00 2001 From: Blockhead Date: Fri, 13 Mar 2020 13:24:11 +1100 Subject: Use a standard wagon inventory formspec This new formspec also allows access to the wagon properties. Once whitelisted in the wagon properties, other players can access its inventory. Note on 'useless use' of OO: I tried passing just the wagon ID and avoiding using the `self` object in order to bypass the need to look up the lua entitie out of the list, but it ended up retrieving nil data. The best way to solve this overhead might be to wait for some kind of better way upstream in minetest's lua API to get entities, or to keep a central record of entities. Either way, the solution is outside the scope of this commit. --- advtrains/api_doc.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'advtrains/api_doc.txt') diff --git a/advtrains/api_doc.txt b/advtrains/api_doc.txt index 34f1beb..0256713 100644 --- a/advtrains/api_doc.txt +++ b/advtrains/api_doc.txt @@ -101,7 +101,9 @@ advtrains.register_wagon(name, prototype, description, inventory_image) get_inventory_formspec = function(self, player_name, inventory_name) return "" end, - ^- Function that should return the formspec to be displayed when requests to open the wagon's inventory + ^- Function that should return the formspec to be displayed when requests to open the wagon's inventory. + ^- advtrains.standard_inventory_formspec can be used for ordinary wagons with inventories to show + ^- both the inventory grid and a 'Wagon properties' button. ^- Use "list["..inventory_name..";;,;,;]" to display a wagon's inventory list. custom_on_step = function(self, dtime) end -- cgit v1.2.3