add mining_laser_mk3
This commit is contained in:
parent
8912de4f51
commit
7aa6921a80
2
init.lua
2
init.lua
@ -375,5 +375,5 @@ end
|
||||
if extrablocks_tools then
|
||||
dofile(path.."/tools.lua")
|
||||
end
|
||||
dofile(path.."/laser_mk2.lua")
|
||||
dofile(path.."/mining_lasers.lua")
|
||||
print("[extrablocks] loaded")
|
||||
|
@ -1,9 +1,12 @@
|
||||
--license LGPLv2+, for the changes: WTFPL
|
||||
|
||||
local laser_mk2_range = 10 --range of the laser shot
|
||||
local r_corr = 0.25 --remove a bit more nodes (if shooting diagonal) to let it look like a hole (sth like antialiasing)
|
||||
--local laser_mk2_max_charge = 40000
|
||||
local laser_mk2_range = 11 --range of the laser shots
|
||||
local laser_mk3_range = 30
|
||||
--local laser_mk2_max_charge = 40000*4
|
||||
--local laser_mk3_max_charge = laser_mk2_max_charge*4
|
||||
--technic.register_power_tool("technic:laser_mk2", laser_mk2_max_charge)
|
||||
--technic.register_power_tool("technic:laser_mk3", laser_mk3_max_charge)
|
||||
|
||||
local f_1 = 0.5-r_corr
|
||||
local f_2 = 0.5+r_corr
|
||||
@ -96,33 +99,39 @@ local function laser_shoot(player, range, particle_texture, sound)
|
||||
|
||||
local startpos = {x=playerpos.x, y=playerpos.y+1.6, z=playerpos.z}
|
||||
local a = {x=dir.x*50, y=dir.y*50, z=dir.z*50}
|
||||
minetest.add_particle(startpos, dir, a, 1, 1, false, particle_texture)
|
||||
minetest.add_particle(startpos, dir, a, range/11, 1, false, particle_texture)
|
||||
lazer_nodes(vector.round(startpos), dir, player, range)
|
||||
minetest.sound_play(sound, {pos = playerpos, gain = 1.0, max_hear_distance = range})
|
||||
|
||||
print("[extrablocks] <laser_mk2> my shot was calculated after "..tostring(os.clock()-t1).."s")
|
||||
print("[extrablocks] <mining_laser> my shot was calculated after "..tostring(os.clock()-t1).."s")
|
||||
return true --?
|
||||
end
|
||||
|
||||
|
||||
minetest.register_tool("extrablocks:laser_mk2", {
|
||||
description = "Mining Laser MK2",
|
||||
inventory_image = "extrablocks_mining_laser_mk2.png",
|
||||
stack_max = 1,
|
||||
on_use = function(itemstack, user)
|
||||
--[[local meta = get_item_meta(itemstack:get_metadata())
|
||||
if not meta or not meta.charge then
|
||||
return
|
||||
end
|
||||
if meta.charge - 400 > 0 then]]
|
||||
laser_shoot(user, laser_mk2_range, "extrablocks_laser_beam_mk2.png", "extrablocks_laser_mk2")
|
||||
--[[meta.charge = meta.charge - 400
|
||||
technic.set_RE_wear(itemstack, meta.charge, laser_mk2_max_charge)
|
||||
itemstack:set_metadata(set_item_meta(meta))
|
||||
end
|
||||
return itemstack]]
|
||||
end,
|
||||
})
|
||||
|
||||
for _,m in ipairs({
|
||||
{"2", laser_mk2_range, laser_mk2_max_charge},
|
||||
{"3", laser_mk3_range, laser_mk3_max_charge},
|
||||
}) do
|
||||
minetest.register_tool("extrablocks:laser_mk"..m[1], {
|
||||
description = "Mining Laser MK"..m[1],
|
||||
inventory_image = "extrablocks_mining_laser_mk"..m[1]..".png",
|
||||
stack_max = 1,
|
||||
on_use = function(itemstack, user)
|
||||
--[[local meta = get_item_meta(itemstack:get_metadata())
|
||||
if not meta or not meta.charge then
|
||||
return
|
||||
end
|
||||
if meta.charge - 400 > 0 then]]
|
||||
laser_shoot(user, m[2], "extrablocks_laser_beam_mk"..m[1]..".png", "extrablocks_laser_mk"..m[1])
|
||||
--[[meta.charge = meta.charge - 400
|
||||
technic.set_RE_wear(itemstack, meta.charge, m[3])
|
||||
itemstack:set_metadata(set_item_meta(meta))
|
||||
end
|
||||
return itemstack]]
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
function lazer_it(pos, player)
|
||||
local node = minetest.get_node(pos)
|
BIN
sounds/extrablocks_laser_mk3.1.ogg
Normal file
BIN
sounds/extrablocks_laser_mk3.1.ogg
Normal file
Binary file not shown.
BIN
sounds/extrablocks_laser_mk3.2.ogg
Normal file
BIN
sounds/extrablocks_laser_mk3.2.ogg
Normal file
Binary file not shown.
BIN
textures/extrablocks_laser_beam_mk3.png
Normal file
BIN
textures/extrablocks_laser_beam_mk3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 547 B |
BIN
textures/extrablocks_mining_laser_mk3.png
Normal file
BIN
textures/extrablocks_mining_laser_mk3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 458 B |
Loading…
x
Reference in New Issue
Block a user