A lot more changes, notably adding shears and a failed attempt to fix

bedrock spawning
This commit is contained in:
IamPyu 2024-10-15 17:09:08 -06:00
parent 3e99d422ef
commit e2ab26594d
12 changed files with 103 additions and 17 deletions

View File

@ -169,3 +169,37 @@ PyuTest.tool_caps = function(options)
full_punch_interval = options.full_punch_interval
}
end
-- https://github.com/minetest/minetest_game/blob/master/mods/stairs/init.lua#L27
PyuTest.rotate_and_place = function(itemstack, placer, pointed_thing)
local p0 = pointed_thing.under
local p1 = pointed_thing.above
local param2 = 0
if placer then
local placer_pos = placer:get_pos()
if placer_pos then
local diff = vector.subtract(p1, placer_pos)
param2 = minetest.dir_to_facedir(diff)
-- The player places a node on the side face of the node he is standing on
if p0.y == p1.y and math.abs(diff.x) <= 0.5 and math.abs(diff.z) <= 0.5 and diff.y < 0 then
-- reverse node direction
param2 = (param2 + 2) % 4
end
end
local finepos = minetest.pointed_thing_to_face_pos(placer, pointed_thing)
local fpos = finepos.y % 1
if p0.y - 1 == p1.y or (fpos > 0 and fpos < 0.5)
or (fpos < -0.5 and fpos > -0.999999999) then
param2 = param2 + 20
if param2 == 21 then
param2 = 23
elseif param2 == 23 then
param2 = 21
end
end
end
return minetest.item_place(itemstack, placer, pointed_thing, param2)
end

View File

