diff options
author | Blockhead <jbis1337@hotmail.com> | 2020-03-13 13:24:11 +1100 |
---|---|---|
committer | Blockhead <jbis1337@hotmail.com> | 2020-03-18 00:35:30 +1100 |
commit | a2f68371ec160d2171289df2ec14a291cb12778a (patch) | |
tree | de7f942162712d8280ee61e1c9304dfedcb97afa /advtrains_train_steam | |
parent | 7ed69d69fcf12ca51ef2afb0f6c30dfdf2313ee6 (diff) | |
download | basic_trains-a2f68371ec160d2171289df2ec14a291cb12778a.tar.gz basic_trains-a2f68371ec160d2171289df2ec14a291cb12778a.tar.bz2 basic_trains-a2f68371ec160d2171289df2ec14a291cb12778a.zip |
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.
Diffstat (limited to 'advtrains_train_steam')
-rwxr-xr-x | advtrains_train_steam/init.lua | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/advtrains_train_steam/init.lua b/advtrains_train_steam/init.lua index c337a79..6b5047c 100755 --- a/advtrains_train_steam/init.lua +++ b/advtrains_train_steam/init.lua @@ -216,12 +216,7 @@ advtrains.register_wagon("wagon_box", { collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0}, drops={"default:steelblock 1"}, has_inventory = true, - get_inventory_formspec = function(self, pname, invname) - return "size[8,11]".. - "list["..invname..";box;0,0;8,3;]".. - "list[current_player;main;0,5;8,4;]".. - "listring[]" - end, + get_inventory_formspec = advtrains.standard_inventory_formspec, inventory_list_sizes = { box=8*3, }, |