move all chatcommands to the same place
This commit is contained in:
parent
db0d0f99db
commit
5cede8dd9b
30
init.lua
30
init.lua
@ -8,33 +8,3 @@ dofile(MP.."/doc.lua")
|
|||||||
dofile(MP.."/default_markets.lua")
|
dofile(MP.."/default_markets.lua")
|
||||||
dofile(MP.."/mapgen_dungeon_markets.lua")
|
dofile(MP.."/mapgen_dungeon_markets.lua")
|
||||||
|
|
||||||
|
|
||||||
-- internationalization boilerplate
|
|
||||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
|
||||||
local S, NS = dofile(MP.."/intllib.lua")
|
|
||||||
|
|
||||||
minetest.register_chatcommand("market.show", {
|
|
||||||
params = "marketname",
|
|
||||||
privs = {server=true},
|
|
||||||
description = S("show market formspec"),
|
|
||||||
func = function(name, param)
|
|
||||||
local market = commoditymarket.registered_markets[param]
|
|
||||||
if market == nil then return end
|
|
||||||
local formspec = market:get_formspec(market:get_account(name))
|
|
||||||
minetest.show_formspec(name, "commoditymarket:"..param..":"..name, formspec)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_chatcommand("market.list", {
|
|
||||||
params = "",
|
|
||||||
privs = {server=true},
|
|
||||||
description = S("list all registered markets"),
|
|
||||||
func = function(name, param)
|
|
||||||
local list = {}
|
|
||||||
for marketname, def in pairs(commoditymarket.registered_markets) do
|
|
||||||
table.insert(list, marketname)
|
|
||||||
end
|
|
||||||
table.sort(list)
|
|
||||||
minetest.chat_send_player(name, "Registered markets: " .. table.concat(list, ", "))
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
27
market.lua
27
market.lua
@ -377,6 +377,33 @@ local initialize_market_item = function(orders_for_items, item)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------------------
|
||||||
|
-- Chat commands
|
||||||
|
|
||||||
|
minetest.register_chatcommand("market.show", {
|
||||||
|
params = "marketname",
|
||||||
|
privs = {server=true},
|
||||||
|
description = S("show market formspec"),
|
||||||
|
func = function(name, param)
|
||||||
|
local market = commoditymarket.registered_markets[param]
|
||||||
|
if market == nil then return end
|
||||||
|
local formspec = market:get_formspec(market:get_account(name))
|
||||||
|
minetest.show_formspec(name, "commoditymarket:"..param..":"..name, formspec)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_chatcommand("market.list", {
|
||||||
|
params = "",
|
||||||
|
privs = {server=true},
|
||||||
|
description = S("list all registered markets"),
|
||||||
|
func = function(name, param)
|
||||||
|
local list = {}
|
||||||
|
for marketname, def in pairs(commoditymarket.registered_markets) do
|
||||||
|
table.insert(list, marketname)
|
||||||
|
end
|
||||||
|
table.sort(list)
|
||||||
|
minetest.chat_send_player(name, "Registered markets: " .. table.concat(list, ", "))
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
local remove_market_item = function(market, item)
|
local remove_market_item = function(market, item)
|
||||||
local marketitem = market.orders_for_items[item]
|
local marketitem = market.orders_for_items[item]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user