mirror of
https://github.com/minetest-mods/technic.git
synced 2024-12-22 13:52:31 +01:00
Add protection support to the sonic screwdriver
This commit is contained in:
parent
47b0b59884
commit
818a0e5ff0
@ -41,17 +41,20 @@ minetest.register_tool("technic:sonic_screwdriver", {
|
|||||||
p = 0
|
p = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- hacky_swap_node, unforunatly.
|
if minetest.is_protected(pos, user:get_player_name()) then
|
||||||
local meta = minetest.get_meta(pos)
|
minetest.record_protection_violation(pos, user:get_player_name())
|
||||||
local meta0 = meta:to_table()
|
else
|
||||||
node.param2 = p
|
local meta = minetest.get_meta(pos)
|
||||||
minetest.set_node(pos, node)
|
local meta0 = meta:to_table()
|
||||||
meta = minetest.get_meta(pos)
|
node.param2 = p
|
||||||
meta:from_table(meta0)
|
minetest.set_node(pos, node)
|
||||||
|
meta = minetest.get_meta(pos)
|
||||||
|
meta:from_table(meta0)
|
||||||
|
|
||||||
meta1.charge = meta1.charge - 100
|
meta1.charge = meta1.charge - 100
|
||||||
itemstack:set_metadata(set_item_meta(meta1))
|
itemstack:set_metadata(set_item_meta(meta1))
|
||||||
technic.set_RE_wear(itemstack, meta1.charge, sonic_screwdriver_max_charge)
|
technic.set_RE_wear(itemstack, meta1.charge, sonic_screwdriver_max_charge)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
|
Loading…
Reference in New Issue
Block a user