allow this mod to work with either default (minetest_game) or mineclone2 (#1)
294
caravan_markets.lua
Normal file
@ -0,0 +1,294 @@
|
||||
if not minetest.settings:get_bool("commoditymarket_enable_caravan_market", true) then
|
||||
return
|
||||
end
|
||||
|
||||
local S = commoditymarket_fantasy.S
|
||||
local coins_per_ingot = commoditymarket_fantasy.coins_per_ingot
|
||||
local default_items = commoditymarket_fantasy.default_items
|
||||
local gold_ingot = commoditymarket_fantasy.gold_ingot
|
||||
local gold_currency = commoditymarket_fantasy.gold_currency
|
||||
local chest_locked = commoditymarket_fantasy.chest_locked
|
||||
local wood_sounds = commoditymarket_fantasy.wood_sounds
|
||||
local usage_help = commoditymarket_fantasy.usage_help
|
||||
|
||||
commoditymarket_fantasy.register_gold_coins()
|
||||
|
||||
local time_until_caravan = 120 -- caravan arrives in two minutes
|
||||
local dwell_time = 600 -- caravan leaves ten minutes after last usage
|
||||
|
||||
local caravan_def = {
|
||||
description = S("Trader's Caravan"),
|
||||
long_description = S("Unlike most markets that have well-known fixed locations that travelers congregate to, the network of Trader's Caravans is fluid and dynamic in their locations. A Trader's Caravan can show up anywhere, make modest trades, and then be gone the next time you visit them. These caravans accept gold and gold coins as a currency (one gold ingot to @1 gold coins exchange rate). Any reasonably-wealthy person can create a signpost marking a location where Trader's Caravans will make a stop.", coins_per_ingot),
|
||||
currency = gold_currency,
|
||||
currency_symbol = "☼", --"\u{263C}"
|
||||
inventory_limit = 1000,
|
||||
sell_limit = 1000,
|
||||
initial_items = default_items,
|
||||
}
|
||||
|
||||
minetest.register_craft({
|
||||
output = "commoditymarket_fantasy:caravan_post",
|
||||
recipe = {
|
||||
{'group:wood', 'group:wood', ''},
|
||||
{'group:wood', gold_ingot, ''},
|
||||
{'group:wood', chest_locked, ''},
|
||||
}
|
||||
})
|
||||
|
||||
commoditymarket.register_market("caravan", caravan_def)
|
||||
|
||||
local caravan_nodebox = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
-- Note: this nodebox should have a height of 1.5, but using 95/64 as a workaround for
|
||||
-- https://github.com/minetest/minetest/issues/9322
|
||||
{-0.75, -0.5, -1.25, 0.75, 95/64, 1.25},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
local create_caravan_def = function(override_table)
|
||||
local def = {
|
||||
description = caravan_def.description,
|
||||
_doc_items_longdesc = caravan_def.long_description,
|
||||
_doc_items_usagehelp = usage_help,
|
||||
drawtype = "mesh",
|
||||
mesh = "commoditymarket_wagon.obj",
|
||||
tiles = {
|
||||
{ name = "commoditymarket_door_wood.png", backface_culling = true }, -- door
|
||||
{ name = "default_wood.png", backface_culling = true }, -- base wood
|
||||
{ name = "commoditymarket_default_fence_rail_wood.png", backface_culling = true }, -- wheel sides
|
||||
{ name = "default_coal_block.png", backface_culling = true }, -- wheel tyre
|
||||
{ name = "commoditymarket_shingles_wood.png", backface_culling = true }, -- roof
|
||||
{ name = "default_junglewood.png", backface_culling = true }, -- corner wood
|
||||
},
|
||||
collision_box = caravan_nodebox,
|
||||
selection_box = caravan_nodebox,
|
||||
|
||||
paramtype2 = "facedir",
|
||||
drop = "",
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 1, not_in_creative_inventory = 1},
|
||||
sounds = wood_sounds,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
commoditymarket.show_market("caravan", clicker:get_player_name())
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(dwell_time)
|
||||
end,
|
||||
after_destruct = function(pos, oldnode)
|
||||
local facedir = oldnode.param2
|
||||
local dir = minetest.facedir_to_dir(facedir)
|
||||
local target = vector.add(pos, vector.multiply(dir,-3))
|
||||
local target_node = minetest.get_node(target)
|
||||
if target_node.name == "commoditymarket_fantasy:caravan_post" then
|
||||
local meta = minetest.get_meta(target)
|
||||
meta:set_string("infotext", S("Right-click to summon a trader's caravan"))
|
||||
end
|
||||
end,
|
||||
on_timer = function(pos, elapsed)
|
||||
minetest.set_node(pos, {name="air"})
|
||||
minetest.sound_play("commoditymarket_register_closed", {
|
||||
pos = pos,
|
||||
gain = 1.0, -- default
|
||||
max_hear_distance = 32, -- default, uses an euclidean metric
|
||||
})
|
||||
end,
|
||||
}
|
||||
if override_table then
|
||||
for k, v in pairs(override_table) do
|
||||
def[k] = v
|
||||
end
|
||||
end
|
||||
return def
|
||||
end
|
||||
|
||||
-- Create five caravans with different textures, randomly pick which one shows up.
|
||||
minetest.register_node("commoditymarket_fantasy:caravan_market_1", create_caravan_def())
|
||||
minetest.register_node("commoditymarket_fantasy:caravan_market_2", create_caravan_def({
|
||||
tiles = {
|
||||
{ name = "commoditymarket_door_wood.png^[multiply:#CCCCFF", backface_culling = true }, -- door
|
||||
{ name = "default_acacia_wood.png", backface_culling = true }, -- base wood
|
||||
{ name = "commoditymarket_default_fence_rail_wood.png", backface_culling = true }, -- wheel sides
|
||||
{ name = "commoditymarket_default_copper_block.png", backface_culling = true }, -- wheel tyre
|
||||
{ name = "commoditymarket_shingles_wood.png^[multiply:#CC8888", backface_culling = true }, -- roof
|
||||
{ name = "default_wood.png", backface_culling = true }, -- corner wood
|
||||
}
|
||||
}))
|
||||
minetest.register_node("commoditymarket_fantasy:caravan_market_3", create_caravan_def({
|
||||
tiles = {
|
||||
{ name = "commoditymarket_door_wood.png", backface_culling = true }, -- door
|
||||
{ name = "commoditymarket_default_aspen_wood.png", backface_culling = true }, -- base wood
|
||||
{ name = "commoditymarket_default_fence_aspen_wood.png", backface_culling = true }, -- wheel sides
|
||||
{ name = "default_cobble.png", backface_culling = true }, -- wheel tyre
|
||||
{ name = "default_stone_brick.png", backface_culling = true }, -- roof
|
||||
{ name = "commoditymarket_default_pine_tree.png", backface_culling = true }, -- corner wood
|
||||
}
|
||||
}))
|
||||
minetest.register_node("commoditymarket_fantasy:caravan_market_4", create_caravan_def({
|
||||
tiles = {
|
||||
{ name = "commoditymarket_door_wood.png", backface_culling = true }, -- door
|
||||
{ name = "default_junglewood.png", backface_culling = true }, -- base wood
|
||||
{ name = "commoditymarket_default_fence_rail_junglewood.png", backface_culling = true }, -- wheel sides
|
||||
{ name = "default_obsidian.png", backface_culling = true }, -- wheel tyre
|
||||
{ name = "commoditymarket_shingles_wood.png^[multiply:#88FF88", backface_culling = true }, -- roof
|
||||
{ name = "default_tree.png", backface_culling = true }, -- corner wood
|
||||
}
|
||||
}))
|
||||
minetest.register_node("commoditymarket_fantasy:caravan_market_5", create_caravan_def({
|
||||
tiles = {
|
||||
{ name = "commoditymarket_door_wood.png", backface_culling = true }, -- door
|
||||
{ name = "commoditymarket_default_pine_wood.png", backface_culling = true }, -- base wood
|
||||
{ name = "commoditymarket_default_chest_lock.png", backface_culling = true }, -- wheel sides
|
||||
{ name = "commoditymarket_default_chest_top.png", backface_culling = true }, -- wheel tyre
|
||||
{ name = "default_furnace_top.png", backface_culling = true }, -- roof
|
||||
{ name = "default_wood.png", backface_culling = true }, -- corner wood
|
||||
}
|
||||
}))
|
||||
|
||||
local caravan_protect = minetest.settings:get_bool("commoditymarket_protect_caravan_market", true)
|
||||
local on_blast
|
||||
if caravan_protect then
|
||||
on_blast = function() end
|
||||
end
|
||||
|
||||
-- This one doesn't delete itself, server admins can place a permanent instance of it that way. Maybe inside towns next to bigger stationary markets.
|
||||
minetest.register_node("commoditymarket_fantasy:caravan_market_permanent", {
|
||||
description = caravan_def.description,
|
||||
_doc_items_longdesc = caravan_def.long_description,
|
||||
_doc_items_usagehelp = usage_help,
|
||||
drawtype = "mesh",
|
||||
mesh = "commoditymarket_wagon.obj",
|
||||
tiles = {
|
||||
{ name = "commoditymarket_door_wood.png", backface_culling = true }, -- door
|
||||
{ name = "default_wood.png", backface_culling = true }, -- base wood
|
||||
{ name = "commoditymarket_default_fence_rail_wood.png", backface_culling = true }, -- wheel sides
|
||||
{ name = "default_coal_block.png", backface_culling = true }, -- wheel tyre
|
||||
{ name = "commoditymarket_shingles_wood.png", backface_culling = true }, -- roof
|
||||
{ name = "default_junglewood.png", backface_culling = true }, -- corner wood
|
||||
},
|
||||
collision_box = caravan_nodebox,
|
||||
selection_box = caravan_nodebox,
|
||||
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 1,},
|
||||
sounds = wood_sounds,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
commoditymarket.show_market("caravan", clicker:get_player_name())
|
||||
end,
|
||||
can_dig = function(pos, player)
|
||||
return not caravan_protect or minetest.check_player_privs(player, "protection_bypass")
|
||||
end,
|
||||
on_blast = on_blast,
|
||||
})
|
||||
|
||||
-- is a 5x3 area centered around pos clear of obstruction and has usable ground?
|
||||
local is_suitable_caravan_space = function(pos, facedir)
|
||||
local x_dim = 2
|
||||
local z_dim = 2
|
||||
local dir = minetest.facedir_to_dir(facedir)
|
||||
if dir.x ~= 0 then
|
||||
z_dim = 1
|
||||
elseif dir.z ~= 0 then
|
||||
x_dim = 1
|
||||
end
|
||||
|
||||
-- walkable ground?
|
||||
for x = pos.x - x_dim, pos.x + x_dim, 1 do
|
||||
for z = pos.z - z_dim, pos.z + z_dim, 1 do
|
||||
local node = minetest.get_node({x=x, y=pos.y-1, z=z})
|
||||
local node_def = minetest.registered_nodes[node.name]
|
||||
if node_def == nil or node_def.walkable ~= true then return false end
|
||||
end
|
||||
end
|
||||
-- buildable_to in the rest?
|
||||
for y = pos.y, pos.y+2, 1 do
|
||||
for x = pos.x - x_dim, pos.x + x_dim, 1 do
|
||||
for z = pos.z - z_dim, pos.z + z_dim, 1 do
|
||||
local node = minetest.get_node({x=x, y=y, z=z})
|
||||
local node_def = minetest.registered_nodes[node.name]
|
||||
if node_def == nil or node_def.buildable_to ~= true then return false end
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
minetest.register_node("commoditymarket_fantasy:caravan_post", {
|
||||
description = S("Trading Post"),
|
||||
_long_items_longdesc = S("This post signals passing caravan traders that customers can be found here, and signals to customers that caravan traders can be found here. If no caravan is present, right-click to summon one."),
|
||||
_doc_items_usagehelp = S("The trader's caravan requires a suitable open space next to the trading post for it to arrive, and takes some time to arrive after being summoned. The post gives a countdown to the caravan's arrival when moused over."),
|
||||
tiles = {"commoditymarket_sign.png^[transformR90", "commoditymarket_sign.png^[transformR270",
|
||||
"commoditymarket_sign.png^commoditymarket_caravan_sign.png", "commoditymarket_sign.png^commoditymarket_caravan_sign.png^[transformFX",
|
||||
"commoditymarket_sign_post.png", "commoditymarket_sign_post.png"},
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 1,},
|
||||
sounds = wood_sounds,
|
||||
inventory_image = "commoditymarket_caravan_sign_inventory.png",
|
||||
paramtype= "light",
|
||||
paramtype2 = "facedir",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.125,-0.5,-0.5,0.125,2.0625,-0.25},
|
||||
{-0.0625,1.4375,-0.25,0.0625,2.0,0.5},
|
||||
},
|
||||
},
|
||||
on_construct = function(pos)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(1.0)
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(1.0)
|
||||
end,
|
||||
on_timer = function(pos, elapsed)
|
||||
local node = minetest.get_node(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if node.name ~= "commoditymarket_fantasy:caravan_post" then
|
||||
return -- the node was removed
|
||||
end
|
||||
local facedir = node.param2
|
||||
local dir = minetest.facedir_to_dir(facedir)
|
||||
local target = vector.add(pos, vector.multiply(dir,3))
|
||||
|
||||
local target_node = minetest.get_node(target)
|
||||
|
||||
if target_node.name:sub(1,string.len("commoditymarket_fantasy:caravan_market")) == "commoditymarket_fantasy:caravan_market" then
|
||||
-- It's already here somehow, shut down timer.
|
||||
meta:set_string("infotext", "")
|
||||
meta:set_float("wait_time", 0)
|
||||
return
|
||||
end
|
||||
|
||||
local is_suitable_space = is_suitable_caravan_space(target, facedir)
|
||||
|
||||
if not is_suitable_space then
|
||||
meta:set_string("infotext", S("Indicated parking area isn't suitable.\nA 5x3 open space with solid ground\nis required for a caravan."))
|
||||
meta:set_float("wait_time", 0)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(1.0)
|
||||
return
|
||||
end
|
||||
|
||||
local wait_time = (meta:get_float("wait_time") or 0) + elapsed
|
||||
meta:set_float("wait_time", wait_time)
|
||||
if wait_time < time_until_caravan then
|
||||
meta:set_string("infotext", S("Caravan summoned\nETA: @1 seconds.", math.floor(time_until_caravan - wait_time)))
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(1.0)
|
||||
return
|
||||
end
|
||||
|
||||
-- spawn the caravan. We've already established that the target pos is clear.
|
||||
minetest.set_node(target, {name="commoditymarket_fantasy:caravan_market_"..math.random(1,5), param2=facedir})
|
||||
minetest.sound_play("commoditymarket_register_opened", {
|
||||
pos = target,
|
||||
gain = 1.0, -- default
|
||||
max_hear_distance = 32, -- default, uses an euclidean metric
|
||||
})
|
||||
local timer = minetest.get_node_timer(target)
|
||||
timer:start(dwell_time)
|
||||
meta:set_string("infotext", "")
|
||||
meta:set_float("wait_time", 0)
|
||||
end,
|
||||
})
|
101
dungeon_markets.lua
Normal file
@ -0,0 +1,101 @@
|
||||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||
dofile(modpath.."/mapgen_dungeon_markets.lua")
|
||||
|
||||
local S = commoditymarket_fantasy.S
|
||||
local coal_lump = commoditymarket_fantasy.coal_lump
|
||||
local wood_sounds = commoditymarket_fantasy.wood_sounds
|
||||
local usage_help = commoditymarket_fantasy.usage_help
|
||||
local default_modpath = commoditymarket_fantasy.default_modpath
|
||||
|
||||
local undermarket_currency = commoditymarket_fantasy.undermarket_currency
|
||||
local undermarket_desc = commoditymarket_fantasy.undermarket_desc
|
||||
local undermarket_symbol = commoditymarket_fantasy.undermarket_symbol
|
||||
local stone_sounds = commoditymarket_fantasy.stone_sounds
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- "Goblin Exchange"
|
||||
if minetest.settings:get_bool("commoditymarket_enable_goblin_market", true) then
|
||||
|
||||
local goblin_def = {
|
||||
description = S("Goblin Exchange"),
|
||||
long_description = S("One does not usually associate Goblins with the sort of sophistication that running a market requires. Usually one just associates Goblins with savagery and violence. But they understand the principle of tit-for-tat exchange, and if approached correctly they actually respect the concepts of ownership and debt. However, for some peculiar reason they understand this concept in the context of coal lumps. Goblins deal in the standard coal lump as their form of currency, conceptually divided into 100 coal centilumps (though Goblin brokers prefer to \"keep the change\" when giving back actual coal lumps)."),
|
||||
currency = {
|
||||
[coal_lump] = 100
|
||||
},
|
||||
currency_symbol = "¢", --"\u{00A2}" cent symbol
|
||||
inventory_limit = 1000,
|
||||
--sell_limit =, -- no sell limit
|
||||
}
|
||||
|
||||
commoditymarket.register_market("goblin", goblin_def)
|
||||
|
||||
local goblin_protect = minetest.settings:get_bool("commoditymarket_protect_goblin_market", true)
|
||||
local on_blast
|
||||
if goblin_protect then
|
||||
on_blast = function() end
|
||||
end
|
||||
|
||||
minetest.register_node("commoditymarket_fantasy:goblin_market", {
|
||||
description = goblin_def.description,
|
||||
_doc_items_longdesc = goblin_def.long_description,
|
||||
_doc_items_usagehelp = usage_help,
|
||||
tiles = {"commoditymarket_default_chest_top.png^(default_coal_block.png^[opacity:128)","commoditymarket_default_chest_top.png^(default_coal_block.png^[opacity:128)",
|
||||
"commoditymarket_default_chest_side.png^(default_coal_block.png^[opacity:128)","commoditymarket_default_chest_side.png^(default_coal_block.png^[opacity:128)",
|
||||
"commoditymarket_empty_shelf.png^(default_coal_block.png^[opacity:128)","commoditymarket_default_chest_side.png^(default_coal_block.png^[opacity:128)^commoditymarket_goblin.png",},
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 1,},
|
||||
sounds = wood_sounds,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
commoditymarket.show_market("goblin", clicker:get_player_name())
|
||||
end,
|
||||
can_dig = function(pos, player)
|
||||
return not goblin_protect or minetest.check_player_privs(player, "protection_bypass")
|
||||
end,
|
||||
on_blast = on_blast,
|
||||
})
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Undermarket
|
||||
|
||||
if minetest.settings:get_bool("commoditymarket_enable_under_market", true) then
|
||||
|
||||
local undermarket_def = {
|
||||
description = S("Undermarket"),
|
||||
long_description = undermarket_desc,
|
||||
currency = undermarket_currency,
|
||||
currency_symbol = undermarket_symbol,
|
||||
inventory_limit = 10000,
|
||||
--sell_limit =, -- no sell limit
|
||||
}
|
||||
|
||||
commoditymarket.register_market("under", undermarket_def)
|
||||
|
||||
local under_protect = minetest.settings:get_bool("commoditymarket_protect_under_market", true)
|
||||
local on_blast
|
||||
if under_protect then
|
||||
on_blast = function() end
|
||||
end
|
||||
|
||||
minetest.register_node("commoditymarket_fantasy:under_market", {
|
||||
description = undermarket_def.description,
|
||||
_doc_items_longdesc = undermarket_def.long_description,
|
||||
_doc_items_usagehelp = usage_help,
|
||||
tiles = {"commoditymarket_under_top.png","commoditymarket_under_top.png",
|
||||
"commoditymarket_under.png","commoditymarket_under.png","commoditymarket_under.png","commoditymarket_under.png"},
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 1,},
|
||||
sounds = stone_sounds,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
commoditymarket.show_market("under", clicker:get_player_name())
|
||||
end,
|
||||
can_dig = function(pos, player)
|
||||
return not under_protect or minetest.check_player_privs(player, "protection_bypass")
|
||||
end,
|
||||
on_blast = on_blast,
|
||||
})
|
||||
end
|
||||
------------------------------------------------------------------
|
570
init.lua
@ -1,4 +1,15 @@
|
||||
commoditymarket_fantasy = {}
|
||||
|
||||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||
local default_modpath = minetest.get_modpath("default")
|
||||
local mcl_modpath = minetest.get_modpath("mcl_core")
|
||||
and minetest.get_modpath("mcl_sounds")
|
||||
and minetest.get_modpath("mcl_chests")
|
||||
and minetest.get_modpath("mesecons_wires") -- confusingly, 'mesecons:wire_00000000_off' is defined in this mod
|
||||
|
||||
if not (default_modpath or mcl_modpath) then
|
||||
assert(false, "commoditymarket_fantasy must have either the default mod (eg from minetest_game) or the mineclone2 core mods enabled.")
|
||||
end
|
||||
|
||||
minetest.register_alias("commoditymarket:kings_market", "commoditymarket_fantasy:kings_market")
|
||||
minetest.register_alias("commoditymarket:gold_coins", "commoditymarket_fantasy:gold_coins")
|
||||
@ -14,15 +25,48 @@ minetest.register_alias("commoditymarket:caravan_market_5", "commoditym
|
||||
minetest.register_alias("commoditymarket:caravan_market_permanent", "commoditymarket_fantasy:caravan_market_permanent")
|
||||
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
commoditymarket_fantasy.S = S
|
||||
|
||||
if default_modpath then
|
||||
commoditymarket_fantasy.default_items = {"default:axe_bronze","default:axe_diamond","default:axe_mese","default:axe_steel","default:axe_steel","default:axe_stone","default:axe_wood","default:pick_bronze","default:pick_diamond","default:pick_mese","default:pick_steel","default:pick_stone","default:pick_wood","default:shovel_bronze","default:shovel_diamond","default:shovel_mese","default:shovel_steel","default:shovel_stone","default:shovel_wood","default:sword_bronze","default:sword_diamond","default:sword_mese","default:sword_steel","default:sword_stone","default:sword_wood", "default:blueberries", "default:book", "default:bronze_ingot", "default:clay_brick", "default:clay_lump", "default:coal_lump", "default:copper_ingot", "default:copper_lump", "default:diamond", "default:flint", "default:gold_ingot", "default:gold_lump", "default:iron_lump", "default:mese_crystal", "default:mese_crystal_fragment", "default:obsidian_shard", "default:paper", "default:steel_ingot", "default:stick", "default:tin_ingot", "default:tin_lump", "default:acacia_tree", "default:acacia_wood", "default:apple", "default:aspen_tree", "default:aspen_wood", "default:blueberry_bush_sapling", "default:bookshelf", "default:brick", "default:bronzeblock", "default:bush_sapling", "default:cactus", "default:clay", "default:coalblock", "default:cobble", "default:copperblock", "default:desert_cobble", "default:desert_sand", "default:desert_sandstone", "default:desert_sandstone_block", "default:desert_sandstone_brick", "default:desert_stone", "default:desert_stone_block", "default:desert_stonebrick", "default:diamondblock", "default:dirt", "default:glass", "default:goldblock", "default:gravel", "default:ice", "default:junglegrass", "default:junglesapling", "default:jungletree", "default:junglewood", "default:ladder_steel", "default:ladder_wood", "default:large_cactus_seedling", "default:mese", "default:mese_post_light", "default:meselamp", "default:mossycobble", "default:obsidian", "default:obsidian_block", "default:obsidian_glass", "default:obsidianbrick", "default:papyrus", "default:pine_sapling", "default:pine_tree", "default:pine_wood", "default:sand", "default:sandstone", "default:sandstone_block", "default:sandstonebrick", "default:sapling", "default:silver_sand", "default:silver_sandstone", "default:silver_sandstone_block", "default:silver_sandstone_brick", "default:snow", "default:snowblock", "default:steelblock", "default:stone", "default:stone_block", "default:stonebrick", "default:tinblock", "default:tree", "default:wood",}
|
||||
commoditymarket_fantasy.wood_sounds = default.node_sound_wood_defaults()
|
||||
commoditymarket_fantasy.chest_locked = "default:chest_locked" -- used in the trader's caravan post recipe
|
||||
commoditymarket_fantasy.gold_ingot = "default:gold_ingot"
|
||||
commoditymarket_fantasy.coal_lump = "default:coal_lump" -- used by the goblin market
|
||||
|
||||
commoditymarket_fantasy.undermarket_currency = {
|
||||
["default:mese"] = 9*9*20,
|
||||
["default:mese_crystal"] = 9*20,
|
||||
["default:mese_crystal_fragment"] = 20
|
||||
}
|
||||
commoditymarket_fantasy.undermarket_desc = S("Deep in the bowels of the world, below even the goblin-infested warrens and ancient delvings of the dwarves, dark and mysterious beings once dwelt. A few still linger to this day, and facilitate barter for those brave souls willing to travel in their lost realms. The Undermarket uses Mese chips ('₥') as a currency - twenty chips to the Mese fragment. Though traders are loathe to physically break Mese crystals up into units that small, as it renders it useless for other purposes.")
|
||||
commoditymarket_fantasy.undermarket_symbol = "₥" --"\u{20A5}" mill sign
|
||||
commoditymarket_fantasy.stone_sounds = default.node_sound_stone_defaults()
|
||||
|
||||
elseif mcl_modpath then
|
||||
commoditymarket_fantasy.default_items = {}
|
||||
commoditymarket_fantasy.wood_sounds = mcl_sounds.node_sound_wood_defaults()
|
||||
commoditymarket_fantasy.chest_locked = "mcl_chests:chest" -- used in the trader's caravan post recipe
|
||||
commoditymarket_fantasy.gold_ingot = "mcl_core:gold_ingot"
|
||||
commoditymarket_fantasy.coal_lump = "mcl_core:coal_lump" -- used by the goblin market
|
||||
|
||||
commoditymarket_fantasy.undermarket_currency = {
|
||||
["mesecons:wire_00000000_off"] = 1
|
||||
}
|
||||
commoditymarket_fantasy.undermarket_desc = S("Deep in the bowels of the world, below even the goblin-infested warrens and ancient delvings of the dwarves, dark and mysterious beings once dwelt. A few still linger to this day, and facilitate barter for those brave souls willing to travel in their lost realms. The Undermarket uses Redstone ('₨') as a currency.")
|
||||
commoditymarket_fantasy.undermarket_symbol = "₨" --"\u{20A8}" rupee sign
|
||||
commoditymarket_fantasy.stone_sounds = mcl_sounds.node_sound_stone_defaults()
|
||||
end
|
||||
|
||||
dofile(modpath.."/mapgen_dungeon_markets.lua")
|
||||
|
||||
local coins_per_ingot = math.floor(tonumber(minetest.settings:get("commoditymarket_coins_per_ingot")) or 1000)
|
||||
commoditymarket_fantasy.coins_per_ingot = coins_per_ingot
|
||||
|
||||
-- Only register gold coins once, if required
|
||||
-- Only register gold coins once, if required.
|
||||
-- If coins_per_ingot is 1 or less, don't register coins at all - users can use fractional ingots
|
||||
local gold_coins_registered = false
|
||||
local register_gold_coins = function()
|
||||
if not gold_coins_registered then
|
||||
commoditymarket_fantasy.register_gold_coins = function()
|
||||
if not gold_coins_registered and coins_per_ingot > 1 then
|
||||
minetest.register_craftitem("commoditymarket_fantasy:gold_coins", {
|
||||
description = S("Gold Coins"),
|
||||
_doc_items_longdesc = S("A gold ingot is far too valuable to use as a basic unit of value, so it has become common practice to divide the standard gold bar into @1 small disks to make trade easier.", coins_per_ingot),
|
||||
@ -34,513 +78,23 @@ local register_gold_coins = function()
|
||||
end
|
||||
end
|
||||
|
||||
local default_items = {"default:axe_bronze","default:axe_diamond","default:axe_mese","default:axe_steel","default:axe_steel","default:axe_stone","default:axe_wood","default:pick_bronze","default:pick_diamond","default:pick_mese","default:pick_steel","default:pick_stone","default:pick_wood","default:shovel_bronze","default:shovel_diamond","default:shovel_mese","default:shovel_steel","default:shovel_stone","default:shovel_wood","default:sword_bronze","default:sword_diamond","default:sword_mese","default:sword_steel","default:sword_stone","default:sword_wood", "default:blueberries", "default:book", "default:bronze_ingot", "default:clay_brick", "default:clay_lump", "default:coal_lump", "default:copper_ingot", "default:copper_lump", "default:diamond", "default:flint", "default:gold_ingot", "default:gold_lump", "default:iron_lump", "default:mese_crystal", "default:mese_crystal_fragment", "default:obsidian_shard", "default:paper", "default:steel_ingot", "default:stick", "default:tin_ingot", "default:tin_lump", "default:acacia_tree", "default:acacia_wood", "default:apple", "default:aspen_tree", "default:aspen_wood", "default:blueberry_bush_sapling", "default:bookshelf", "default:brick", "default:bronzeblock", "default:bush_sapling", "default:cactus", "default:clay", "default:coalblock", "default:cobble", "default:copperblock", "default:desert_cobble", "default:desert_sand", "default:desert_sandstone", "default:desert_sandstone_block", "default:desert_sandstone_brick", "default:desert_stone", "default:desert_stone_block", "default:desert_stonebrick", "default:diamondblock", "default:dirt", "default:glass", "default:goldblock", "default:gravel", "default:ice", "default:junglegrass", "default:junglesapling", "default:jungletree", "default:junglewood", "default:ladder_steel", "default:ladder_wood", "default:large_cactus_seedling", "default:mese", "default:mese_post_light", "default:meselamp", "default:mossycobble", "default:obsidian", "default:obsidian_block", "default:obsidian_glass", "default:obsidianbrick", "default:papyrus", "default:pine_sapling", "default:pine_tree", "default:pine_wood", "default:sand", "default:sandstone", "default:sandstone_block", "default:sandstonebrick", "default:sapling", "default:silver_sand", "default:silver_sandstone", "default:silver_sandstone_block", "default:silver_sandstone_brick", "default:snow", "default:snowblock", "default:steelblock", "default:stone", "default:stone_block", "default:stonebrick", "default:tinblock", "default:tree", "default:wood",}
|
||||
|
||||
local usage_help = S("Right-click on this to open the market interface.")
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
-- King's Market
|
||||
|
||||
if minetest.settings:get_bool("commoditymarket_enable_kings_market", true) then
|
||||
|
||||
local kings_def = {
|
||||
description = S("King's Market"),
|
||||
long_description = S("The largest and most accessible market for the common man, the King's Market uses gold coins as its medium of exchange (or the equivalent in gold ingots - @1 coins to the ingot). However, as a respectable institution of the surface world, the King's Market operates only during the hours of daylight. The purchase and sale of swords and explosives is prohibited in the King's Market. Gold coins are represented by a '☼' symbol.", coins_per_ingot),
|
||||
currency = {
|
||||
["default:gold_ingot"] = coins_per_ingot,
|
||||
-- used by both village markets and the caravan market
|
||||
if coins_per_ingot > 1 then
|
||||
commoditymarket_fantasy.gold_currency = {
|
||||
[commoditymarket_fantasy.gold_ingot] = coins_per_ingot,
|
||||
["commoditymarket_fantasy:gold_coins"] = 1
|
||||
},
|
||||
currency_symbol = "☼", -- "\u{263C}" Alchemical symbol for gold
|
||||
allow_item = function(item)
|
||||
if item:sub(1,13) == "default:sword" or item:sub(1,4) == "tnt:" then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end,
|
||||
inventory_limit = 100000,
|
||||
--sell_limit =, -- no sell limit for the King's Market
|
||||
initial_items = default_items,
|
||||
}
|
||||
|
||||
register_gold_coins()
|
||||
|
||||
commoditymarket.register_market("kings", kings_def)
|
||||
|
||||
local kings_protect = minetest.settings:get_bool("commoditymarket_protect_kings_market", true)
|
||||
local on_blast
|
||||
if kings_protect then
|
||||
on_blast = function() end
|
||||
end
|
||||
|
||||
minetest.register_node("commoditymarket_fantasy:kings_market", {
|
||||
description = kings_def.description,
|
||||
_doc_items_longdesc = kings_def.long_description,
|
||||
_doc_items_usagehelp = usage_help,
|
||||
tiles = {"default_chest_top.png","default_chest_top.png",
|
||||
"default_chest_side.png","default_chest_side.png",
|
||||
"commoditymarket_empty_shelf.png","default_chest_side.png^commoditymarket_crown.png",},
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 1,},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
local timeofday = minetest.get_timeofday()
|
||||
if timeofday > 0.2 and timeofday < 0.8 then
|
||||
commoditymarket.show_market("kings", clicker:get_player_name())
|
||||
else
|
||||
minetest.chat_send_player(clicker:get_player_name(), S("At this time of day the King's Market is closed."))
|
||||
minetest.sound_play({name = "commoditymarket_error", gain = 0.1}, {to_player=clicker:get_player_name()})
|
||||
end
|
||||
end,
|
||||
can_dig = function(pos, player)
|
||||
return not kings_protect or minetest.check_player_privs(player, "protection_bypass")
|
||||
end,
|
||||
on_blast = on_blast,
|
||||
})
|
||||
end
|
||||
-------------------------------------------------------------------------------
|
||||
-- Night Market
|
||||
|
||||
if minetest.settings:get_bool("commoditymarket_enable_night_market", true) then
|
||||
local night_def = {
|
||||
description = S("Night Market"),
|
||||
long_description = S("When the sun sets and the stalls of the King's Market close, other vendors are just waking up to share their wares. The Night Market is not as voluminous as the King's Market but accepts a wider range of wares. It accepts the same gold coinage of the realm, @1 coins to the gold ingot.", coins_per_ingot),
|
||||
currency = {
|
||||
["default:gold_ingot"] = coins_per_ingot,
|
||||
["commoditymarket_fantasy:gold_coins"] = 1
|
||||
},
|
||||
currency_symbol = "☼", --"\u{263C}"
|
||||
inventory_limit = 10000,
|
||||
--sell_limit =, -- no sell limit for the Night Market
|
||||
initial_items = default_items,
|
||||
anonymous = true,
|
||||
}
|
||||
|
||||
register_gold_coins()
|
||||
|
||||
commoditymarket.register_market("night", night_def)
|
||||
|
||||
local night_protect = minetest.settings:get_bool("commoditymarket_protect_night_market", true)
|
||||
local on_blast
|
||||
if night_protect then
|
||||
on_blast = function() end
|
||||
end
|
||||
|
||||
minetest.register_node("commoditymarket_fantasy:night_market", {
|
||||
description = night_def.description,
|
||||
_doc_items_longdesc = night_def.long_description,
|
||||
_doc_items_usagehelp = usage_help,
|
||||
tiles = {"default_chest_top.png","default_chest_top.png",
|
||||
"default_chest_side.png","default_chest_side.png",
|
||||
"commoditymarket_empty_shelf.png","default_chest_side.png^commoditymarket_moon.png",},
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 1,},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
local timeofday = minetest.get_timeofday()
|
||||
if timeofday < 0.2 or timeofday > 0.8 then
|
||||
commoditymarket.show_market("night", clicker:get_player_name())
|
||||
else
|
||||
minetest.chat_send_player(clicker:get_player_name(), S("At this time of day the Night Market is closed."))
|
||||
minetest.sound_play({name = "commoditymarket_error", gain = 0.1}, {to_player=clicker:get_player_name()})
|
||||
end
|
||||
end,
|
||||
can_dig = function(pos, player)
|
||||
return not night_protect or minetest.check_player_privs(player, "protection_bypass")
|
||||
end,
|
||||
on_blast = on_blast,
|
||||
})
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
if minetest.settings:get_bool("commoditymarket_enable_caravan_market", true) then
|
||||
-- "Trader's Caravan" - small-capacity market that players can summon
|
||||
|
||||
local time_until_caravan = 120 -- caravan arrives in two minutes
|
||||
local dwell_time = 600 -- caravan leaves ten minutes after last usage
|
||||
|
||||
local caravan_def = {
|
||||
description = S("Trader's Caravan"),
|
||||
long_description = S("Unlike most markets that have well-known fixed locations that travelers congregate to, the network of Trader's Caravans is fluid and dynamic in their locations. A Trader's Caravan can show up anywhere, make modest trades, and then be gone the next time you visit them. These caravans accept gold and gold coins as a currency (one gold ingot to @1 gold coins exchange rate). Any reasonably-wealthy person can create a signpost marking a location where Trader's Caravans will make a stop.", coins_per_ingot),
|
||||
currency = {
|
||||
["default:gold_ingot"] = coins_per_ingot,
|
||||
["commoditymarket_fantasy:gold_coins"] = 1
|
||||
},
|
||||
currency_symbol = "☼", --"\u{263C}"
|
||||
inventory_limit = 1000,
|
||||
sell_limit = 1000,
|
||||
initial_items = default_items,
|
||||
}
|
||||
|
||||
register_gold_coins()
|
||||
|
||||
minetest.register_craft({
|
||||
output = "commoditymarket_fantasy:caravan_post",
|
||||
recipe = {
|
||||
{'group:wood', 'group:wood', ''},
|
||||
{'group:wood', "default:gold_ingot", ''},
|
||||
{'group:wood', "default:chest_locked", ''},
|
||||
}
|
||||
})
|
||||
|
||||
commoditymarket.register_market("caravan", caravan_def)
|
||||
|
||||
local create_caravan_def = function(override_table)
|
||||
local def = {
|
||||
description = caravan_def.description,
|
||||
_doc_items_longdesc = caravan_def.long_description,
|
||||
_doc_items_usagehelp = usage_help,
|
||||
drawtype = "mesh",
|
||||
mesh = "commoditymarket_wagon.obj",
|
||||
tiles = {
|
||||
{ name = "commoditymarket_door_wood.png", backface_culling = true }, -- door
|
||||
{ name = "default_wood.png", backface_culling = true }, -- base wood
|
||||
{ name = "default_fence_rail_wood.png", backface_culling = true }, -- wheel sides
|
||||
{ name = "default_coal_block.png", backface_culling = true }, -- wheel tyre
|
||||
{ name = "commoditymarket_shingles_wood.png", backface_culling = true }, -- roof
|
||||
{ name = "default_junglewood.png", backface_culling = true }, -- corner wood
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
-- Note: this nodebox should have a height of 1.5, but using 95/64 as a workaround for
|
||||
-- https://github.com/minetest/minetest/issues/9322
|
||||
{-0.75, -0.5, -1.25, 0.75, 95/64, 1.25},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.75, -0.5, -1.25, 0.75, 95/64, 1.25},
|
||||
},
|
||||
},
|
||||
|
||||
paramtype2 = "facedir",
|
||||
drop = "",
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 1, not_in_creative_inventory = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
commoditymarket.show_market("caravan", clicker:get_player_name())
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(dwell_time)
|
||||
end,
|
||||
after_destruct = function(pos, oldnode)
|
||||
local facedir = oldnode.param2
|
||||
local dir = minetest.facedir_to_dir(facedir)
|
||||
local target = vector.add(pos, vector.multiply(dir,-3))
|
||||
local target_node = minetest.get_node(target)
|
||||
if target_node.name == "commoditymarket_fantasy:caravan_post" then
|
||||
local meta = minetest.get_meta(target)
|
||||
meta:set_string("infotext", S("Right-click to summon a trader's caravan"))
|
||||
end
|
||||
end,
|
||||
on_timer = function(pos, elapsed)
|
||||
minetest.set_node(pos, {name="air"})
|
||||
minetest.sound_play("commoditymarket_register_closed", {
|
||||
pos = pos,
|
||||
gain = 1.0, -- default
|
||||
max_hear_distance = 32, -- default, uses an euclidean metric
|
||||
})
|
||||
end,
|
||||
else
|
||||
commoditymarket_fantasy.gold_currency = {
|
||||
[commoditymarket_fantasy.gold_ingot] = 1,
|
||||
}
|
||||
if override_table then
|
||||
for k, v in pairs(override_table) do
|
||||
def[k] = v
|
||||
end
|
||||
end
|
||||
return def
|
||||
end
|
||||
end
|
||||
|
||||
-- Create five caravans with different textures, randomly pick which one shows up.
|
||||
minetest.register_node("commoditymarket_fantasy:caravan_market_1", create_caravan_def())
|
||||
minetest.register_node("commoditymarket_fantasy:caravan_market_2", create_caravan_def({
|
||||
tiles = {
|
||||
{ name = "commoditymarket_door_wood.png^[multiply:#CCCCFF", backface_culling = true }, -- door
|
||||
{ name = "default_acacia_wood.png", backface_culling = true }, -- base wood
|
||||
{ name = "default_fence_rail_wood.png", backface_culling = true }, -- wheel sides
|
||||
{ name = "default_copper_block.png", backface_culling = true }, -- wheel tyre
|
||||
{ name = "commoditymarket_shingles_wood.png^[multiply:#CC8888", backface_culling = true }, -- roof
|
||||
{ name = "default_wood.png", backface_culling = true }, -- corner wood
|
||||
}
|
||||
}))
|
||||
minetest.register_node("commoditymarket_fantasy:caravan_market_3", create_caravan_def({
|
||||
tiles = {
|
||||
{ name = "commoditymarket_door_wood.png", backface_culling = true }, -- door
|
||||
{ name = "default_aspen_wood.png", backface_culling = true }, -- base wood
|
||||
{ name = "default_fence_aspen_wood.png", backface_culling = true }, -- wheel sides
|
||||
{ name = "default_cobble.png", backface_culling = true }, -- wheel tyre
|
||||
{ name = "default_stone_brick.png", backface_culling = true }, -- roof
|
||||
{ name = "default_pine_tree.png", backface_culling = true }, -- corner wood
|
||||
}
|
||||
}))
|
||||
minetest.register_node("commoditymarket_fantasy:caravan_market_4", create_caravan_def({
|
||||
tiles = {
|
||||
{ name = "commoditymarket_door_wood.png", backface_culling = true }, -- door
|
||||
{ name = "default_junglewood.png", backface_culling = true }, -- base wood
|
||||
{ name = "default_fence_rail_junglewood.png", backface_culling = true }, -- wheel sides
|
||||
{ name = "default_obsidian.png", backface_culling = true }, -- wheel tyre
|
||||
{ name = "commoditymarket_shingles_wood.png^[multiply:#88FF88", backface_culling = true }, -- roof
|
||||
{ name = "default_tree.png", backface_culling = true }, -- corner wood
|
||||
}
|
||||
}))
|
||||
minetest.register_node("commoditymarket_fantasy:caravan_market_5", create_caravan_def({
|
||||
tiles = {
|
||||
{ name = "commoditymarket_door_wood.png", backface_culling = true }, -- door
|
||||
{ name = "default_pine_wood.png", backface_culling = true }, -- base wood
|
||||
{ name = "default_chest_lock.png", backface_culling = true }, -- wheel sides
|
||||
{ name = "default_chest_top.png", backface_culling = true }, -- wheel tyre
|
||||
{ name = "default_furnace_top.png", backface_culling = true }, -- roof
|
||||
{ name = "default_wood.png", backface_culling = true }, -- corner wood
|
||||
}
|
||||
}))
|
||||
commoditymarket_fantasy.usage_help = S("Right-click on this to open the market interface.")
|
||||
|
||||
local caravan_protect = minetest.settings:get_bool("commoditymarket_protect_caravan_market", true)
|
||||
local on_blast
|
||||
if caravan_protect then
|
||||
on_blast = function() end
|
||||
end
|
||||
dofile(modpath.."/caravan_markets.lua")
|
||||
dofile(modpath.."/dungeon_markets.lua")
|
||||
dofile(modpath.."/village_markets.lua")
|
||||
|
||||
-- This one doesn't delete itself, server admins can place a permanent instance of it that way. Maybe inside towns next to bigger stationary markets.
|
||||
minetest.register_node("commoditymarket_fantasy:caravan_market_permanent", {
|
||||
description = caravan_def.description,
|
||||
_doc_items_longdesc = caravan_def.long_description,
|
||||
_doc_items_usagehelp = usage_help,
|
||||
drawtype = "mesh",
|
||||
mesh = "commoditymarket_wagon.obj",
|
||||
tiles = {
|
||||
{ name = "commoditymarket_door_wood.png", backface_culling = true }, -- door
|
||||
{ name = "default_wood.png", backface_culling = true }, -- base wood
|
||||
{ name = "default_fence_rail_wood.png", backface_culling = true }, -- wheel sides
|
||||
{ name = "default_coal_block.png", backface_culling = true }, -- wheel tyre
|
||||
{ name = "commoditymarket_shingles_wood.png", backface_culling = true }, -- roof
|
||||
{ name = "default_junglewood.png", backface_culling = true }, -- corner wood
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
-- Note: this nodebox should have a height of 1.5, but using 95/64 as a workaround for
|
||||
-- https://github.com/minetest/minetest/issues/9322
|
||||
{-0.75, -0.5, -1.25, 0.75, 95/64, 1.25},
|
||||
},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.75, -0.5, -1.25, 0.75, 95/64, 1.25},
|
||||
},
|
||||
},
|
||||
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 1,},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
commoditymarket.show_market("caravan", clicker:get_player_name())
|
||||
end,
|
||||
can_dig = function(pos, player)
|
||||
return not caravan_protect or minetest.check_player_privs(player, "protection_bypass")
|
||||
end,
|
||||
on_blast = on_blast,
|
||||
})
|
||||
|
||||
-- is a 5x3 area centered around pos clear of obstruction and has usable ground?
|
||||
local is_suitable_caravan_space = function(pos, facedir)
|
||||
local x_dim = 2
|
||||
local z_dim = 2
|
||||
local dir = minetest.facedir_to_dir(facedir)
|
||||
if dir.x ~= 0 then
|
||||
z_dim = 1
|
||||
elseif dir.z ~= 0 then
|
||||
x_dim = 1
|
||||
end
|
||||
|
||||
-- walkable ground?
|
||||
for x = pos.x - x_dim, pos.x + x_dim, 1 do
|
||||
for z = pos.z - z_dim, pos.z + z_dim, 1 do
|
||||
local node = minetest.get_node({x=x, y=pos.y-1, z=z})
|
||||
local node_def = minetest.registered_nodes[node.name]
|
||||
if node_def == nil or node_def.walkable ~= true then return false end
|
||||
end
|
||||
end
|
||||
-- buildable_to in the rest?
|
||||
for y = pos.y, pos.y+2, 1 do
|
||||
for x = pos.x - x_dim, pos.x + x_dim, 1 do
|
||||
for z = pos.z - z_dim, pos.z + z_dim, 1 do
|
||||
local node = minetest.get_node({x=x, y=y, z=z})
|
||||
local node_def = minetest.registered_nodes[node.name]
|
||||
if node_def == nil or node_def.buildable_to ~= true then return false end
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
minetest.register_node("commoditymarket_fantasy:caravan_post", {
|
||||
description = S("Trading Post"),
|
||||
_long_items_longdesc = S("This post signals passing caravan traders that customers can be found here, and signals to customers that caravan traders can be found here. If no caravan is present, right-click to summon one."),
|
||||
_doc_items_usagehelp = S("The trader's caravan requires a suitable open space next to the trading post for it to arrive, and takes some time to arrive after being summoned. The post gives a countdown to the caravan's arrival when moused over."),
|
||||
tiles = {"commoditymarket_sign.png^[transformR90", "commoditymarket_sign.png^[transformR270",
|
||||
"commoditymarket_sign.png^commoditymarket_caravan_sign.png", "commoditymarket_sign.png^commoditymarket_caravan_sign.png^[transformFX",
|
||||
"commoditymarket_sign_post.png", "commoditymarket_sign_post.png"},
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 1,},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
inventory_image = "commoditymarket_caravan_sign_inventory.png",
|
||||
paramtype= "light",
|
||||
paramtype2 = "facedir",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.125,-0.5,-0.5,0.125,2.0625,-0.25},
|
||||
{-0.0625,1.4375,-0.25,0.0625,2.0,0.5},
|
||||
},
|
||||
},
|
||||
on_construct = function(pos)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(1.0)
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(1.0)
|
||||
end,
|
||||
on_timer = function(pos, elapsed)
|
||||
local node = minetest.get_node(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if node.name ~= "commoditymarket_fantasy:caravan_post" then
|
||||
return -- the node was removed
|
||||
end
|
||||
local facedir = node.param2
|
||||
local dir = minetest.facedir_to_dir(facedir)
|
||||
local target = vector.add(pos, vector.multiply(dir,3))
|
||||
|
||||
local target_node = minetest.get_node(target)
|
||||
|
||||
if target_node.name:sub(1,string.len("commoditymarket_fantasy:caravan_market")) == "commoditymarket_fantasy:caravan_market" then
|
||||
-- It's already here somehow, shut down timer.
|
||||
meta:set_string("infotext", "")
|
||||
meta:set_float("wait_time", 0)
|
||||
return
|
||||
end
|
||||
|
||||
local is_suitable_space = is_suitable_caravan_space(target, facedir)
|
||||
|
||||
if not is_suitable_space then
|
||||
meta:set_string("infotext", S("Indicated parking area isn't suitable.\nA 5x3 open space with solid ground\nis required for a caravan."))
|
||||
meta:set_float("wait_time", 0)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(1.0)
|
||||
return
|
||||
end
|
||||
|
||||
local wait_time = (meta:get_float("wait_time") or 0) + elapsed
|
||||
meta:set_float("wait_time", wait_time)
|
||||
if wait_time < time_until_caravan then
|
||||
meta:set_string("infotext", S("Caravan summoned\nETA: @1 seconds.", math.floor(time_until_caravan - wait_time)))
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(1.0)
|
||||
return
|
||||
end
|
||||
|
||||
-- spawn the caravan. We've already established that the target pos is clear.
|
||||
minetest.set_node(target, {name="commoditymarket_fantasy:caravan_market_"..math.random(1,5), param2=facedir})
|
||||
minetest.sound_play("commoditymarket_register_opened", {
|
||||
pos = target,
|
||||
gain = 1.0, -- default
|
||||
max_hear_distance = 32, -- default, uses an euclidean metric
|
||||
})
|
||||
local timer = minetest.get_node_timer(target)
|
||||
timer:start(dwell_time)
|
||||
meta:set_string("infotext", "")
|
||||
meta:set_float("wait_time", 0)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- "Goblin Exchange"
|
||||
if minetest.settings:get_bool("commoditymarket_enable_goblin_market", true) then
|
||||
|
||||
local goblin_def = {
|
||||
description = S("Goblin Exchange"),
|
||||
long_description = S("One does not usually associate Goblins with the sort of sophistication that running a market requires. Usually one just associates Goblins with savagery and violence. But they understand the principle of tit-for-tat exchange, and if approached correctly they actually respect the concepts of ownership and debt. However, for some peculiar reason they understand this concept in the context of coal lumps. Goblins deal in the standard coal lump as their form of currency, conceptually divided into 100 coal centilumps (though Goblin brokers prefer to \"keep the change\" when giving back actual coal lumps)."),
|
||||
currency = {
|
||||
["default:coal_lump"] = 100
|
||||
},
|
||||
currency_symbol = "¢", --"\u{00A2}" cent symbol
|
||||
inventory_limit = 1000,
|
||||
--sell_limit =, -- no sell limit
|
||||
}
|
||||
|
||||
commoditymarket.register_market("goblin", goblin_def)
|
||||
|
||||
local goblin_protect = minetest.settings:get_bool("commoditymarket_protect_goblin_market", true)
|
||||
local on_blast
|
||||
if goblin_protect then
|
||||
on_blast = function() end
|
||||
end
|
||||
|
||||
minetest.register_node("commoditymarket_fantasy:goblin_market", {
|
||||
description = goblin_def.description,
|
||||
_doc_items_longdesc = goblin_def.long_description,
|
||||
_doc_items_usagehelp = usage_help,
|
||||
tiles = {"default_chest_top.png^(default_coal_block.png^[opacity:128)","default_chest_top.png^(default_coal_block.png^[opacity:128)",
|
||||
"default_chest_side.png^(default_coal_block.png^[opacity:128)","default_chest_side.png^(default_coal_block.png^[opacity:128)",
|
||||
"commoditymarket_empty_shelf.png^(default_coal_block.png^[opacity:128)","default_chest_side.png^(default_coal_block.png^[opacity:128)^commoditymarket_goblin.png",},
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 1,},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
commoditymarket.show_market("goblin", clicker:get_player_name())
|
||||
end,
|
||||
can_dig = function(pos, player)
|
||||
return not goblin_protect or minetest.check_player_privs(player, "protection_bypass")
|
||||
end,
|
||||
on_blast = on_blast,
|
||||
})
|
||||
end
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
if minetest.settings:get_bool("commoditymarket_enable_under_market", true) then
|
||||
local undermarket_def = {
|
||||
description = S("Undermarket"),
|
||||
long_description = S("Deep in the bowels of the world, below even the goblin-infested warrens and ancient delvings of the dwarves, dark and mysterious beings once dwelt. A few still linger to this day, and facilitate barter for those brave souls willing to travel in their lost realms. The Undermarket uses Mese chips ('₥') as a currency - twenty chips to the Mese fragment. Though traders are loathe to physically break Mese crystals up into units that small, as it renders it useless for other purposes."),
|
||||
currency = {
|
||||
["default:mese"] = 9*9*20,
|
||||
["default:mese_crystal"] = 9*20,
|
||||
["default:mese_crystal_fragment"] = 20
|
||||
},
|
||||
currency_symbol = "₥", --"\u{20A5}" mill sign
|
||||
inventory_limit = 10000,
|
||||
--sell_limit =, -- no sell limit
|
||||
}
|
||||
|
||||
commoditymarket.register_market("under", undermarket_def)
|
||||
|
||||
local under_protect = minetest.settings:get_bool("commoditymarket_protect_under_market", true)
|
||||
local on_blast
|
||||
if under_protect then
|
||||
on_blast = function() end
|
||||
end
|
||||
|
||||
minetest.register_node("commoditymarket_fantasy:under_market", {
|
||||
description = undermarket_def.description,
|
||||
_doc_items_longdesc = undermarket_def.long_description,
|
||||
_doc_items_usagehelp = usage_help,
|
||||
tiles = {"commoditymarket_under_top.png","commoditymarket_under_top.png",
|
||||
"commoditymarket_under.png","commoditymarket_under.png","commoditymarket_under.png","commoditymarket_under.png"},
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 1,},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
commoditymarket.show_market("under", clicker:get_player_name())
|
||||
end,
|
||||
can_dig = function(pos, player)
|
||||
return not under_protect or minetest.check_player_privs(player, "protection_bypass")
|
||||
end,
|
||||
on_blast = on_blast,
|
||||
})
|
||||
end
|
||||
------------------------------------------------------------------
|
||||
-- These globals were only needed during initialization, dispose of them afterward
|
||||
commoditymarket_fantasy = nil
|
@ -1,42 +1,54 @@
|
||||
# textdomain: commoditymarket_fantasy
|
||||
|
||||
|
||||
### init.lua ###
|
||||
### caravan_markets.lua ###
|
||||
|
||||
A gold ingot is far too valuable to use as a basic unit of value, so it has become common practice to divide the standard gold bar into @1 small disks to make trade easier.=Золотой слиток слишком ценен, чтобы использовать его в качестве базовой единицы стоимости, поэтому стало общепринятой практикой делить стандартный слиток золота на маленькие диски @1, чтобы облегчить торговлю.
|
||||
|
||||
At this time of day the King's Market is closed.=В это время дня Королевский рынок закрыт.
|
||||
At this time of day the Night Market is closed.=В это время суток Ночной рынок закрыт.
|
||||
Caravan summoned@nETA: @1 seconds.=Караван вызван! @nETA: @1 сек
|
||||
|
||||
Deep in the bowels of the world, below even the goblin-infested warrens and ancient delvings of the dwarves, dark and mysterious beings once dwelt. A few still linger to this day, and facilitate barter for those brave souls willing to travel in their lost realms. The Undermarket uses Mese chips ('₥') as a currency - twenty chips to the Mese fragment. Though traders are loathe to physically break Mese crystals up into units that small, as it renders it useless for other purposes.=Глубоко в недрах мира, еще ниже заражённых гоблинов и древними раскопками гномов, когда-то обитали темные и таинственные существа. Немногие и по сей день живут, и предлагают обмен для тех бесстрашных храбрецов, которые готовы путешествовать в затерянных мирах. Подземный рынок использует кристалл Месе в качестве валюты за осколок кристалла Месе дают 20 фрагментов Месе ('₥'). Торговцы не любят физически разбивать осколоки кристаллов Mese на такие маленькие единицы, так как это делает их бесполезными для других целей.
|
||||
|
||||
Goblin Exchange=Гоблинский Обмен
|
||||
Gold Coins=Золотые монеты
|
||||
|
||||
Gold coins can be deposited and withdrawn from markets that accept them as currency. These markets can make change if you have @1 coins and would like them back in ingot form again.=Золотые монеты можно депонировать и выводить с рынков, принимающих их в качестве валюты. Эти рынки могут измениться, если у вас есть @1 монета и вы хотите, чтобы они снова были в слитке.
|
||||
|
||||
Indicated parking area isn't suitable.@nA 5x3 open space with solid ground@nis required for a caravan.=Указанное место не подходит! Необходимо@nA 5x3 открытое пространство с твердым грунтом.
|
||||
|
||||
King's Market=Королевский рынок
|
||||
Night Market=Ночной рынок
|
||||
|
||||
One does not usually associate Goblins with the sort of sophistication that running a market requires. Usually one just associates Goblins with savagery and violence. But they understand the principle of tit-for-tat exchange, and if approached correctly they actually respect the concepts of ownership and debt. However, for some peculiar reason they understand this concept in the context of coal lumps. Goblins deal in the standard coal lump as their form of currency, conceptually divided into 100 coal centilumps (though Goblin brokers prefer to "keep the change" when giving back actual coal lumps).=Обычно Гоблинов не связывают с той высокой тонкостью, которая присуща рынку. Чаще всего Гоблинов относят к числу дикарей и первобытных людей. Но они понимают суть обмена "око за око", если к ним относиться справедливо, то они реально уважают понятия собственности и долга. Однако по каким-то своеобразным причинам они понимают это понятие в разрезе комочков угля. Гоблины имеют дело со стандартным углем как со своей формой валюты, условно разделенной на 100 косарей (правда Гоблинские брокеры предпочитают держать сдачу у себя, отдавая только целыми частями угля).
|
||||
|
||||
Right-click on this to open the market interface.=Кликните правой кнопкой мыши на это, чтобы открыть рыночный интерфейс.
|
||||
Right-click to summon a trader's caravan=Клик правой кнопкой мыши, чтобы вызвать торговый караван
|
||||
|
||||
The largest and most accessible market for the common man, the King's Market uses gold coins as its medium of exchange (or the equivalent in gold ingots - @1 coins to the ingot). However, as a respectable institution of the surface world, the King's Market operates only during the hours of daylight. The purchase and sale of swords and explosives is prohibited in the King's Market. Gold coins are represented by a '☼' symbol.=Крупнейший и наиболее доступный для простого человека рынок, Королевский рынок использует золотые монеты в качестве средства обмена (или эквивалент в золотых слитках - @1 монета к слитку). Однако, как респектабельный институт поверхностного мира, Королевский рынок работает только в часы дневного света. Купля-продажа мечей и взрывчатых веществ на Королевском рынке запрещена. Золотые монеты представлены символом "☼".
|
||||
|
||||
The trader's caravan requires a suitable open space next to the trading post for it to arrive, and takes some time to arrive after being summoned. The post gives a countdown to the caravan's arrival when moused over.=Караван трейдера требует подходящего открытого пространства рядом с торговым постом, чтобы он прибыл, и занимает некоторое время, чтобы прибыть после вызова. Пост дает обратный отсчет времени до прибытия каравана, когда он оказался в канаве.
|
||||
|
||||
This post signals passing caravan traders that customers can be found here, and signals to customers that caravan traders can be found here. If no caravan is present, right-click to summon one.=Этот пост сигнализирует проходящим трейдерам каравана, что клиенты могут быть найдены здесь, и сигналы для клиентов, что караванные трейдеры могут быть найдены здесь. Если каравана нет, кликните правой кнопкой мыши, чтобы вызвать караван.
|
||||
|
||||
Trader's Caravan=Караван торговцев
|
||||
Trading Post=Торговый пост
|
||||
Undermarket=Подземный рынок
|
||||
|
||||
Unlike most markets that have well-known fixed locations that travelers congregate to, the network of Trader's Caravans is fluid and dynamic in their locations. A Trader's Caravan can show up anywhere, make modest trades, and then be gone the next time you visit them. These caravans accept gold and gold coins as a currency (one gold ingot to @1 gold coins exchange rate). Any reasonably-wealthy person can create a signpost marking a location where Trader's Caravans will make a stop.=В отличие от большинства рынков, которые имеют хорошо известные фиксированные местоположения, на которые собираются путешественники, сеть Караванов трейдеров является гибкой и динамичной в своем местоположении. Караван трейдера может появиться где угодно, совершить скромные сделки, а затем уехать в следующий раз, когда вы его посетите. Эти караваны принимают золото и золотые монеты в качестве валюты (один слиток золота на @1 обменный курс золотых монет). Любой достаточно состоятельный человек может создать указатель, обозначающий место, где Караваны трейдера сделают остановку.
|
||||
|
||||
When the sun sets and the stalls of the King's Market close, other vendors are just waking up to share their wares. The Night Market is not as voluminous as the King's Market but accepts a wider range of wares. It accepts the same gold coinage of the realm, @1 coins to the gold ingot.=Когда заходит солнце и закрываются ларьки Королевского рынка, другие продавцы просто просыпаются, чтобы поделиться своими товарами. Ночной рынок не такой объемный, как Королевский, но принимает более широкий ассортимент товаров. Он принимает одну и ту же золотую монету королевства, @1 монету к золотым слиткам.
|
||||
|
||||
### dungeon_markets.lua ###
|
||||
|
||||
Goblin Exchange=Гоблинский Обмен
|
||||
|
||||
One does not usually associate Goblins with the sort of sophistication that running a market requires. Usually one just associates Goblins with savagery and violence. But they understand the principle of tit-for-tat exchange, and if approached correctly they actually respect the concepts of ownership and debt. However, for some peculiar reason they understand this concept in the context of coal lumps. Goblins deal in the standard coal lump as their form of currency, conceptually divided into 100 coal centilumps (though Goblin brokers prefer to "keep the change" when giving back actual coal lumps).=Обычно Гоблинов не связывают с той высокой тонкостью, которая присуща рынку. Чаще всего Гоблинов относят к числу дикарей и первобытных людей. Но они понимают суть обмена "око за око", если к ним относиться справедливо, то они реально уважают понятия собственности и долга. Однако по каким-то своеобразным причинам они понимают это понятие в разрезе комочков угля. Гоблины имеют дело со стандартным углем как со своей формой валюты, условно разделенной на 100 косарей (правда Гоблинские брокеры предпочитают держать сдачу у себя, отдавая только целыми частями угля).
|
||||
|
||||
Undermarket=Подземный рынок
|
||||
|
||||
### init.lua ###
|
||||
|
||||
A gold ingot is far too valuable to use as a basic unit of value, so it has become common practice to divide the standard gold bar into @1 small disks to make trade easier.=Золотой слиток слишком ценен, чтобы использовать его в качестве базовой единицы стоимости, поэтому стало общепринятой практикой делить стандартный слиток золота на маленькие диски @1, чтобы облегчить торговлю.
|
||||
|
||||
Deep in the bowels of the world, below even the goblin-infested warrens and ancient delvings of the dwarves, dark and mysterious beings once dwelt. A few still linger to this day, and facilitate barter for those brave souls willing to travel in their lost realms. The Undermarket uses Mese chips ('₥') as a currency - twenty chips to the Mese fragment. Though traders are loathe to physically break Mese crystals up into units that small, as it renders it useless for other purposes.=Глубоко в недрах мира, еще ниже заражённых гоблинов и древними раскопками гномов, когда-то обитали темные и таинственные существа. Немногие и по сей день живут, и предлагают обмен для тех бесстрашных храбрецов, которые готовы путешествовать в затерянных мирах. Подземный рынок использует кристалл Месе в качестве валюты за осколок кристалла Месе дают 20 фрагментов Месе ('₥'). Торговцы не любят физически разбивать осколоки кристаллов Mese на такие маленькие единицы, так как это делает их бесполезными для других целей.
|
||||
|
||||
Deep in the bowels of the world, below even the goblin-infested warrens and ancient delvings of the dwarves, dark and mysterious beings once dwelt. A few still linger to this day, and facilitate barter for those brave souls willing to travel in their lost realms. The Undermarket uses Redstone ('₨') as a currency.=
|
||||
|
||||
Gold Coins=Золотые монеты
|
||||
|
||||
Gold coins can be deposited and withdrawn from markets that accept them as currency. These markets can make change if you have @1 coins and would like them back in ingot form again.=Золотые монеты можно депонировать и выводить с рынков, принимающих их в качестве валюты. Эти рынки могут измениться, если у вас есть @1 монета и вы хотите, чтобы они снова были в слитке.
|
||||
|
||||
Right-click on this to open the market interface.=Кликните правой кнопкой мыши на это, чтобы открыть рыночный интерфейс.
|
||||
|
||||
### village_markets.lua ###
|
||||
|
||||
At this time of day the King's Market is closed.=В это время дня Королевский рынок закрыт.
|
||||
At this time of day the Night Market is closed.=В это время суток Ночной рынок закрыт.
|
||||
King's Market=Королевский рынок
|
||||
Night Market=Ночной рынок
|
||||
|
||||
The largest and most accessible market for the common man, the King's Market uses gold coins as its medium of exchange (or the equivalent in gold ingots - @1 coins to the ingot). However, as a respectable institution of the surface world, the King's Market operates only during the hours of daylight. Gold coins are represented by a '☼' symbol.=Крупнейший и наиболее доступный для простого человека рынок, Королевский рынок использует золотые монеты в качестве средства обмена (или эквивалент в золотых слитках - @1 монета к слитку). Однако, как респектабельный институт поверхностного мира, Королевский рынок работает только в часы дневного света. Золотые монеты представлены символом "☼".
|
||||
|
||||
When the sun sets and the stalls of the King's Market close, other vendors are just waking up to share their wares. The Night Market is not as voluminous as the King's Market but sometimes it's the only option. It accepts the same gold coinage of the realm, @1 coins to the gold ingot.=Когда заходит солнце и закрываются ларьки Королевского рынка, другие продавцы просто просыпаются, чтобы поделиться своими товарами. Ночной рынок не такой объемный, как Королевский, но принимает более широкий ассортимент товаров. Он принимает одну и ту же золотую монету королевства, @1 монету к золотым слиткам.
|
||||
|
||||
|
@ -1,42 +1,54 @@
|
||||
# textdomain: commoditymarket_fantasy
|
||||
|
||||
|
||||
### init.lua ###
|
||||
### caravan_markets.lua ###
|
||||
|
||||
A gold ingot is far too valuable to use as a basic unit of value, so it has become common practice to divide the standard gold bar into @1 small disks to make trade easier.=
|
||||
|
||||
At this time of day the King's Market is closed.=
|
||||
At this time of day the Night Market is closed.=
|
||||
Caravan summoned@nETA: @1 seconds.=
|
||||
|
||||
Deep in the bowels of the world, below even the goblin-infested warrens and ancient delvings of the dwarves, dark and mysterious beings once dwelt. A few still linger to this day, and facilitate barter for those brave souls willing to travel in their lost realms. The Undermarket uses Mese chips ('₥') as a currency - twenty chips to the Mese fragment. Though traders are loathe to physically break Mese crystals up into units that small, as it renders it useless for other purposes.=
|
||||
|
||||
Goblin Exchange=
|
||||
Gold Coins=
|
||||
|
||||
Gold coins can be deposited and withdrawn from markets that accept them as currency. These markets can make change if you have @1 coins and would like them back in ingot form again.=
|
||||
|
||||
Indicated parking area isn't suitable.@nA 5x3 open space with solid ground@nis required for a caravan.=
|
||||
|
||||
King's Market=
|
||||
Night Market=
|
||||
|
||||
One does not usually associate Goblins with the sort of sophistication that running a market requires. Usually one just associates Goblins with savagery and violence. But they understand the principle of tit-for-tat exchange, and if approached correctly they actually respect the concepts of ownership and debt. However, for some peculiar reason they understand this concept in the context of coal lumps. Goblins deal in the standard coal lump as their form of currency, conceptually divided into 100 coal centilumps (though Goblin brokers prefer to "keep the change" when giving back actual coal lumps).=
|
||||
|
||||
Right-click on this to open the market interface.=
|
||||
Right-click to summon a trader's caravan=
|
||||
|
||||
The largest and most accessible market for the common man, the King's Market uses gold coins as its medium of exchange (or the equivalent in gold ingots - @1 coins to the ingot). However, as a respectable institution of the surface world, the King's Market operates only during the hours of daylight. The purchase and sale of swords and explosives is prohibited in the King's Market. Gold coins are represented by a '☼' symbol.=
|
||||
|
||||
The trader's caravan requires a suitable open space next to the trading post for it to arrive, and takes some time to arrive after being summoned. The post gives a countdown to the caravan's arrival when moused over.=
|
||||
|
||||
This post signals passing caravan traders that customers can be found here, and signals to customers that caravan traders can be found here. If no caravan is present, right-click to summon one.=
|
||||
|
||||
Trader's Caravan=
|
||||
Trading Post=
|
||||
Undermarket=
|
||||
|
||||
Unlike most markets that have well-known fixed locations that travelers congregate to, the network of Trader's Caravans is fluid and dynamic in their locations. A Trader's Caravan can show up anywhere, make modest trades, and then be gone the next time you visit them. These caravans accept gold and gold coins as a currency (one gold ingot to @1 gold coins exchange rate). Any reasonably-wealthy person can create a signpost marking a location where Trader's Caravans will make a stop.=
|
||||
|
||||
When the sun sets and the stalls of the King's Market close, other vendors are just waking up to share their wares. The Night Market is not as voluminous as the King's Market but accepts a wider range of wares. It accepts the same gold coinage of the realm, @1 coins to the gold ingot.=
|
||||
|
||||
### dungeon_markets.lua ###
|
||||
|
||||
Goblin Exchange=
|
||||
|
||||
One does not usually associate Goblins with the sort of sophistication that running a market requires. Usually one just associates Goblins with savagery and violence. But they understand the principle of tit-for-tat exchange, and if approached correctly they actually respect the concepts of ownership and debt. However, for some peculiar reason they understand this concept in the context of coal lumps. Goblins deal in the standard coal lump as their form of currency, conceptually divided into 100 coal centilumps (though Goblin brokers prefer to "keep the change" when giving back actual coal lumps).=
|
||||
|
||||
Undermarket=
|
||||
|
||||
### init.lua ###
|
||||
|
||||
A gold ingot is far too valuable to use as a basic unit of value, so it has become common practice to divide the standard gold bar into @1 small disks to make trade easier.=
|
||||
|
||||
Deep in the bowels of the world, below even the goblin-infested warrens and ancient delvings of the dwarves, dark and mysterious beings once dwelt. A few still linger to this day, and facilitate barter for those brave souls willing to travel in their lost realms. The Undermarket uses Mese chips ('₥') as a currency - twenty chips to the Mese fragment. Though traders are loathe to physically break Mese crystals up into units that small, as it renders it useless for other purposes.=
|
||||
|
||||
Deep in the bowels of the world, below even the goblin-infested warrens and ancient delvings of the dwarves, dark and mysterious beings once dwelt. A few still linger to this day, and facilitate barter for those brave souls willing to travel in their lost realms. The Undermarket uses Redstone ('₨') as a currency.=
|
||||
|
||||
Gold Coins=
|
||||
|
||||
Gold coins can be deposited and withdrawn from markets that accept them as currency. These markets can make change if you have @1 coins and would like them back in ingot form again.=
|
||||
|
||||
Right-click on this to open the market interface.=
|
||||
|
||||
### village_markets.lua ###
|
||||
|
||||
At this time of day the King's Market is closed.=
|
||||
At this time of day the Night Market is closed.=
|
||||
King's Market=
|
||||
Night Market=
|
||||
|
||||
The largest and most accessible market for the common man, the King's Market uses gold coins as its medium of exchange (or the equivalent in gold ingots - @1 coins to the ingot). However, as a respectable institution of the surface world, the King's Market operates only during the hours of daylight. Gold coins are represented by a '☼' symbol.=
|
||||
|
||||
When the sun sets and the stalls of the King's Market close, other vendors are just waking up to share their wares. The Night Market is not as voluminous as the King's Market but sometimes it's the only option. It accepts the same gold coinage of the realm, @1 coins to the gold ingot.=
|
||||
|
||||
|
4
mod.conf
@ -1,4 +1,4 @@
|
||||
name = commoditymarket_fantasy
|
||||
description = Adds a number of fantasy-themed marketplaces
|
||||
depends = commoditymarket, default
|
||||
optional_depends = doc
|
||||
depends = commoditymarket
|
||||
optional_depends = doc, lorebooks, default, mcl_core, mcl_sounds, mcl_chests, mesecons_wires
|
BIN
textures/commoditymarket_default_aspen_wood.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
textures/commoditymarket_default_chest_lock.png
Normal file
After Width: | Height: | Size: 469 B |
BIN
textures/commoditymarket_default_chest_side.png
Normal file
After Width: | Height: | Size: 375 B |
BIN
textures/commoditymarket_default_chest_top.png
Normal file
After Width: | Height: | Size: 423 B |
BIN
textures/commoditymarket_default_copper_block.png
Normal file
After Width: | Height: | Size: 359 B |
BIN
textures/commoditymarket_default_fence_aspen_wood.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
textures/commoditymarket_default_fence_rail_junglewood.png
Normal file
After Width: | Height: | Size: 230 B |
BIN
textures/commoditymarket_default_fence_rail_wood.png
Normal file
After Width: | Height: | Size: 230 B |
BIN
textures/commoditymarket_default_furnace_top.png
Normal file
After Width: | Height: | Size: 274 B |
BIN
textures/commoditymarket_default_pine_tree.png
Normal file
After Width: | Height: | Size: 280 B |
BIN
textures/commoditymarket_default_pine_wood.png
Normal file
After Width: | Height: | Size: 223 B |
@ -8,4 +8,18 @@ commoditymarket_shingles_wood.png is cottages_homedecor_shingles_wood.png from t
|
||||
commoditymarket_trade.png, commoditymarket_trade_flag.png, commoditymarket_under.png, and commoditymarket_under_top were created by FaceDeer and released under the CC0 public domain license
|
||||
|
||||
commoditymarket_sign_post.png and commoditymarket_sign.png are made from elements of default_tree.png and default_aspen_wood.png
|
||||
commoditymarket_door_wood.png is doors_door_wood.png from the doors mod
|
||||
commoditymarket_door_wood.png is doors_door_wood.png from the doors mod
|
||||
|
||||
|
||||
The following are all taken from the default mod unaltered, to allow this mod to be mineclone2 compatible:
|
||||
commoditymarket_default_aspen_wood
|
||||
commoditymarket_default_chest_lock
|
||||
commoditymarket_default_chest_side
|
||||
commoditymarket_default_chest_top
|
||||
commoditymarket_default_copper_block
|
||||
commoditymarket_default_fence_aspen_wood
|
||||
commoditymarket_default_fence_rail_junglewood
|
||||
commoditymarket_default_fence_rail_wood
|
||||
commoditymarket_default_furnace_top
|
||||
commoditymarket_default_pine_tree
|
||||
commoditymarket_default_pine_wood
|
112
village_markets.lua
Normal file
@ -0,0 +1,112 @@
|
||||
local S = commoditymarket_fantasy.S
|
||||
local coins_per_ingot = commoditymarket_fantasy.coins_per_ingot
|
||||
local default_items = commoditymarket_fantasy.default_items
|
||||
local gold_ingot = commoditymarket_fantasy.gold_ingot
|
||||
local gold_currency = commoditymarket_fantasy.gold_currency
|
||||
local wood_sounds = commoditymarket_fantasy.wood_sounds
|
||||
local usage_help = commoditymarket_fantasy.usage_help
|
||||
|
||||
commoditymarket_fantasy.register_gold_coins()
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
-- King's Market
|
||||
|
||||
if minetest.settings:get_bool("commoditymarket_enable_kings_market", true) then
|
||||
|
||||
local kings_def = {
|
||||
description = S("King's Market"),
|
||||
long_description = S("The largest and most accessible market for the common man, the King's Market uses gold coins as its medium of exchange (or the equivalent in gold ingots - @1 coins to the ingot). However, as a respectable institution of the surface world, the King's Market operates only during the hours of daylight. Gold coins are represented by a '☼' symbol.", coins_per_ingot),
|
||||
currency = gold_currency,
|
||||
currency_symbol = "☼", -- "\u{263C}" Alchemical symbol for gold
|
||||
inventory_limit = 100000,
|
||||
--sell_limit =, -- no sell limit for the King's Market
|
||||
initial_items = default_items,
|
||||
}
|
||||
|
||||
commoditymarket_fantasy.register_gold_coins()
|
||||
|
||||
commoditymarket.register_market("kings", kings_def)
|
||||
|
||||
local kings_protect = minetest.settings:get_bool("commoditymarket_protect_kings_market", true)
|
||||
local on_blast
|
||||
if kings_protect then
|
||||
on_blast = function() end
|
||||
end
|
||||
|
||||
minetest.register_node("commoditymarket_fantasy:kings_market", {
|
||||
description = kings_def.description,
|
||||
_doc_items_longdesc = kings_def.long_description,
|
||||
_doc_items_usagehelp = usage_help,
|
||||
tiles = {"commoditymarket_default_chest_top.png","commoditymarket_default_chest_top.png",
|
||||
"commoditymarket_default_chest_side.png","commoditymarket_default_chest_side.png",
|
||||
"commoditymarket_empty_shelf.png","commoditymarket_default_chest_side.png^commoditymarket_crown.png",},
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 1,},
|
||||
sounds = wood_sounds,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
local timeofday = minetest.get_timeofday()
|
||||
if timeofday > 0.2 and timeofday < 0.8 then
|
||||
commoditymarket.show_market("kings", clicker:get_player_name())
|
||||
else
|
||||
minetest.chat_send_player(clicker:get_player_name(), S("At this time of day the King's Market is closed."))
|
||||
minetest.sound_play({name = "commoditymarket_error", gain = 0.1}, {to_player=clicker:get_player_name()})
|
||||
end
|
||||
end,
|
||||
can_dig = function(pos, player)
|
||||
return not kings_protect or minetest.check_player_privs(player, "protection_bypass")
|
||||
end,
|
||||
on_blast = on_blast,
|
||||
})
|
||||
end
|
||||
-------------------------------------------------------------------------------
|
||||
-- Night Market
|
||||
|
||||
if minetest.settings:get_bool("commoditymarket_enable_night_market", true) then
|
||||
local night_def = {
|
||||
description = S("Night Market"),
|
||||
long_description = S("When the sun sets and the stalls of the King's Market close, other vendors are just waking up to share their wares. The Night Market is not as voluminous as the King's Market but sometimes it's the only option. It accepts the same gold coinage of the realm, @1 coins to the gold ingot.", coins_per_ingot),
|
||||
currency = gold_currency,
|
||||
currency_symbol = "☼", --"\u{263C}"
|
||||
inventory_limit = 10000,
|
||||
--sell_limit =, -- no sell limit for the Night Market
|
||||
initial_items = default_items,
|
||||
anonymous = true,
|
||||
}
|
||||
|
||||
commoditymarket_fantasy.register_gold_coins()
|
||||
|
||||
commoditymarket.register_market("night", night_def)
|
||||
|
||||
local night_protect = minetest.settings:get_bool("commoditymarket_protect_night_market", true)
|
||||
local on_blast
|
||||
if night_protect then
|
||||
on_blast = function() end
|
||||
end
|
||||
|
||||
minetest.register_node("commoditymarket_fantasy:night_market", {
|
||||
description = night_def.description,
|
||||
_doc_items_longdesc = night_def.long_description,
|
||||
_doc_items_usagehelp = usage_help,
|
||||
tiles = {"commoditymarket_default_chest_top.png","commoditymarket_default_chest_top.png",
|
||||
"commoditymarket_default_chest_side.png","commoditymarket_default_chest_side.png",
|
||||
"commoditymarket_empty_shelf.png","commoditymarket_default_chest_side.png^commoditymarket_moon.png",},
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 1,},
|
||||
sounds = wood_sounds,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
local timeofday = minetest.get_timeofday()
|
||||
if timeofday < 0.2 or timeofday > 0.8 then
|
||||
commoditymarket.show_market("night", clicker:get_player_name())
|
||||
else
|
||||
minetest.chat_send_player(clicker:get_player_name(), S("At this time of day the Night Market is closed."))
|
||||
minetest.sound_play({name = "commoditymarket_error", gain = 0.1}, {to_player=clicker:get_player_name()})
|
||||
end
|
||||
end,
|
||||
can_dig = function(pos, player)
|
||||
return not night_protect or minetest.check_player_privs(player, "protection_bypass")
|
||||
end,
|
||||
on_blast = on_blast,
|
||||
})
|
||||
end
|