FrostWalker
parent
bbc6db489e
commit
4d37e309e7
|
@ -189,7 +189,7 @@ mcl_enchanting.enchantments.fortune = {
|
|||
requires_tool = false,
|
||||
}
|
||||
|
||||
-- unimplemented
|
||||
-- implemented using walkover.register_global
|
||||
mcl_enchanting.enchantments.frost_walker = {
|
||||
name = "Frost Walker",
|
||||
max_level = 2,
|
||||
|
@ -204,6 +204,23 @@ mcl_enchanting.enchantments.frost_walker = {
|
|||
requires_tool = false,
|
||||
}
|
||||
|
||||
walkover.register_global(function(pos, _, player)
|
||||
local boots = player:get_inventory():get_stack("armor", 5)
|
||||
local frost_walker = mcl_enchanting.get_enchantment(boots, "frost_walker")
|
||||
if frost_walker <= 0 then
|
||||
return
|
||||
end
|
||||
local radius = frost_walker + 2
|
||||
local minp = {x = pos.x - radius, y = pos.y, z = pos.z - radius}
|
||||
local maxp = {x = pos.x + radius, y = pos.y, z = pos.z + radius}
|
||||
local positions = minetest.find_nodes_in_area_under_air(minp, maxp, "mcl_core:water_source")
|
||||
for _, p in ipairs(positions) do
|
||||
if vector.distance(pos, p) <= radius then
|
||||
minetest.set_node(p, {name = "mcl_core:frosted_ice_0"})
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- implemented in mcl_bows
|
||||
mcl_enchanting.enchantments.infinity = {
|
||||
name = "Infinity",
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
local modpath = minetest.get_modpath("mcl_enchanting")
|
||||
|
||||
mcl_enchanting = {
|
||||
lapis_itemstring = "mcl_dye:blue",
|
||||
book_offset = vector.new(0, 0.75, 0),
|
||||
roman_numerals = dofile(modpath .. "/roman_numerals.lua"), -- https://exercism.io/tracks/lua/exercises/roman-numerals/solutions/73c2fb7521e347209312d115f872fa49
|
||||
enchantments = {},
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name = mcl_enchanting
|
||||
description = The rewrite of the Enchanting mod for MineClone2
|
||||
depends = mcl_formspec, tt, mcl_books
|
||||
depends = mcl_formspec, tt, mcl_books, walkover
|
||||
optional_depends = screwdriver
|
||||
author = Fleckenstein
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
-- register extra flavours of a base nodedef
|
||||
walkover = {}
|
||||
walkover.registered_globals = {}
|
||||
|
||||
function walkover.register_global(func)
|
||||
table.insert(walkover.registered_globals, func)
|
||||
end
|
||||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime)
|
||||
timer = timer + dtime;
|
||||
|
@ -10,11 +17,15 @@ minetest.register_globalstep(function(dtime)
|
|||
if loc ~= nil then
|
||||
|
||||
local nodeiamon = minetest.get_node(loc)
|
||||
|
||||
if nodeiamon ~= nil then
|
||||
local def = minetest.registered_nodes[nodeiamon.name]
|
||||
if def ~= nil and def.on_walk_over ~= nil then
|
||||
def.on_walk_over(loc, nodeiamon, player)
|
||||
end
|
||||
for _, func in ipairs(walkover.registered_globals) do
|
||||
func(loc, nodeiamon, player)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue