Many changes

This commit is contained in:
IamPyu 2024-12-15 13:21:09 -06:00
parent 5e59ed8c9d
commit 0030fdc506
22 changed files with 184 additions and 13 deletions

3
.gitmodules vendored
View File

@ -5,3 +5,6 @@
[submodule "mods/mobs_redo"]
path = mods/mobs_redo
url = https://codeberg.org/tenplus1/mobs_redo
[submodule "mods/hudbars"]
path = mods/hudbars
url = https://codeberg.org/Wuzzy/minetest_hudbars

View File

@ -28,6 +28,7 @@ Notable Game Changes:
- Added Golden Apples and Spellbooks of Healing
- Added Lightning
- Added Ambient Sounds
- Added Mana to balance Magic, when you don't have enough Mana to use something your magic tool get's a mind of it's own and damages a 3rd of your health.
Other Game Changes:

View File

@ -13,6 +13,7 @@ Credit for sounds I didn't make and are not made with JFXR:
- Piano F#.wav by pinkyfinger -- https://freesound.org/s/68445/ -- License: Creative Commons 0
- Thunder.wav by IllusiaProductions -- https://freesound.org/s/249950/ -- License: Attribution 4.0
- Carpet nord wind(DR-05x,3lrs,grnlzr,fltr_frk,fltr,Eq).wav by newlocknew -- https://freesound.org/s/528810/ -- License: Attribution 4.0
- motorboat passes underwater sound by andraskollmann -- https://freesound.org/s/325336/ -- License: Creative Commons 0
## Textures

Binary file not shown.

Binary file not shown.

View File

@ -149,3 +149,12 @@ core.register_craft({
{"pyutest_tools:basalt_stick"},
}
})
core.register_craft({
output = "pyutest_magic:arcane_wand",
recipe = {
{"pyutest_blocks:crystal_lantern"},
{"pyutest_tools:basalt_stick"},
{"pyutest_tools:basalt_stick"},
}
})

View File

@ -15,6 +15,7 @@ core.register_craft({
}
})
dofile(modpath .. "/mana.lua")
dofile(modpath .. "/tools.lua")
dofile(modpath .. "/wands.lua")
dofile(modpath .. "/spellbooks.lua")

View File

@ -0,0 +1,70 @@
PyuTest.MAGIC_MANA_MAX = 150
local storage = core.get_mod_storage()
local manas = core.deserialize(storage:get("player_manas")) or {}
PyuTest.get_mana = function (player)
return manas[player]
end
PyuTest.use_mana = function(player, amount)
if PyuTest.get_mana(player) >= amount then
manas[player] = manas[player] - amount
return true
end
core.chat_send_player(player, string.format("Not enough mana! (Need %d)", amount))
local obj = core.get_player_by_name(player)
PyuTest.deal_damage(obj, obj:get_hp() / 3, PyuTest.DAMAGE_TYPES.magic())
core.sound_play("pyutest-magic-negative", {
gain = 1,
player = player,
})
return false
end
local timers = {}
core.register_globalstep(function (dtime)
for i, p in pairs(core.get_connected_players()) do
local name = p:get_player_name()
if timers[name] == nil then
timers[name] = 0
end
timers[name] = timers[name] + (10 * dtime)
if timers[name] > 3 then
if manas[name] < PyuTest.MAGIC_MANA_MAX then
manas[name] = manas[name] + 1
end
timers[name] = 0
end
hb.change_hudbar(p, "mana", manas[name], PyuTest.MAGIC_MANA_MAX)
end
end)
core.register_on_joinplayer(function(player)
local name = player:get_player_name()
if manas[name] == nil then
manas[name] = PyuTest.MAGIC_MANA_MAX
end
hb.init_hudbar(player, "mana", manas[name], PyuTest.MAGIC_MANA_MAX)
end)
local function save_data()
storage:set_string("player_manas", core.serialize(manas))
end
core.register_on_shutdown(save_data)
PyuTest.register_interval(save_data, 10)
hb.register_hudbar("mana", 0xFFFFFF, Translate("Mana"), {
icon = "pyutest-mana.png",
bar = "pyutest-mana-bg.png",
bgicon = "pyutest-mana-bg.png"
}, 0, PyuTest.MAGIC_MANA_MAX, false)

