| | |
| | | |
| | | local function drill_dig_it1 (player) |
| | | local dir=player:get_look_dir() |
| | | if math.abs(dir.x)>math.abs(dir.z) then |
| | | if math.abs(dir.x)>math.abs(dir.z) then |
| | | if dir.x>0 then return 0 end |
| | | return 1 |
| | | end |
| | |
| | | if mode == 1 then |
| | | drill_dig_it0(pos, player) |
| | | end |
| | | |
| | | |
| | | if mode == 2 then -- 3 deep |
| | | dir = drill_dig_it1(player) |
| | | local dir = drill_dig_it1(player) |
| | | if dir == 0 then -- x+ |
| | | drill_dig_it0(pos, player) |
| | | pos.x = pos.x + 1 |
| | |
| | | drill_dig_it0 (pos,player) |
| | | end |
| | | end |
| | | |
| | | |
| | | if mode==3 then -- 3 wide |
| | | dir=drill_dig_it1(player) |
| | | local dir = drill_dig_it1(player) |
| | | if dir==0 or dir==1 then -- x |
| | | drill_dig_it0 (pos,player) |
| | | pos.z=pos.z+1 |
| | |
| | | drill_dig_it0 (pos,player) |
| | | end |
| | | end |
| | | |
| | | |
| | | if mode==4 then -- 3 tall, selected in the middle |
| | | drill_dig_it0 (pos,player) |
| | | pos.y=pos.y-1 |
| | |
| | | drill_dig_it4(pos,player) |
| | | end |
| | | end |
| | | |
| | | |
| | | minetest.sound_play("mining_drill", {pos = pos, gain = 1.0, max_hear_distance = 10,}) |
| | | end |
| | | |
| | |
| | | local function mining_drill_mk2_setmode(user,itemstack) |
| | | local player_name=user:get_player_name() |
| | | local item=itemstack:to_table() |
| | | local mode = nil |
| | | local meta=minetest.deserialize(item["metadata"]) |
| | | if meta==nil then |
| | | meta={} |
| | |
| | | |
| | | local function mining_drill_mk2_handler(itemstack, user, pointed_thing) |
| | | local keys = user:get_player_control() |
| | | local player_name = user:get_player_name() |
| | | local meta = minetest.deserialize(itemstack:get_metadata()) |
| | | if not meta or not meta.mode or keys.sneak then |
| | | return mining_drill_mk2_setmode(user, itemstack) |
| | |
| | | |
| | | local function mining_drill_mk3_handler(itemstack, user, pointed_thing) |
| | | local keys = user:get_player_control() |
| | | local player_name = user:get_player_name() |
| | | local meta = minetest.deserialize(itemstack:get_metadata()) |
| | | if not meta or not meta.mode or keys.sneak then |
| | | return mining_drill_mk3_setmode(user, itemstack) |