Update: Luck and Boxes

This commit is contained in:
IamPyu 2024-06-14 21:40:36 -06:00
parent c27eecf202
commit 2ffc11443a
6 changed files with 101 additions and 1 deletions

View File

@ -1,5 +1,16 @@
# Changelog
## [Jun 14th 2024] Major Update: Luck and Boxes
- Added Lootboxes
- Added Trash Lootbox
- Added Resource Lootbox
- Added Griefer's Dream Lootbox
- Added Liquid Sources Lootbox
- Added Lighting Lootbox
- Lootboxes spawn across various biomes
- Revamped Bomb
## [Jun 14th 2024] Major Update: Items and Utilites Update
- Added Gunpowder, Coins, Sugar, and Ash

View File

@ -33,3 +33,4 @@ dofile(PyuTestCore_Path.."/abms.lua")
dofile(PyuTestCore_Path.."/tools.lua")
dofile(PyuTestCore_Path.."/player.lua")
dofile(PyuTestCore_Path.."/crafts.lua")
dofile(PyuTestCore_Path.."/lootboxes.lua")

View File

@ -0,0 +1,60 @@
PyuTestCore.LOOTBOX_USEFULLNESS = {
USELESS = "white",
AVERAGE = "lightblue",
USEFUL = "coral",
AMAZING = "cyan"
}
PyuTestCore.make_lootbox = function (type, dtype, items, usefullness)
local id = "pyutest_core:"..type.."_lootbox"
minetest.register_node(id, {
description = Translate(dtype .. " Lootbox"),
groups = {block = PyuTestCore.BLOCK_BREAKABLE_LONG},
tiles = {"crate.png"},
color = usefullness,
sounds = PyuTestCore.make_node_sounds(),
on_rightclick = function (pos, _, clicker)
if clicker == nil then return end
for _, v in pairs(items) do
minetest.add_item(pos, v)
end
minetest.sound_play("lootbox_unlock", {
pos = pos,
gain = 1
})
minetest.remove_node(pos)
end
})
end
PyuTestCore.make_lootbox("trash", "Trash", {
ItemStack("pyutest_core:deadbush 19"),
ItemStack("pyutest_core:")
}, PyuTestCore.LOOTBOX_USEFULLNESS.USELESS)
PyuTestCore.make_lootbox("resource", "Resource", {
ItemStack("pyutest_core:gunpowder 4"),
ItemStack("pyutest_core:stick 6"),
ItemStack("pyutest_core:sugar 3"),
ItemStack("pyutest_core:coin 4"),
ItemStack("pyutest_core:tree_sapling 2")
}, PyuTestCore.LOOTBOX_USEFULLNESS.AVERAGE)
PyuTestCore.make_lootbox("griefer", "Griefer's Dream", {
ItemStack("pyutest_core:tnt 3"),
ItemStack("pyutest_core:bomb 2")
}, PyuTestCore.LOOTBOX_USEFULLNESS.USEFUL)
PyuTestCore.make_lootbox("liquid_sources", "Liquid Sources", {
ItemStack("pyutest_core:water_source 5"),
ItemStack("pyutest_core:lava_source 5"),
ItemStack("pyutest_core:oil_source 5"),
ItemStack("pyutest_core:liquid_acid_source 5")
}, PyuTestCore.LOOTBOX_USEFULLNESS.USEFUL)
PyuTestCore.make_lootbox("lighting", "Lighting", {
ItemStack("pyutest_core:light 2"),
ItemStack("pyutest_core:torch 13")
}, PyuTestCore.LOOTBOX_USEFULLNESS.AMAZING)

View File

@ -49,3 +49,26 @@ minetest.register_decoration({
rotation = "random",
flags = "place_center_x, place_center_z"
})
minetest.register_decoration({
deco_type = "simple",
sidelen = 16,
fill_ratio = 0.0008,
place_on = {
"pyutest_core:grass_block",
"pyutest_core:dirt_block",
"pyutest_core:snow_block",
"pyutest_core:mycelium_block",
"pyutest_core:stone_block"
},
biomes = {"desert", "grassland", "mushroom_fields", "frozen_plains", "forest"},
y_max = PyuTestCore_BiomeTops.mountains,
y_min = PyuTestCore_SurfaceBiomeBottom,
decoration = {
"pyutest_core:trash_lootbox",
"pyutest_core:resource_lootbox",
"pyutest_core:griefer_lootbox",
"pyutest_core:liquid_sources_lootbox",
"pyutest_core:lighting_lootbox",
}
})

Binary file not shown.

View File

@ -51,13 +51,18 @@ PyuTestCore.make_tool("pyutest_core:pickaxe", "pickaxe", "Pickaxe", {}, "pickaxe
}
})
PyuTestCore.make_tool("pyutest_core:bomb", "bomb", "Bomb", {}, "bomb.png", {
PyuTestCore.make_item("pyutest_core:bomb", "bomb", "Bomb", {}, "bomb.png", {
stack_max = 16,
on_use = function (_, user)
if user == nil then
return
end
local pos = user:get_pos()
PyuTestCore.create_explosion(pos, 2)
local stack = user:get_wielded_item()
stack:set_count(stack:get_count() - 1)
user:set_wielded_item(stack)
end
})