2015-10-08 18:42:47 +02:00
|
|
|
minetest.register_tool("diplazer:grav", {
|
|
|
|
description = "Gravity manipuler",
|
|
|
|
range = 0,
|
|
|
|
inventory_image = "diplazer_grav.png",
|
2015-11-18 11:45:20 +01:00
|
|
|
on_use = function(itemstack, user, pointed_thing)
|
2015-11-18 11:38:19 +01:00
|
|
|
local grav=user:get_physics_override().gravity
|
|
|
|
|
|
|
|
if grav==diplazer_restore_gravity_to then
|
|
|
|
user:set_physics_override({gravity=diplazer_gravity_to_use,})
|
|
|
|
minetest.sound_play("diplazer_gravon" , {pos = user:getpos(), gain = 2.0, max_hear_distance = 5,})
|
|
|
|
else
|
|
|
|
user:set_physics_override({gravity=diplazer_restore_gravity_to,})
|
|
|
|
minetest.sound_play("diplazer_gravoff" , {pos = user:getpos(), gain = 2.0, max_hear_distance = 5,})
|
|
|
|
end
|
|
|
|
|
2015-10-08 18:42:47 +02:00
|
|
|
return itemstack
|
2015-11-18 11:38:19 +01:00
|
|
|
end,
|
2015-10-08 18:42:47 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "diplazer:grav",
|
|
|
|
recipe = {
|
|
|
|
{"default:sand", "default:sand", "default:sand"},
|
|
|
|
{"default:mese_crystal", "default:mese", "default:mese_crystal"},
|
|
|
|
{"default:sand", "default:sand", "default:sand"},
|
|
|
|
},
|
2015-11-18 11:38:19 +01:00
|
|
|
})
|