Compare commits
5 Commits
a37fea1360
...
a16db8f2f1
Author | SHA1 | Date |
---|---|---|
Beha | a16db8f2f1 | |
Beha | e1d8534d44 | |
Beha | ff0584a4cd | |
Beha | 306b26a7ad | |
Beha | 00c98488d5 |
|
@ -0,0 +1,28 @@
|
|||
License for Code
|
||||
----------------
|
||||
|
||||
Copyright (c) 2016-2017 Beha
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
License for Textures, Models and Sounds
|
||||
---------------------------------------
|
||||
|
||||
CC BY-SA 4.0. Created by Beha.
|
|
@ -0,0 +1,3 @@
|
|||
# Magic by Beha
|
||||
|
||||
This mod adds magic to Minetest: spells, potions, turrets and more! For use with [kingdoms](https://github.com/shacknetisp/kingdoms).
|
24
mapgen.lua
24
mapgen.lua
|
@ -1,13 +1,11 @@
|
|||
function magic.register_mapgen()
|
||||
-- Vitality crystals form in warm forests.
|
||||
minetest.register_decoration({
|
||||
deco_type = "simple",
|
||||
place_on = {"default:dirt_with_grass"},
|
||||
sidelen = 80,
|
||||
fill_ratio = 0.00025,
|
||||
biomes = {"rainforest", "deciduous_forest", "coniferous_forest"},
|
||||
y_min = 1,
|
||||
y_max = 31000,
|
||||
decoration = "magic:crystal_vitality",
|
||||
})
|
||||
end
|
||||
-- Vitality crystals form in warm forests.
|
||||
minetest.register_decoration({
|
||||
deco_type = "simple",
|
||||
place_on = {"default:dirt_with_grass"},
|
||||
sidelen = 80,
|
||||
fill_ratio = 0.00025,
|
||||
biomes = {"rainforest", "deciduous_forest", "coniferous_forest"},
|
||||
y_min = 1,
|
||||
y_max = 31000,
|
||||
decoration = "magic:crystal_vitality",
|
||||
})
|
||||
|
|
80
potions.lua
80
potions.lua
|
@ -31,7 +31,7 @@ function magic.register_potion(name, def)
|
|||
if player:get_inventory():room_for_item("main", "vessels:glass_bottle") then
|
||||
player:get_inventory():add_item("main", "vessels:glass_bottle")
|
||||
else
|
||||
minetest.add_item(pos, "vessels:glass_bottle")
|
||||
minetest.add_item(player:get_pos(), "vessels:glass_bottle")
|
||||
end
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
@ -79,3 +79,81 @@ minetest.register_craft({
|
|||
type = "shapeless",
|
||||
recipe = {"magic:water_bottle", "flowers:geranium"},
|
||||
})
|
||||
|
||||
|
||||
local ele_parts = function(pos)
|
||||
for i=0,math.random(1,3) do
|
||||
minetest.add_particle({
|
||||
pos = vector.add(pos, vector.multiply({x=math.random()-0.5, y=math.random()-0.5, z=math.random()-0.5}, math.random())),
|
||||
velocity = vector.multiply({x=math.random()-0.5, y=math.random()-0.5, z=math.random()-0.5}, math.random() * 2),
|
||||
acceleration = vector.multiply({x=math.random()-0.5, y=math.random()*-5, z=math.random()-0.5}, math.random() * 4),
|
||||
expirationtime = math.random() * 5,
|
||||
size = math.random() * 5,
|
||||
texture = "smoke_puff.png^[transform" .. math.random(0, 7),
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_entity("magic:explosive_launch_entity", {
|
||||
physical = false,
|
||||
timer = 0,
|
||||
parttimer = 0,
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
textures = {"default_cloud.png^[opacity:0"},
|
||||
visual_size = {x=0, y=0},
|
||||
|
||||
on_step = function(self, dtime)
|
||||
self.timer = self.timer - dtime
|
||||
self.parttimer = self.timer + dtime
|
||||
if not self.p then
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
if self.timer <= 0 or self.object:getvelocity().y < 0 then
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
local pos = self.object:getpos()
|
||||
if self.parttimer > 0.3 then
|
||||
ele_parts(pos)
|
||||
self.parttimer = self.parttimer - 0.3
|
||||
end
|
||||
if not magic.missile_passable(vector.add(pos, {x=0, y=1, z=0})) then
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
if not magic.missile_passable(pos) then
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
magic.register_potion("magic:explosive_launch_potion", {
|
||||
description = "Explosive Launch Potion",
|
||||
color = "#B30",
|
||||
on_use = function(itemstack, player)
|
||||
if not minetest.registered_nodes[minetest.get_node(vector.add(player:get_pos(), {x=0, y=-1, z=0})).name].walkable then
|
||||
return false
|
||||
end
|
||||
local pos = player:get_pos()
|
||||
local speed = math.random(15, 20)
|
||||
local time = 10
|
||||
local obj = minetest.add_entity(pos, "magic:explosive_launch_entity")
|
||||
local dir = player:get_look_dir()
|
||||
local v = {x=dir.x*-speed, y=dir.y*-speed, z=dir.z*-speed}
|
||||
obj:setvelocity(v)
|
||||
obj:setacceleration({x=-(v.x / math.abs(v.y / 9.81)), y=-9.81, z=-(v.z / math.abs(v.y / 9.81))})
|
||||
obj:setyaw(player:get_look_horizontal()+math.pi)
|
||||
player:set_attach(obj, "", {x=0, y=0, z=0}, {x=0, y=0, z=0})
|
||||
obj:get_luaentity().timer = time
|
||||
obj:get_luaentity().p = player
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "magic:explosive_launch_potion",
|
||||
type = "shapeless",
|
||||
recipe = {"magic:water_bottle", "magic:rage_essence", "magic:vitality_essence"},
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue