New items and features

This commit is contained in:
IamPyu 2024-06-08 16:12:55 -06:00
parent 4062c9bbe8
commit 1d4908360e
14 changed files with 131 additions and 11 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "mods/unified_inventory"]
path = mods/unified_inventory
url = https://github.com/minetest-mods/unified_inventory

View File

@ -2,6 +2,8 @@
Pyu's Minetest Game
![screenshot](./screenshot.png)
## Notes so I can remember some parts of the Minetest API
### Groups

BIN
menu/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

View File

@ -1,2 +1,2 @@
creative_mode = true
bomb_range = 2
unified_inventory_lite = true

View File

@ -5,6 +5,6 @@ minetest.register_abm({
interval = 0.1,
chance = 1,
action = function (pos)
minetest.set_node(pos, {name = "air"})
minetest.remove_node(pos)
end
})

View File

@ -24,6 +24,38 @@ PyuTestCore.make_node = function(nsname, sname, desc, groups, tiles, extra_conf)
minetest.register_alias(sname, nsname)
end
PyuTestCore.make_wool_and_carpet = function (color, dcolor, tex, colorspec)
local name_wool = color.."_wool"
local name_carpet = color.."_carpet"
local desc_wool = dcolor .. " Wool"
local desc_carpet = dcolor .. " Carpet"
local groups = {
block = PyuTestCore.BLOCK_BREAKABLE_NORMAL
}
minetest.register_node("pyutest_core:"..name_wool, {
description = Translate(desc_wool),
tiles = {tex},
color = colorspec,
groups = groups
})
minetest.register_node("pyutest_core:"..name_carpet, {
description = Translate(desc_carpet),
tiles = {tex},
groups = groups,
color = colorspec,
drawtype = "nodebox",
paramtype = "light",
paramtyp2 = "facedir",
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -0.45, 0.5}
}
})
end
PyuTestCore.make_liquid = function (nsname, sname, desc, groups, tiles)
local function make_liquid_flags(liquidtype)
local drawtype = ""
@ -83,7 +115,7 @@ PyuTestCore.make_node("pyutest_core:light", "light", "Light", {
}, {
"light.png"
}, {
light_source = 14,
light_source = minetest.LIGHT_MAX,
})
PyuTestCore.make_node("pyutest_core:torch", "torch", "Torch", {
@ -93,10 +125,11 @@ PyuTestCore.make_node("pyutest_core:torch", "torch", "Torch", {
}, {
"torch.png"
}, {
light_source = 14,
light_source = 12,
walkable = false,
drawtype = "torchlike",
paramtype = "light"
paramtype = "light",
inventory_image = "torch.png"
})
PyuTestCore.make_node("pyutest_core:sponge", "sponge", "Sponge", {
@ -127,7 +160,8 @@ PyuTestCore.make_node("pyutest_core:flower", "flower", "Flower", {
waving = 2,
buildable_to = true,
paramtype = "light",
sunlight_propagates = true
sunlight_propagates = true,
inventory_image = "flower.png"
})
PyuTestCore.make_node("pyutest_core:iron", "iron", "Iron", {
@ -135,6 +169,15 @@ PyuTestCore.make_node("pyutest_core:iron", "iron", "Iron", {
block = PyuTestCore.BLOCK_BREAKABLE_LONG
}, {"iron.png"})
PyuTestCore.make_wool_and_carpet("white", "White", "wool.png", "white")
PyuTestCore.make_wool_and_carpet("red", "Red", "wool.png", "red")
PyuTestCore.make_wool_and_carpet("orange", "Orange", "wool.png", "orange")
PyuTestCore.make_wool_and_carpet("yellow", "Yellow", "wool.png", "yellow")
PyuTestCore.make_wool_and_carpet("green", "Green", "wool.png", "green")
PyuTestCore.make_wool_and_carpet("blue", "Blue", "wool.png", "blue")
PyuTestCore.make_wool_and_carpet("purple", "Purple", "wool.png", "purple")
PyuTestCore.make_wool_and_carpet("black", "Black", "wool.png", "black")
PyuTestCore.make_liquid("pyutest_core:water", "water", "Water", {}, {"water.png"})

View File

@ -3,7 +3,13 @@ PyuTestCore = {
BLOCK_BREAKABLE_INSTANT = 0,
BLOCK_BREAKABLE_NORMAL = 1,
BLOCK_BREAKABLE_LONG = 2,
BLOCK_BREAKABLE_FOREVER = 3
BLOCK_BREAKABLE_FOREVER = 3,
util = {
toint = function (float)
return tonumber(string.format("%d", float))
end
}
}
local path = minetest.get_modpath("pyutest_core")
@ -11,6 +17,7 @@ dofile(path.."/blocks.lua")
dofile(path.."/mapgen.lua")
dofile(path.."/abms.lua")
dofile(path.."/tools.lua")
dofile(path.."/player.lua")
-- player hand
minetest.register_item(":", {
@ -18,13 +25,13 @@ minetest.register_item(":", {
wield_image = "hand.png"
})
minetest.override_item('', {
minetest.override_item("", {
range = 10,
tool_capabilities = {
groupcaps = {
block = {
times = {
[PyuTestCore.BLOCK_BREAKABLE_INSTANT] = 0.075,
[PyuTestCore.BLOCK_BREAKABLE_INSTANT] = 0.25,
[PyuTestCore.BLOCK_BREAKABLE_NORMAL] = 0.4,
[PyuTestCore.BLOCK_BREAKABLE_LONG] = 4,
[PyuTestCore.BLOCK_BREAKABLE_FOREVER] = 12

View File

@ -0,0 +1,38 @@
-- player privs
minetest.register_on_joinplayer(function(player)
minetest.set_player_privs(player:get_player_name(), {
interact = true,
shout = true,
fly = true,
fast = true,
noclip = true,
give = true,
teleport = true,
bring = true,
settime = true
})
end)
-- player hand
minetest.register_item(":", {
type = "none",
wield_image = "hand.png"
})
minetest.override_item("", {
range = 10,
tool_capabilities = {
groupcaps = {
block = {
times = {
[PyuTestCore.BLOCK_BREAKABLE_INSTANT] = 0.25,
[PyuTestCore.BLOCK_BREAKABLE_NORMAL] = 0.4,
[PyuTestCore.BLOCK_BREAKABLE_LONG] = 4,
[PyuTestCore.BLOCK_BREAKABLE_FOREVER] = 12
},
uses = 0,
}
},
punch_attack_uses = 0
}
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

View File

@ -34,4 +34,29 @@ PyuTestCore.make_tool("pyutest_core:pickaxe", "pickaxe", "Pickaxe", {}, "pickaxe
}
})
PyuTestCore.make_tool("pyutest_core:stick", "stick", "Stick", {}, "stick.png")
PyuTestCore.make_tool("pyutest_core:stick", "stick", "Stick", {}, "stick.png", {
stack_max = 99
})
PyuTestCore.make_tool("pyutest_core:bomb", "bomb", "Bomb", {}, "bomb.png", {
on_use = function (itemstack, user)
if user == nil then
return
end
local pos = user:get_pos()
local range = tonumber(minetest.settings:get("bomb_range")) or 2
for dx = -range, range do
for dz = -range, range do
for dy = -range, range do
minetest.remove_node({x = pos.x + dx, y = pos.y + dy, z = pos.z + dz})
end
end
end
minetest.sound_play("block_break", {
pos = pos,
gain = 1
})
end
})

@ -0,0 +1 @@
Subproject commit 2c9449b6e796c5a4bcf832b10595c5a78e237dc6

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 KiB

1
settingtypes.txt Normal file
View File

@ -0,0 +1 @@
bomb_range (Bomb Explosion Range) int 2 1