View File

@ -1 +1 @@
depends = pyutest_tools,pyutest_blocks
depends = pyutest_tools,pyutest_blocks,hudbars

View File

@ -1,5 +1,5 @@
PyuTest.registered_spellbooks = {}
PyuTest.make_spellbook = function(nsname, desc, color, craftitem, action)
PyuTest.make_spellbook = function(nsname, desc, color, mana, craftitem, action)
if action == nil then
action = function(_, _, _) end
end
@ -8,6 +8,9 @@ PyuTest.make_spellbook = function(nsname, desc, color, craftitem, action)
stack_max = 1,
color = color,
on_use = function(itemstack, user, pointed_thing)
if not PyuTest.use_mana(user:get_player_name(), mana) then
return
end
local pos = user:get_pos()
core.sound_play({ name = "spellbook_action", gain = 0.75 }, { pos = pos })
action(itemstack, user, pointed_thing)
@ -30,13 +33,13 @@ PyuTest.make_spellbook = function(nsname, desc, color, craftitem, action)
}
end
PyuTest.make_spellbook("pyutest_magic:explosions_spellbook", "Spellbook of Explosions", "gray", "pyutest_tools:bomb",
PyuTest.make_spellbook("pyutest_magic:explosions_spellbook", "Spellbook of Explosions", "gray", 10, "pyutest_tools:bomb",
function(itemstack, user)
PyuTest.create_explosion(user:get_pos(), 2, false, 7, { user })
end)
PyuTest.make_spellbook("pyutest_magic:healing_spellbok", "Spellbook of Healing", "gold",
"pyutest_tools:golden_apple", function (itemstack, user)
30, "pyutest_tools:golden_apple", function (itemstack, user)
for e in core.objects_inside_radius(user:get_pos(), 2) do
PyuTest.deal_damage(e, -10, PyuTest.DAMAGE_TYPES.magic())
end

View File

@ -1,4 +1,4 @@
PyuTest.make_wand = function (id, desc, texture, properties, fns)
PyuTest.make_wand = function (id, desc, texture, mana, properties, fns)
local e_id = id .. "_entity"
core.register_entity(e_id, {
@ -44,6 +44,9 @@ PyuTest.make_wand = function (id, desc, texture, properties, fns)
stack_max = 1,
on_use = function (itemstack, user, pointed_thing)
if not user:is_player() then return itemstack end
if not PyuTest.use_mana(user:get_player_name(), mana) then
return
end
local dir = user:get_look_dir()
local pos = user:get_pos()
@ -65,7 +68,7 @@ PyuTest.make_wand = function (id, desc, texture, properties, fns)
})
end
PyuTest.make_wand("pyutest_magic:ice_wand", "Ice Wand", "pyutest-ice-wand.png", {
PyuTest.make_wand("pyutest_magic:ice_wand", "Ice Wand", "pyutest-ice-wand.png", 20, {
textures = {
"pyutest-ice.png",
"pyutest-ice.png",
@ -108,7 +111,7 @@ PyuTest.make_wand("pyutest_magic:ice_wand", "Ice Wand", "pyutest-ice-wand.png",
end
})
PyuTest.make_wand("pyutest_magic:fire_wand", "Fire Wand", "pyutest-fire-wand.png", {
PyuTest.make_wand("pyutest_magic:fire_wand", "Fire Wand", "pyutest-fire-wand.png", 20, {
textures = {
"pyutest-lava.png",
"pyutest-lava.png",
@ -142,7 +145,7 @@ PyuTest.make_wand("pyutest_magic:fire_wand", "Fire Wand", "pyutest-fire-wand.png
end
})
PyuTest.make_wand("pyutest_magic:arcane_wand", "Arcane Wand", "pyutest-arcane-wand.png", {
PyuTest.make_wand("pyutest_magic:arcane_wand", "Arcane Wand", "pyutest-arcane-wand.png", 33, {
textures = {
"pyutest-crystal-lantern.png",
"pyutest-crystal-lantern.png",
@ -164,3 +167,32 @@ PyuTest.make_wand("pyutest_magic:arcane_wand", "Arcane Wand", "pyutest-arcane-wa
PyuTest.lightning_strike(entity.object:get_pos(), 3)
end
})
PyuTest.make_wand("pyutest_magic:water_wand", "Water Wand", "pyutest-water-wand.png", 15, {
textures = {
"pyutest-water.png",
"pyutest-water.png",
"pyutest-water.png",
"pyutest-water.png",
"pyutest-water.png",
"pyutest-water.png",
}
}, {
predicate = function (entity)
local pos = entity.object:get_pos()
local node = core.get_node(pos)
local walkable = core.registered_nodes[node.name].walkable
return walkable
end,
action = function (entity)
PyuTest.dorange(entity.object:get_pos(), 1, function (p)
local node = core.get_node(p)
local walkable = core.registered_nodes[node.name].walkable
if walkable then return end
core.set_node(p, {name = "pyutest_blocks:water_source"})
end)
end
})

View File

@ -1,3 +1,7 @@
if true then -- replaced with Wuzzy's hudbars mod.
return
end
core.hud_replace_builtin("health", {})
core.hud_replace_builtin("breath", {})
@ -31,7 +35,10 @@ function PyuTest.Hudbar:add(name, def, update)
cfg.position = {x = 0.5, y = 0.925}
cfg.direction = 0
cfg.size = {x = 24, y = 24}
cfg.offset = {x = (-10 * 24 - 25) * -(PyuTest.HUDBARS.defs_count - 1), y = (-48 + 24 + 16)}
cfg.offset = {
x = (-10 * 24 - 25) * -(PyuTest.HUDBARS.defs_count - 1),
y = (-48 + 24 + 16)
}
cfg.text2 = cfg.text2 or "pyutest-bar-empty.png"
local m = setmetatable({

View File

@ -47,9 +47,9 @@ core.register_item(":", {
core.register_globalstep(function ()
for _, v in pairs(core.get_connected_players()) do
local speed_multiplier = 1
local sprint_addition = 0.35
if v:get_player_control().aux1 then
local sprint_addition = 0.35
speed_multiplier = speed_multiplier + sprint_addition
end
@ -57,7 +57,8 @@ core.register_globalstep(function ()
speed = 1.15 * speed_multiplier,
})
v:set_fov(1 + ((speed_multiplier - 1) / 2), true, 0.15)
local fovm = (1 + (speed_multiplier - sprint_addition) / 2)
v:set_fov(fovm, true, 0.15)
end
end)

View File

@ -0,0 +1,36 @@
local pl = {}
local function fill_for(player)
local name = player:get_player_name()
local pos = player:get_pos()
local def = PyuTest.get_biome_def(pos)
if def == nil then
if pl[name] ~= nil then
core.sound_stop(pl[name])
pl[name] = nil
end
return
end
local ambient = def._pyutest_ambient
if ambient == nil then
return
end
if pl[name] == nil then
pl[name] = core.sound_play(ambient, {
player = name,
loop = true
})
end
end
core.register_globalstep(function ()
for _, player in ipairs(core.get_connected_players()) do
fill_for(player)
end
end)

View File

@ -1,3 +1,4 @@
local modpath = core.get_modpath(core.get_current_modname())
dofile(modpath .. "/wind.lua")
dofile(modpath .. "/biomes.lua")

View File

@ -1,6 +1,5 @@
local pl = {}
local function do_wind(player)
local n = player:get_player_name()
@ -12,6 +11,10 @@ local function do_wind(player)
end
end
core.register_on_leaveplayer(function (p)
pl[p:get_player_name()] = nil
end)
core.register_globalstep(function(dtime)
for _, player in ipairs(core.get_connected_players()) do
do_wind(player)

View File

@ -216,7 +216,9 @@ PyuTest.register_overworld_biome = function(name, type, opts, only_base)
humidity_point = nopts["humidity_point"],
y_max = 0,
y_min = PyuTest.OVERWORLD_OCEAN_MIN
y_min = PyuTest.OVERWORLD_OCEAN_MIN,
_pyutest_ambient = "pyutest-underwater"
}, {
_pyutest_biome_type = PyuTest.BIOME_TYPES.OCEAN,
_pyutest_ocean_type = type

1
mods/hudbars Submodule

@ -0,0 +1 @@
Subproject commit bd191abfcd38ffd7ad575620d9fd1c6bf1f2f7cf

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 B

BIN
textures/pyutest-mana.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B