forked from mtcontrib/bitchange
Shop: Allow server admins to open the owner formspec of shops
Clean up the position entry on leave Add wrench support
This commit is contained in:
parent
498d97a8bc
commit
b49ba5dc14
@ -1,6 +1,7 @@
|
||||
default
|
||||
moreores?
|
||||
technic_worldgen?
|
||||
wrench?
|
||||
quartz?
|
||||
pipeworks?
|
||||
money?
|
||||
|
6
init.lua
6
init.lua
@ -68,7 +68,11 @@ end
|
||||
-- Privs
|
||||
minetest.register_privilege("bitchange", "Can access to owned nodes of the bitchange mod")
|
||||
function bitchange.has_access(owner, player_name)
|
||||
return (player_name == owner or owner == "" or minetest.get_player_privs(player_name).server or minetest.get_player_privs(player_name).bitchange)
|
||||
if player_name == owner or owner == "" then
|
||||
return true
|
||||
end
|
||||
local privs = minetest.get_player_privs(player_name)
|
||||
return privs.server or privs.bitchange
|
||||
end
|
||||
|
||||
print("[BitChange] Loaded.")
|
||||
|
20
shop.lua
20
shop.lua
@ -303,7 +303,7 @@ minetest.register_node("bitchange:shop", {
|
||||
local player_name = clicker:get_player_name()
|
||||
local view = 0
|
||||
exchange_shop[player_name] = pos
|
||||
if player_name == meta:get_string("owner") then
|
||||
if bitchange.has_access(meta:get_string("owner"), player_name) then
|
||||
if clicker:get_player_control().aux1 then
|
||||
view = 1
|
||||
else
|
||||
@ -355,3 +355,21 @@ minetest.register_craft({
|
||||
{"default:chest_locked"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_on_dieplayer(function(player)
|
||||
local player_name = player:get_player_name()
|
||||
exchange_shop[player_name] = nil
|
||||
end)
|
||||
|
||||
if minetest.get_modpath("wrench") and wrench then
|
||||
local STRING = wrench.META_TYPE_STRING
|
||||
wrench:register_node("bitchange:shop", {
|
||||
lists = {"stock", "custm", "custm_ej", "cust_ow", "cust_og", "cust_ej"},
|
||||
metas = {
|
||||
owner = STRING,
|
||||
infotext = STRING,
|
||||
title = STRING,
|
||||
},
|
||||
owned = true
|
||||
})
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user