init
|
@ -0,0 +1,4 @@
|
|||
# Build'N'Buy
|
||||
A game inspired by Minecraft Championship's Build Mart, where you have to replicate mini build and to get the materials for them, you have to go 'shopping'.
|
||||
Initially made for 2021 Minetest game jam.
|
||||
Version: 0.0
|
|
@ -0,0 +1 @@
|
|||
A game inspired by Minecraft Championship's Build Mart, where you have to replicate mini build and to get the materials for them, you have to go 'shopping'.
|
|
@ -0,0 +1,3 @@
|
|||
name = Build'N'Buy
|
||||
description = A game inspired by Minecraft Championship's Build Mart, where you have to replicate mini build and to get the materials for them, you have to go 'shopping'.
|
||||
author = j45
|
|
@ -0,0 +1,3 @@
|
|||
mg_name = singlenode
|
||||
static_spawnpoint = 0,0,0
|
||||
enable_damage = false
|
|
@ -0,0 +1,5 @@
|
|||
# bnb_coins
|
||||
Stuff to do with coins for Build'N'Buy<br>
|
||||
Code License: MIT<br>
|
||||
Coin texture license: CC-BY-SA 4.0<br>
|
||||
author = j45
|
|
@ -0,0 +1,56 @@
|
|||
bnb_coins = {}
|
||||
|
||||
bnb_coins.get_player_coins = function(name)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local meta = player:get_meta()
|
||||
local coins = meta:get_int("coins")
|
||||
return coins
|
||||
end
|
||||
|
||||
bnb_coins.set_player_coins = function(name, amount)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local meta = player:get_meta()
|
||||
local coins = meta:set_int("coins", amount)
|
||||
end
|
||||
|
||||
bnb_coins.add_player_coins = function(name, amount)
|
||||
bnb_coins.set_player_coins(name, bnb_coins.get_player_coins(name) + amount)
|
||||
end
|
||||
|
||||
--HUD things
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
local coins = tostring(bnb_coins.get_player_coins(name))
|
||||
player:hud_add({
|
||||
hud_elem_type = "text",
|
||||
position = {x = 0.1, y = 0.9},
|
||||
offset = {x = 0, y = 0},
|
||||
text = "Coins: " .. coins,
|
||||
number = 0xFFFFFF,
|
||||
alignment = {x = 0, y = 0},
|
||||
--scale = {x = 350, y = 350},
|
||||
})
|
||||
player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
position = {x = 0.1, y = 0.9},
|
||||
offset = {x = (#coins * 4.2)+46, y = 0},
|
||||
text = "coin.png",
|
||||
number = 0xFFFFFF,
|
||||
alignment = {x = 0, y = 0},
|
||||
scale = {x = 2, y = 2},
|
||||
})
|
||||
end)
|
||||
|
||||
local time = 0
|
||||
minetest.register_globalstep(function(dtime)
|
||||
time = time + dtime
|
||||
if time >= 1 then
|
||||
time = 0
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
local name = player:get_player_name()
|
||||
local coins = tostring(bnb_coins.get_player_coins(name))
|
||||
player:hud_change(0, "text", "Coins: " .. coins)
|
||||
player:hud_change(1, "offset", {x = (#coins * 4.2)+46, y = 0})
|
||||
end
|
||||
end
|
||||
end)
|
After Width: | Height: | Size: 148 B |
|
@ -0,0 +1,4 @@
|
|||
# bnb_core
|
||||
Core stuff for Build'N'Buy<br>
|
||||
License: MIT<br>
|
||||
author = j45
|
|
@ -0,0 +1,67 @@
|
|||
bnb_core = {}
|
||||
bnb_core.play_pos = {x = 0, y = 101, z = 0}
|
||||
bnb_core.shop_pos = {x = 0, y = 301, z = 0}
|
||||
bnb_core.building_min = {x = -11, y = 102, z = -3}
|
||||
bnb_core.building_max = {x = -5, y = 105, z = 3}
|
||||
bnb_core.demo_min = {x = 5, y = 102, z = -3}
|
||||
bnb_core.demo_max = { x = 11, y = 105, z = 3}
|
||||
|
||||
bnb_core.start = function(player)
|
||||
player:set_pos(bnb_core.play_pos)
|
||||
end
|
||||
|
||||
bnb_core.tp_shop = function(player)
|
||||
player:set_pos(bnb_core.shop_pos)
|
||||
end
|
||||
|
||||
bnb_core.finished = function()
|
||||
for x = bnb_core.building_min.x, bnb_core.building_max.x do
|
||||
for y = bnb_core.building_min.y, bnb_core.building_max.y do
|
||||
for z = bnb_core.building_min.z, bnb_core.building_max.z do
|
||||
local pos = {x = x, y = y, z = z}
|
||||
local node = minetest.get_node(pos)
|
||||
local pos_demo = {x = x+16, y = y, z = z}
|
||||
local node_demo = minetest.get_node(pos_demo)
|
||||
if node.name ~= node_demo.name then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("check", {
|
||||
description = "Check if the areas are the same",
|
||||
func = function(name)
|
||||
minetest.chat_send_all(dump(bnb_core.finished()))
|
||||
end,
|
||||
})
|
||||
|
||||
local punching = false
|
||||
local punchtimer = 0
|
||||
minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
|
||||
if punching then
|
||||
return
|
||||
end
|
||||
punching = true
|
||||
minetest.after(0.1, function()
|
||||
punching = false
|
||||
end)
|
||||
if puncher:get_wielded_item().name == "bnb_nodes:stick" then return end
|
||||
local node_pos = pointed_thing.under
|
||||
if node_pos.x >= bnb_core.building_min.x and node_pos.x <= bnb_core.building_max.x and node_pos.z >= bnb_core.building_min.z and node_pos.z <= bnb_core.building_max.z then
|
||||
if node_pos.y >= bnb_core.building_min.y and node_pos.y <= bnb_core.building_max.y then
|
||||
--give puncher the node
|
||||
local nodename = node.name
|
||||
puncher:get_inventory():add_item("main", nodename)
|
||||
minetest.set_node(node_pos, {name = "air"})
|
||||
end
|
||||
elseif node_pos.x >= bnb_core.demo_min.x and node_pos.x <= bnb_core.demo_max.x and node_pos.z >= bnb_core.demo_min.z and node_pos.z <= bnb_core.demo_max.z then
|
||||
if node_pos.y >= bnb_core.demo_min.y and node_pos.y <= bnb_core.demo_max.y then
|
||||
minetest.chat_send_player(puncher:get_player_name(), "This is the demo you need to replicate!")
|
||||
end
|
||||
else
|
||||
return false
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,5 @@
|
|||
# bnb_nodes
|
||||
Nodes for Build'N'Buy<br>
|
||||
License: MIT<br>
|
||||
Texture licenses: see ./textures/README.md<br>
|
||||
author = j45
|
|
@ -0,0 +1 @@
|
|||
bnb_core
|
|
@ -0,0 +1,245 @@
|
|||
--stick that sets pointed_thing to air, for development purposes
|
||||
minetest.register_craftitem("bnb_nodes:stick", {
|
||||
description = "Stick",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
minetest.set_node(pointed_thing.under, {name="air"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
--logs
|
||||
minetest.register_node(minetest.get_current_modname()..":oak_log", {
|
||||
description = "Oak Log",
|
||||
tiles = {"log_oak_top.png", "log_oak_top.png", "log_oak.png"},
|
||||
})
|
||||
minetest.register_node(minetest.get_current_modname()..":pine_log", {
|
||||
description = "Pine Log",
|
||||
tiles = {"log_pine_top.png", "log_pine_top.png", "log_pine.png"},
|
||||
})
|
||||
minetest.register_node(minetest.get_current_modname()..":beech_log", {
|
||||
description = "Beech Log",
|
||||
tiles = {"log_beech_top.png", "log_beech_top.png", "log_beech.png"},
|
||||
})
|
||||
minetest.register_node(minetest.get_current_modname()..":ash_log", {
|
||||
description = "Ash Log",
|
||||
tiles = {"log_ash_top.png", "log_ash_top.png", "log_ash.png"},
|
||||
})
|
||||
minetest.register_node(minetest.get_current_modname()..":teak_log", {
|
||||
description = "Teak Log",
|
||||
tiles = {"log_teak_top.png", "log_teak_top.png", "log_teak.png"},
|
||||
})
|
||||
|
||||
--quartz
|
||||
minetest.register_node(minetest.get_current_modname()..":quartz_block", {
|
||||
description = "Quartz Block",
|
||||
tiles = {"quartz_block.png"},
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2,},
|
||||
})
|
||||
|
||||
minetest.register_node(minetest.get_current_modname()..":quartz_slab", {
|
||||
description = "Quartz Slab",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"quartz_block.png"},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node(minetest.get_current_modname()..":quartz_slab1", {
|
||||
description = "Quartz Slab",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"quartz_block.png"},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, 0, -0.5, 0.5, 0.5, 0.5},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node(minetest.get_current_modname()..":quartz_pillar", {
|
||||
description = "Quartz Pillar",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"quartz_block.png"},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.25, -0.5, -0.25, 0.25, 0.5, 0.25},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node(minetest.get_current_modname()..":quartz_wall1", {
|
||||
description = "Quartz Wall",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"quartz_block.png"},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.25, 0.5, 0.5, 0.25},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node(minetest.get_current_modname()..":quartz_wall2", {
|
||||
description = "Quartz Wall",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"quartz_block.png"},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.25, -0.5, -0.5, 0.25, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node(minetest.get_current_modname()..":quartz_wall3_1", {
|
||||
description = "Quartz Wall",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"quartz_block.png"},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{0, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node(minetest.get_current_modname()..":quartz_wall3_2", {
|
||||
description = "Quartz Wall",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"quartz_block.png"},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node(minetest.get_current_modname()..":quartz_wall4_1", {
|
||||
description = "Quartz Wall",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"quartz_block.png"},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node(minetest.get_current_modname()..":quartz_wall4_2", {
|
||||
description = "Quartz Wall",
|
||||
drawtype = "nodebox",
|
||||
tiles = {"quartz_block.png"},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0.5, 0},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node(minetest.get_current_modname()..":quartz_welcome", {
|
||||
description = "Quartz Welcome",
|
||||
tiles = {"quartz_block.png^welcome_text.png"},
|
||||
})
|
||||
|
||||
minetest.register_node(minetest.get_current_modname()..":quartz_play", {
|
||||
description = "Quartz Play",
|
||||
tiles = {"quartz_block.png^play_text.png"},
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
bnb_core.start(player)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node(minetest.get_current_modname()..":quartz_shop", {
|
||||
description = "Quartz Shop",
|
||||
tiles = {"quartz_block.png^shop_text.png"},
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
bnb_core.tp_shop(player)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node(minetest.get_current_modname()..":quartz_finished", {
|
||||
description = "Quartz Finished",
|
||||
tiles = {"quartz_block.png^finished_text.png"},
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
bnb_core.finished()
|
||||
end
|
||||
})
|
||||
|
||||
--lantern
|
||||
minetest.register_node(minetest.get_current_modname()..":light_block", {
|
||||
description = "Light Block",
|
||||
tiles = {"light.png"},
|
||||
--emmits light
|
||||
light_source = 14,
|
||||
})
|
||||
|
||||
|
||||
local function register_wool(name, desc)
|
||||
minetest.register_node(minetest.get_current_modname()..":"..name .. "_wool", {
|
||||
description = desc,
|
||||
tiles = {name .. "_wool.png"},
|
||||
light_source = 1,
|
||||
})
|
||||
end
|
||||
|
||||
local wools = {
|
||||
{"red", "Red Wool"},
|
||||
{"blue", "Blue Wool"},
|
||||
{"grey", "Grey Wool"},
|
||||
{"black", "Black Wool"},
|
||||
{"brown", "Brown Wool"},
|
||||
{"cyan", "Cyan Wool"},
|
||||
{"dark_green", "Dark Green Wool"},
|
||||
{"green", "Green Wool"},
|
||||
{"light_grey", "Light Grey Wool"},
|
||||
{"magenta", "Magenta Wool"},
|
||||
{"orange", "Orange Wool"},
|
||||
{"pink", "Pink Wool"},
|
||||
{"violet", "Violet Wool"},
|
||||
{"white", "White Wool"},
|
||||
{"yellow", "Yellow Wool"},
|
||||
}
|
||||
|
||||
for _, conc in ipairs(wools) do
|
||||
register_wool(conc[1], conc[2])
|
||||
end
|
||||
|
||||
minetest.register_node(minetest.get_current_modname()..":grey_stained_glass", {
|
||||
description = "Grey Stained Glass",
|
||||
drawtype = "glasslike",
|
||||
use_texture_alpha = true,
|
||||
tiles = {"grey_glass.png^[colorize:#000F:100"},
|
||||
light_source = 1,
|
||||
})
|
||||
|
||||
minetest.register_node(minetest.get_current_modname()..":grey_stained_glass_slab", {
|
||||
description = "Grey Stained Glass",
|
||||
drawtype = "nodebox",
|
||||
use_texture_alpha = true,
|
||||
tiles = {"grey_glass.png^[colorize:#000F:100"},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
},
|
||||
light_source = 1,
|
||||
})
|
||||
|
||||
--signs
|
||||
|
||||
local register_sign = function(name, desc, tile)
|
||||
minetest.register_node(minetest.get_current_modname()..":sign_"..name, {
|
||||
description = desc,
|
||||
tiles = {tile},
|
||||
light_source = 1,
|
||||
})
|
||||
end
|
||||
|
||||
register_sign("magenta_w", "Magenta W Sign", "magenta_wool.png^font_w.png")
|
||||
register_sign("orange_o", "Orange O Sign", "orange_wool.png^font_o.png")
|
||||
register_sign("cyan_o", "Cyan O Sign", "cyan_wool.png^font_o.png")
|
||||
register_sign("green_l", "Green L Sign", "green_wool.png^font_l.png")
|
|
@ -0,0 +1 @@
|
|||
For the licenses for each texture, see the README.md in the corresponding folder.
|
|
@ -0,0 +1 @@
|
|||
The textures in this folder are not made by me but are under the CC-BY-SA 4.0 license and can be found at https://content.minetest.net/packages/Zughy/soothing32/
|
After Width: | Height: | Size: 95 B |
After Width: | Height: | Size: 96 B |
After Width: | Height: | Size: 95 B |
After Width: | Height: | Size: 95 B |
After Width: | Height: | Size: 96 B |
After Width: | Height: | Size: 95 B |
After Width: | Height: | Size: 101 B |
After Width: | Height: | Size: 95 B |
After Width: | Height: | Size: 152 B |
After Width: | Height: | Size: 95 B |
After Width: | Height: | Size: 123 B |
After Width: | Height: | Size: 175 B |
After Width: | Height: | Size: 129 B |
After Width: | Height: | Size: 179 B |
After Width: | Height: | Size: 123 B |
After Width: | Height: | Size: 166 B |
After Width: | Height: | Size: 123 B |
After Width: | Height: | Size: 166 B |
After Width: | Height: | Size: 136 B |
After Width: | Height: | Size: 157 B |
After Width: | Height: | Size: 95 B |
After Width: | Height: | Size: 95 B |
After Width: | Height: | Size: 96 B |
After Width: | Height: | Size: 83 B |
After Width: | Height: | Size: 95 B |
After Width: | Height: | Size: 95 B |
After Width: | Height: | Size: 95 B |
After Width: | Height: | Size: 95 B |
After Width: | Height: | Size: 493 B |
After Width: | Height: | Size: 187 B |
|
@ -0,0 +1 @@
|
|||
I made the textures in this folder, these are under CC-BY-SA 4.0
|
After Width: | Height: | Size: 549 B |
After Width: | Height: | Size: 97 B |
After Width: | Height: | Size: 94 B |
After Width: | Height: | Size: 99 B |
After Width: | Height: | Size: 92 B |
After Width: | Height: | Size: 98 B |
After Width: | Height: | Size: 95 B |
After Width: | Height: | Size: 99 B |
After Width: | Height: | Size: 93 B |
After Width: | Height: | Size: 93 B |
After Width: | Height: | Size: 93 B |
After Width: | Height: | Size: 101 B |
After Width: | Height: | Size: 87 B |
After Width: | Height: | Size: 102 B |
After Width: | Height: | Size: 97 B |
After Width: | Height: | Size: 92 B |
After Width: | Height: | Size: 94 B |
After Width: | Height: | Size: 98 B |
After Width: | Height: | Size: 97 B |
After Width: | Height: | Size: 102 B |
After Width: | Height: | Size: 90 B |
After Width: | Height: | Size: 92 B |
After Width: | Height: | Size: 97 B |
After Width: | Height: | Size: 97 B |
After Width: | Height: | Size: 94 B |
After Width: | Height: | Size: 100 B |
After Width: | Height: | Size: 93 B |
After Width: | Height: | Size: 412 B |
After Width: | Height: | Size: 408 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 87 KiB |