mirror of
https://notabug.org/TenPlus1/lucky_block.git
synced 2024-08-20 23:34:07 +02:00
Added new explosion settings and new blocks
This commit is contained in:
parent
09d83ce51e
commit
94a64db889
@ -17,3 +17,4 @@ Changelog:
|
|||||||
- 0.2 - New api commands added thanks to blert2112
|
- 0.2 - New api commands added thanks to blert2112
|
||||||
- 0.3 - New blocks added, also error checking, new options and schematic rehaul
|
- 0.3 - New blocks added, also error checking, new options and schematic rehaul
|
||||||
- 0.4 - Added ability to add custom functions within lucky blocks
|
- 0.4 - Added ability to add custom functions within lucky blocks
|
||||||
|
- 0.5 - Explosions now have radius and fire setting, also added new blocks
|
||||||
|
10
api.txt
10
api.txt
@ -239,9 +239,15 @@ Explosion
|
|||||||
---------
|
---------
|
||||||
|
|
||||||
Now we start adding the bad lucky blocks that cause damage to the player by
|
Now we start adding the bad lucky blocks that cause damage to the player by
|
||||||
exploding.
|
adding explosions.
|
||||||
|
|
||||||
{"exp"}
|
{"exp", radius, fire}
|
||||||
|
|
||||||
|
e.g.
|
||||||
|
|
||||||
|
Cause explosion with radius of 4 and fire enabled.
|
||||||
|
|
||||||
|
{"exp", 4, true}
|
||||||
|
|
||||||
|
|
||||||
Lightning Strike
|
Lightning Strike
|
||||||
|
53
blocks.lua
53
blocks.lua
@ -8,6 +8,7 @@ lucky_block:add_schematics({
|
|||||||
{"defpinetree", dpath .. "pine_tree_from_sapling.mts", {x = 2, y = 1, z = 2}},
|
{"defpinetree", dpath .. "pine_tree_from_sapling.mts", {x = 2, y = 1, z = 2}},
|
||||||
{"acaciatree", dpath .. "acacia_tree_from_sapling.mts", {x = 4, y = 1, z = 4}},
|
{"acaciatree", dpath .. "acacia_tree_from_sapling.mts", {x = 4, y = 1, z = 4}},
|
||||||
{"aspentree", dpath .. "aspen_tree_from_sapling.mts", {x = 2, y = 1, z = 2}},
|
{"aspentree", dpath .. "aspen_tree_from_sapling.mts", {x = 2, y = 1, z = 2}},
|
||||||
|
{"corals", dpath .. "corals.mts", {x = 2, y = 1, z = 2}},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Default blocks
|
-- Default blocks
|
||||||
@ -28,7 +29,7 @@ lucky_block:add_blocks({
|
|||||||
{"sch", "defpinetree", 0, false},
|
{"sch", "defpinetree", 0, false},
|
||||||
{"sch", "lavatrap", 1, true},
|
{"sch", "lavatrap", 1, true},
|
||||||
{"dro", {"default:mese_crystal_fragment", "default:mese_crystal"}, 10},
|
{"dro", {"default:mese_crystal_fragment", "default:mese_crystal"}, 10},
|
||||||
{"exp"},
|
{"exp", 2, true},
|
||||||
{"nod", "default:diamondblock", 0},
|
{"nod", "default:diamondblock", 0},
|
||||||
{"nod", "default:steelblock", 0},
|
{"nod", "default:steelblock", 0},
|
||||||
{"nod", "default:dirt", 0},
|
{"nod", "default:dirt", 0},
|
||||||
@ -41,7 +42,7 @@ lucky_block:add_blocks({
|
|||||||
{"sch", "acaciatree", 0, false},
|
{"sch", "acaciatree", 0, false},
|
||||||
{"dro", {"default:axe_steel"}, 1},
|
{"dro", {"default:axe_steel"}, 1},
|
||||||
{"dro", {"default:sword_bronze"}, 1},
|
{"dro", {"default:sword_bronze"}, 1},
|
||||||
{"exp"},
|
{"exp", 3},
|
||||||
{"sch", "platform", 1, true},
|
{"sch", "platform", 1, true},
|
||||||
{"nod", "default:wood", 0},
|
{"nod", "default:wood", 0},
|
||||||
{"dro", {"default:pick_bronze"}, 1},
|
{"dro", {"default:pick_bronze"}, 1},
|
||||||
@ -49,8 +50,52 @@ lucky_block:add_blocks({
|
|||||||
{"dro", {"default:shovel_bronze"}, 1},
|
{"dro", {"default:shovel_bronze"}, 1},
|
||||||
{"nod", "default:gravel", 0},
|
{"nod", "default:gravel", 0},
|
||||||
{"dro", {"default:axe_bronze"}, 1},
|
{"dro", {"default:axe_bronze"}, 1},
|
||||||
|
{"dro", {"default:bookshelf", "default:book", "default:paper"}, 5},
|
||||||
|
{"dro", {"default:fence_wood", "default:fence_acacia_wood", "default:fence_aspen_wood",
|
||||||
|
"default:fence_junglewood", "default:fence_pine_wood"}, 15},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- default dev blocks
|
||||||
|
if minetest.registered_nodes["default:coral_brown"] then
|
||||||
|
lucky_block:add_blocks({
|
||||||
|
{"dro", {"default:coral_brown", "default:coral_orange", "default:coral_skeleton"}, 5},
|
||||||
|
{"sch", "corals", 0, true},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
if minetest.registered_nodes["default:mese_post_light"] then
|
||||||
|
lucky_block:add_blocks({
|
||||||
|
{"dro", {"default:mese_post_light", "default:fence_wood"}, 5},
|
||||||
|
{"nod", "default:mese_post_light"},
|
||||||
|
{"dro", {"default:silver_sand", "default:sand", "default:desert_sand"}, 25},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- doors mod
|
||||||
|
if minetest.get_modpath("doors") then
|
||||||
|
lucky_block:add_blocks({
|
||||||
|
{"dro", {"doors:door_wood", "doors:door_steel", "doors:door_glass",
|
||||||
|
"doors:door_obsidian_glass", "doors:trapdoor", "doors:trapdoor_steel"}, 1},
|
||||||
|
{"dro", {"doors:gate_acacia_wood_closed", "doors:gate_aspen_wood_closed", "doors:gate_wood_closed",
|
||||||
|
"doors:gate_pine_wood_closed", "doors:gate_junglewood_closed"}, 5},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- screwdriver mod
|
||||||
|
if minetest.get_modpath("screwdriver") then
|
||||||
|
lucky_block:add_blocks({
|
||||||
|
{"dro", {"screwdriver:screwdriver"}, 1},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- vessels mod
|
||||||
|
if minetest.get_modpath("vessels") then
|
||||||
|
lucky_block:add_blocks({
|
||||||
|
{"dro", {"vessels:shelf", "vessels:drinking_glass", "vessels:glass_bottle",
|
||||||
|
"vessels:steel_bottle", "vessels:glass_fragments"}, 5},
|
||||||
|
})
|
||||||
|
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({
|
||||||
@ -108,14 +153,14 @@ lucky_block:add_blocks({
|
|||||||
{"dro", {"shields:shield_gold"}, 1},
|
{"dro", {"shields:shield_gold"}, 1},
|
||||||
{"dro", {"shields:shield_cactus"}, 1},
|
{"dro", {"shields:shield_cactus"}, 1},
|
||||||
{"dro", {"shields:shield_bronze"}, 1},
|
{"dro", {"shields:shield_bronze"}, 1},
|
||||||
{"exp"},
|
{"exp", 2},
|
||||||
})
|
})
|
||||||
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({
|
||||||
{"dro", {"fire:flint_and_steel"}, 1},
|
{"dro", {"fire:flint_and_steel", "default:flint"}, 1},
|
||||||
{"nod", "fire:basic_flame", 1},
|
{"nod", "fire:basic_flame", 1},
|
||||||
{"nod", "fire:permanent_flame", 1},
|
{"nod", "fire:permanent_flame", 1},
|
||||||
})
|
})
|
||||||
|
23
init.lua
23
init.lua
@ -40,7 +40,7 @@ local lucky_list = {
|
|||||||
{"fal", {"default:wood", "default:gravel", "default:sand", "default:desert_sand", "default:stone", "default:dirt", "default:goldblock"}, 0},
|
{"fal", {"default:wood", "default:gravel", "default:sand", "default:desert_sand", "default:stone", "default:dirt", "default:goldblock"}, 0},
|
||||||
{"lig"},
|
{"lig"},
|
||||||
{"nod", "lucky_block:super_lucky_block", 0},
|
{"nod", "lucky_block:super_lucky_block", 0},
|
||||||
{"exp"},
|
{"exp", 2, true},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- ability to add new blocks to list
|
-- ability to add new blocks to list
|
||||||
@ -179,7 +179,7 @@ local c_brick = minetest.get_content_id("default:obsidianbrick")
|
|||||||
local c_chest = minetest.get_content_id("default:chest_locked")
|
local c_chest = minetest.get_content_id("default:chest_locked")
|
||||||
|
|
||||||
-- explosion
|
-- explosion
|
||||||
function explosion(pos, radius)
|
function explosion(pos, radius, fire)
|
||||||
|
|
||||||
-- play explosion sound
|
-- play explosion sound
|
||||||
minetest.sound_play("tnt_explode", {
|
minetest.sound_play("tnt_explode", {
|
||||||
@ -222,9 +222,13 @@ function explosion(pos, radius)
|
|||||||
if on_blast then
|
if on_blast then
|
||||||
return on_blast(p)
|
return on_blast(p)
|
||||||
else
|
else
|
||||||
minetest.set_node(p, {name = "air"})
|
if fire and minetest.registered_nodes[n].groups.flammable then
|
||||||
|
minetest.set_node(p, {name = "fire:basic_flame"})
|
||||||
|
else
|
||||||
|
minetest.set_node(p, {name = "air"})
|
||||||
|
end
|
||||||
|
|
||||||
effect(p, 2, "tnt_smoke.png", 5)
|
effect(p, 5, "tnt_smoke.png", 5)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -256,7 +260,7 @@ end
|
|||||||
-- this is what happens when you dig a lucky block
|
-- this is what happens when you dig a lucky block
|
||||||
local lucky_block = function(pos, digger)
|
local lucky_block = function(pos, digger)
|
||||||
|
|
||||||
local luck = math.random(1, #lucky_list) ; -- luck = 1
|
local luck = math.random(1, #lucky_list) ; -- luck = 1
|
||||||
local action = lucky_list[luck][1]
|
local action = lucky_list[luck][1]
|
||||||
local schem
|
local schem
|
||||||
|
|
||||||
@ -375,8 +379,11 @@ local lucky_block = function(pos, digger)
|
|||||||
-- explosion
|
-- explosion
|
||||||
elseif action == "exp" then
|
elseif action == "exp" then
|
||||||
|
|
||||||
explosion(pos, 2)
|
local rad = lucky_list[luck][2] or 2
|
||||||
entity_physics(pos, 2)
|
local fire = lucky_list[luck][3]
|
||||||
|
|
||||||
|
explosion(pos, rad, fire)
|
||||||
|
entity_physics(pos, rad)
|
||||||
|
|
||||||
-- teleport
|
-- teleport
|
||||||
elseif action == "tel" then
|
elseif action == "tel" then
|
||||||
@ -392,6 +399,8 @@ local lucky_block = function(pos, digger)
|
|||||||
|
|
||||||
digger:setpos(pos, false)
|
digger:setpos(pos, false)
|
||||||
|
|
||||||
|
minetest.chat_send_player(digger:get_player_name(), "Random Teleport!")
|
||||||
|
|
||||||
-- drop items
|
-- drop items
|
||||||
elseif action == "dro" then
|
elseif action == "dro" then
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user