Backup changes before going on a new distro hopping adventure
This commit is contained in:
parent
d9237a9686
commit
247d6b3c5d
@ -3,6 +3,7 @@
|
||||
## [Oct 12th - **STILL UNDER DEVELOPMENT** 2024] Update: Building Update
|
||||
|
||||
- Added Stained Glass
|
||||
- Start working on a new entity API to replace mobs_redo
|
||||
|
||||
## [Oct 6th - Oct 12th 2024] Update: Texture Update
|
||||
|
||||
|
109
mods/ENTITIES/pyutest_entities/api.lua
Normal file
109
mods/ENTITIES/pyutest_entities/api.lua
Normal file
@ -0,0 +1,109 @@
|
||||
-- local PATH_FIND_ALGORITHM = "Dijkstra"
|
||||
local PATH_FIND_ALGORITHM = "A*_noprefetch"
|
||||
|
||||
PyuTest.ENTITY_BLOOD_AMOUNT = 6
|
||||
PyuTest.HUMAN_LIKE_CBOX = {-0.25, -1, -0.25, 0.25, 1, 0.25}
|
||||
|
||||
PyuTest.get_nearest_entity = function (self, pos, range, only_player)
|
||||
local closet_distance = math.huge
|
||||
local nearest
|
||||
|
||||
for obj in minetest.objects_inside_radius(pos, range) do
|
||||
local dist = vector.distance(pos, obj:get_pos())
|
||||
|
||||
if dist < closet_distance and obj ~= self then
|
||||
if only_player then
|
||||
if obj:is_player() then
|
||||
closet_distance = dist
|
||||
nearest = obj
|
||||
end
|
||||
else
|
||||
closet_distance = dist
|
||||
nearest = obj
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return nearest
|
||||
end
|
||||
|
||||
PyuTest.make_mob = function (name, properties, options)
|
||||
local default_options = {
|
||||
ai = "dummy",
|
||||
max_jump = 1,
|
||||
max_drop = 8,
|
||||
speed = 3,
|
||||
view_range = 3,
|
||||
sight_range = 10,
|
||||
}
|
||||
local cfg = {}
|
||||
|
||||
for k, v in pairs(options) do
|
||||
cfg[k] = v
|
||||
end
|
||||
|
||||
for k, v in pairs(default_options) do
|
||||
if cfg[k] == nil then
|
||||
cfg[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
local collisionbox = properties.collisionbox or PyuTest.HUMAN_LIKE_CBOX
|
||||
|
||||
minetest.register_entity(name, {
|
||||
initial_properties = PyuTest.util.tableconcat(properties, {
|
||||
physical = true,
|
||||
collide_with_objects = true,
|
||||
stepheight = properties.stepheight or 1.1,
|
||||
collisionbox = collisionbox,
|
||||
selectionbox = properties.selectionbox or collisionbox
|
||||
}),
|
||||
options = cfg,
|
||||
data = {
|
||||
target = {
|
||||
object = nil,
|
||||
position = nil,
|
||||
path = nil,
|
||||
pathindex = nil
|
||||
}
|
||||
},
|
||||
|
||||
on_step = function (self, dtime, moveresult)
|
||||
local obj = self.object
|
||||
local pos = obj:get_pos()
|
||||
local ai = self.options.ai
|
||||
local data = self.data
|
||||
|
||||
if ai == nil or ai == "dummy" then
|
||||
return
|
||||
end
|
||||
|
||||
if ai == "follownearest" then
|
||||
if data.target.path == nil then
|
||||
data.target.object = PyuTest.get_nearest_entity(obj, pos, cfg.sight_range, true)
|
||||
|
||||
if data.target.object == nil then
|
||||
return
|
||||
end
|
||||
|
||||
data.target.position = data.target.object:get_pos()
|
||||
data.target.path = minetest.find_path(pos, data.target.position, cfg.view_range, cfg.max_jump, cfg.max_drop, PATH_FIND_ALGORITHM)
|
||||
data.target.pathindex = 1
|
||||
else
|
||||
if data.target.pathindex == #data.target.path then
|
||||
data.target.path = nil
|
||||
data.target.object = nil
|
||||
data.target.position = nil
|
||||
data.target.pathindex = nil
|
||||
else
|
||||
local p = data.target.path[data.target.pathindex]
|
||||
-- obj:move_to(p, true)
|
||||
obj:move_to(p, true)
|
||||
obj:set_yaw(vector.angle(data.target.object:get_pos(), obj:get_pos()))
|
||||
data.target.pathindex = data.target.pathindex + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
17
mods/ENTITIES/pyutest_entities/init.lua
Normal file
17
mods/ENTITIES/pyutest_entities/init.lua
Normal file
@ -0,0 +1,17 @@
|
||||
local modpath = minetest.get_modpath("pyutest_entities")
|
||||
dofile(modpath .. "/api.lua")
|
||||
|
||||
PyuTest.make_mob("pyutest_entities:test_follower", {
|
||||
hp_max = 2,
|
||||
visual = "upright_sprite",
|
||||
visual_size = {x = 1, y = 2},
|
||||
makes_footstep_sound = true,
|
||||
textures = {
|
||||
"player.png", "player_back.png"
|
||||
},
|
||||
nametag = "Test Follower"
|
||||
}, {
|
||||
ai = "follownearest",
|
||||
max_jump = 1,
|
||||
view_range = 3,
|
||||
})
|
1
mods/ENTITIES/pyutest_entities/mod.conf
Normal file
1
mods/ENTITIES/pyutest_entities/mod.conf
Normal file
@ -0,0 +1 @@
|
||||
depends = pyutest_blocks
|
@ -1,6 +1,3 @@
|
||||
PyuTest.ENTITY_BLOOD_AMOUNT = 6
|
||||
PyuTest.HUMAN_LIKE_CBOX = {-0.25, -1, -0.25, 0.25, 1, 0.25}
|
||||
|
||||
PyuTest.create_boss_egg = function(mob_id, desc, texture, addegg, no_creative, craft)
|
||||
mobs:register_egg(mob_id, desc, texture, addegg, no_creative)
|
||||
|
||||
|
@ -1 +1 @@
|
||||
depends = pyutest_blocks,mobs,pyutest_mapgen
|
||||
depends = pyutest_blocks,mobs,pyutest_mapgen,pyutest_entities
|
||||
|
@ -132,7 +132,7 @@ PyuTest.make_building_blocks("pyutest_blocks:mushroom_stem", "Mushroom Stem", {
|
||||
}, { is_ground_content = false })
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:glowshroom", "Glowshroom", {
|
||||
"pyutest-purple-mushroom.png"
|
||||
"pyutest-glowshroom.png"
|
||||
}, nil, {
|
||||
flammable = 1,
|
||||
choppy = PyuTest.BLOCK_FAST
|
||||
@ -156,7 +156,7 @@ PyuTest.make_building_blocks("pyutest_blocks:slime", "Slime", { "pyutest-slime.p
|
||||
oddly_breakable_by_hand = PyuTest.BLOCK_FAST
|
||||
})
|
||||
|
||||
PyuTest.make_building_blocks("pyutest_blocks:glowslime", "Glowslime", { "pyutest-slime.png" }, nil, {
|
||||
PyuTest.make_building_blocks("pyutest_blocks:glowslime", "Glowslime", { "pyutest-slime.png" }, "gray", {
|
||||
bouncy = 85,
|
||||
oddly_breakable_by_hand = PyuTest.BLOCK_FAST
|
||||
}, {
|
||||
|
@ -32,14 +32,7 @@ PyuTest.register_structure = function (name, schematic, def)
|
||||
nodenames = {id},
|
||||
action = function (pos, node)
|
||||
minetest.remove_node(pos)
|
||||
minetest.place_schematic(
|
||||
pos,
|
||||
PyuTest.get_schem_path(schematic),
|
||||
def.rotation or "random",
|
||||
def.replacements or {},
|
||||
def.force_placement or true,
|
||||
def.flags or "place_center_x, place_center_z"
|
||||
)
|
||||
minetest.place_schematic(pos, PyuTest.get_schem_path(schematic), def.rotation or "random", def.replacements or {}, def.force_placement or true, def.flags or "place_center_x, place_center_z")
|
||||
end
|
||||
})
|
||||
end
|
||||
|
@ -75,7 +75,7 @@ minetest.register_decoration({
|
||||
deco_type = "schematic",
|
||||
place_on = {"group:grass"},
|
||||
sidelen = 16,
|
||||
fill_ratio = 0.004,
|
||||
fill_ratio = 0.03,
|
||||
biomes = {"forest"},
|
||||
schematic = PyuTest.get_schem_path("Tree"),
|
||||
rotation = "random",
|
||||
@ -138,7 +138,7 @@ minetest.register_decoration({
|
||||
deco_type = "schematic",
|
||||
place_on = {"group:grass"},
|
||||
sidelen = 16,
|
||||
fill_ratio = 0.005,
|
||||
fill_ratio = 0.03,
|
||||
biomes = {"birch_forest"},
|
||||
schematic = PyuTest.get_schem_path("BirchTree"),
|
||||
rotation = "random",
|
||||
@ -150,7 +150,7 @@ minetest.register_decoration({
|
||||
deco_type = "schematic",
|
||||
place_on = {"group:grass"},
|
||||
sidelen = 16,
|
||||
fill_ratio = 0.005,
|
||||
fill_ratio = 0.02,
|
||||
biomes = {"birch_forest", "old_growth_birch_forest"},
|
||||
schematic = PyuTest.get_schem_path("TallBirchTree"),
|
||||
rotation = "random",
|
||||
|
@ -27,20 +27,9 @@ PyuTest.LavaWorld:register_ore({
|
||||
ore_type = "blob",
|
||||
ore = "pyutest_blocks:lava_source",
|
||||
wherein = "pyutest_blocks:molten_rock_block",
|
||||
clust_scarcity = 7.5 * 7.5 * 7.5,
|
||||
clust_scarcity = 9 * 9 * 9,
|
||||
clust_num_ores = 1,
|
||||
clust_size = 2,
|
||||
biomes = {lava_cavern},
|
||||
noise_params = PyuTest.SPECIALSTONE_NOISE_PARAMS
|
||||
})
|
||||
|
||||
PyuTest.LavaWorld:register_ore({
|
||||
ore_type = "blob",
|
||||
ore = "pyutest_blocks:lava_source",
|
||||
wherein = "pyutest_blocks:molten_rock_block",
|
||||
clust_scarcity = 14.5 * 14.5 * 14.5,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 6,
|
||||
biomes = {lava_cavern},
|
||||
noise_params = PyuTest.SPECIALSTONE_NOISE_PARAMS
|
||||
})
|
||||
|
@ -7,26 +7,15 @@ PyuTest.MushroomWorld:create_token("pyutest_worlds:mushroom_world_token", "Mushr
|
||||
|
||||
local mushroom_forest = PyuTest.MushroomWorld:register_biome({
|
||||
name = "mushroom_forest",
|
||||
node_stone = "pyutest_blocks:mycelium_block",
|
||||
node_stone = "pyutest_blocks:mushroom_block",
|
||||
heat_point = 36,
|
||||
humidity_point = 0
|
||||
})
|
||||
|
||||
PyuTest.MushroomWorld:register_ore({
|
||||
ore_type = "blob",
|
||||
ore = "pyutest_blocks:mushroom_block",
|
||||
wherein = "pyutest_blocks:mycelium_block",
|
||||
clust_scarcity = 4.5 * 4.5 * 4.5,
|
||||
clust_num_ores = 6,
|
||||
clust_size = 5,
|
||||
biomes = {mushroom_forest},
|
||||
noise_params = PyuTest.SPECIALSTONE_NOISE_PARAMS
|
||||
})
|
||||
|
||||
PyuTest.MushroomWorld:register_ore({
|
||||
ore_type = "blob",
|
||||
ore = "pyutest_blocks:mushroom_stem_block",
|
||||
wherein = "pyutest_blocks:mycelium_block",
|
||||
wherein = "pyutest_blocks:mushroom_block",
|
||||
clust_scarcity = 9.5 * 9.5 * 9.5,
|
||||
clust_num_ores = 6,
|
||||
clust_size = 5,
|
||||
@ -37,7 +26,7 @@ PyuTest.MushroomWorld:register_ore({
|
||||
PyuTest.MushroomWorld:register_ore({
|
||||
ore_type = "blob",
|
||||
ore = "pyutest_blocks:glowshroom_block",
|
||||
wherein = "pyutest_blocks:mycelium_block",
|
||||
wherein = "pyutest_blocks:mushroom_block",
|
||||
clust_scarcity = 4.5 * 4.5 * 4.5,
|
||||
clust_num_ores = 6,
|
||||
clust_size = 5,
|
||||
@ -47,7 +36,7 @@ PyuTest.MushroomWorld:register_ore({
|
||||
|
||||
PyuTest.MushroomWorld:register_decoration({
|
||||
deco_type = "schematic",
|
||||
place_on = {"pyutest_blocks:mycelium_block"},
|
||||
place_on = {"pyutest_blocks:mushroom_block"},
|
||||
sidelen = 16,
|
||||
fill_ratio = 0.006,
|
||||
biomes = PyuTest.MushroomWorld.biome_names,
|
||||
|
BIN
textures/pyutest-glowshroom.png
Normal file
BIN
textures/pyutest-glowshroom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 256 B |
Loading…
x
Reference in New Issue
Block a user