1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-28 03:30:36 +01:00

Merge branch 'NALC2' into NALC

This commit is contained in:
sys4-fr 2017-04-10 03:38:59 +02:00
commit 035d0cc302
4 changed files with 4361 additions and 3937 deletions

View File

@ -109,9 +109,12 @@ elseif minetest.get_modpath("unified_inventory") then
.."list[detached:"..name.."_armor;armor;0,"..fy..";2,3;]" .."list[detached:"..name.."_armor;armor;0,"..fy..";2,3;]"
.."image[2.5,"..(fy - 0.25)..";2,4;"..armor.textures[name].preview.."]" .."image[2.5,"..(fy - 0.25)..";2,4;"..armor.textures[name].preview.."]"
.."label[5.0,"..(fy + 0.0)..";Level: "..armor.def[name].level.."]" .."label[5.0,"..(fy + 0.0)..";Level: "..armor.def[name].level.."]"
.."label[5.0,"..(fy + 0.5)..";Heal: "..armor.def[name].heal.."]" .."label[5.0,"..(fy + 0.4)..";Heal: "..armor.def[name].heal.."]"
.."label[5.0,"..(fy + 1.0)..";Fire: "..armor.def[name].fire.."]" .."label[5.0,"..(fy + 0.8)..";Fire: "..armor.def[name].fire.."]"
.."label[5.0,"..(fy + 1.5)..";Radiation: "..armor.def[name].radiation.."]" .."label[5.0,"..(fy + 1.2)..";Radiation: "..armor.def[name].radiation.."]"
.."label[5.0,"..(fy + 1.6)..";Speed: "..armor.def[name].speed.."]"
.."label[5.0,"..(fy + 2)..";Jump: "..armor.def[name].jump.."]"
.."label[5.0,"..(fy + 2.4)..";Gravity: "..armor.def[name].gravity.."]"
.."listring[current_player;main]" .."listring[current_player;main]"
.."listring[detached:"..name.."_armor;armor]" .."listring[detached:"..name.."_armor;armor]"
return {formspec=formspec} return {formspec=formspec}
@ -302,6 +305,9 @@ armor.get_armor_formspec = function(self, name)
formspec = formspec:gsub("armor_heal", armor.def[name].heal) formspec = formspec:gsub("armor_heal", armor.def[name].heal)
formspec = formspec:gsub("armor_fire", armor.def[name].fire) formspec = formspec:gsub("armor_fire", armor.def[name].fire)
formspec = formspec:gsub("armor_radiation", armor.def[name].radiation) formspec = formspec:gsub("armor_radiation", armor.def[name].radiation)
formspec = formspec:gsub("armor_speed", armor.def[name].speed)
formspec = formspec:gsub("armor_jump", armor.def[name].jump)
formspec = formspec:gsub("armor_gravity", armor.def[name].gravity)
return formspec return formspec
end end

View File

@ -150,6 +150,9 @@ local function punch_filter(data, filtpos, filtnode, msg)
local v_mul = vector.multiply(dir, 2) local v_mul = vector.multiply(dir, 2)
frompos = vector.subtract(filtpos, v_mul) frompos = vector.subtract(filtpos, v_mul)
fromnode = minetest.get_node(frompos) fromnode = minetest.get_node(frompos)
if fromnode and fromnode.name ~= "connected_chests:chest_left" then
return
end
end end
if not fromnode then return end if not fromnode then return end

File diff suppressed because it is too large Load Diff

View File

@ -1,426 +1,480 @@
--scrolls --scrolls
minetest.register_craftitem(
"witchcraft:scroll_day",
{
description = "Scroll of day",
inventory_image = "witchcraft_scroll.png^witchcraft_sun_over.png",
stack_max = 1,
on_use = function(item)
minetest.set_timeofday(0.5)
item:take_item()
return item
end,
})
minetest.register_craftitem("witchcraft:scroll_day", { minetest.register_craftitem(
description = "Scroll of day", "witchcraft:scroll_night",
inventory_image = "witchcraft_scroll.png^witchcraft_sun_over.png", {
stack_max = 1, description = "Scroll of night",
on_use = function(item) inventory_image = "witchcraft_scroll.png^witchcraft_moon_over.png",
minetest.set_timeofday(0.5) stack_max = 1,
item:take_item() on_use = function(item)
return item minetest.set_timeofday(0)
end, item:take_item()
}) return item
end,
})
minetest.register_craftitem("witchcraft:scroll_night", { if minetest.get_modpath("pmobs") then
description = "Scroll of night", minetest.register_craftitem(
inventory_image = "witchcraft_scroll.png^witchcraft_moon_over.png", "witchcraft:scroll_wild",
stack_max = 1, {
on_use = function(item) description = "Scroll of Wild",
minetest.set_timeofday(0) inventory_image = "witchcraft_scroll.png^witchcraft_dark_over.png",
item:take_item() stack_max = 1,
return item on_use = function(item, placer)
end, local pos = placer:getpos();
}) minetest.add_entity(pos, "pmobs:dog")
item:take_item()
if minetest.get_modpath("pmobs")then return item
minetest.register_craftitem("witchcraft:scroll_wild", { end,
description = "Scroll of Wild", })
inventory_image = "witchcraft_scroll.png^witchcraft_dark_over.png",
stack_max = 1,
on_use = function(item, placer)
local pos = placer:getpos();
minetest.env:add_entity(pos, "pmobs:dog")
item:take_item()
return item
end,
})
end end
minetest.register_craftitem("witchcraft:scroll_fireball", { minetest.register_craftitem(
description = "Scroll of fireball", "witchcraft:scroll_fireball",
inventory_image = "witchcraft_scroll.png^witchcraft_fire_over.png", {
stack_max = 1, description = "Scroll of fireball",
on_use = function(item, placer, pos) inventory_image = "witchcraft_scroll.png^witchcraft_fire_over.png",
local dir = placer:get_look_dir(); stack_max = 1,
local playerpos = placer:getpos(); on_use = function(item, placer, pos)
local obj = minetest.env:add_entity({x=playerpos.x+dir.x*1.5,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "witchcraft:fireball") local dir = placer:get_look_dir();
local obj2 = minetest.env:add_entity({x=playerpos.x+dir.x*1.5,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "witchcraft:fireball") local playerpos = placer:getpos();
local obj3 = minetest.env:add_entity({x=playerpos.x+dir.x*1.5,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "witchcraft:fireball") local obj = minetest.add_entity(
local obj4 = minetest.env:add_entity({x=playerpos.x+dir.x*1.5,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "witchcraft:fireball") {x=playerpos.x+dir.x*1.5,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z},
obj2:setvelocity({x=dir.x*7+0.5,y=dir.y*7,z=dir.z*7+0.5}) "witchcraft:fireball")
obj3:setvelocity({x=dir.x*7-0.5,y=dir.y*7,z=dir.z*7-0.5}) local obj2 = minetest.add_entity(
obj4:setvelocity({x=dir.x*7,y=dir.y*7-0.5,z=dir.z*7}) {x=playerpos.x+dir.x*1.5,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z},
obj:setvelocity({x=dir.x*7,y=dir.y*7+0.5,z=dir.z*7}) "witchcraft:fireball")
item:take_item() local obj3 = minetest.add_entity(
return item {x=playerpos.x+dir.x*1.5,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z},
end, "witchcraft:fireball")
}) local obj4 = minetest.add_entity(
{x=playerpos.x+dir.x*1.5,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z},
"witchcraft:fireball")
obj2:setvelocity({x=dir.x*7+0.5,y=dir.y*7,z=dir.z*7+0.5})
obj3:setvelocity({x=dir.x*7-0.5,y=dir.y*7,z=dir.z*7-0.5})
obj4:setvelocity({x=dir.x*7,y=dir.y*7-0.5,z=dir.z*7})
obj:setvelocity({x=dir.x*7,y=dir.y*7+0.5,z=dir.z*7})
item:take_item()
return item
end,
})
if minetest.get_modpath("lightning") then if minetest.get_modpath("lightning") then
minetest.register_craftitem("witchcraft:scroll_lightning", { minetest.register_craftitem(
description = "Scroll of lightning", "witchcraft:scroll_lightning",
inventory_image = "witchcraft_scroll.png^witchcraft_thunder_over.png", {
stack_max = 1, description = "Scroll of lightning",
on_use = function(item, placer, pos) inventory_image = "witchcraft_scroll.png^witchcraft_thunder_over.png",
local playerpos = placer:getpos(); stack_max = 1,
local dir = placer:get_look_dir(); on_use = function(item, placer, pos)
lightning.strike({x=playerpos.x+dir.x*2,y=playerpos.y+0+dir.y,z=playerpos.z+dir.z*2}) local playerpos = placer:getpos();
item:take_item() local dir = placer:get_look_dir();
return item lightning.strike({x=playerpos.x+dir.x*2,y=playerpos.y+0+dir.y,z=playerpos.z+dir.z*2})
end, item:take_item()
}) return item
end,
})
end end
minetest.register_craftitem("witchcraft:scroll_icicle", { minetest.register_craftitem(
description = "Scroll of icicle", "witchcraft:scroll_icicle",
inventory_image = "witchcraft_scroll.png^witchcraft_ice_over.png", {
stack_max = 1, description = "Scroll of icicle",
on_use = function(item, placer, pos) inventory_image = "witchcraft_scroll.png^witchcraft_ice_over.png",
local dir = placer:get_look_dir(); stack_max = 1,
local playerpos = placer:getpos(); on_use = function(item, placer, pos)
local vec = {x=dir.x*7,y=dir.y*7,z=dir.z*7} local dir = placer:get_look_dir();
local obj = minetest.env:add_entity({x=playerpos.x+dir.x*1.5,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "witchcraft:ice") local playerpos = placer:getpos();
local obj2 = minetest.env:add_entity({x=playerpos.x+dir.x*1.5,y=playerpos.y+1.5+dir.y,z=playerpos.z+1+dir.z}, "witchcraft:ice") local vec = {x=dir.x*7,y=dir.y*7,z=dir.z*7}
local obj3 = minetest.env:add_entity({x=playerpos.x+1+dir.x*1.5,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "witchcraft:ice") local obj = minetest.add_entity({x=playerpos.x+dir.x*1.5,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "witchcraft:ice")
obj:setvelocity(vec) local obj2 = minetest.add_entity({x=playerpos.x+dir.x*1.5,y=playerpos.y+1.5+dir.y,z=playerpos.z+1+dir.z}, "witchcraft:ice")
obj2:setvelocity(vec) local obj3 = minetest.add_entity({x=playerpos.x+1+dir.x*1.5,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "witchcraft:ice")
obj3:setvelocity(vec) obj:setvelocity(vec)
obj2:setvelocity(vec)
item:take_item() obj3:setvelocity(vec)
return item
end, item:take_item()
}) return item
end,
})
minetest.register_craftitem(
"witchcraft:scroll_nature",
{
description = "Scroll of nature",
inventory_image = "witchcraft_scroll.png^witchcraft_leaf_over.png",
stack_max = 1,
on_use = function(item, placer, pos)
local dir = placer:get_look_dir();
local playerpos = placer:getpos();
local vec = {x=dir.x*6,y=dir.y*6,z=dir.z*6}
local obj = minetest.add_entity({x=playerpos.x+dir.x*1.5,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "witchcraft:tree")
obj:setvelocity(vec)
item:take_item()
return item
end,
})
minetest.register_craftitem("witchcraft:scroll_nature", { minetest.register_craftitem(
description = "Scroll of nature", "witchcraft:scroll",
inventory_image = "witchcraft_scroll.png^witchcraft_leaf_over.png", {
stack_max = 1, description = "Blank Scroll",
on_use = function(item, placer, pos) inventory_image = "witchcraft_scroll.png",
local dir = placer:get_look_dir(); })
local playerpos = placer:getpos();
local vec = {x=dir.x*6,y=dir.y*6,z=dir.z*6}
local obj = minetest.env:add_entity({x=playerpos.x+dir.x*1.5,y=playerpos.y+1.5+dir.y,z=playerpos.z+0+dir.z}, "witchcraft:tree")
obj:setvelocity(vec)
item:take_item()
return item
end,
})
minetest.register_craftitem("witchcraft:scroll", { minetest.register_craftitem(
description = "Blank Scroll", "witchcraft:scroll_recipe",
inventory_image = "witchcraft_scroll.png", {
}) description = "Recipe Scroll",
inventory_image = "witchcraft_scroll.png^witchcraft_writing_over.png",
minetest.register_craftitem("witchcraft:scroll_recipe", { on_use = function(itemstack, user, pointed_thing)
description = "Recipe Scroll", local formspec = "size[10,9]"..
inventory_image = "witchcraft_scroll.png^witchcraft_writing_over.png", "background[-0.6,-0.5;11.5,10.4;witchcraft_recipes.png]";
on_use = function(itemstack, user, pointed_thing)
minetest.show_formspec(user:get_player_name(), "witchcraft:scroll", formspec);
local formspec = "size[10,9]".. end,
"background[-0.6,-0.5;11.5,10.4;witchcraft_recipes.png]"; })
minetest.show_formspec(user:get_player_name(), "witchcraft:scroll", formspec);
end,
})
if minetest.get_modpath("pmobs")then if minetest.get_modpath("pmobs")then
minetest.register_craft({ minetest.register_craft(
output = 'witchcraft:scroll_wild', {
recipe = { output = 'witchcraft:scroll_wild',
{'mobs:meat_raw'}, recipe = {
{'witchcraft:scroll'}, {'mobs:meat_raw'},
} {'witchcraft:scroll'},
}) }
})
end end
minetest.register_craft({ minetest.register_craft(
output = 'witchcraft:scroll', {
recipe = { output = 'witchcraft:scroll',
{'default:paper', 'default:paper', ''}, recipe = {
{'default:paper', 'default:paper', ''}, {'default:paper', 'default:paper', ''},
} {'default:paper', 'default:paper', ''},
}) }
})
minetest.register_craft({ minetest.register_craft(
output = 'witchcraft:scroll_recipe', {
recipe = { output = 'witchcraft:scroll_recipe',
{'dye:black'}, recipe = {
{'witchcraft:scroll'}, {'dye:black'},
} {'witchcraft:scroll'},
}) }
})
minetest.register_craft({ minetest.register_craft(
output = 'witchcraft:scroll_icicle', {
recipe = { output = 'witchcraft:scroll_icicle',
{'default:ice'}, recipe = {
{'default:diamond'}, {'default:ice'},
{'witchcraft:scroll'}, {'default:diamond'},
} {'witchcraft:scroll'},
}) }
})
minetest.register_craft({ minetest.register_craft(
output = 'witchcraft:scroll_fireball', {
recipe = { output = 'witchcraft:scroll_fireball',
{'default:obsidian_shard'}, recipe = {
{'default:diamond'}, {'default:obsidian_shard'},
{'witchcraft:scroll'}, {'default:diamond'},
} {'witchcraft:scroll'},
}) }
})
minetest.register_craft({ minetest.register_craft(
output = 'witchcraft:scroll_nature', {
recipe = { output = 'witchcraft:scroll_nature',
{'default:leaves'}, recipe = {
{'default:diamond'}, {'default:leaves'},
{'witchcraft:scroll'}, {'default:diamond'},
} {'witchcraft:scroll'},
}) }
})
minetest.register_craft({ minetest.register_craft(
output = 'witchcraft:scroll_day', {
recipe = { output = 'witchcraft:scroll_day',
{'default:torch'}, recipe = {
{'default:diamond'}, {'default:torch'},
{'witchcraft:scroll'}, {'default:diamond'},
} {'witchcraft:scroll'},
}) }
})
minetest.register_craft({ minetest.register_craft(
output = 'witchcraft:scroll_night', {
recipe = { output = 'witchcraft:scroll_night',
{'default:coal_lump'}, recipe = {
{'default:diamond'}, {'default:coal_lump'},
{'witchcraft:scroll'}, {'default:diamond'},
} {'witchcraft:scroll'},
}) }
})
minetest.register_craft({ minetest.register_craft(
output = 'witchcraft:scroll_lightning', {
recipe = { output = 'witchcraft:scroll_lightning',
{'default:steel_ingot'}, recipe = {
{'default:diamond'}, {'default:steel_ingot'},
{'witchcraft:scroll'}, {'default:diamond'},
} {'witchcraft:scroll'},
}) }
})
--scroll powers --scroll powers
minetest.register_entity("witchcraft:fireball", { minetest.register_entity(
textures = {"tnt_boom.png"}, "witchcraft:fireball",
velocity = 0.1, {
damage = 2, textures = {"tnt_boom.png"},
collisionbox = {0, 0, 0, 0, 0, 0}, velocity = 0.1,
on_step = function(self, obj, pos) damage = 2,
local remove = minetest.after(2, function() collisionbox = {0, 0, 0, 0, 0, 0},
self.object:remove() on_step = function(self, obj, pos)
end) local remove = minetest.after(
local pos = self.object:getpos() 2,
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2) function()
self.object:remove()
end)
local pos = self.object:getpos()
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "witchcraft:fireball" and obj:get_luaentity().name ~= "__builtin:item" then if obj:get_luaentity().name ~= "witchcraft:fireball"
obj:punch(self.object, 1.0, { and obj:get_luaentity().name ~= "__builtin:item"
full_punch_interval=1.0, and obj:get_luaentity().name ~= "gauges:hp_bar"
damage_groups={fleshy=3}, then
}, nil) obj:punch(
self.object:remove() self.object, 1.0,
{
full_punch_interval=1.0,
damage_groups={fleshy=3},
}, nil)
self.object:remove()
end end
end end
end end
for dx=0,1 do for dx=0,1 do
for dy=0,1 do for dy=0,1 do
for dz=0,1 do for dz=0,1 do
local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz} local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz} local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name local n = minetest.get_node(p).name
if n ~= "witchcraft:fireball" and n ~="default:dirt_with_grass" and n ~="default:dirt_with_dry_grass" and n ~="default:stone" then if n ~= "witchcraft:fireball" and n ~="default:dirt_with_grass"
if minetest.registered_nodes[n].groups.flammable --[[or math.random(1, 100) <= 1]] then and n ~="default:dirt_with_dry_grass" and n ~="default:stone" then
minetest.env:set_node(t, {name="fire:basic_flame"}) if minetest.registered_nodes[n].groups.flammable --[[or math.random(1, 100) <= 1]] then
self.object:remove() minetest.set_node(t, {name="fire:basic_flame"})
return self.object:remove()
end return
end
end end
end end
end end
end
end
hit_node = function(self, pos, node) hit_node = function(self, pos, node)
-- local pos = self.object:getpos() -- local pos = self.object:getpos()
for dx=-4,4 do for dx=-4,4 do
for dy=-4,4 do for dy=-4,4 do
for dz=-4,4 do for dz=-4,4 do
local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz} local p = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz} local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(pos).name local n = minetest.get_node(pos).name
if math.random(1, 50) <= 35 then if math.random(1, 50) <= 35 then
minetest.env:remove_node(p) minetest.remove_node(p)
end end
if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <=5 then if minetest.registered_nodes[n].groups.flammable or math.random(1, 100) <=5 then
minetest.env:set_node(t, {name="fire:basic_flame"}) minetest.set_node(t, {name="fire:basic_flame"})
end
end
end end
end end
end end
end
end
local apos = self.object:getpos() local apos = self.object:getpos()
local vec = self.object:getvelocity() local vec = self.object:getvelocity()
local part = minetest.add_particlespawner( local part = minetest.add_particlespawner(
6, --amount 6, --amount
0.3, --time 0.3, --time
{x=apos.x-0.3, y=apos.y-0.3, z=apos.z-0.3}, --minpos {x=apos.x-0.3, y=apos.y-0.3, z=apos.z-0.3}, --minpos
{x=apos.x+0.3, y=apos.y+0.3, z=apos.z+0.3}, --maxpos {x=apos.x+0.3, y=apos.y+0.3, z=apos.z+0.3}, --maxpos
{x=-0, y=-0, z=-0}, --minvel {x=-0, y=-0, z=-0}, --minvel
{x=0, y=0, z=0}, --maxvel {x=0, y=0, z=0}, --maxvel
{x=0,y=-0.5,z=0}, --minacc {x=0,y=-0.5,z=0}, --minacc
{x=-vec.x,y=-vec.y,z=-vec.z}, --maxacc {x=-vec.x,y=-vec.y,z=-vec.z}, --maxacc
0.1, --minexptime 0.1, --minexptime
0.3, --maxexptime 0.3, --maxexptime
1, --minsize 1, --minsize
2, --maxsize 2, --maxsize
false, --collisiondetection false, --collisiondetection
"witchcraft_flame.png" --texture "witchcraft_flame.png" --texture
) )
end, end,
}) })
minetest.register_entity("witchcraft:tree", { minetest.register_entity(
textures = {"witchcraft_skin.png"}, "witchcraft:tree",
velocity = 1, {
damage = 2, textures = {"witchcraft_skin.png"},
collisionbox = {0, 0, 0, 0, 0, 0}, velocity = 1,
on_step = function(self, obj, pos) damage = 2,
local remove = minetest.after(2, function() collisionbox = {0, 0, 0, 0, 0, 0},
self.object:remove() on_step = function(self, obj, pos)
end) local remove = minetest.after(
local pos = self.object:getpos() 2,
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2) function()
self.object:remove()
end)
local pos = self.object:getpos()
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "witchcraft:tree" and obj:get_luaentity().name ~= "__builtin:item" then if obj:get_luaentity().name ~= "witchcraft:tree"
and obj:get_luaentity().name ~= "__builtin:item"
and obj:get_luaentity().name ~= "gauges:hp_bar"
then
obj:remove() obj:remove()
local treepos = self.object:getpos() local treepos = self.object:getpos()
default.grow_new_jungle_tree(treepos) default.grow_new_jungle_tree(treepos)
self.object:remove() self.object:remove()
end end
end end
end end
for dx=0,1 do for dx=0,1 do
for dy=0,1 do for dy=0,1 do
for dz=0,1 do for dz=0,1 do
local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz} local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz} local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local n = minetest.env:get_node(p).name local n = minetest.get_node(p).name
if n ~= "witchcraft:tree" and n ~="air" then if n ~= "witchcraft:tree" and n ~="air" then
local treepos = self.object:getpos() local treepos = self.object:getpos()
default.grow_new_jungle_tree(treepos) default.grow_new_jungle_tree(treepos)
self.object:remove() self.object:remove()
elseif n == "default:wood" or n =="default:tree" or n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then elseif n == "default:wood" or n =="default:tree" or n =="default:dirt_with_grass" or n =="default:dirt_with_dry_grass" then
self.hit_node(self, pos, node) self.hit_node(self, pos, node)
self.object:remove() self.object:remove()
return return
end
end
end end
end end
end
end
hit_node = function(self, pos, node) hit_node = function(self, pos, node)
local treepos = self.object:getpos() local treepos = self.object:getpos()
default.grow_new_jungle_tree(treepos) default.grow_new_jungle_tree(treepos)
end end
local apos = self.object:getpos()
local part = minetest.add_particlespawner(
6, --amount
0.3, --time
{x=apos.x-0.3, y=apos.y-0.3, z=apos.z-0.3}, --minpos
{x=apos.x+0.3, y=apos.y+0.3, z=apos.z+0.3}, --maxpos
{x=-0, y=-0, z=-0}, --minvel
{x=0, y=0, z=0}, --maxvel
{x=0,y=-0.5,z=0}, --minacc
{x=0.5,y=0.5,z=0.5}, --maxacc
0.1, --minexptime
0.3, --maxexptime
1, --minsize
2, --maxsize
false, --collisiondetection
"witchcraft_leaf_over.png" --texture
)
end,
})
local apos = self.object:getpos() minetest.register_entity(
local part = minetest.add_particlespawner( "witchcraft:ice",
6, --amount {
0.3, --time visual="sprite",
{x=apos.x-0.3, y=apos.y-0.3, z=apos.z-0.3}, --minpos visual_size={x=1,y=1},
{x=apos.x+0.3, y=apos.y+0.3, z=apos.z+0.3}, --maxpos physical=false,
{x=-0, y=-0, z=-0}, --minvel textures={"witchcraft_ice.png"},
{x=0, y=0, z=0}, --maxvel velocity = 1,
{x=0,y=-0.5,z=0}, --minacc rotate = 90,
{x=0.5,y=0.5,z=0.5}, --maxacc auto_rotate = true,
0.1, --minexptime damage = 2,
0.3, --maxexptime collisionbox = {0, 0, 0, 0, 0, 0},
1, --minsize on_step = function(self, obj, pos)
2, --maxsize local remove = minetest.after(10, function()
false, --collisiondetection self.object:remove()
"witchcraft_leaf_over.png" --texture end)
) local pos = self.object:getpos()
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
end,
})
minetest.register_entity("witchcraft:ice", {
visual="sprite",
visual_size={x=1,y=1},
physical=false,
textures={"witchcraft_ice.png"},
velocity = 1,
rotate = 90,
auto_rotate = true,
damage = 2,
collisionbox = {0, 0, 0, 0, 0, 0},
on_step = function(self, obj, pos)
local remove = minetest.after(10, function()
self.object:remove()
end)
local pos = self.object:getpos()
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
for k, obj in pairs(objs) do for k, obj in pairs(objs) do
if obj:get_luaentity() ~= nil then if obj:get_luaentity() ~= nil then
if obj:get_luaentity().name ~= "witchcraft:ice" and obj:get_luaentity().name ~= "__builtin:item" then if obj:get_luaentity().name ~= "witchcraft:ice"
obj:punch(self.object, 1.0, { and obj:get_luaentity().name ~= "__builtin:item"
full_punch_interval=1.0, and obj:get_luaentity().name ~= "gauges:hp_bar"
damage_groups={fleshy=1}, then
}, nil) obj:punch(
self.object:remove() self.object, 1.0,
{
full_punch_interval=1.0,
damage_groups={fleshy=1},
}, nil)
self.object:remove()
end
end end
end for dx=0,1 do
for dx=0,1 do for dy=0,1 do
for dy=0,1 do for dz=0,1 do
for dz=0,1 do local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz}
local p = {x=pos.x+dx, y=pos.y, z=pos.z+dz} local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz}
local t = {x=pos.x+dx, y=pos.y+dy, z=pos.z+dz} local n = minetest.get_node(p).name
local n = minetest.env:get_node(p).name if n == "default:water_source" or n =="default:river_water_source" then
if n == "default:water_source" or n =="default:river_water_source" then
local pos = self.object:getpos() local pos = self.object:getpos()
minetest.set_node(pos, {name="default:ice"}) minetest.set_node(pos, {name="default:ice"})
self.object:remove() self.object:remove()
elseif n ~= "air" then elseif n ~= "air" then
local velo = self.object:getvelocity() local velo = self.object:getvelocity()
self.object:setvelocity({x=velo.x*-1, y=velo.y*0, z=velo.z*1}) self.object:setvelocity({x=velo.x*-1, y=velo.y*0, z=velo.z*1})
--self.object:remove() --self.object:remove()
return return
end
end end
end end
end end
end
local apos = self.object:getpos() local apos = self.object:getpos()
local part = minetest.add_particlespawner( local part = minetest.add_particlespawner(
10, --amount 10, --amount
0.3, --time 0.3, --time
{x=apos.x-0.3, y=apos.y-0.3, z=apos.z-0.3}, --minpos {x=apos.x-0.3, y=apos.y-0.3, z=apos.z-0.3}, --minpos
{x=apos.x+0.3, y=apos.y+0.3, z=apos.z+0.3}, --maxpos {x=apos.x+0.3, y=apos.y+0.3, z=apos.z+0.3}, --maxpos
{x=-0, y=-0, z=-0}, --minvel {x=-0, y=-0, z=-0}, --minvel
{x=0, y=0, z=0}, --maxvel {x=0, y=0, z=0}, --maxvel
{x=0,y=-0.5,z=0}, --minacc {x=0,y=-0.5,z=0}, --minacc
{x=0.5,y=0.5,z=0.5}, --maxacc {x=0.5,y=0.5,z=0.5}, --maxacc
0.1, --minexptime 0.1, --minexptime
0.3, --maxexptime 0.3, --maxexptime
0.2, --minsize 0.2, --minsize
0.5, --maxsize 0.5, --maxsize
false, --collisiondetection false, --collisiondetection
"witchcraft_light_over.png" --texture "witchcraft_light_over.png" --texture
) )
end end
end end
}) })