mirror of
https://github.com/minetest-mods/technic.git
synced 2024-12-22 13:52:31 +01:00
fixes to laser and mining drill
This commit is contained in:
parent
9aa8ced2e0
commit
77e83840f5
@ -38,23 +38,13 @@ minetest.register_craft({
|
|||||||
|
|
||||||
function drill_dig_it (pos, player)
|
function drill_dig_it (pos, player)
|
||||||
local node=minetest.env:get_node(pos)
|
local node=minetest.env:get_node(pos)
|
||||||
if node.name == "air" then return end
|
if node.name == "air" or node.name == "ignore" then return end
|
||||||
if node.name == "default:lava_source" then return end
|
if node.name == "default:lava_source" then return end
|
||||||
if node.name == "default:lava_flowing" then return end
|
if node.name == "default:lava_flowing" then return end
|
||||||
if node.name == "default:water_source" then minetest.env:remove_node(pos) return end
|
if node.name == "default:water_source" then minetest.env:remove_node(pos) return end
|
||||||
if node.name == "default:water_flowing" then minetest.env:remove_node(pos) return end
|
if node.name == "default:water_flowing" then minetest.env:remove_node(pos) return end
|
||||||
if node.name == "ignore" then minetest.env:remove_node(pos) return end
|
|
||||||
|
|
||||||
if player then
|
|
||||||
local drops = minetest.get_node_drops(node.name, "default:pick_mese")
|
|
||||||
if player:get_inventory() then
|
|
||||||
local _, dropped_item
|
|
||||||
for _, dropped_item in ipairs(drops) do
|
|
||||||
player:get_inventory():add_item("main", dropped_item)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
minetest.sound_play("mining_drill", {pos = pos, gain = 1.0, max_hear_distance = 10,})
|
minetest.sound_play("mining_drill", {pos = pos, gain = 1.0, max_hear_distance = 10,})
|
||||||
minetest.env:remove_node(pos)
|
minetest.node_dig(pos,node,player)
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
@ -11,8 +11,8 @@ local laser_shoot = function(itemstack, player, pointed_thing)
|
|||||||
if obj:get_luaentity().player == nil then
|
if obj:get_luaentity().player == nil then
|
||||||
obj:get_luaentity().player = player
|
obj:get_luaentity().player = player
|
||||||
end
|
end
|
||||||
obj:setvelocity({x=dir.x*19, y=dir.y*19, z=dir.z*19})
|
obj:setvelocity({x=dir.x*12, y=dir.y*12, z=dir.z*12})
|
||||||
obj:setacceleration({x=dir.x*-2, y=0, z=dir.z*-2})
|
obj:setacceleration({x=0, y=0, z=0})
|
||||||
obj:setyaw(player:get_look_yaw()+math.pi)
|
obj:setyaw(player:get_look_yaw()+math.pi)
|
||||||
if obj:get_luaentity().player == nil then
|
if obj:get_luaentity().player == nil then
|
||||||
obj:get_luaentity().player = player
|
obj:get_luaentity().player = player
|
||||||
@ -132,22 +132,13 @@ minetest.register_entity("technic:laser_beam_entity", LASER_BEAM_ENTITY)
|
|||||||
minetest.register_entity("technic:laser_beam_entityV", LASER_BEAM_ENTITYV)
|
minetest.register_entity("technic:laser_beam_entityV", LASER_BEAM_ENTITYV)
|
||||||
|
|
||||||
function lazer_it (pos, node, player,count)
|
function lazer_it (pos, node, player,count)
|
||||||
if node.name == "air" then return end
|
if node.name == "air" or node.name == "ignore" then return end
|
||||||
if node.name == "default:lava_source" then return end
|
if node.name == "default:lava_source" then return end
|
||||||
if node.name == "default:lava_flowing" then return end
|
if node.name == "default:lava_flowing" then return end
|
||||||
if node.name == "default:water_source" then minetest.env:remove_node(pos) return end
|
if node.name == "default:water_source" then minetest.env:remove_node(pos) return end
|
||||||
if node.name == "default:water_flowing" then minetest.env:remove_node(pos) return end
|
if node.name == "default:water_flowing" then minetest.env:remove_node(pos) return end
|
||||||
if node.name == "ignore" then minetest.env:remove_node(pos) return end
|
|
||||||
|
|
||||||
if player then
|
if player then
|
||||||
local drops = minetest.get_node_drops(node.name, "default:pick_mese")
|
minetest.node_dig(pos,node,player)
|
||||||
if player:get_inventory() then
|
|
||||||
local _, dropped_item
|
|
||||||
for _, dropped_item in ipairs(drops) do
|
|
||||||
player:get_inventory():add_item("main", dropped_item)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
minetest.env:remove_node(pos)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user