Update init.lua

master
AiTechEye 2018-07-21 19:58:11 +02:00 committed by GitHub
parent 968f162c5b
commit 414d0344fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -40,12 +40,20 @@ smartshop.get_offer=function(pos)
return offer
end
smartshop.not_pos=function(pos)
if not (pos and pos.x and pos.y and pos.z) then
return true
end
end
smartshop.receive_fields=function(player,pressed)
if pressed.customer then
return smartshop.showform(smartshop.user[player:get_player_name()],player,true)
elseif pressed.sellall then
local pos=smartshop.user[player:get_player_name()]
if smartshop.not_pos(pos) then return end
local meta=minetest.get_meta(pos)
local pname=player:get_player_name()
if meta:get_int("sellall")==0 then
@ -57,6 +65,7 @@ smartshop.receive_fields=function(player,pressed)
end
elseif pressed.tooglelime then
local pos=smartshop.user[player:get_player_name()]
if smartshop.not_pos(pos) then return end
local meta=minetest.get_meta(pos)
local pname=player:get_player_name()
if meta:get_int("type")==0 then
@ -73,6 +82,7 @@ smartshop.receive_fields=function(player,pressed)
if pressed["buy" .. i] then break end
end
local pos=smartshop.user[player:get_player_name()]
if smartshop.not_pos(pos) then return end
local meta=minetest.get_meta(pos)
local type=meta:get_int("type")
local sellall=meta:get_int("sellall")
@ -163,6 +173,7 @@ smartshop.receive_fields=function(player,pressed)
end
else
local pos=smartshop.user[player:get_player_name()]
if smartshop.not_pos(pos) then return end
if pos and pos.x then
smartshop.update_info(pos)
if smartshop.user[player:get_player_name()] or minetest.check_player_privs(player:get_player_name(), {protection_bypass=true}) then