mirror of
https://github.com/minetest-mods/technic.git
synced 2025-06-30 23:30:38 +02:00
Tools don't wear in creative mode v2
- Removed cans (will add again per request) - Added creative check to global namespace (checking only once as requested by VanessaE)
This commit is contained in:
committed by
Vanessa Ezekowitz
parent
19f74d11ba
commit
b8c9028681
@ -40,10 +40,12 @@ local function check_for_flashlight(player)
|
||||
if hotbar[i]:get_name() == "technic:flashlight" then
|
||||
local meta = minetest.deserialize(hotbar[i]:get_metadata())
|
||||
if meta and meta.charge and meta.charge >= 2 then
|
||||
meta.charge = meta.charge - 2;
|
||||
technic.set_RE_wear(hotbar[i], meta.charge, flashlight_max_charge)
|
||||
hotbar[i]:set_metadata(minetest.serialize(meta))
|
||||
inv:set_stack("main", i, hotbar[i])
|
||||
if not technic.creative_mode then
|
||||
meta.charge = meta.charge - 2;
|
||||
technic.set_RE_wear(hotbar[i], meta.charge, flashlight_max_charge)
|
||||
hotbar[i]:set_metadata(minetest.serialize(meta))
|
||||
inv:set_stack("main", i, hotbar[i])
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user