aboutsummaryrefslogtreecommitdiff
path: root/advtrains_train_industrial/init.lua
diff options
context:
space:
mode:
authorBlockhead <jbis1337@hotmail.com>2020-03-13 13:24:11 +1100
committerBlockhead <jbis1337@hotmail.com>2020-03-18 00:35:30 +1100
commit2da11c5a49f39a6b55c411510f44f2f3676efc3a (patch)
tree0d6dcdedac170125427bf9539300e07d853d0109 /advtrains_train_industrial/init.lua
parentfb837a449af3bc3f5d70b10d807fc53982520e9f (diff)
downloadadvtrains-2da11c5a49f39a6b55c411510f44f2f3676efc3a.tar.gz
advtrains-2da11c5a49f39a6b55c411510f44f2f3676efc3a.tar.bz2
advtrains-2da11c5a49f39a6b55c411510f44f2f3676efc3a.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_industrial/init.lua')
-rw-r--r--advtrains_train_industrial/init.lua14
1 files changed, 2 insertions, 12 deletions
diff --git a/advtrains_train_industrial/init.lua b/advtrains_train_industrial/init.lua
index 64a98b8..4d64615 100644
--- a/advtrains_train_industrial/init.lua
+++ b/advtrains_train_industrial/init.lua
@@ -90,12 +90,7 @@ advtrains.register_wagon("wagon_tank", {
collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
drops={"default:steelblock 4"},
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,
},
@@ -111,12 +106,7 @@ advtrains.register_wagon("wagon_wood", {
collisionbox = {-1.0,-0.5,-1.0, 1.0,2.5,1.0},
drops={"default:steelblock 4"},
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,
},