diff options
author | Blockhead <jbis1337@hotmail.com> | 2020-03-18 01:13:06 +1100 |
---|---|---|
committer | Blockhead <jbis1337@hotmail.com> | 2020-03-18 01:13:06 +1100 |
commit | d0629469aa1403fb884a26688f2b9b5695c7806a (patch) | |
tree | 4cd7087d065b0c20c8f4596f6f0840363de6ac0b | |
parent | 2da11c5a49f39a6b55c411510f44f2f3676efc3a (diff) | |
download | advtrains-d0629469aa1403fb884a26688f2b9b5695c7806a.tar.gz advtrains-d0629469aa1403fb884a26688f2b9b5695c7806a.tar.bz2 advtrains-d0629469aa1403fb884a26688f2b9b5695c7806a.zip |
Show the wagon properties button only to the owner
-rw-r--r-- | advtrains/wagons.lua | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/advtrains/wagons.lua b/advtrains/wagons.lua index ddf533b..20ad269 100644 --- a/advtrains/wagons.lua +++ b/advtrains/wagons.lua @@ -1182,11 +1182,21 @@ function advtrains.get_wagon_prototype(data) end
function advtrains.standard_inventory_formspec(self, pname, invname)
- return "size[8,11]"..
- "list["..invname..";box;0,0;8,3;]"..
- "button_exit[0,9;4,1;prop;"..attrans("Wagon properties").."]"..
- "list[current_player;main;0,5;8,4;]"..
+ --[[minetest.chat_send_player(pname, string.format("self=%s, pname=%s, invname=%s", self, pname, invname))
+ for k,v in pairs(self) do
+ minetest.chat_send_player(pname, string.format("%s=%s", k,v))
+ end
+ minetest.chat_send_player(pname, string.format("***%s***", self.object:get_pos()))--]]
+ local data = advtrains.wagons[self.id]
+ local r = "size[8,11]"..
+ "list["..invname..";box;0,0;8,3;]"
+ minetest.chat_send_player(pname, string.format("self.owner=%s, pname=%s", data.owner, pname))
+ if data.owner==pname then
+ r = r .. "button_exit[0,9;4,1;prop;"..attrans("Wagon properties").."]"
+ end
+ r = r .. "list[current_player;main;0,5;8,4;]"..
"listring[]"
+ return r
end
function advtrains.register_wagon(sysname_p, prototype, desc, inv_img, nincreative)
|