Add a bunch of stuff

This commit is contained in:
Jordan blank 2015-06-17 18:05:03 -04:00
parent 3123a1af39
commit 4e2fc3734e
9 changed files with 442 additions and 282 deletions

180
init.lua
View File

@ -13,22 +13,31 @@ function intable(tbl, item)
end
--current goal, give a pickaxe a random table of enchantments -
--DONE current goal, give a pickaxe a random table of enchantments -
--for the cherry pick enchantment, do an on_dignode function for all players, then check for the enchantment, drop the item that was mined using player:dig_node
--DONE for the cherry pick enchantment, do an on_dignode function for all players, then check for the enchantment, drop the item that was mined using player:dig_node
--do multiple levels for these
--make the thing slowly raise the tool with a sound, make a noise with particles and throw the tool at the player
--DONE make the thing slowly raise the tool with a sound, make a noise with particles and throw the tool at the player
--possibly a max level enchant? maybe?
--damage group enchant?
--make the enchantment box use the moving water texture, with an overlay, to make it look like it's magic
--DONE make the enchantment box use the moving water texture, with an overlay, to make it look like it's magic
--make the enchantment box randomly eat items instead of enchanting them
--make the enchantment box explode, and kill player's in area on rare occasions
--make the enchant box clear the player's inventory on RARE occasions
--modify treecapitator to use voxel manip
--make bad effects also happen
enchant = {}
enchant.enchantments_pick = {
@ -298,17 +307,79 @@ end
local enchant_top = {
name = "default_water_source_animated.png^[colorize:red:120^enchant_table_top.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
}
function decimate_player_with_crucible(pos)
local radius = 3
local min = {x=pos.x-radius,y=pos.y-radius,z=pos.z-radius}
local max = {x=pos.x+radius,y=pos.y+radius,z=pos.z+radius}
local vm = minetest.get_voxel_manip()
local emin, emax = vm:read_from_map(min,max)
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
local data = vm:get_data()
for x = -radius,radius do
for y = -radius,radius do
for z = -radius,radius do
if x*x+y*y+z*z <= radius * radius + radius then --from sfan5's nuke mod (1.6)
local p_pos = area:index(pos.x+x,pos.y+y,pos.z+z)
data[p_pos] = minetest.get_content_id("air")
end
end
end
end
vm:set_data(data)
vm:calc_lighting()
vm:write_to_map()
vm:update_map()
minetest.forceload_block(pos)
end
--The logic of this thing is totally messed up, so you can right click it with your hand, or any item in general
--Possibly keeping it like this?
minetest.register_node("enchant:crucible", {
description = "Crucible",
minetest.register_node("enchant:enchantbox", {
description = "Cactus",
tiles = {"default_cactus_top.png", "default_stone.png"},
--Thanks to Gambit and kilbith for this
tiles = {enchant_top,"enchant_table_bottom.png","enchant_table_side.png","enchant_table_side.png","enchant_table_side.png","enchant_table_side.png",},
paramtype2 = "facedir",
is_ground_content = true,
groups = {snappy=1,choppy=3,flammable=2},
paramtype = "light",
drawtype = "nodebox",
selection_box = {type="regular"},
node_box = {
type = "fixed",
fixed = {
--jukebox core - divide by 16 because 16 pixels
{-8/16, -8/16, -8/16, 8/16, 7/16, 8/16},
--top
{-8/16, 6/16, -8/16, 8/16, 7/16, 8/16},
--top trim
{6/16, 7/16, -8/16, 8/16, 8/16, 8/16},
{-8/16, 7/16, 6/16, 8/16, 8/16, 8/16},
{-8/16, 7/16, -8/16, -6/16, 8/16, 8/16},
{-8/16, 7/16, -8/16, 8/16, 8/16, -6/16},
},
},
on_place = minetest.rotate_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local chance = math.random()
--chance = 0.999 --------------------------------------------------------------------------------------------------------- uh oh
if chance <= 0.85 then
local name = itemstack:get_name()
local meta = itemstack:get_metadata()
--only enchant unenchanted tools
@ -361,8 +432,8 @@ minetest.register_node("enchant:enchantbox", {
minetest.add_particlespawner({
amount = 100,
time = 13,
minpos = {x=pos.x-0.5, y=pos.y-0.1, z=pos.z-0.5},
maxpos = {x=pos.x+0.5, y=pos.y-0.1, z=pos.z+0.5},
minpos = {x=pos.x-(6/16), y=pos.y-0.1, z=pos.z-(6/16)},
maxpos = {x=pos.x+(6/16), y=pos.y-0.1, z=pos.z+(6/16)},
minvel = {x=0, y=0, z=0},
maxvel = {x=0, y=0, z=0},
minacc = {x=0, y=0.1, z=0},
@ -468,8 +539,8 @@ minetest.register_node("enchant:enchantbox", {
minetest.add_particlespawner({
amount = 100,
time = 13,
minpos = {x=pos.x-0.5, y=pos.y-0.1, z=pos.z-0.5},
maxpos = {x=pos.x+0.5, y=pos.y-0.1, z=pos.z+0.5},
minpos = {x=pos.x-(6/16), y=pos.y-0.1, z=pos.z-(6/16)},
maxpos = {x=pos.x+(6/16), y=pos.y-0.1, z=pos.z+(6/16)},
minvel = {x=0, y=0, z=0},
maxvel = {x=0, y=0, z=0},
minacc = {x=0, y=0.1, z=0},
@ -576,8 +647,8 @@ minetest.register_node("enchant:enchantbox", {
minetest.add_particlespawner({
amount = 100,
time = 13,
minpos = {x=pos.x-0.5, y=pos.y-0.1, z=pos.z-0.5},
maxpos = {x=pos.x+0.5, y=pos.y-0.1, z=pos.z+0.5},
minpos = {x=pos.x-(6/16), y=pos.y-0.1, z=pos.z-(6/16)},
maxpos = {x=pos.x+(6/16), y=pos.y-0.1, z=pos.z+(6/16)},
minvel = {x=0, y=0, z=0},
maxvel = {x=0, y=0, z=0},
minacc = {x=0, y=0.1, z=0},
@ -646,6 +717,89 @@ minetest.register_node("enchant:enchantbox", {
--end
--return(itemstack)
elseif chance > 0.85 and chance < 0.998 then
--it ate the item! such bad luck
itemstack:take_item()
minetest.sound_play("chomp", {
pos = pos,
max_hear_distance = 20,
gain = 1,
})
minetest.add_particlespawner({
amount = 200,
time = 5,
minpos = {x=pos.x-(6/16), y=pos.y-0.1, z=pos.z-(6/16)},
maxpos = {x=pos.x+(6/16), y=pos.y-0.1, z=pos.z+(6/16)},
minvel = {x=0, y=0, z=0},
maxvel = {x=0, y=0, z=0},
minacc = {x=0, y=0.5, z=0},
maxacc = {x=0, y=3, z=0},
minexptime = 1,
maxexptime = 2,
minsize = 1,
maxsize = 1,
collisiondetection = false,
vertical = false,
texture = "heart.png",
})
elseif chance >= 0.999 then
--warning: this function is brutal
--you must have broken 200 mirrors and crashed with a salt truck, let's destroy your life
minetest.sound_play("bad_luck", {
pos = pos,
max_hear_distance = 55,
gain = 1,
})
minetest.add_particlespawner({
amount = 200,
time = 10,
minpos = {x=pos.x-(6/16), y=pos.y-0.1, z=pos.z-(6/16)},
maxpos = {x=pos.x+(6/16), y=pos.y-0.1, z=pos.z+(6/16)},
minvel = {x=0, y=0, z=0},
maxvel = {x=0, y=0, z=0},
minacc = {x=0, y=0.5, z=0},
maxacc = {x=0, y=3, z=0},
minexptime = 1,
maxexptime = 2,
minsize = 1,
maxsize = 1,
collisiondetection = false,
vertical = false,
texture = "bubble.png^[colorize:red:120",
})
minetest.after(10, function() --give them the illusion that they might live
local inv = clicker:get_inventory()
local size = inv:get_size("main")
for i = 1,size do
local stack = inv:get_stack("main", i)
inv:set_stack("main", i, "")
end
--explosion stuff (use this for fireworks/tnt/nukes)
decimate_player_with_crucible(pos)
minetest.add_particlespawner({
amount = 200,
time = 0.1,
minpos = pos,
maxpos = pos,
minvel = {x=-5, y=-5, z=-5},
maxvel = {x=5, y=5, z=5},
minacc = {x=0, y=0, z=0},
maxacc = {x=0, y=0, z=0},
minexptime = 3,
maxexptime = 5,
minsize = 1,
maxsize = 1,
collisiondetection = false,
vertical = false,
texture = "bubble.png",
})
minetest.sound_play("boom", {
pos = pos,
max_hear_distance = 55,
gain = 1,
})
end)
end
end,
})

BIN
sounds/bad_luck.ogg Normal file

Binary file not shown.

BIN
sounds/boom.ogg Normal file

Binary file not shown.

BIN
sounds/chomp.ogg Normal file

Binary file not shown.

View File

@ -1,2 +1,5 @@
https://www.freesound.org/people/Sclolex/sounds/172876/
https://www.freesound.org/people/suntemple/sounds/241809/
https://www.freesound.org/people/ggctuk/sounds/80551/
https://www.freesound.org/people/DJ%20Chronos/sounds/57350/
https://www.freesound.org/people/unfa/sounds/259300/

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

3
thanks.txt Normal file
View File

@ -0,0 +1,3 @@
Thanks to kilbith for suggesting the textures of the crucible.
Thanks to Gambit for creating the textures crucible.