htspells completly renewed
i have based the spells on PilzAdams throwing mod since it is more effective. Added some wands also. You still cannot craft anything at the moment. You need to get it via creative or /give command.master
|
@ -152,7 +152,7 @@ end
|
|||
|
||||
local on_mdoor_punched = function( pos, node, puncher )
|
||||
local tool = puncher:get_wielded_item():get_name()
|
||||
if tool and tool == "htspells:alohomora" then
|
||||
if tool and tool == "unlockcharm:alohomora" then
|
||||
if string.find( node.name, 'harrytest:mdoor_wood' ) == nil then return end
|
||||
|
||||
local upos = { x = pos.x, y = pos.y - 1, z = pos.z }
|
||||
|
|
Before Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 245 B |
Before Width: | Height: | Size: 249 B |
Before Width: | Height: | Size: 216 B |
Before Width: | Height: | Size: 216 B |
|
@ -0,0 +1,85 @@
|
|||
minetest.register_craftitem("htspells:arrow_build", {
|
||||
description = "Build Arrow",
|
||||
inventory_image = "htspells_arrow_build.png",
|
||||
})
|
||||
|
||||
minetest.register_node("htspells:arrow_build_box", {
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
-- Shaft
|
||||
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
|
||||
--Spitze
|
||||
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
|
||||
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
|
||||
--Federn
|
||||
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
|
||||
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
|
||||
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
|
||||
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
|
||||
|
||||
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
|
||||
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
|
||||
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
|
||||
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
|
||||
}
|
||||
},
|
||||
tiles = {"htspells_arrow_build.png", "htspells_arrow_build.png", "htspells_arrow_build_back.png", "htspells_arrow_build_front.png", "htspells_arrow_build_2.png", "htspells_arrow_build.png"},
|
||||
groups = {not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
local THROWING_ARROW_ENTITY={
|
||||
physical = false,
|
||||
timer=0,
|
||||
visual = "wielditem",
|
||||
visual_size = {x=0.1, y=0.1},
|
||||
textures = {"htspells:arrow_build_box"},
|
||||
lastpos={},
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
node = "",
|
||||
}
|
||||
|
||||
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
self.timer=self.timer+dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.env:get_node(pos)
|
||||
|
||||
if self.timer>0.2 then
|
||||
local objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "htspells:arrow_build_entity" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if self.node ~= "" then
|
||||
minetest.env:set_node(self.lastpos, {name=self.node})
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
else
|
||||
if self.node ~= "" then
|
||||
minetest.env:set_node(self.lastpos, {name=self.node})
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.lastpos.x~=nil then
|
||||
if node.name ~= "air" then
|
||||
if self.node ~= "" then
|
||||
minetest.env:set_node(self.lastpos, {name=self.node})
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||
end
|
||||
|
||||
minetest.register_entity("htspells:arrow_build_entity", THROWING_ARROW_ENTITY)
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'htspells:arrow_build',
|
||||
recipe = {
|
||||
{'default:stick', 'default:stick', 'default:shovel_steel'},
|
||||
}
|
||||
})
|
|
@ -1 +1,3 @@
|
|||
default
|
||||
default
|
||||
bucket
|
||||
fire
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
minetest.register_craftitem("htspells:arrow_dig", {
|
||||
description = "Dig Arrow",
|
||||
inventory_image = "htspells_arrow_dig.png",
|
||||
})
|
||||
|
||||
minetest.register_node("htspells:arrow_dig_box", {
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
-- Shaft
|
||||
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
|
||||
--Spitze
|
||||
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
|
||||
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
|
||||
--Federn
|
||||
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
|
||||
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
|
||||
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
|
||||
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
|
||||
|
||||
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
|
||||
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
|
||||
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
|
||||
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
|
||||
}
|
||||
},
|
||||
tiles = {"htspells_arrow_dig.png", "htspells_arrow_dig.png", "htspells_arrow_dig_back.png", "htspells_arrow_dig_front.png", "htspells_arrow_dig_2.png", "htspells_arrow_dig.png"},
|
||||
groups = {not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
local THROWING_ARROW_ENTITY={
|
||||
physical = false,
|
||||
timer=0,
|
||||
visual = "wielditem",
|
||||
visual_size = {x=0.1, y=0.1},
|
||||
textures = {"htspells:arrow_dig_box"},
|
||||
lastpos={},
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
}
|
||||
|
||||
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
self.timer=self.timer+dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.env:get_node(pos)
|
||||
|
||||
if self.timer>0.2 then
|
||||
local objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "htspells:arrow_dig_entity" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
minetest.env:add_item(pos, 'htspells:arrow_dig')
|
||||
minetest.env:remove_node(pos)
|
||||
self.object:remove()
|
||||
end
|
||||
else
|
||||
minetest.env:add_item(pos, 'htspells:arrow_dig')
|
||||
minetest.env:remove_node(pos)
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.lastpos.x~=nil then
|
||||
if node.name ~= "air" then
|
||||
minetest.env:add_item(self.lastpos, 'htspells:arrow_dig')
|
||||
minetest.env:remove_node(pos)
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||
end
|
||||
|
||||
minetest.register_entity("htspells:arrow_dig_entity", THROWING_ARROW_ENTITY)
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'htspells:arrow_dig',
|
||||
recipe = {
|
||||
{'default:stick', 'default:stick', 'default:pick_steel'},
|
||||
}
|
||||
})
|
|
@ -0,0 +1,125 @@
|
|||
minetest.register_craftitem("htspells:spell_fire", {
|
||||
description = "Incendio",
|
||||
inventory_image = "htspells_spell_fire.png",
|
||||
})
|
||||
|
||||
minetest.register_node("htspells:spell_fire_box", {
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
-- Shaft
|
||||
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
|
||||
--Spitze
|
||||
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
|
||||
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
|
||||
--Federn
|
||||
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
|
||||
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
|
||||
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
|
||||
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
|
||||
|
||||
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
|
||||
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
|
||||
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
|
||||
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
|
||||
}
|
||||
},
|
||||
tiles = {"htspells_spell_fire.png", "htspells_spell_fire.png", "htspells_spell_fire_back.png", "htspells_spell_fire_front.png", "htspells_spell_fire_2.png", "htspells_spell_fire.png"},
|
||||
groups = {not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
local HTSPELLS_SPELL_ENTITY={
|
||||
physical = false,
|
||||
timer=0,
|
||||
visual = "wielditem",
|
||||
visual_size = {x=0.1, y=0.1},
|
||||
textures = {"htspells:spell_fire_box"},
|
||||
lastpos={},
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
}
|
||||
|
||||
HTSPELLS_SPELL_ENTITY.on_step = function(self, dtime)
|
||||
self.timer=self.timer+dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.env:get_node(pos)
|
||||
|
||||
if self.timer>0.2 then
|
||||
local objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "htspells:spell_fire_entity" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
local damage = 5
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval=1.0,
|
||||
groupcaps={
|
||||
fleshy={times={[1]=1/(damage-2), [2]=1/(damage-1), [3]=1/damage}},
|
||||
snappy={times={[1]=1/(damage-2), [2]=1/(damage-1), [3]=1/damage}},
|
||||
}
|
||||
}, nil)
|
||||
self.object:remove()
|
||||
end
|
||||
else
|
||||
local damage = 5
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval=1.0,
|
||||
groupcaps={
|
||||
fleshy={times={[1]=1/(damage-2), [2]=1/(damage-1), [3]=1/damage}},
|
||||
snappy={times={[1]=1/(damage-2), [2]=1/(damage-1), [3]=1/damage}},
|
||||
}
|
||||
}, nil)
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.lastpos.x~=nil then
|
||||
if node.name ~= "air" and node.name ~= "htspells:light" then
|
||||
minetest.env:set_node(self.lastpos, {name="fire:basic_flame"})
|
||||
self.object:remove()
|
||||
end
|
||||
if math.floor(self.lastpos.x+0.5) ~= math.floor(pos.x+0.5) or math.floor(self.lastpos.y+0.5) ~= math.floor(pos.y+0.5) or math.floor(self.lastpos.z+0.5) ~= math.floor(pos.z+0.5) then
|
||||
if minetest.env:get_node(self.lastpos).name == "htspells:light" then
|
||||
minetest.env:remove_node(self.lastpos)
|
||||
end
|
||||
if minetest.env:get_node(pos).name == "air" then
|
||||
minetest.env:set_node(pos, {name="htspells:light"})
|
||||
end
|
||||
end
|
||||
end
|
||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||
end
|
||||
|
||||
minetest.register_entity("htspells:spell_fire_entity", HTSPELLS_SPELL_ENTITY)
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'htspells:spell_fire 4',
|
||||
recipe = {
|
||||
{'default:stick', 'default:stick', 'bucket:bucket_lava'},
|
||||
},
|
||||
replacements = {
|
||||
{"bucket:bucket_lava", "bucket:bucket_empty"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("htspells:light", {
|
||||
drawtype = "glasslike",
|
||||
tiles = {"htspells_empty.png"},
|
||||
light_source = LIGHT_MAX-4,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{0,0,0,0,0,0}
|
||||
}
|
||||
},
|
||||
groups = {not_in_creative_inventory=1}
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"htspells:light"},
|
||||
interval = 10,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
minetest.env:remove_node(pos)
|
||||
end
|
||||
})
|
|
@ -1,124 +1,99 @@
|
|||
--[
|
||||
--PotterTest Mod Made by LandMine
|
||||
--This subfolder of the mod contains all spells
|
||||
--Licence: WTFPL
|
||||
--]
|
||||
|
||||
---Functions
|
||||
|
||||
|
||||
-- Spells
|
||||
|
||||
|
||||
----1. Aguamenti - Sends out water
|
||||
|
||||
minetest.register_tool("htspells:aguamenti", {
|
||||
description = "Aguamenti Spell",
|
||||
inventory_image = "aqua.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=10, maxlevel=2},
|
||||
snappy={times={[2]=0.70, [3]=0.30}, uses=40, maxlevel=1},
|
||||
choppy={times={[3]=0.70}, uses=40, maxlevel=0}
|
||||
}
|
||||
},
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
minetest.env:set_node(pointed_thing.above, {name="default:water_source"})
|
||||
end
|
||||
})
|
||||
|
||||
----2. Incendio - Sends out fire
|
||||
|
||||
minetest.register_tool("htspells:incendio", {
|
||||
description = "Inendio Spell",
|
||||
inventory_image = "flame.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=10, maxlevel=2},
|
||||
snappy={times={[2]=0.70, [3]=0.30}, uses=40, maxlevel=1},
|
||||
choppy={times={[3]=0.70}, uses=40, maxlevel=0}
|
||||
}
|
||||
},
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
minetest.env:set_node(pointed_thing.above, {name="fire:basic_flame"})
|
||||
end
|
||||
})
|
||||
|
||||
----3. Alohomora - Unlocks doors
|
||||
minetest.register_tool("htspells:alohomora", {
|
||||
description = "Alohomora Spell",
|
||||
inventory_image = "key.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=10, maxlevel=2},
|
||||
snappy={times={[2]=0.70, [3]=0.30}, uses=40, maxlevel=1},
|
||||
choppy={times={[3]=0.70}, uses=40, maxlevel=0}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
----4. Lumos - Illuminates the tip of the caster's wand.
|
||||
minetest.register_tool("htspells:lumos", {
|
||||
description = "Lumos Spell",
|
||||
inventory_image = "lumos.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=10, maxlevel=2},
|
||||
snappy={times={[2]=0.70, [3]=0.30}, uses=40, maxlevel=1},
|
||||
choppy={times={[3]=0.70}, uses=40, maxlevel=0}
|
||||
}
|
||||
},
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
minetest.env:set_node(pointed_thing.above, {name="default:torch"})
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
----5. Bombarda - Provokes a small explosion.
|
||||
|
||||
minetest.register_tool("htspells:bombarda", {
|
||||
description = "Bombarda Spell",
|
||||
inventory_image = "flame.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=10, maxlevel=2},
|
||||
snappy={times={[2]=0.70, [3]=0.30}, uses=40, maxlevel=1},
|
||||
choppy={times={[3]=0.70}, uses=40, maxlevel=0}
|
||||
}
|
||||
},
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
boom(pos)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_entity("htspells:smoke", {
|
||||
physical = true,
|
||||
visual = "sprite",
|
||||
textures = {"smoke.png"},
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
|
||||
timer = 0,
|
||||
time = 5,
|
||||
|
||||
on_activate = function(self, staticdata)
|
||||
self.object:setacceleration({x=math.random(0,10)/10-0.5, y=5, z=math.random(0,10)/10-0.5})
|
||||
self.time = math.random(1, 10)/10
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
self.timer = self.timer+dtime
|
||||
if self.timer > self.time then
|
||||
self.object:remove()
|
||||
end
|
||||
end,
|
||||
})
|
||||
spells = {
|
||||
{"htspells:spell", "htspells:spell_entity"},
|
||||
{"htspells:spell_fire", "htspells:spell_fire_entity"},
|
||||
{"htspells:spell_teleport", "htspells:spell_teleport_entity"},
|
||||
{"htspells:spell_dig", "htspells:spell_dig_entity"},
|
||||
{"htspells:spell_build", "htspells:spell_build_entity"}
|
||||
}
|
||||
|
||||
local htspells_shoot_spell = function(itemstack, player)
|
||||
for _,stack in ipairs(player:get_inventory():get_list("main")) do
|
||||
for _,spell in ipairs(spells) do
|
||||
if stack:get_name() == spell[1] then
|
||||
player:get_inventory():remove_item("main", spell[1])
|
||||
local playerpos = player:getpos()
|
||||
local obj = minetest.env:add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, spell[2])
|
||||
local dir = player:get_look_dir()
|
||||
obj:setvelocity({x=dir.x*19, y=dir.y*19, z=dir.z*19})
|
||||
obj:setacceleration({x=dir.x*-3, y=-10, z=dir.z*-3})
|
||||
obj:setyaw(player:get_look_yaw()+math.pi)
|
||||
minetest.sound_play("throwing_sound", {pos=playerpos})
|
||||
if obj:get_luaentity().player == "" then
|
||||
obj:get_luaentity().player = player
|
||||
end
|
||||
obj:get_luaentity().node = player:get_inventory():get_stack("main", 1):get_name()
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
minetest.register_tool("htspells:wand_basic", {
|
||||
description = "Basic Wand",
|
||||
inventory_image = "wand2.png",
|
||||
stack_max = 1,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if htspells_shoot_spell(itemstack, user, pointed_thing) then
|
||||
itemstack:add_wear(65535/50)
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'htspells:wand_basic',
|
||||
recipe = {
|
||||
{'', '', ''},
|
||||
{'', 'default:stick', ''},
|
||||
{'default:stick', 'default:stick', 'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_tool("htspells:wand_normal", {
|
||||
description = "Wand",
|
||||
inventory_image = "wand3.png",
|
||||
stack_max = 1,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if htspells_shoot_spell(item, user, pointed_thing) then
|
||||
itemstack:add_wear(65535/100)
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'htspells:wand_normal',
|
||||
recipe = {
|
||||
{'', '', ''},
|
||||
{'default:stick', 'default:stick', 'default:stick'},
|
||||
{'default:stick', 'default:stick', 'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_tool("htspells:wand_advanced", {
|
||||
description = "Advanced Wand",
|
||||
inventory_image = "wand4.png",
|
||||
stack_max = 1,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if htspells_shoot_spell(item, user, pointed_thing) then
|
||||
itemstack:add_wear(65535/200)
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'htspells:wand_advanced',
|
||||
recipe = {
|
||||
{'', '', ''},
|
||||
{'default:stick', 'default:stick', ''},
|
||||
{'default:stick', 'default:stick', 'default:stick'},
|
||||
}
|
||||
})
|
||||
|
||||
dofile(minetest.get_modpath("htspells").."/spell.lua")
|
||||
dofile(minetest.get_modpath("htspells").."/fire_spell.lua")
|
||||
dofile(minetest.get_modpath("htspells").."/teleport_spell.lua")
|
||||
dofile(minetest.get_modpath("htspells").."/dig_spell.lua")
|
||||
dofile(minetest.get_modpath("htspells").."/build_spell.lua")
|
|
@ -0,0 +1,92 @@
|
|||
minetest.register_craftitem("htspells:spell", {
|
||||
description = "Spell",
|
||||
inventory_image = "htspells_spell.png",
|
||||
})
|
||||
|
||||
minetest.register_node("htspells:spell_box", {
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
-- Shaft
|
||||
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
|
||||
--Spitze
|
||||
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
|
||||
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
|
||||
--Federn
|
||||
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
|
||||
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
|
||||
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
|
||||
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
|
||||
|
||||
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
|
||||
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
|
||||
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
|
||||
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
|
||||
}
|
||||
},
|
||||
tiles = {"htspells_spell.png", "htspells_spell.png", "htspells_spell_back.png", "htspells_spell_front.png", "htspells_spell_2.png", "htspells_spell.png"},
|
||||
groups = {not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
local HTSPELLS_SPELL_ENTITY={
|
||||
physical = false,
|
||||
timer=0,
|
||||
visual = "wielditem",
|
||||
visual_size = {x=0.1, y=0.1},
|
||||
textures = {"htspells:spell_box"},
|
||||
lastpos={},
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
}
|
||||
|
||||
HTSPELLS_SPELL_ENTITY.on_step = function(self, dtime)
|
||||
self.timer=self.timer+dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.env:get_node(pos)
|
||||
|
||||
if self.timer>0.2 then
|
||||
local objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "htspells:spell_entity" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
local damage = 3
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval=1.0,
|
||||
groupcaps={
|
||||
fleshy={times={[1]=1/(damage-2), [2]=1/(damage-1), [3]=1/damage}},
|
||||
snappy={times={[1]=1/(damage-2), [2]=1/(damage-1), [3]=1/damage}},
|
||||
}
|
||||
}, nil)
|
||||
self.object:remove()
|
||||
end
|
||||
else
|
||||
local damage = 3
|
||||
obj:punch(self.object, 1.0, {
|
||||
full_punch_interval=1.0,
|
||||
groupcaps={
|
||||
fleshy={times={[1]=1/(damage-2), [2]=1/(damage-1), [3]=1/damage}},
|
||||
snappy={times={[1]=1/(damage-2), [2]=1/(damage-1), [3]=1/damage}},
|
||||
}
|
||||
}, nil)
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.lastpos.x~=nil then
|
||||
if node.name ~= "air" then
|
||||
minetest.env:add_item(self.lastpos, 'htspells:spell')
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||
end
|
||||
|
||||
minetest.register_entity("htspells:spell_entity", HTSPELLS_SPELL_ENTITY)
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'htspells:spell 16',
|
||||
recipe = {
|
||||
{'default:stick', 'default:stick', 'default:steel_ingot'},
|
||||
}
|
||||
})
|
|
@ -0,0 +1,88 @@
|
|||
minetest.register_craftitem("htspells:arrow_teleport", {
|
||||
description = "Teleport Arrow",
|
||||
inventory_image = "htspells_arrow_teleport.png",
|
||||
})
|
||||
|
||||
minetest.register_node("htspells:arrow_teleport_box", {
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
-- Shaft
|
||||
{-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17},
|
||||
--Spitze
|
||||
{-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17},
|
||||
{-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17},
|
||||
--Federn
|
||||
{6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17},
|
||||
{7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17},
|
||||
{7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17},
|
||||
{6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17},
|
||||
|
||||
{7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17},
|
||||
{8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17},
|
||||
{8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17},
|
||||
{7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17},
|
||||
}
|
||||
},
|
||||
tiles = {"htspells_arrow_teleport.png", "htspells_arrow_teleport.png", "htspells_arrow_teleport_back.png", "htspells_arrow_teleport_front.png", "htspells_arrow_teleport_2.png", "htspells_arrow_teleport.png"},
|
||||
groups = {not_in_creative_inventory=1},
|
||||
})
|
||||
|
||||
local THROWING_ARROW_ENTITY={
|
||||
physical = false,
|
||||
timer=0,
|
||||
visual = "wielditem",
|
||||
visual_size = {x=0.1, y=0.1},
|
||||
textures = {"htspells:arrow_teleport_box"},
|
||||
lastpos={},
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
player = "",
|
||||
}
|
||||
|
||||
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||
self.timer=self.timer+dtime
|
||||
local pos = self.object:getpos()
|
||||
local node = minetest.env:get_node(pos)
|
||||
|
||||
if self.timer>0.2 then
|
||||
local objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name ~= "htspells:arrow_teleport_entity" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||
if self.player ~= "" then
|
||||
self.player:setpos(pos)
|
||||
self.player:get_inventory():add_item("main", ItemStack("htspells:arrow_teleport"))
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
else
|
||||
if self.player ~= "" then
|
||||
self.player:setpos(pos)
|
||||
self.player:get_inventory():add_item("main", ItemStack("htspells:arrow_teleport"))
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.lastpos.x~=nil then
|
||||
if node.name ~= "air" then
|
||||
if self.player ~= "" then
|
||||
self.player:setpos(self.lastpos)
|
||||
self.player:get_inventory():add_item("main", ItemStack("htspells:arrow_teleport"))
|
||||
end
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
self.lastpos={x=pos.x, y=pos.y, z=pos.z}
|
||||
end
|
||||
|
||||
minetest.register_entity("htspells:arrow_teleport_entity", THROWING_ARROW_ENTITY)
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'htspells:arrow_teleport',
|
||||
recipe = {
|
||||
{'default:stick', 'default:stick', 'default:mese'},
|
||||
}
|
||||
})
|
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 330 B |
Before Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 178 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 323 B |
After Width: | Height: | Size: 213 B |
After Width: | Height: | Size: 220 B |
After Width: | Height: | Size: 227 B |
After Width: | Height: | Size: 191 B |
After Width: | Height: | Size: 213 B |
After Width: | Height: | Size: 214 B |
After Width: | Height: | Size: 228 B |
After Width: | Height: | Size: 191 B |
After Width: | Height: | Size: 213 B |
After Width: | Height: | Size: 213 B |
After Width: | Height: | Size: 225 B |
After Width: | Height: | Size: 189 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
|
@ -0,0 +1 @@
|
|||
default
|
|
@ -0,0 +1,25 @@
|
|||
--[
|
||||
--PotterTest Mod Made by LandMine
|
||||
--This subfolder of the mod contains all spells
|
||||
--Licence: WTFPL
|
||||
--]
|
||||
|
||||
---Functions
|
||||
|
||||
|
||||
-- Spells
|
||||
|
||||
----3. Alohomora - Unlocks doors
|
||||
minetest.register_tool("unlockcharm:alohomora", {
|
||||
description = "Alohomora Spell",
|
||||
inventory_image = "key.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=10, maxlevel=2},
|
||||
snappy={times={[2]=0.70, [3]=0.30}, uses=40, maxlevel=1},
|
||||
choppy={times={[3]=0.70}, uses=40, maxlevel=0}
|
||||
}
|
||||
}
|
||||
})
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |