updated to newer 0.4.16 functions

This commit is contained in:
TenPlus1 2017-10-09 12:09:23 +01:00
parent 9e350517f2
commit d440d8d8e0
2 changed files with 24 additions and 5 deletions

View File

@ -4,8 +4,8 @@
real_torch = {}
-- check for timer settings or use defaults
real_torch.min_duration = tonumber(minetest.setting_get("torch_min_duration")) or 480
real_torch.max_duration = tonumber(minetest.setting_get("torch_min_duration")) or 600
real_torch.min_duration = tonumber(minetest.settings:get("torch_min_duration")) or 480
real_torch.max_duration = tonumber(minetest.settings:get("torch_min_duration")) or 600
-- check which torch(es) are available in minetest version
@ -30,6 +30,13 @@ minetest.register_lbm({
})
-- creative check
local creative_mode_cache = minetest.settings:get_bool("creative_mode")
function is_creative(name)
return creative_mode_cache or minetest.check_player_privs(name, {creative = true})
end
-- coal powder
minetest.register_craftitem("real_torch:coal_powder", {
description = "Coal Powder",
@ -61,7 +68,10 @@ minetest.register_craftitem("real_torch:coal_powder", {
if rep then
minetest.set_node(pos, {name = nod.name, param2 = nod.param2})
itemstack:take_item()
if not is_creative(user:get_player_name()) then
itemstack:take_item()
end
end
return itemstack
@ -213,9 +223,15 @@ minetest.override_item("tnt:gunpowder", {
end
if rep then
minetest.set_node(pos, {name = nod.name, param2 = nod.param2})
add_effects(pos, 1)
itemstack:take_item()
if not is_creative(user:get_player_name()) then
itemstack:take_item()
end
return itemstack
end
@ -227,7 +243,9 @@ minetest.override_item("tnt:gunpowder", {
add_effects(pos, 1)
itemstack:take_item()
if not is_creative(user:get_player_name()) then
itemstack:take_item()
end
end
return itemstack

View File

@ -23,3 +23,4 @@ Changelog:
- 0.5 - 2x coal lumps give 10x coal dust, also fixed check for ethereal mod
- 0.6 - Burnout and extinguish sounds added by tacotexmex :)
- 0.7 - Torches can be re-lit using flint & steel and gunpowder, settings added
- 0.8 - Updated to newer functions, requires Minetest 0.4.16 to run