@ -1,5 +1,6 @@
-- local PATH_FIND_ALGORITHM = "Dijkstra"
local PATH_FIND_ALGORITHM = "A*_noprefetch"
local PATH_FIND_ALGORITHM = "Dijkstra"
-- local PATH_FIND_ALGORITHM = "A*_noprefetch"
-- local PATH_FIND_ALGORITHM = "A*"
PyuTest.ENTITY_BLOOD_AMOUNT = 6
PyuTest.HUMAN_LIKE_CBOX = {-0.25, -1, -0.25, 0.25, 1, 0.25}
@ -35,6 +36,8 @@ PyuTest.make_mob = function (name, properties, options)
speed = 3,
view_range = 3,
sight_range = 10,
gravity = true,
gravity_multiplier = 1
}
local cfg = {}
@ -56,7 +59,8 @@ PyuTest.make_mob = function (name, properties, options)
collide_with_objects = true,
stepheight = properties.stepheight or 1.1,
collisionbox = collisionbox,
selectionbox = properties.selectionbox or collisionbox
selectionbox = properties.selectionbox or collisionbox,
show_on_minimap = properties.show_on_minimap or true
}),
options = cfg,
data = {
@ -97,8 +101,7 @@ PyuTest.make_mob = function (name, properties, options)
data.target.pathindex = nil
else
local p = data.target.path[data.target.pathindex]
-- obj:move_to(p, true)
obj:move_to(p, true)
obj:move_to(p)
obj:set_yaw(vector.angle(data.target.object:get_pos(), obj:get_pos()))
data.target.pathindex = data.target.pathindex + 1
end

View File

@ -55,7 +55,7 @@ mobs:register_mob("pyutest_mobs:human", {
visual_size = {x = 1, y = 2},
collisionbox = PyuTest.HUMAN_LIKE_CBOX,
textures = {"player.png", "player_back.png"},
follow = {"pyutest_mobs:coin"},
follow = {"pyutest_tools:coin"},
runaway = true,
view_range = 15,
reach = 2,

View File

@ -105,6 +105,7 @@ PyuTest.make_building_blocks = function(name, desc, tex, colortint, cgroups, ext
groups = groups,
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
node_box = PyuTest.node_boxes.SLAB,
sounds = PyuTest.make_node_sounds(),
}, econf))
@ -116,7 +117,7 @@ PyuTest.make_building_blocks = function(name, desc, tex, colortint, cgroups, ext
drawtype = "nodebox",
paramtype = "light",
node_box = PyuTest.node_boxes.PILLAR,
sounds = PyuTest.make_node_sounds(),
sounds = PyuTest.make_node_sounds()
}, econf))
minetest.register_node(id_stairs, PyuTest.util.tableconcat({

View File

@ -88,6 +88,15 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = "pyutest_tools:shears",
recipe = {
"pyutest_ores:iron_ingot",
"pyutest_ores:iron_ingot"
},
type = "shapeless"
})
minetest.register_craft({
output = "pyutest_tools:diamond_pickaxe",
recipe = {

View File

@ -1,4 +1,4 @@
PyuTest.make_leaves = function(id, desc, color, overlay, special_drops)
PyuTest.make_leaves = function(id, desc, color, overlay, special_drops, drops)
local leaves_id = id .. "_leaves_block"
PyuTest.make_node(leaves_id, desc .. " Leaves", {
acid_vulnerable = 1,
@ -14,7 +14,7 @@ PyuTest.make_leaves = function(id, desc, color, overlay, special_drops)
})
if special_drops == nil or special_drops == true then
minetest.override_item(leaves_id, {
drop = {
drop = drops or {
max_items = 1,
items = {
{
@ -38,6 +38,9 @@ PyuTest.make_leaves = function(id, desc, color, overlay, special_drops)
},
{
tool_groups = {
"shears"
},
items = {leaves_id}
}
}

View File

@ -36,7 +36,8 @@ end
PyuTest.make_sword = function (nsname, desc, texture, damage, durability, atkspeed)
PyuTest.make_tool(nsname, desc, {
weapon = 1
weapon = 1,
sword = 1
}, texture, {
stack_max = 1,
tool_capabilities = PyuTest.tool_caps({

View File

@ -131,6 +131,34 @@ PyuTest.make_tool("pyutest_tools:diamond_axe", "Diamond Axe", {}, "pyutest-diamo
})
})
PyuTest.make_tool("pyutest_tools:shears", "Shears", {
shears = 1
}, "pyutest-shears.png", {
stack_max = 1,
tool_capabilities = PyuTest.tool_caps({
uses = 100,
attack_uses = 50,
groupcaps = {
snappy = {
times = {
[PyuTest.BLOCK_FAST] = 0.2,
[PyuTest.BLOCK_NORMAL] = 0.3,
[PyuTest.BLOCK_SLOW] = 0.4
}
},
wooly = {
times = {
[PyuTest.BLOCK_FAST] = 0.2,
[PyuTest.BLOCK_NORMAL] = 0.3,
[PyuTest.BLOCK_SLOW] = 0.4
}
}
}
})
})
PyuTest.make_item("pyutest_tools:bomb", "Bomb", {}, "pyutest-bomb.png", {
stack_max = 16,
on_use = function (_, user)

View File

@ -3,14 +3,14 @@ PyuTest.make_colored_blocks = function(name, desc, color)
PyuTest.make_building_blocks(name.."_wool", desc.." Wool", {
"pyutest-wool.png"
}, color or "white", {
oddly_breakable_by_hand = PyuTest.BLOCK_NORMAL,
wooly = PyuTest.BLOCK_NORMAL,
colored = 1
})
PyuTest.make_building_blocks(name.."_terracotta", desc .. " Terracotta", {
"pyutest-terracotta.png"
}, color or "white", {
cracky = PyuTest.BLOCK_FAST,
cracky = PyuTest.BLOCK_NORMAL,
colored = 1
})

View File

@ -23,7 +23,7 @@ PyuTest.register_world = function (options)
minetest.register_decoration({
deco_type = "simple",
decoration = "pyutest_blocks:bedrock",
sidelen = 8,
sidelen = 80,
fill_ratio = 10,
y_min = conf.y_max,
y_max = conf.y_max,
@ -33,7 +33,7 @@ PyuTest.register_world = function (options)
minetest.register_decoration({
deco_type = "simple",
decoration = "pyutest_blocks:bedrock",
sidelen = 8,
sidelen = 80,
fill_ratio = 10,
y_min = conf.y_min,
y_max = conf.y_min,

View File

@ -57,14 +57,14 @@ if minetest.is_creative_enabled("") then
range = 9,
tool_capabilities = PyuTest.tool_caps({
uses = 0,
time = 0.20,
time = 0.25,
groupcaps = {
crumbly = {},
choppy = {},
cracky = {},
snappy = {},
explody = {},
wooly = {},
oddly_breakable_by_hand = {}
},
@ -115,7 +115,14 @@ else
[PyuTest.BLOCK_NORMAL] = 10,
[PyuTest.BLOCK_SLOW] = 45,
}
}
},
wooly = {
times = {
[PyuTest.BLOCK_FAST] = 0.55,
[PyuTest.BLOCK_NORMAL] = 0.70,
[PyuTest.BLOCK_SLOW] = 0.70
}
},
}
})
})

BIN
textures/pyutest-shears.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B