mirror of
https://notabug.org/TenPlus1/lucky_block.git
synced 2024-10-28 00:39:26 +01:00
Added new api commands
This commit is contained in:
parent
e1601488a5
commit
ae31b9afde
@ -14,3 +14,4 @@ https://forum.minetest.net/viewtopic.php?f=9&t=13284
|
|||||||
Released under WTFPL
|
Released under WTFPL
|
||||||
|
|
||||||
0.1 - Initial release
|
0.1 - Initial release
|
||||||
|
0.2 - New api commands added thanks to blert2112
|
||||||
|
25
api.txt
25
api.txt
@ -123,3 +123,28 @@ Add gold block with wood sound, then after 2 seconds remove with pop
|
|||||||
-= Lightning Strike (no settings, Lucky Block is hit by lightning and deals damage)
|
-= Lightning Strike (no settings, Lucky Block is hit by lightning and deals damage)
|
||||||
|
|
||||||
{"lig"}
|
{"lig"}
|
||||||
|
|
||||||
|
|
||||||
|
Additional Commands thanks to blert2112
|
||||||
|
|
||||||
|
lucky_block:purge_block_list()
|
||||||
|
|
||||||
|
This removes all pre-defined lucky blocks and leaves the super lucky block.
|
||||||
|
|
||||||
|
|
||||||
|
lucky_block:purge_chest_items()
|
||||||
|
|
||||||
|
This removes all pre-defined chest_stuff items and leaves it empty.
|
||||||
|
|
||||||
|
|
||||||
|
lucky_block:add_chest_items(list)
|
||||||
|
|
||||||
|
This command adds items to the chest_stuff list for use inside of lucky chests:
|
||||||
|
|
||||||
|
lucky_block:add_chest_items({
|
||||||
|
{name = "default:apple", max = 3},
|
||||||
|
{name = "default:steel_ingot", max = 2},
|
||||||
|
{name = "default:gold_ingot", max = 2},
|
||||||
|
{name = "default:diamond", max = 1},
|
||||||
|
{name = "default:pick_steel", max = 1}
|
||||||
|
})
|
||||||
|
21
init.lua
21
init.lua
@ -14,7 +14,12 @@ function lucky_block:add_blocks(list)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- import blocks
|
-- call to purge the block list
|
||||||
|
function lucky_block:purge_block_list()
|
||||||
|
lucky_list = {{"nod", "lucky_block:super_lucky_block", 0}}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- import default blocks
|
||||||
dofile(minetest.get_modpath("lucky_block").."/blocks.lua")
|
dofile(minetest.get_modpath("lucky_block").."/blocks.lua")
|
||||||
|
|
||||||
-- for random colour selection
|
-- for random colour selection
|
||||||
@ -32,6 +37,18 @@ local chest_stuff = {
|
|||||||
{name = "default:pick_steel", max = 1}
|
{name = "default:pick_steel", max = 1}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- call to purge the chest items list
|
||||||
|
function lucky_block:purge_chest_items()
|
||||||
|
chest_stuff = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- ability to add chest items
|
||||||
|
function lucky_block:add_chest_items(list)
|
||||||
|
for s = 1, #list do
|
||||||
|
table.insert(chest_stuff, list[s])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- particle effects
|
-- particle effects
|
||||||
function effect(pos, amount, texture, max_size)
|
function effect(pos, amount, texture, max_size)
|
||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
@ -82,7 +99,6 @@ end
|
|||||||
|
|
||||||
-- explosion
|
-- explosion
|
||||||
function explosion(pos, radius)
|
function explosion(pos, radius)
|
||||||
|
|
||||||
local pos = vector.round(pos)
|
local pos = vector.round(pos)
|
||||||
local vm = VoxelManip()
|
local vm = VoxelManip()
|
||||||
local minp, maxp = vm:read_from_map(vector.subtract(pos, radius), vector.add(pos, radius))
|
local minp, maxp = vm:read_from_map(vector.subtract(pos, radius), vector.add(pos, radius))
|
||||||
@ -148,7 +164,6 @@ function explosion(pos, radius)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function fill_chest(pos, items)
|
function fill_chest(pos, items)
|
||||||
|
|
||||||
local stacks = items or {}
|
local stacks = items or {}
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
|
Loading…
Reference in New Issue
Block a user