tidy and tweak code
This commit is contained in:
parent
d70a52c6f8
commit
09b388cfdf
169
init.lua
169
init.lua
@ -1,9 +1,12 @@
|
|||||||
|
|
||||||
-- mod check
|
-- translation and mod support
|
||||||
|
|
||||||
|
local S = minetest.get_translator("lucky_block")
|
||||||
local def = minetest.get_modpath("default")
|
local def = minetest.get_modpath("default")
|
||||||
local mcl = minetest.get_modpath("mcl_core")
|
local mcl = minetest.get_modpath("mcl_core")
|
||||||
|
|
||||||
-- global
|
-- global
|
||||||
|
|
||||||
lucky_block = {
|
lucky_block = {
|
||||||
mod_def = def,
|
mod_def = def,
|
||||||
mod_mcl = mcl,
|
mod_mcl = mcl,
|
||||||
@ -17,44 +20,28 @@ lucky_block = {
|
|||||||
def_flame = mcl and "mcl_fire:fire" or "fire:basic_flame",
|
def_flame = mcl and "mcl_fire:fire" or "fire:basic_flame",
|
||||||
def_gold = mcl and "mcl_core:goldblock" or "default:goldblock",
|
def_gold = mcl and "mcl_core:goldblock" or "default:goldblock",
|
||||||
def_glass = mcl and "mcl_core:glass" or "default:glass",
|
def_glass = mcl and "mcl_core:glass" or "default:glass",
|
||||||
green = minetest.get_color_escape_sequence("#1eff00")
|
green = minetest.get_color_escape_sequence("#1eff00"),
|
||||||
|
S = S
|
||||||
}
|
}
|
||||||
|
|
||||||
lucky_schems = {}
|
lucky_schems = {}
|
||||||
|
|
||||||
|
|
||||||
-- quick sound setup
|
-- quick sound setup
|
||||||
if mcl then
|
|
||||||
|
|
||||||
|
if mcl then
|
||||||
lucky_block.snd_glass = mcl_sounds.node_sound_glass_defaults()
|
lucky_block.snd_glass = mcl_sounds.node_sound_glass_defaults()
|
||||||
lucky_block.snd_wood = mcl_sounds.node_sound_wood_defaults()
|
lucky_block.snd_wood = mcl_sounds.node_sound_wood_defaults()
|
||||||
lucky_block.snd_stone = mcl_sounds.node_sound_stone_defaults()
|
lucky_block.snd_stone = mcl_sounds.node_sound_stone_defaults()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- translation support
|
|
||||||
local S
|
|
||||||
if minetest.get_translator then
|
|
||||||
S = minetest.get_translator("lucky_block") -- 5.x translation function
|
|
||||||
else -- boilerplate function
|
|
||||||
S = function(str, ...)
|
|
||||||
local args = {...}
|
|
||||||
return str:gsub("@%d+", function(match)
|
|
||||||
return args[tonumber(match:sub(2))]
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
lucky_block.intllib = S
|
|
||||||
|
|
||||||
|
|
||||||
-- default blocks
|
-- default blocks
|
||||||
|
|
||||||
local lucky_list = {
|
local lucky_list = {
|
||||||
{"nod", "lucky_block:super_lucky_block", 0}
|
{"nod", "lucky_block:super_lucky_block", 0}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-- ability to add new blocks to list
|
-- ability to add new blocks to list
|
||||||
|
|
||||||
function lucky_block:add_blocks(list)
|
function lucky_block:add_blocks(list)
|
||||||
|
|
||||||
for s = 1, #list do
|
for s = 1, #list do
|
||||||
@ -62,8 +49,8 @@ function lucky_block:add_blocks(list)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- call to purge the block list
|
-- call to purge the block list
|
||||||
|
|
||||||
function lucky_block:purge_block_list()
|
function lucky_block:purge_block_list()
|
||||||
|
|
||||||
lucky_list = {
|
lucky_list = {
|
||||||
@ -71,8 +58,8 @@ function lucky_block:purge_block_list()
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- add schematics to global list
|
-- add schematics to global list
|
||||||
|
|
||||||
function lucky_block:add_schematics(list)
|
function lucky_block:add_schematics(list)
|
||||||
|
|
||||||
for s = 1, #list do
|
for s = 1, #list do
|
||||||
@ -80,32 +67,33 @@ function lucky_block:add_schematics(list)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- for random colour selection
|
-- for random colour selection
|
||||||
|
|
||||||
local all_colours = {
|
local all_colours = {
|
||||||
"grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta",
|
"grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta",
|
||||||
"orange", "violet", "brown", "pink", "dark_grey", "dark_green", "white"
|
"orange", "violet", "brown", "pink", "dark_grey", "dark_green", "white"
|
||||||
}
|
}
|
||||||
|
|
||||||
if lucky_block.mcl then
|
if lucky_block.mcl then
|
||||||
|
|
||||||
all_colours = {
|
all_colours = {
|
||||||
"red", "blue", "cyan", "grey", "silver", "black", "yellow", "green", "magenta",
|
"red", "blue", "cyan", "grey", "silver", "black", "yellow", "green", "magenta",
|
||||||
"orange", "purple", "brown", "pink", "lime", "light_blue", "white"
|
"orange", "purple", "brown", "pink", "lime", "light_blue", "white"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- default chests items
|
-- default chests items
|
||||||
|
|
||||||
local chest_stuff = {}
|
local chest_stuff = {}
|
||||||
|
|
||||||
|
|
||||||
-- call to purge the chest item list
|
-- call to purge the chest item list
|
||||||
|
|
||||||
function lucky_block:purge_chest_items()
|
function lucky_block:purge_chest_items()
|
||||||
chest_stuff = {}
|
chest_stuff = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- ability to add to chest item list
|
-- ability to add to chest item list
|
||||||
|
|
||||||
function lucky_block:add_chest_items(list)
|
function lucky_block:add_chest_items(list)
|
||||||
|
|
||||||
for s = 1, #list do
|
for s = 1, #list do
|
||||||
@ -113,8 +101,8 @@ function lucky_block:add_chest_items(list)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- particle effects
|
-- particle effects
|
||||||
|
|
||||||
local effect = function(pos, amount, texture, min_size, max_size, radius, gravity, glow)
|
local effect = function(pos, amount, texture, min_size, max_size, radius, gravity, glow)
|
||||||
|
|
||||||
radius = radius or 2
|
radius = radius or 2
|
||||||
@ -138,8 +126,8 @@ local effect = function(pos, amount, texture, min_size, max_size, radius, gravit
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- temp entity for mob damage
|
-- temp entity for mob damage
|
||||||
|
|
||||||
minetest.register_entity("lucky_block:temp", {
|
minetest.register_entity("lucky_block:temp", {
|
||||||
physical = true,
|
physical = true,
|
||||||
collisionbox = {0, 0, 0, 0, 0, 0},
|
collisionbox = {0, 0, 0, 0, 0, 0},
|
||||||
@ -152,14 +140,12 @@ minetest.register_entity("lucky_block:temp", {
|
|||||||
|
|
||||||
self.timer = (self.timer or 0) + dtime
|
self.timer = (self.timer or 0) + dtime
|
||||||
|
|
||||||
if self.timer > 0.5 then
|
if self.timer > 0.5 then self.object:remove() end
|
||||||
self.object:remove()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- modified from TNT mod to deal entity damage only
|
-- modified from TNT mod to deal entity damage only
|
||||||
|
|
||||||
local function entity_physics(pos, radius)
|
local function entity_physics(pos, radius)
|
||||||
|
|
||||||
radius = radius * 2
|
radius = radius * 2
|
||||||
@ -188,18 +174,16 @@ local function entity_physics(pos, radius)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- fill chest at position
|
||||||
|
|
||||||
-- function to fill chest at position
|
|
||||||
local function fill_chest(pos, items)
|
local function fill_chest(pos, items)
|
||||||
|
|
||||||
local stacks = items or chest_stuff
|
local stacks = items or chest_stuff
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta and meta:get_inventory()
|
local inv = meta and meta:get_inventory() ; if not inv then return end
|
||||||
local size = inv and inv:get_size("main")
|
local size = inv and inv:get_size("main")
|
||||||
local stack
|
local stack
|
||||||
|
|
||||||
if not inv then return end
|
|
||||||
|
|
||||||
-- loop through inventory
|
-- loop through inventory
|
||||||
for _, def in ipairs(stacks) do
|
for _, def in ipairs(stacks) do
|
||||||
|
|
||||||
@ -223,8 +207,8 @@ local function fill_chest(pos, items)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- explosion with protection check
|
-- explosion with protection check
|
||||||
|
|
||||||
local function explode(pos, radius, sound)
|
local function explode(pos, radius, sound)
|
||||||
|
|
||||||
sound = sound or "tnt_explode"
|
sound = sound or "tnt_explode"
|
||||||
@ -242,12 +226,12 @@ local function explode(pos, radius, sound)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- place schematic
|
||||||
|
|
||||||
local lb_schematic = function(pos, digger, def)
|
local lb_schematic = function(pos, digger, def)
|
||||||
|
|
||||||
if #lucky_schems == 0 then
|
if #lucky_schems == 0 then
|
||||||
print ("[lucky block] No schematics")
|
print ("[lucky block] No schematics") ; return
|
||||||
return
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local schem = def[2]
|
local schem = def[2]
|
||||||
@ -255,9 +239,7 @@ local lb_schematic = function(pos, digger, def)
|
|||||||
local force = def[4]
|
local force = def[4]
|
||||||
local reps = def[5] or {}
|
local reps = def[5] or {}
|
||||||
|
|
||||||
if switch == 1 then
|
if switch == 1 then pos = vector.round(digger:get_pos()) end
|
||||||
pos = vector.round(digger:get_pos())
|
|
||||||
end
|
|
||||||
|
|
||||||
for i = 1, #lucky_schems do
|
for i = 1, #lucky_schems do
|
||||||
|
|
||||||
@ -271,11 +253,10 @@ local lb_schematic = function(pos, digger, def)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if switch == 1 then
|
if switch == 1 then digger:set_pos(pos, false) end
|
||||||
digger:set_pos(pos, false)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- place node
|
||||||
|
|
||||||
local lb_node = function(pos, digger, def)
|
local lb_node = function(pos, digger, def)
|
||||||
|
|
||||||
@ -283,9 +264,7 @@ local lb_node = function(pos, digger, def)
|
|||||||
local switch = def[3]
|
local switch = def[3]
|
||||||
local items = def[4]
|
local items = def[4]
|
||||||
|
|
||||||
if switch == 1 then
|
if switch == 1 then pos = digger:get_pos() end
|
||||||
pos = digger:get_pos()
|
|
||||||
end
|
|
||||||
|
|
||||||
if not minetest.registered_nodes[nod] then
|
if not minetest.registered_nodes[nod] then
|
||||||
nod = lucky_block.def_node
|
nod = lucky_block.def_node
|
||||||
@ -295,12 +274,12 @@ local lb_node = function(pos, digger, def)
|
|||||||
|
|
||||||
minetest.set_node(pos, {name = nod})
|
minetest.set_node(pos, {name = nod})
|
||||||
|
|
||||||
if nod == "default:chest"
|
if nod == "default:chest" or nod == "mcl_chests:chest_small" then
|
||||||
or nod == "mcl_chests:chest_small" then
|
|
||||||
fill_chest(pos, items)
|
fill_chest(pos, items)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- spawn entity/mob
|
||||||
|
|
||||||
local lb_spawn = function(pos, digger, def)
|
local lb_spawn = function(pos, digger, def)
|
||||||
|
|
||||||
@ -351,15 +330,12 @@ local lb_spawn = function(pos, digger, def)
|
|||||||
|
|
||||||
local ent = obj:get_luaentity()
|
local ent = obj:get_luaentity()
|
||||||
|
|
||||||
if tame then
|
if tame then ent.tamed = true end
|
||||||
ent.tamed = true
|
|
||||||
end
|
|
||||||
|
|
||||||
if own then
|
if own then ent.owner = digger:get_player_name() end
|
||||||
ent.owner = digger:get_player_name()
|
|
||||||
end
|
|
||||||
|
|
||||||
if name then
|
if name then
|
||||||
|
|
||||||
ent.nametag = name
|
ent.nametag = name
|
||||||
ent.object:set_properties({
|
ent.object:set_properties({
|
||||||
nametag = name,
|
nametag = name,
|
||||||
@ -374,6 +350,7 @@ local lb_spawn = function(pos, digger, def)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- explosion
|
||||||
|
|
||||||
local lb_explode = function(pos, def)
|
local lb_explode = function(pos, def)
|
||||||
|
|
||||||
@ -383,6 +360,7 @@ local lb_explode = function(pos, def)
|
|||||||
explode(pos, rad, snd)
|
explode(pos, rad, snd)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- teleport player
|
||||||
|
|
||||||
local lb_teleport = function(pos, digger, def)
|
local lb_teleport = function(pos, digger, def)
|
||||||
|
|
||||||
@ -403,6 +381,7 @@ local lb_teleport = function(pos, digger, def)
|
|||||||
lucky_block.green .. S("Random Teleport!"))
|
lucky_block.green .. S("Random Teleport!"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- drop items
|
||||||
|
|
||||||
local lb_drop = function(pos, digger, def)
|
local lb_drop = function(pos, digger, def)
|
||||||
|
|
||||||
@ -410,8 +389,7 @@ local lb_drop = function(pos, digger, def)
|
|||||||
local colours = def[4]
|
local colours = def[4]
|
||||||
local items = #def[2]
|
local items = #def[2]
|
||||||
|
|
||||||
-- drop multiple different items or colours
|
if items > 1 or colours then -- drop multiple different items or colours
|
||||||
if items > 1 or colours then
|
|
||||||
|
|
||||||
for i = 1, num do
|
for i = 1, num do
|
||||||
|
|
||||||
@ -460,23 +438,20 @@ local lb_drop = function(pos, digger, def)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- lightning bolt
|
||||||
|
|
||||||
local lb_lightning = function(pos, digger, def)
|
local lb_lightning = function(pos, digger, def)
|
||||||
|
|
||||||
local nod = def[2]
|
local nod = def[2]
|
||||||
|
|
||||||
if not minetest.registered_nodes[nod] then
|
if not minetest.registered_nodes[nod] then nod = lucky_block.def_flame end
|
||||||
nod = lucky_block.def_flame
|
|
||||||
end
|
|
||||||
|
|
||||||
pos = digger:get_pos()
|
pos = digger:get_pos()
|
||||||
|
|
||||||
local bnod = minetest.get_node_or_nil(pos)
|
local bnod = minetest.get_node_or_nil(pos)
|
||||||
local bref = bnod and minetest.registered_items[bnod.name]
|
local bref = bnod and minetest.registered_items[bnod.name]
|
||||||
|
|
||||||
if bref and bref.buildable_to then
|
if bref and bref.buildable_to then minetest.set_node(pos, {name = nod}) end
|
||||||
minetest.set_node(pos, {name = nod})
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.add_particle({
|
minetest.add_particle({
|
||||||
pos = pos,
|
pos = pos,
|
||||||
@ -492,9 +467,10 @@ local lb_lightning = function(pos, digger, def)
|
|||||||
entity_physics(pos, 2)
|
entity_physics(pos, 2)
|
||||||
|
|
||||||
minetest.sound_play("lightning", {
|
minetest.sound_play("lightning", {
|
||||||
pos = pos, gain = 1.0, max_hear_distance = 25}, true)
|
pos = pos, gain = 1.2, max_hear_distance = 30}, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- falling nodes
|
||||||
|
|
||||||
local lb_falling = function(pos, digger, def)
|
local lb_falling = function(pos, digger, def)
|
||||||
|
|
||||||
@ -503,9 +479,7 @@ local lb_falling = function(pos, digger, def)
|
|||||||
local spread = def[4]
|
local spread = def[4]
|
||||||
local range = def[5] or 5
|
local range = def[5] or 5
|
||||||
|
|
||||||
if switch == 1 then
|
if switch == 1 then pos = digger:get_pos() end
|
||||||
pos = digger:get_pos()
|
|
||||||
end
|
|
||||||
|
|
||||||
if spread then
|
if spread then
|
||||||
pos.y = pos.y + 10
|
pos.y = pos.y + 10
|
||||||
@ -548,6 +522,7 @@ local lb_falling = function(pos, digger, def)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- troll block
|
||||||
|
|
||||||
local lb_troll = function(pos, def)
|
local lb_troll = function(pos, def)
|
||||||
|
|
||||||
@ -555,9 +530,7 @@ local lb_troll = function(pos, def)
|
|||||||
local snd = def[3]
|
local snd = def[3]
|
||||||
local exp = def[4]
|
local exp = def[4]
|
||||||
|
|
||||||
if not minetest.registered_nodes[nod] then
|
if not minetest.registered_nodes[nod] then nod = lucky_block.def_gold end
|
||||||
nod = lucky_block.def_gold
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.set_node(pos, {name = nod})
|
minetest.set_node(pos, {name = nod})
|
||||||
|
|
||||||
@ -567,21 +540,18 @@ local lb_troll = function(pos, def)
|
|||||||
|
|
||||||
minetest.after(2.0, function()
|
minetest.after(2.0, function()
|
||||||
|
|
||||||
|
minetest.set_node(pos, {name = "air"})
|
||||||
|
|
||||||
if exp then
|
if exp then
|
||||||
|
|
||||||
minetest.set_node(pos, {name = "air"})
|
|
||||||
|
|
||||||
explode(pos, 2)
|
explode(pos, 2)
|
||||||
else
|
else
|
||||||
|
|
||||||
minetest.set_node(pos, {name = "air"})
|
|
||||||
|
|
||||||
minetest.sound_play(lucky_block.snd_pop, {
|
minetest.sound_play(lucky_block.snd_pop, {
|
||||||
pos = pos, gain = 1.0, max_hear_distance = 10}, true)
|
pos = pos, gain = 1.0, max_hear_distance = 10}, true)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- floor of nodes
|
||||||
|
|
||||||
local lb_floor = function(pos, def)
|
local lb_floor = function(pos, def)
|
||||||
|
|
||||||
@ -605,7 +575,7 @@ local lb_floor = function(pos, def)
|
|||||||
z = (pos.z + z) - offs}, {name = nod})
|
z = (pos.z + z) - offs}, {name = nod})
|
||||||
|
|
||||||
minetest.sound_play(snd, {
|
minetest.sound_play(snd, {
|
||||||
pos = pos, gain = 1.0, max_hear_distance = 10}, true)
|
pos = pos, gain = 1.0, max_hear_distance = 10}, true)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
num = num + 1
|
num = num + 1
|
||||||
@ -613,8 +583,8 @@ local lb_floor = function(pos, def)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- this is what happens when you dig a lucky block
|
-- this is what happens when you dig a lucky block
|
||||||
|
|
||||||
function lucky_block:open(pos, digger, blocks_list)
|
function lucky_block:open(pos, digger, blocks_list)
|
||||||
|
|
||||||
-- check for custom blocks list or use default
|
-- check for custom blocks list or use default
|
||||||
@ -624,7 +594,7 @@ function lucky_block:open(pos, digger, blocks_list)
|
|||||||
math.randomseed(minetest.get_timeofday() + pos.x + pos.z - os.time())
|
math.randomseed(minetest.get_timeofday() + pos.x + pos.z - os.time())
|
||||||
|
|
||||||
local luck = math.random(#blocks_list) ; -- luck = 1
|
local luck = math.random(#blocks_list) ; -- luck = 1
|
||||||
local result = blocks_list[luck]
|
local result = blocks_list[luck] ; if not result then return end
|
||||||
local action = result[1]
|
local action = result[1]
|
||||||
|
|
||||||
-- print ("luck ["..luck.." of "..#blocks_list.."]", action)
|
-- print ("luck ["..luck.." of "..#blocks_list.."]", action)
|
||||||
@ -665,8 +635,8 @@ function lucky_block:open(pos, digger, blocks_list)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- lucky block node
|
||||||
|
|
||||||
-- lucky block itself
|
|
||||||
minetest.register_node("lucky_block:lucky_block", {
|
minetest.register_node("lucky_block:lucky_block", {
|
||||||
description = S("Lucky Block"),
|
description = S("Lucky Block"),
|
||||||
tiles = {{
|
tiles = {{
|
||||||
@ -680,7 +650,7 @@ minetest.register_node("lucky_block:lucky_block", {
|
|||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
light_source = 3,
|
light_source = 3,
|
||||||
groups = {handy = 2, oddly_breakable_by_hand = 3, unbreakable = 1},
|
groups = {handy = 1, oddly_breakable_by_hand = 3, unbreakable = 1},
|
||||||
drop = {},
|
drop = {},
|
||||||
sounds = lucky_block.snd_wood,
|
sounds = lucky_block.snd_wood,
|
||||||
|
|
||||||
@ -696,10 +666,11 @@ minetest.register_node("lucky_block:lucky_block", {
|
|||||||
|
|
||||||
on_blast = function() end,
|
on_blast = function() end,
|
||||||
|
|
||||||
_mcl_hardness = 1,
|
_mcl_hardness = 0.7,
|
||||||
_mcl_blast_resistance = 1200
|
_mcl_blast_resistance = 1200
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- lucky block recipe
|
||||||
|
|
||||||
local gitem = mcl and "mcl_core:gold_ingot" or "default:gold_ingot"
|
local gitem = mcl and "mcl_core:gold_ingot" or "default:gold_ingot"
|
||||||
local citem = mcl and "mcl_chests:chest" or "default:chest"
|
local citem = mcl and "mcl_chests:chest" or "default:chest"
|
||||||
@ -713,16 +684,17 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- set default groups for super lucky block and change if mineclone found
|
||||||
|
|
||||||
local grp = {cracky = 1, level = 2, unbreakable = 1}
|
local grp = {cracky = 1, level = 2, unbreakable = 1}
|
||||||
|
|
||||||
-- change super lucky block groups for mineclone
|
|
||||||
if mcl then
|
if mcl then
|
||||||
grp.handy = 5
|
grp.handy = 5
|
||||||
grp.level = nil
|
grp.level = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- super lucky block
|
-- super lucky block
|
||||||
|
|
||||||
minetest.register_node("lucky_block:super_lucky_block", {
|
minetest.register_node("lucky_block:super_lucky_block", {
|
||||||
description = S("Super Lucky Block (use pick)"),
|
description = S("Super Lucky Block (use pick)"),
|
||||||
tiles = {{
|
tiles = {{
|
||||||
@ -755,7 +727,7 @@ minetest.register_node("lucky_block:super_lucky_block", {
|
|||||||
effect(pos, 25, "tnt_smoke.png", 8, 8, 1, -10, 0)
|
effect(pos, 25, "tnt_smoke.png", 8, 8, 1, -10, 0)
|
||||||
|
|
||||||
minetest.sound_play("fart1", {
|
minetest.sound_play("fart1", {
|
||||||
pos = pos, gain = 1.0, max_hear_distance = 10}, true)
|
pos = pos, gain = 1.0, max_hear_distance = 10}, true)
|
||||||
|
|
||||||
if math.random(5) == 1 then
|
if math.random(5) == 1 then
|
||||||
pos.y = pos.y + 0.5
|
pos.y = pos.y + 0.5
|
||||||
@ -773,28 +745,23 @@ minetest.register_node("lucky_block:super_lucky_block", {
|
|||||||
_mcl_blast_resistance = 1200
|
_mcl_blast_resistance = 1200
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- get mod path and import blocks
|
||||||
|
|
||||||
local path = minetest.get_modpath("lucky_block")
|
local path = minetest.get_modpath("lucky_block")
|
||||||
|
|
||||||
-- import schematics
|
dofile(path .. "/lb_schems.lua") -- schematics
|
||||||
dofile(path .. "/lb_schems.lua")
|
dofile(path .. "/lb_well.lua") -- wishing well & drops
|
||||||
|
dofile(path .. "/lb_special.lua") -- special items & drops
|
||||||
|
|
||||||
-- wishing well & drops
|
|
||||||
dofile(path .. "/lb_well.lua")
|
|
||||||
|
|
||||||
-- lucky block special items and blocks
|
|
||||||
dofile(path .. "/lb_special.lua")
|
|
||||||
|
|
||||||
-- if mineclone detected then load specific lucky blocks
|
|
||||||
if mcl then
|
if mcl then
|
||||||
dofile(path .. "/lb_mineclone.lua")
|
dofile(path .. "/lb_mineclone.lua") -- mineclone only
|
||||||
else
|
else
|
||||||
dofile(path .. "/lb_default.lua")
|
dofile(path .. "/lb_default.lua") -- default drops
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 3rd party mod lucky blocks
|
dofile(path .. "/lb_other.lua") -- 3rd party mod drops
|
||||||
dofile(path .. "/lb_other.lua")
|
|
||||||
|
|
||||||
|
-- wait until mods loaded and show how many lucky blocks we have in use
|
||||||
|
|
||||||
minetest.after(0, function()
|
minetest.after(0, function()
|
||||||
print("[MOD] Lucky Blocks loaded: ", #lucky_list)
|
print("[MOD] Lucky Blocks loaded: ", #lucky_list)
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
|
||||||
local S = lucky_block.intllib
|
local S = lucky_block.S
|
||||||
local MP = minetest.get_modpath("lucky_block")
|
local MP = minetest.get_modpath("lucky_block")
|
||||||
|
|
||||||
-- default mod
|
-- default mod
|
||||||
|
|
||||||
if lucky_block.def_mod then
|
if lucky_block.def_mod then
|
||||||
|
|
||||||
-- chest items
|
-- chest items
|
||||||
@ -174,8 +175,8 @@ if lucky_block.def_mod then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- wool mod
|
-- wool mod
|
||||||
|
|
||||||
if minetest.get_modpath("wool") then
|
if minetest.get_modpath("wool") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -187,6 +188,7 @@ if minetest.get_modpath("wool") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Flowers mod
|
-- Flowers mod
|
||||||
|
|
||||||
if minetest.get_modpath("flowers") then
|
if minetest.get_modpath("flowers") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -210,6 +212,7 @@ if minetest.get_modpath("flowers") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Doors mod
|
-- Doors mod
|
||||||
|
|
||||||
if minetest.get_modpath("doors") then
|
if minetest.get_modpath("doors") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -228,6 +231,7 @@ if minetest.get_modpath("doors") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Screwdriver mod
|
-- Screwdriver mod
|
||||||
|
|
||||||
if minetest.get_modpath("screwdriver") then
|
if minetest.get_modpath("screwdriver") then
|
||||||
|
|
||||||
if screwdriver and screwdriver.handler then
|
if screwdriver and screwdriver.handler then
|
||||||
@ -259,6 +263,7 @@ if minetest.get_modpath("screwdriver") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Vessels mod
|
-- Vessels mod
|
||||||
|
|
||||||
if minetest.get_modpath("vessels") then
|
if minetest.get_modpath("vessels") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -271,6 +276,7 @@ if minetest.get_modpath("vessels") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Farming mod (default)
|
-- Farming mod (default)
|
||||||
|
|
||||||
if minetest.get_modpath("farming") then
|
if minetest.get_modpath("farming") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -283,6 +289,7 @@ if minetest.get_modpath("farming") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Boats mod
|
-- Boats mod
|
||||||
|
|
||||||
if minetest.get_modpath("boats") then
|
if minetest.get_modpath("boats") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -291,6 +298,7 @@ if minetest.get_modpath("boats") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Beds mod
|
-- Beds mod
|
||||||
|
|
||||||
if minetest.get_modpath("beds") then
|
if minetest.get_modpath("beds") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -300,6 +308,7 @@ if minetest.get_modpath("beds") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Walls mod
|
-- Walls mod
|
||||||
|
|
||||||
if minetest.get_modpath("walls") then
|
if minetest.get_modpath("walls") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -310,8 +319,8 @@ if minetest.get_modpath("walls") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Carts mod
|
-- Carts mod
|
||||||
if minetest.get_modpath("carts")
|
|
||||||
or minetest.get_modpath("boost_cart") then
|
if minetest.get_modpath("carts") or minetest.get_modpath("boost_cart") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
{"dro", {"carts:cart"}},
|
{"dro", {"carts:cart"}},
|
||||||
@ -322,6 +331,7 @@ or minetest.get_modpath("boost_cart") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- 3D Armor mod
|
-- 3D Armor mod
|
||||||
|
|
||||||
if minetest.get_modpath("3d_armor") then
|
if minetest.get_modpath("3d_armor") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -352,6 +362,7 @@ if minetest.get_modpath("3d_armor") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- 3D Armor's Shields mod
|
-- 3D Armor's Shields mod
|
||||||
|
|
||||||
if minetest.get_modpath("shields") then
|
if minetest.get_modpath("shields") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -365,6 +376,7 @@ if minetest.get_modpath("shields") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Fire mod
|
-- Fire mod
|
||||||
|
|
||||||
if minetest.get_modpath("fire") then
|
if minetest.get_modpath("fire") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -377,6 +389,7 @@ if minetest.get_modpath("fire") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- TNT mod
|
-- TNT mod
|
||||||
|
|
||||||
if minetest.get_modpath("tnt") then
|
if minetest.get_modpath("tnt") then
|
||||||
|
|
||||||
local p = "tnt:tnt_burning"
|
local p = "tnt:tnt_burning"
|
||||||
@ -389,6 +402,7 @@ if minetest.get_modpath("tnt") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- More Ore's mod
|
-- More Ore's mod
|
||||||
|
|
||||||
if minetest.get_modpath("moreores") then
|
if minetest.get_modpath("moreores") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -438,6 +452,7 @@ if minetest.get_modpath("moreores") then
|
|||||||
end -- END moreores
|
end -- END moreores
|
||||||
|
|
||||||
-- Bags mod
|
-- Bags mod
|
||||||
|
|
||||||
if minetest.get_modpath("bags") or minetest.get_modpath("sfinv_bags") then
|
if minetest.get_modpath("bags") or minetest.get_modpath("sfinv_bags") then
|
||||||
|
|
||||||
minetest.register_craftitem(":bags:spar", {
|
minetest.register_craftitem(":bags:spar", {
|
||||||
@ -456,6 +471,7 @@ if minetest.get_modpath("bags") or minetest.get_modpath("sfinv_bags") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Nether Mod
|
-- Nether Mod
|
||||||
|
|
||||||
if minetest.get_modpath("nether") then
|
if minetest.get_modpath("nether") then
|
||||||
|
|
||||||
local p = "nether:"
|
local p = "nether:"
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
|
|
||||||
local S = lucky_block.intllib
|
local S = lucky_block.S
|
||||||
|
local mpath = minetest.get_modpath("mcl_core") .. "/schematics/"
|
||||||
local tmp -- helper
|
local tmp -- helper
|
||||||
|
|
||||||
-- chest items
|
-- chest items
|
||||||
|
|
||||||
lucky_block:add_chest_items({
|
lucky_block:add_chest_items({
|
||||||
{name = "mcl_core:wood", max = 5},
|
{name = "mcl_core:wood", max = 5},
|
||||||
{name = "mcl_core:apple", max = 3},
|
{name = "mcl_core:apple", max = 3},
|
||||||
@ -12,10 +14,8 @@ lucky_block:add_chest_items({
|
|||||||
{name = "mcl_core:pick_iron", max = 1, chance = 2, min_wear = 20000, max_wear = 65536}
|
{name = "mcl_core:pick_iron", max = 1, chance = 2, min_wear = 20000, max_wear = 65536}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
local mpath = minetest.get_modpath("mcl_core") .. "/schematics/"
|
|
||||||
|
|
||||||
-- Default tree schematics
|
-- Default tree schematics
|
||||||
|
|
||||||
lucky_block:add_schematics({
|
lucky_block:add_schematics({
|
||||||
{"oaktree1", mpath .. "mcl_core_oak_large_1.mts", {x = 2, y = 1, z = 2}},
|
{"oaktree1", mpath .. "mcl_core_oak_large_1.mts", {x = 2, y = 1, z = 2}},
|
||||||
-- {"oaktree2", mpath .. "mcl_core_oak_large_2.mts", {x = 1, y = 1, z = 1}},
|
-- {"oaktree2", mpath .. "mcl_core_oak_large_2.mts", {x = 1, y = 1, z = 1}},
|
||||||
@ -42,7 +42,8 @@ lucky_block:add_schematics({
|
|||||||
-- {"redmushroom2", mpath .. "mcl_mushrooms_giant_red.mts", {x = 1, y = 1, z = 1}}
|
-- {"redmushroom2", mpath .. "mcl_mushrooms_giant_red.mts", {x = 1, y = 1, z = 1}}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- mineclone tree's
|
-- mineclone trees
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
{"sch", "oaktree1", 0, false},
|
{"sch", "oaktree1", 0, false},
|
||||||
{"sch", "oaktreeswamp", 0, false},
|
{"sch", "oaktreeswamp", 0, false},
|
||||||
@ -57,6 +58,7 @@ lucky_block:add_blocks({
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- mineclone lucky blocks
|
-- mineclone lucky blocks
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
{"nod", "mcl_chests_small:chest", 0, {
|
{"nod", "mcl_chests_small:chest", 0, {
|
||||||
{name = "mcl_core:glass_red", max = 5},
|
{name = "mcl_core:glass_red", max = 5},
|
||||||
@ -165,6 +167,7 @@ lucky_block:add_blocks({
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- Additional Wishing Well Styles
|
-- Additional Wishing Well Styles
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
{"sch", "wishingwell", 0, true, {
|
{"sch", "wishingwell", 0, true, {
|
||||||
{"default:stonebrick", "mcl_core:sandstone"},
|
{"default:stonebrick", "mcl_core:sandstone"},
|
||||||
@ -176,6 +179,7 @@ lucky_block:add_blocks({
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- mcl_crafting_table
|
-- mcl_crafting_table
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_crafting_table") then
|
if minetest.get_modpath("mcl_crafting_table") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -185,6 +189,7 @@ if minetest.get_modpath("mcl_crafting_table") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_dye
|
-- mcl_dye
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_dye") then
|
if minetest.get_modpath("mcl_dye") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -193,6 +198,7 @@ if minetest.get_modpath("mcl_dye") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_buckets
|
-- mcl_buckets
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_buckets") then
|
if minetest.get_modpath("mcl_buckets") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -206,6 +212,7 @@ if minetest.get_modpath("mcl_buckets") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_books
|
-- mcl_books
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_books") then
|
if minetest.get_modpath("mcl_books") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -215,6 +222,7 @@ if minetest.get_modpath("mcl_books") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_wool
|
-- mcl_wool
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_wool") then
|
if minetest.get_modpath("mcl_wool") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -226,6 +234,7 @@ if minetest.get_modpath("mcl_wool") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_flowers
|
-- mcl_flowers
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_flowers") then
|
if minetest.get_modpath("mcl_flowers") then
|
||||||
|
|
||||||
tmp = "mcl_flowers:"
|
tmp = "mcl_flowers:"
|
||||||
@ -261,6 +270,7 @@ if minetest.get_modpath("mcl_flowers") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_hoppers
|
-- mcl_hoppers
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_hoppers") then
|
if minetest.get_modpath("mcl_hoppers") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -269,6 +279,7 @@ if minetest.get_modpath("mcl_hoppers") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_doors
|
-- mcl_doors
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_doors") then
|
if minetest.get_modpath("mcl_doors") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -291,6 +302,7 @@ if minetest.get_modpath("mcl_doors") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_fences
|
-- mcl_fences
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_fences") then
|
if minetest.get_modpath("mcl_fences") then
|
||||||
|
|
||||||
tmp = "mcl_fences:"
|
tmp = "mcl_fences:"
|
||||||
@ -308,6 +320,7 @@ if minetest.get_modpath("mcl_fences") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Screwdriver mod
|
-- Screwdriver mod
|
||||||
|
|
||||||
if minetest.get_modpath("screwdriver") then
|
if minetest.get_modpath("screwdriver") then
|
||||||
|
|
||||||
if screwdriver and screwdriver.handler then
|
if screwdriver and screwdriver.handler then
|
||||||
@ -339,6 +352,7 @@ if minetest.get_modpath("screwdriver") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_farming
|
-- mcl_farming
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_farming") then
|
if minetest.get_modpath("mcl_farming") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -384,6 +398,7 @@ if minetest.get_modpath("mcl_farming") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_boats
|
-- mcl_boats
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_boats") then
|
if minetest.get_modpath("mcl_boats") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -393,6 +408,7 @@ if minetest.get_modpath("mcl_boats") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_beds
|
-- mcl_beds
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_beds") then
|
if minetest.get_modpath("mcl_beds") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -401,6 +417,7 @@ if minetest.get_modpath("mcl_beds") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_walls
|
-- mcl_walls
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_walls") then
|
if minetest.get_modpath("mcl_walls") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -424,6 +441,7 @@ if minetest.get_modpath("mcl_walls") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_minecarts
|
-- mcl_minecarts
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_minecarts") then
|
if minetest.get_modpath("mcl_minecarts") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -437,6 +455,7 @@ if minetest.get_modpath("mcl_minecarts") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_armor
|
-- mcl_armor
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_armor") then
|
if minetest.get_modpath("mcl_armor") then
|
||||||
|
|
||||||
tmp = "mcl_armor:"
|
tmp = "mcl_armor:"
|
||||||
@ -470,6 +489,7 @@ if minetest.get_modpath("mcl_armor") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_fire
|
-- mcl_fire
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_fire") then
|
if minetest.get_modpath("mcl_fire") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -481,6 +501,7 @@ if minetest.get_modpath("mcl_fire") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_tnt
|
-- mcl_tnt
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_tnt") then
|
if minetest.get_modpath("mcl_tnt") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -492,6 +513,7 @@ if minetest.get_modpath("mcl_tnt") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mobs_mc
|
-- mobs_mc
|
||||||
|
|
||||||
if minetest.get_modpath("mobs_mc") then
|
if minetest.get_modpath("mobs_mc") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -511,6 +533,7 @@ if minetest.get_modpath("mobs_mc") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_mobitems
|
-- mcl_mobitems
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_mobitems") then
|
if minetest.get_modpath("mcl_mobitems") then
|
||||||
|
|
||||||
tmp = "mcl_mobitems:"
|
tmp = "mcl_mobitems:"
|
||||||
@ -536,6 +559,7 @@ if minetest.get_modpath("mcl_mobitems") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_potions
|
-- mcl_potions
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_potions") then
|
if minetest.get_modpath("mcl_potions") then
|
||||||
|
|
||||||
tmp = "mcl_potions:"
|
tmp = "mcl_potions:"
|
||||||
@ -551,6 +575,7 @@ if minetest.get_modpath("mcl_potions") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_torches
|
-- mcl_torches
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_torches") then
|
if minetest.get_modpath("mcl_torches") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -560,6 +585,7 @@ if minetest.get_modpath("mcl_torches") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_cake
|
-- mcl_cake
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_cake") then
|
if minetest.get_modpath("mcl_cake") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -576,6 +602,7 @@ if minetest.get_modpath("mcl_cake") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_fishing
|
-- mcl_fishing
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_fishing") then
|
if minetest.get_modpath("mcl_fishing") then
|
||||||
|
|
||||||
tmp = "mcl_fishing:"
|
tmp = "mcl_fishing:"
|
||||||
@ -588,6 +615,7 @@ if minetest.get_modpath("mcl_fishing") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- mcl_nether
|
-- mcl_nether
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_nether") then
|
if minetest.get_modpath("mcl_nether") then
|
||||||
|
|
||||||
tmp = "mcl_nether:"
|
tmp = "mcl_nether:"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
-- extra doors mod
|
-- extra doors mod
|
||||||
|
|
||||||
if minetest.get_modpath("extra_doors") then
|
if minetest.get_modpath("extra_doors") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -27,6 +28,7 @@ if minetest.get_modpath("extra_doors") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Home Decor mod
|
-- Home Decor mod
|
||||||
|
|
||||||
if minetest.get_modpath("homedecor") then
|
if minetest.get_modpath("homedecor") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -53,6 +55,7 @@ if minetest.get_modpath("homedecor") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Caverealms
|
-- Caverealms
|
||||||
|
|
||||||
if minetest.get_modpath("caverealms") then
|
if minetest.get_modpath("caverealms") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -66,6 +69,7 @@ if minetest.get_modpath("caverealms") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Moreblocks mod
|
-- Moreblocks mod
|
||||||
|
|
||||||
if minetest.get_modpath("moreblocks") then
|
if minetest.get_modpath("moreblocks") then
|
||||||
|
|
||||||
local p = "moreblocks:"
|
local p = "moreblocks:"
|
||||||
@ -146,6 +150,7 @@ if minetest.get_modpath("moreblocks") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- worm farm mod
|
-- worm farm mod
|
||||||
|
|
||||||
if minetest.get_modpath("worm_farm") then
|
if minetest.get_modpath("worm_farm") then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
local S = lucky_block.intllib
|
local S = lucky_block.S
|
||||||
|
|
||||||
|
|
||||||
-- custom function (punches player with 5 damage)
|
-- custom function (punches player with 5 damage)
|
||||||
|
|
||||||
local function punchy(pos, player)
|
local function punchy(pos, player)
|
||||||
|
|
||||||
player:punch(player, 1.0, {
|
player:punch(player, 1.0, {
|
||||||
@ -16,8 +16,8 @@ local function punchy(pos, player)
|
|||||||
lucky_block.green .. S("Stop hitting yourself!"))
|
lucky_block.green .. S("Stop hitting yourself!"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- custom function (pint sized player) and potion with recipe
|
-- custom function (pint sized player) and potion with recipe
|
||||||
|
|
||||||
local function pint(pos, player)
|
local function pint(pos, player)
|
||||||
|
|
||||||
player:set_properties({
|
player:set_properties({
|
||||||
@ -50,10 +50,12 @@ local function pint(pos, player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- pint sized potion item
|
-- pint sized potion item
|
||||||
|
|
||||||
minetest.register_craftitem("lucky_block:pint_sized_potion", {
|
minetest.register_craftitem("lucky_block:pint_sized_potion", {
|
||||||
description = S("Pint Sized Potion (DRINK ME)"),
|
description = S("Pint Sized Potion (DRINK ME)"),
|
||||||
inventory_image = "lucky_pint_sized_potion.png",
|
inventory_image = "lucky_pint_sized_potion.png",
|
||||||
groups = {vessel = 1},
|
groups = {vessel = 1},
|
||||||
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
@ -75,6 +77,7 @@ minetest.register_craftitem("lucky_block:pint_sized_potion", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- pint sized potion recipe (default)
|
-- pint sized potion recipe (default)
|
||||||
|
|
||||||
if lucky_block.mod_def then
|
if lucky_block.mod_def then
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
@ -87,8 +90,8 @@ if lucky_block.mod_def then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- custom function (slender player) and potion with recipe
|
-- custom function (slender player) and potion with recipe
|
||||||
|
|
||||||
local function slender(pos, player)
|
local function slender(pos, player)
|
||||||
|
|
||||||
player:set_properties({
|
player:set_properties({
|
||||||
@ -121,10 +124,12 @@ local function slender(pos, player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- slender player potion item
|
-- slender player potion item
|
||||||
|
|
||||||
minetest.register_craftitem("lucky_block:slender_player_potion", {
|
minetest.register_craftitem("lucky_block:slender_player_potion", {
|
||||||
description = S("Slender Player Potion (DRINK ME)"),
|
description = S("Slender Player Potion (DRINK ME)"),
|
||||||
inventory_image = "lucky_slender_potion.png",
|
inventory_image = "lucky_slender_potion.png",
|
||||||
groups = {vessel = 1},
|
groups = {vessel = 1},
|
||||||
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
@ -146,6 +151,7 @@ minetest.register_craftitem("lucky_block:slender_player_potion", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- slender player potion recipe
|
-- slender player potion recipe
|
||||||
|
|
||||||
if lucky_block.mod_def then
|
if lucky_block.mod_def then
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
@ -158,8 +164,8 @@ if lucky_block.mod_def then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- lightning staff
|
-- lightning staff
|
||||||
|
|
||||||
minetest.register_tool("lucky_block:lightning_staff", {
|
minetest.register_tool("lucky_block:lightning_staff", {
|
||||||
description = S("Lightning Staff"),
|
description = S("Lightning Staff"),
|
||||||
inventory_image = "lucky_lightning_staff.png",
|
inventory_image = "lucky_lightning_staff.png",
|
||||||
@ -232,7 +238,7 @@ minetest.register_tool("lucky_block:lightning_staff", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.sound_play("lightning", {
|
minetest.sound_play("lightning", {
|
||||||
pos = pos, gain = 1.0, max_hear_distance = 25}, true)
|
pos = pos, gain = 1.0, max_hear_distance = 25}, true)
|
||||||
|
|
||||||
itemstack:add_wear(65535 / 50) -- 50 uses
|
itemstack:add_wear(65535 / 50) -- 50 uses
|
||||||
|
|
||||||
@ -240,8 +246,8 @@ minetest.register_tool("lucky_block:lightning_staff", {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- custom function (drop player inventory and replace with items and show msg)
|
-- custom function (drop player inventory and replace with items and show msg)
|
||||||
|
|
||||||
local function dropsy(pos, player, def)
|
local function dropsy(pos, player, def)
|
||||||
|
|
||||||
local player_inv = player:get_inventory()
|
local player_inv = player:get_inventory()
|
||||||
@ -267,10 +273,11 @@ local function dropsy(pos, player, def)
|
|||||||
minetest.chat_send_player(player:get_player_name(), lucky_block.green .. S(def.msg))
|
minetest.chat_send_player(player:get_player_name(), lucky_block.green .. S(def.msg))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local tex = lucky_block.mod_mcl and "default_glass.png" or "default_obsidian_glass.png^[brighten"
|
|
||||||
|
|
||||||
-- void mirror block (place to see through solid walls)
|
-- void mirror block (place to see through solid walls)
|
||||||
|
|
||||||
|
local tex = lucky_block.mod_mcl and "default_glass.png"
|
||||||
|
or "default_obsidian_glass.png^[brighten"
|
||||||
|
|
||||||
minetest.register_node("lucky_block:void_mirror", {
|
minetest.register_node("lucky_block:void_mirror", {
|
||||||
description = S("Void Mirror (Place to see through solid walls during daytime)"),
|
description = S("Void Mirror (Place to see through solid walls during daytime)"),
|
||||||
drawtype = "normal",
|
drawtype = "normal",
|
||||||
@ -281,8 +288,8 @@ minetest.register_node("lucky_block:void_mirror", {
|
|||||||
_mcl_hardness = 0.6
|
_mcl_hardness = 0.6
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- Troll item drop
|
-- Troll item drop
|
||||||
|
|
||||||
local function fake_items(pos, player, def)
|
local function fake_items(pos, player, def)
|
||||||
|
|
||||||
for n = 1, 25 do
|
for n = 1, 25 do
|
||||||
@ -310,8 +317,8 @@ local function fake_items(pos, player, def)
|
|||||||
lucky_block.green .. S("Wow! So many faux " .. def.txt .. "!"))
|
lucky_block.green .. S("Wow! So many faux " .. def.txt .. "!"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Void Pick (disable for mineclone since it has silk touch tools)
|
-- Void Pick (disable for mineclone since it has silk touch tools)
|
||||||
|
|
||||||
if not lucky_block.mod_mcl then
|
if not lucky_block.mod_mcl then
|
||||||
|
|
||||||
local old_handle_node_drops = minetest.handle_node_drops
|
local old_handle_node_drops = minetest.handle_node_drops
|
||||||
@ -346,9 +353,7 @@ if not lucky_block.mod_mcl then
|
|||||||
max_drop_level = 3,
|
max_drop_level = 3,
|
||||||
groupcaps = {
|
groupcaps = {
|
||||||
cracky = {
|
cracky = {
|
||||||
times = {[1] = 2.4, [2] = 1.2, [3] = 0.60},
|
times = {[1] = 2.4, [2] = 1.2, [3] = 0.60}, uses = 20, maxlevel = 3
|
||||||
uses = 20,
|
|
||||||
maxlevel = 3
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
damage_groups = {fleshy = 5},
|
damage_groups = {fleshy = 5},
|
||||||
@ -359,6 +364,7 @@ if not lucky_block.mod_mcl then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- add custom functions and special drops
|
-- add custom functions and special drops
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
{"cus", pint},
|
{"cus", pint},
|
||||||
{"cus", punchy},
|
{"cus", punchy},
|
||||||
@ -368,8 +374,8 @@ lucky_block:add_blocks({
|
|||||||
{"dro", {"lucky_block:void_mirror"}}
|
{"dro", {"lucky_block:void_mirror"}}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- custom items for default mod
|
-- custom items for default mod
|
||||||
|
|
||||||
if lucky_block.mod_def then
|
if lucky_block.mod_def then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
@ -398,12 +404,11 @@ if lucky_block.mod_def then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- pova mod effects
|
-- pova mod effects
|
||||||
|
|
||||||
if minetest.get_modpath("pova") then
|
if minetest.get_modpath("pova") then
|
||||||
|
|
||||||
-- slowmo effect
|
local function slowmo(pos, player, def) -- slowmo effect
|
||||||
local function slowmo(pos, player, def)
|
|
||||||
|
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
|
|
||||||
@ -424,8 +429,7 @@ if minetest.get_modpath("pova") then
|
|||||||
end, player)
|
end, player)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- high jump effect
|
local function highfly(pos, player, def) -- high jump effect
|
||||||
local function highfly(pos, player, def)
|
|
||||||
|
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
|
|
||||||
|
22
lb_well.lua
22
lb_well.lua
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
-- well block (player stands near and it triggers drops)
|
-- well block (player stands near and it triggers drops)
|
||||||
|
|
||||||
minetest.register_node("lucky_block:well_block", {
|
minetest.register_node("lucky_block:well_block", {
|
||||||
description = "Well Block",
|
description = "Well Block",
|
||||||
tiles = {"default_glass.png"},
|
tiles = {"default_glass.png"},
|
||||||
@ -9,8 +10,8 @@ minetest.register_node("lucky_block:well_block", {
|
|||||||
drop = {}
|
drop = {}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- wishing well schematic layout
|
-- wishing well schematic layout
|
||||||
|
|
||||||
local stb = {name = "default:steelblock", param1 = 255}
|
local stb = {name = "default:steelblock", param1 = 255}
|
||||||
local sbr = {name = "default:stonebrick", param1 = 255}
|
local sbr = {name = "default:stonebrick", param1 = 255}
|
||||||
local fwd = {name = "default:fence_wood", param1 = 255}
|
local fwd = {name = "default:fence_wood", param1 = 255}
|
||||||
@ -43,18 +44,18 @@ local wishing_well = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-- add schematic to list
|
-- add schematic to list
|
||||||
|
|
||||||
lucky_block:add_schematics({
|
lucky_block:add_schematics({
|
||||||
{"wishingwell", wishing_well, {x = 1, y = 1, z = 1}}
|
{"wishingwell", wishing_well, {x = 1, y = 1, z = 1}}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
-- Global list containing well blocks that can be dropped
|
-- Global list containing well blocks that can be dropped
|
||||||
|
|
||||||
lucky_block.wellblocks = {}
|
lucky_block.wellblocks = {}
|
||||||
|
|
||||||
|
|
||||||
-- helper function
|
-- helper function
|
||||||
|
|
||||||
local add_wblock = function(list)
|
local add_wblock = function(list)
|
||||||
|
|
||||||
for s = 1, #list do
|
for s = 1, #list do
|
||||||
@ -62,6 +63,7 @@ local add_wblock = function(list)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- add default well blocks
|
||||||
|
|
||||||
if lucky_block.mod_def then
|
if lucky_block.mod_def then
|
||||||
|
|
||||||
@ -106,6 +108,8 @@ if lucky_block.mod_def then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- tnt mod
|
||||||
|
|
||||||
if minetest.get_modpath("tnt") then
|
if minetest.get_modpath("tnt") then
|
||||||
|
|
||||||
add_wblock({
|
add_wblock({
|
||||||
@ -115,6 +119,8 @@ if minetest.get_modpath("tnt") then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- ethereal
|
||||||
|
|
||||||
if minetest.get_modpath("ethereal") then
|
if minetest.get_modpath("ethereal") then
|
||||||
|
|
||||||
add_wblock({
|
add_wblock({
|
||||||
@ -122,6 +128,8 @@ if minetest.get_modpath("ethereal") then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- bones
|
||||||
|
|
||||||
if minetest.get_modpath("bones") then
|
if minetest.get_modpath("bones") then
|
||||||
|
|
||||||
add_wblock({
|
add_wblock({
|
||||||
@ -129,6 +137,8 @@ if minetest.get_modpath("bones") then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- mineclone
|
||||||
|
|
||||||
if lucky_block.mod_mcl then
|
if lucky_block.mod_mcl then
|
||||||
|
|
||||||
add_wblock({
|
add_wblock({
|
||||||
@ -145,8 +155,8 @@ if lucky_block.mod_mcl then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- abm function to detect player and trigger drops
|
-- abm function to detect player and trigger drops
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label = "Lucky Block Wishing Well Block",
|
label = "Lucky Block Wishing Well Block",
|
||||||
nodenames = {"lucky_block:well_block"},
|
nodenames = {"lucky_block:well_block"},
|
||||||
@ -163,7 +173,7 @@ minetest.register_abm({
|
|||||||
minetest.swap_node(pos, {name = lucky_block.def_glass})
|
minetest.swap_node(pos, {name = lucky_block.def_glass})
|
||||||
|
|
||||||
minetest.sound_play("default_tool_breaks", {
|
minetest.sound_play("default_tool_breaks", {
|
||||||
pos = pos, gain = 1.0, max_hear_distance = 5}, true)
|
pos = pos, gain = 1.0, max_hear_distance = 5}, true)
|
||||||
|
|
||||||
local b_no = math.random(#lucky_block.wellblocks)
|
local b_no = math.random(#lucky_block.wellblocks)
|
||||||
local item = lucky_block.wellblocks[b_no][1]
|
local item = lucky_block.wellblocks[b_no][1]
|
||||||
|
@ -1,15 +1,9 @@
|
|||||||
# textdomain: lucky_block
|
# textdomain: lucky_block
|
||||||
# author:
|
|
||||||
# last update: 2017/Aug/28
|
|
||||||
|
|
||||||
### init.lua ###
|
|
||||||
Stop hitting yourself!=Прекратите удары себя
|
Stop hitting yourself!=Прекратите удары себя
|
||||||
Dry shrub takeover!=Поглощение сухих кустов
|
Dry shrub takeover!=Поглощение сухих кустов
|
||||||
Random teleport!=Случайный телепорт!
|
Random teleport!=Случайный телепорт!
|
||||||
Lucky Block=Удачливый блок
|
Lucky Block=Удачливый блок
|
||||||
Super Lucky Block (use pick)=Супер удачливый блок (используйте кирку)
|
Super Lucky Block (use pick)=Супер удачливый блок (используйте кирку)
|
||||||
[MOD] Lucky Blocks loaded (@1 in total)=[MOD] Удачливый блок нагруженный (Всего @1)
|
[MOD] Lucky Blocks loaded (@1 in total)=[MOD] Удачливый блок нагруженный (Всего @1)
|
||||||
|
|
||||||
### blocks.lua ###
|
|
||||||
Super Mega Magenta Ultra Screwdriver 2500\n(left-click to rotate face, right-click to rotates axis)"=Пурпурная супер мега ультра отвёртка 2500\n(левая кнопка для вращения лицевой части, правая кнопка для вращения осей)
|
Super Mega Magenta Ultra Screwdriver 2500\n(left-click to rotate face, right-click to rotates axis)"=Пурпурная супер мега ультра отвёртка 2500\n(левая кнопка для вращения лицевой части, правая кнопка для вращения осей)
|
||||||
Void Mirror (Place to see through solid walls during daytime=Пустое зеркало (Установите, чтобы видеть сквозь сплошные стены в дневное время)
|
Void Mirror (Place to see through solid walls during daytime=Пустое зеркало (Установите, чтобы видеть сквозь сплошные стены в дневное время)
|
||||||
|
4
mod.conf
4
mod.conf
@ -1,4 +1,4 @@
|
|||||||
name = lucky_block
|
name = lucky_block
|
||||||
depends =
|
|
||||||
optional_depends = default, mcl_core, mcl_sounds, tnt, screwdriver, pova
|
|
||||||
description = Adds lucky blocks into the game which may give good, bad, hurtful items when open :)
|
description = Adds lucky blocks into the game which may give good, bad, hurtful items when open :)
|
||||||
|
optional_depends = default, mcl_core, mcl_sounds, tnt, screwdriver, pova
|
||||||
|
min_minetest_version = 5.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user