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
|
default
|
||||||
moreores?
|
moreores?
|
||||||
technic_worldgen?
|
technic_worldgen?
|
||||||
|
wrench?
|
||||||
quartz?
|
quartz?
|
||||||
pipeworks?
|
pipeworks?
|
||||||
money?
|
money?
|
||||||
|
6
init.lua
6
init.lua
@ -68,7 +68,11 @@ end
|
|||||||
-- Privs
|
-- Privs
|
||||||
minetest.register_privilege("bitchange", "Can access to owned nodes of the bitchange mod")
|
minetest.register_privilege("bitchange", "Can access to owned nodes of the bitchange mod")
|
||||||
function bitchange.has_access(owner, player_name)
|
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
|
end
|
||||||
|
|
||||||
print("[BitChange] Loaded.")
|
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 player_name = clicker:get_player_name()
|
||||||
local view = 0
|
local view = 0
|
||||||
exchange_shop[player_name] = pos
|
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
|
if clicker:get_player_control().aux1 then
|
||||||
view = 1
|
view = 1
|
||||||
else
|
else
|
||||||
@ -355,3 +355,21 @@ minetest.register_craft({
|
|||||||
{"default:chest_locked"},
|
{"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