2014-04-26 20:02:19 +01:00
|
|
|
local max_charge = {50000, 200000, 650000}
|
|
|
|
local power_usage_per_node = {200, 500, 800}
|
2013-01-27 14:03:46 +01:00
|
|
|
|
2013-10-30 13:45:32 -04:00
|
|
|
local S = technic.getter
|
|
|
|
|
2013-01-27 14:03:46 +01:00
|
|
|
minetest.register_craft({
|
|
|
|
output = 'technic:mining_drill',
|
|
|
|
recipe = {
|
2013-10-18 22:22:39 -04:00
|
|
|
{'technic:stainless_steel_ingot', 'technic:diamond_drill_head', 'technic:stainless_steel_ingot'},
|
|
|
|
{'technic:stainless_steel_ingot', 'technic:motor', 'technic:stainless_steel_ingot'},
|
|
|
|
{'', 'technic:red_energy_crystal', 'moreores:copper_ingot'},
|
2013-01-27 14:03:46 +01:00
|
|
|
}
|
|
|
|
})
|
2013-02-21 22:01:49 +01:00
|
|
|
minetest.register_craft({
|
|
|
|
output = 'technic:mining_drill_mk2',
|
|
|
|
recipe = {
|
2013-10-18 22:22:39 -04:00
|
|
|
{'technic:diamond_drill_head', 'technic:diamond_drill_head', 'technic:diamond_drill_head'},
|
|
|
|
{'technic:stainless_steel_ingot', 'technic:mining_drill', 'technic:stainless_steel_ingot'},
|
|
|
|
{'', 'technic:green_energy_crystal', ''},
|
2013-02-21 22:01:49 +01:00
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
output = 'technic:mining_drill_mk3',
|
|
|
|
recipe = {
|
2013-10-18 22:22:39 -04:00
|
|
|
{'technic:diamond_drill_head', 'technic:diamond_drill_head', 'technic:diamond_drill_head'},
|
|
|
|
{'technic:stainless_steel_ingot', 'technic:mining_drill_mk2', 'technic:stainless_steel_ingot'},
|
|
|
|
{'', 'technic:blue_energy_crystal', ''},
|
2013-02-21 22:01:49 +01:00
|
|
|
}
|
|
|
|
})
|
2013-10-18 22:22:39 -04:00
|
|
|
for i = 1, 4 do
|
2013-07-17 15:34:35 -04:00
|
|
|
minetest.register_craft({
|
|
|
|
output = 'technic:mining_drill_mk3',
|
|
|
|
recipe = {
|
|
|
|
{'technic:diamond_drill_head', 'technic:diamond_drill_head', 'technic:diamond_drill_head'},
|
|
|
|
{'technic:stainless_steel_ingot', 'technic:mining_drill_mk2_'..i, 'technic:stainless_steel_ingot'},
|
|
|
|
{'', 'technic:blue_energy_crystal', ''},
|
|
|
|
}
|
|
|
|
})
|
2013-07-28 12:45:53 +02:00
|
|
|
end
|
2013-01-27 14:03:46 +01:00
|
|
|
|
2013-12-17 13:56:37 -05:00
|
|
|
local mining_drill_mode_text = {
|
|
|
|
{S("Single node.")},
|
|
|
|
{S("3 nodes deep.")},
|
|
|
|
{S("3 nodes wide.")},
|
|
|
|
{S("3 nodes tall.")},
|
|
|
|
{S("3x3 nodes.")},
|
|
|
|
}
|
|
|
|
|
|
|
|
local function drill_dig_it0 (pos,player)
|
2013-12-17 14:22:10 -05:00
|
|
|
if minetest.is_protected(pos, player:get_player_name()) then
|
|
|
|
minetest.record_protection_violation(pos, player:get_player_name())
|
|
|
|
return
|
|
|
|
end
|
2013-12-17 13:56:37 -05:00
|
|
|
local node=minetest.env:get_node(pos)
|
|
|
|
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_flowing" then 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
|
|
|
|
minetest.node_dig(pos,node,player)
|
|
|
|
end
|
|
|
|
|
|
|
|
local function drill_dig_it1 (player)
|
|
|
|
local dir=player:get_look_dir()
|
|
|
|
if math.abs(dir.x)>math.abs(dir.z) then
|
|
|
|
if dir.x>0 then return 0 end
|
|
|
|
return 1
|
|
|
|
end
|
|
|
|
if dir.z>0 then return 2 end
|
|
|
|
return 3
|
|
|
|
end
|
|
|
|
|
|
|
|
local function drill_dig_it2 (pos,player)
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.z=pos.z+1
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.z=pos.z-2
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.z=pos.z+1
|
|
|
|
pos.y=pos.y+1
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.z=pos.z+1
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.z=pos.z-2
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.z=pos.z+1
|
|
|
|
pos.y=pos.y-2
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.z=pos.z+1
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.z=pos.z-2
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
end
|
|
|
|
|
|
|
|
local function drill_dig_it3 (pos,player)
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.x=pos.x+1
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.x=pos.x-2
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.x=pos.x+1
|
|
|
|
pos.y=pos.y+1
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.x=pos.x+1
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.x=pos.x-2
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.x=pos.x+1
|
|
|
|
pos.y=pos.y-2
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.x=pos.x+1
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.x=pos.x-2
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
end
|
|
|
|
|
|
|
|
local function drill_dig_it4 (pos,player)
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.x=pos.x+1
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.x=pos.x-2
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.x=pos.x+1
|
|
|
|
pos.z=pos.z+1
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.x=pos.x+1
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.x=pos.x-2
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.x=pos.x+1
|
|
|
|
pos.z=pos.z-2
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.x=pos.x+1
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.x=pos.x-2
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
end
|
|
|
|
|
2014-04-26 20:02:19 +01:00
|
|
|
local function cost_to_use(drill_type, mode)
|
|
|
|
local mult
|
|
|
|
if mode == 1 then
|
|
|
|
mult = 1
|
|
|
|
elseif mode <= 4 then
|
|
|
|
mult = 3
|
|
|
|
else
|
|
|
|
mult = 9
|
|
|
|
end
|
|
|
|
return power_usage_per_node[drill_type] * mult
|
|
|
|
end
|
2013-12-17 13:56:37 -05:00
|
|
|
|
2014-04-26 20:02:19 +01:00
|
|
|
local function drill_dig_it(pos, player, mode)
|
2013-10-18 22:22:39 -04:00
|
|
|
if mode == 1 then
|
|
|
|
drill_dig_it0(pos, player)
|
2013-02-21 22:01:49 +01:00
|
|
|
end
|
|
|
|
|
2013-10-18 22:22:39 -04:00
|
|
|
if mode == 2 then -- 3 deep
|
|
|
|
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)
|
|
|
|
pos.x = pos.x + 1
|
|
|
|
drill_dig_it0(pos, player)
|
2013-02-21 22:01:49 +01:00
|
|
|
end
|
2013-10-18 22:22:39 -04:00
|
|
|
if dir == 1 then -- x-
|
|
|
|
drill_dig_it0(pos, player)
|
2013-02-21 22:01:49 +01:00
|
|
|
pos.x=pos.x-1
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.x=pos.x-1
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
end
|
|
|
|
if dir==2 then -- z+
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.z=pos.z+1
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.z=pos.z+1
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
end
|
|
|
|
if dir==3 then -- z-
|
|
|
|
drill_dig_it0 (pos,player)
|
2013-12-23 16:54:21 -05:00
|
|
|
pos.z=pos.z-1
|
2013-02-21 22:01:49 +01:00
|
|
|
drill_dig_it0 (pos,player)
|
2013-12-23 16:54:21 -05:00
|
|
|
pos.z=pos.z-1
|
2013-02-21 22:01:49 +01:00
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if mode==3 then -- 3 wide
|
|
|
|
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)
|
|
|
|
pos.z=pos.z-2
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
end
|
|
|
|
if dir==2 or dir==3 then -- z
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.x=pos.x+1
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
pos.x=pos.x-2
|
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if mode==4 then -- 3 tall, selected in the middle
|
|
|
|
drill_dig_it0 (pos,player)
|
2013-12-17 13:56:37 -05:00
|
|
|
pos.y=pos.y-1
|
2013-02-21 22:01:49 +01:00
|
|
|
drill_dig_it0 (pos,player)
|
2013-12-17 13:56:37 -05:00
|
|
|
pos.y=pos.y-1
|
2013-02-21 22:01:49 +01:00
|
|
|
drill_dig_it0 (pos,player)
|
|
|
|
end
|
2013-01-27 14:03:46 +01:00
|
|
|
|
2013-02-21 22:01:49 +01:00
|
|
|
if mode==5 then -- 3 x 3
|
|
|
|
local dir=player:get_look_dir()
|
|
|
|
if math.abs(dir.y)<0.5 then
|
|
|
|
dir=drill_dig_it1(player)
|
|
|
|
if dir==0 or dir==1 then -- x
|
|
|
|
drill_dig_it2(pos,player)
|
|
|
|
end
|
|
|
|
if dir==2 or dir==3 then -- z
|
|
|
|
drill_dig_it3(pos,player)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
drill_dig_it4(pos,player)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
minetest.sound_play("mining_drill", {pos = pos, gain = 1.0, max_hear_distance = 10,})
|
|
|
|
end
|
2013-01-27 14:03:46 +01:00
|
|
|
|
2013-12-17 13:56:37 -05:00
|
|
|
local function mining_drill_mk2_setmode(user,itemstack)
|
|
|
|
local player_name=user:get_player_name()
|
|
|
|
local item=itemstack:to_table()
|
|
|
|
local meta=minetest.deserialize(item["metadata"])
|
|
|
|
if meta==nil then
|
|
|
|
meta={}
|
|
|
|
mode=0
|
|
|
|
end
|
|
|
|
if meta["mode"]==nil then
|
2014-04-25 17:44:46 +01:00
|
|
|
minetest.chat_send_player(player_name, S("Use while sneaking to change Mining Drill Mk%d modes."):format(2))
|
2013-12-17 13:56:37 -05:00
|
|
|
meta["mode"]=0
|
|
|
|
mode=0
|
|
|
|
end
|
|
|
|
mode=(meta["mode"])
|
|
|
|
mode=mode+1
|
|
|
|
if mode>=5 then mode=1 end
|
|
|
|
minetest.chat_send_player(player_name, S("Mining Drill Mk%d Mode %d"):format(2, mode)..": "..mining_drill_mode_text[mode][1])
|
|
|
|
item["name"]="technic:mining_drill_mk2_"..mode
|
|
|
|
meta["mode"]=mode
|
|
|
|
item["metadata"]=minetest.serialize(meta)
|
|
|
|
itemstack:replace(item)
|
|
|
|
return itemstack
|
2013-02-21 22:01:49 +01:00
|
|
|
end
|
|
|
|
|
2013-12-17 13:56:37 -05:00
|
|
|
local function mining_drill_mk3_setmode(user,itemstack)
|
|
|
|
local player_name=user:get_player_name()
|
|
|
|
local item=itemstack:to_table()
|
|
|
|
local meta=minetest.deserialize(item["metadata"])
|
|
|
|
if meta==nil then
|
|
|
|
meta={}
|
|
|
|
mode=0
|
2013-02-21 22:01:49 +01:00
|
|
|
end
|
2013-12-17 13:56:37 -05:00
|
|
|
if meta["mode"]==nil then
|
2014-04-25 17:44:46 +01:00
|
|
|
minetest.chat_send_player(player_name, S("Use while sneaking to change Mining Drill Mk%d modes."):format(3))
|
2013-12-17 13:56:37 -05:00
|
|
|
meta["mode"]=0
|
|
|
|
mode=0
|
|
|
|
end
|
|
|
|
mode=(meta["mode"])
|
|
|
|
mode=mode+1
|
|
|
|
if mode>=6 then mode=1 end
|
|
|
|
minetest.chat_send_player(player_name, S("Mining Drill Mk%d Mode %d"):format(3, mode)..": "..mining_drill_mode_text[mode][1])
|
|
|
|
item["name"]="technic:mining_drill_mk3_"..mode
|
|
|
|
meta["mode"]=mode
|
|
|
|
item["metadata"]=minetest.serialize(meta)
|
|
|
|
itemstack:replace(item)
|
|
|
|
return itemstack
|
2013-02-21 22:01:49 +01:00
|
|
|
end
|
|
|
|
|
2013-12-17 13:56:37 -05:00
|
|
|
|
|
|
|
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)
|
|
|
|
end
|
|
|
|
if pointed_thing.type ~= "node" or not meta.charge then
|
|
|
|
return
|
|
|
|
end
|
2014-04-26 20:02:19 +01:00
|
|
|
local charge_to_take = cost_to_use(2, meta.mode)
|
|
|
|
if meta.charge >= charge_to_take then
|
2013-12-17 13:56:37 -05:00
|
|
|
local pos = minetest.get_pointed_thing_position(pointed_thing, above)
|
2014-04-26 20:02:19 +01:00
|
|
|
drill_dig_it(pos, user, meta.mode)
|
2013-12-17 13:56:37 -05:00
|
|
|
meta.charge = meta.charge - charge_to_take
|
|
|
|
itemstack:set_metadata(minetest.serialize(meta))
|
2014-04-26 20:02:19 +01:00
|
|
|
technic.set_RE_wear(itemstack, meta.charge, max_charge[2])
|
2013-12-17 13:56:37 -05:00
|
|
|
end
|
|
|
|
return itemstack
|
2013-02-21 22:01:49 +01:00
|
|
|
end
|
|
|
|
|
2013-12-17 13:56:37 -05:00
|
|
|
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)
|
|
|
|
end
|
|
|
|
if pointed_thing.type ~= "node" or not meta.charge then
|
|
|
|
return
|
|
|
|
end
|
2014-04-26 20:02:19 +01:00
|
|
|
local charge_to_take = cost_to_use(3, meta.mode)
|
|
|
|
if meta.charge >= charge_to_take then
|
2013-12-17 13:56:37 -05:00
|
|
|
local pos = minetest.get_pointed_thing_position(pointed_thing, above)
|
2014-04-26 20:02:19 +01:00
|
|
|
drill_dig_it(pos, user, meta.mode)
|
2013-12-17 13:56:37 -05:00
|
|
|
meta.charge = meta.charge - charge_to_take
|
|
|
|
itemstack:set_metadata(minetest.serialize(meta))
|
2014-04-26 20:02:19 +01:00
|
|
|
technic.set_RE_wear(itemstack, meta.charge, max_charge[3])
|
2013-12-17 13:56:37 -05:00
|
|
|
end
|
|
|
|
return itemstack
|
2013-02-21 22:01:49 +01:00
|
|
|
end
|
|
|
|
|
2014-04-26 20:02:19 +01:00
|
|
|
technic.register_power_tool("technic:mining_drill", max_charge[1])
|
2013-12-17 13:56:37 -05:00
|
|
|
|
2013-02-21 22:01:49 +01:00
|
|
|
minetest.register_tool("technic:mining_drill", {
|
2013-10-27 22:01:13 +01:00
|
|
|
description = S("Mining Drill Mk%d"):format(1),
|
2013-02-21 22:01:49 +01:00
|
|
|
inventory_image = "technic_mining_drill.png",
|
|
|
|
stack_max = 1,
|
Genericise handling of multiple meanings of wear
The tool workshop is meant to repair mechanical damage to tools, so
is at risk of `repairing' tools that use the wear bar to represent
something other than mechanical wear. It had special-case recognition
of the water and lava cans, which use the wear bar to represent how much
content they're carrying, and wouldn't repair them. But it didn't avoid
`repairing' RE chargeable items, which use the wear bar to represent
how much energy they have stored. It would modify the wear bar without
actually affecting the charge, so the wear bar would jump back to the
correct place when the next charging or discharging event occurred.
To genericise, introduce a new item property, "wear_represents", which
indicates how the wear bar is used for this item. Currently defined
values are "mechanical_wear" (straightforward damage to tools that
start out perfect), "technic_RE_charge" (electrical energy, canonically
represented in the meta rather than the wear bar), and "content_level"
(how full a container is). For backcompat, nil is interpreted as
"mechanical_wear". The tool workshop will only repair "mechanical_wear"
tools. As a bonus, set_RE_wear() will only set the wear bar for
"technic_RE_charge" items: this means developers will notice if they
forget to declare wear_represents, but also means that with no further
changes it's possible to have an RE chargeable item that uses its wear
bar to represent something else.
2014-04-28 10:44:07 +01:00
|
|
|
wear_represents = "technic_RE_charge",
|
2013-02-21 22:01:49 +01:00
|
|
|
on_use = function(itemstack, user, pointed_thing)
|
2013-10-18 22:22:39 -04:00
|
|
|
if pointed_thing.type ~= "node" then
|
|
|
|
return itemstack
|
|
|
|
end
|
2013-12-17 13:56:37 -05:00
|
|
|
local meta = minetest.deserialize(itemstack:get_metadata())
|
2013-10-18 22:22:39 -04:00
|
|
|
if not meta or not meta.charge then
|
|
|
|
return
|
|
|
|
end
|
2014-04-26 20:02:19 +01:00
|
|
|
local charge_to_take = cost_to_use(1, 1)
|
|
|
|
if meta.charge >= charge_to_take then
|
2013-10-18 22:22:39 -04:00
|
|
|
local pos = minetest.get_pointed_thing_position(pointed_thing, above)
|
2014-04-26 20:02:19 +01:00
|
|
|
drill_dig_it(pos, user, 1)
|
|
|
|
meta.charge = meta.charge - charge_to_take
|
2013-12-17 13:56:37 -05:00
|
|
|
itemstack:set_metadata(minetest.serialize(meta))
|
2014-04-26 20:02:19 +01:00
|
|
|
technic.set_RE_wear(itemstack, meta.charge, max_charge[1])
|
2013-02-21 22:01:49 +01:00
|
|
|
end
|
2013-10-18 22:22:39 -04:00
|
|
|
return itemstack
|
2013-02-21 22:01:49 +01:00
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_tool("technic:mining_drill_mk2", {
|
2013-10-27 22:01:13 +01:00
|
|
|
description = S("Mining Drill Mk%d"):format(2),
|
2013-02-21 22:01:49 +01:00
|
|
|
inventory_image = "technic_mining_drill_mk2.png",
|
Genericise handling of multiple meanings of wear
The tool workshop is meant to repair mechanical damage to tools, so
is at risk of `repairing' tools that use the wear bar to represent
something other than mechanical wear. It had special-case recognition
of the water and lava cans, which use the wear bar to represent how much
content they're carrying, and wouldn't repair them. But it didn't avoid
`repairing' RE chargeable items, which use the wear bar to represent
how much energy they have stored. It would modify the wear bar without
actually affecting the charge, so the wear bar would jump back to the
correct place when the next charging or discharging event occurred.
To genericise, introduce a new item property, "wear_represents", which
indicates how the wear bar is used for this item. Currently defined
values are "mechanical_wear" (straightforward damage to tools that
start out perfect), "technic_RE_charge" (electrical energy, canonically
represented in the meta rather than the wear bar), and "content_level"
(how full a container is). For backcompat, nil is interpreted as
"mechanical_wear". The tool workshop will only repair "mechanical_wear"
tools. As a bonus, set_RE_wear() will only set the wear bar for
"technic_RE_charge" items: this means developers will notice if they
forget to declare wear_represents, but also means that with no further
changes it's possible to have an RE chargeable item that uses its wear
bar to represent something else.
2014-04-28 10:44:07 +01:00
|
|
|
wear_represents = "technic_RE_charge",
|
2013-02-21 22:01:49 +01:00
|
|
|
on_use = function(itemstack, user, pointed_thing)
|
2013-10-18 22:22:39 -04:00
|
|
|
mining_drill_mk2_handler(itemstack, user, pointed_thing)
|
|
|
|
return itemstack
|
2013-02-21 22:01:49 +01:00
|
|
|
end,
|
|
|
|
})
|
2013-07-17 15:34:35 -04:00
|
|
|
|
2014-04-26 20:02:19 +01:00
|
|
|
technic.register_power_tool("technic:mining_drill_mk2", max_charge[2])
|
2013-02-21 22:01:49 +01:00
|
|
|
|
2013-10-18 22:22:39 -04:00
|
|
|
for i = 1, 4 do
|
2014-04-26 20:02:19 +01:00
|
|
|
technic.register_power_tool("technic:mining_drill_mk2_"..i, max_charge[2])
|
2013-07-17 15:34:35 -04:00
|
|
|
minetest.register_tool("technic:mining_drill_mk2_"..i, {
|
2013-10-30 13:45:32 -04:00
|
|
|
description = S("Mining Drill Mk%d Mode %d"):format(2, i),
|
2013-07-17 15:34:35 -04:00
|
|
|
inventory_image = "technic_mining_drill_mk2.png^technic_tool_mode"..i..".png",
|
|
|
|
wield_image = "technic_mining_drill_mk2.png",
|
Genericise handling of multiple meanings of wear
The tool workshop is meant to repair mechanical damage to tools, so
is at risk of `repairing' tools that use the wear bar to represent
something other than mechanical wear. It had special-case recognition
of the water and lava cans, which use the wear bar to represent how much
content they're carrying, and wouldn't repair them. But it didn't avoid
`repairing' RE chargeable items, which use the wear bar to represent
how much energy they have stored. It would modify the wear bar without
actually affecting the charge, so the wear bar would jump back to the
correct place when the next charging or discharging event occurred.
To genericise, introduce a new item property, "wear_represents", which
indicates how the wear bar is used for this item. Currently defined
values are "mechanical_wear" (straightforward damage to tools that
start out perfect), "technic_RE_charge" (electrical energy, canonically
represented in the meta rather than the wear bar), and "content_level"
(how full a container is). For backcompat, nil is interpreted as
"mechanical_wear". The tool workshop will only repair "mechanical_wear"
tools. As a bonus, set_RE_wear() will only set the wear bar for
"technic_RE_charge" items: this means developers will notice if they
forget to declare wear_represents, but also means that with no further
changes it's possible to have an RE chargeable item that uses its wear
bar to represent something else.
2014-04-28 10:44:07 +01:00
|
|
|
wear_represents = "technic_RE_charge",
|
2013-07-17 15:34:35 -04:00
|
|
|
groups = {not_in_creative_inventory=1},
|
|
|
|
on_use = function(itemstack, user, pointed_thing)
|
|
|
|
mining_drill_mk2_handler(itemstack, user, pointed_thing)
|
|
|
|
return itemstack
|
|
|
|
end,
|
|
|
|
})
|
2013-02-21 22:01:49 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
minetest.register_tool("technic:mining_drill_mk3", {
|
2013-10-27 22:01:13 +01:00
|
|
|
description = S("Mining Drill Mk%d"):format(3),
|
2013-02-21 22:01:49 +01:00
|
|
|
inventory_image = "technic_mining_drill_mk3.png",
|
Genericise handling of multiple meanings of wear
The tool workshop is meant to repair mechanical damage to tools, so
is at risk of `repairing' tools that use the wear bar to represent
something other than mechanical wear. It had special-case recognition
of the water and lava cans, which use the wear bar to represent how much
content they're carrying, and wouldn't repair them. But it didn't avoid
`repairing' RE chargeable items, which use the wear bar to represent
how much energy they have stored. It would modify the wear bar without
actually affecting the charge, so the wear bar would jump back to the
correct place when the next charging or discharging event occurred.
To genericise, introduce a new item property, "wear_represents", which
indicates how the wear bar is used for this item. Currently defined
values are "mechanical_wear" (straightforward damage to tools that
start out perfect), "technic_RE_charge" (electrical energy, canonically
represented in the meta rather than the wear bar), and "content_level"
(how full a container is). For backcompat, nil is interpreted as
"mechanical_wear". The tool workshop will only repair "mechanical_wear"
tools. As a bonus, set_RE_wear() will only set the wear bar for
"technic_RE_charge" items: this means developers will notice if they
forget to declare wear_represents, but also means that with no further
changes it's possible to have an RE chargeable item that uses its wear
bar to represent something else.
2014-04-28 10:44:07 +01:00
|
|
|
wear_represents = "technic_RE_charge",
|
2013-02-21 22:01:49 +01:00
|
|
|
on_use = function(itemstack, user, pointed_thing)
|
|
|
|
mining_drill_mk3_handler(itemstack,user,pointed_thing)
|
|
|
|
return itemstack
|
|
|
|
end,
|
|
|
|
})
|
2013-07-17 15:34:35 -04:00
|
|
|
|
2014-04-26 20:02:19 +01:00
|
|
|
technic.register_power_tool("technic:mining_drill_mk3", max_charge[3])
|
2013-02-21 22:01:49 +01:00
|
|
|
|
|
|
|
for i=1,5,1 do
|
2014-04-26 20:02:19 +01:00
|
|
|
technic.register_power_tool("technic:mining_drill_mk3_"..i, max_charge[3])
|
2013-07-17 15:34:35 -04:00
|
|
|
minetest.register_tool("technic:mining_drill_mk3_"..i, {
|
2013-10-30 13:45:32 -04:00
|
|
|
description = S("Mining Drill Mk%d Mode %d"):format(3, i),
|
2013-07-17 15:34:35 -04:00
|
|
|
inventory_image = "technic_mining_drill_mk3.png^technic_tool_mode"..i..".png",
|
|
|
|
wield_image = "technic_mining_drill_mk3.png",
|
Genericise handling of multiple meanings of wear
The tool workshop is meant to repair mechanical damage to tools, so
is at risk of `repairing' tools that use the wear bar to represent
something other than mechanical wear. It had special-case recognition
of the water and lava cans, which use the wear bar to represent how much
content they're carrying, and wouldn't repair them. But it didn't avoid
`repairing' RE chargeable items, which use the wear bar to represent
how much energy they have stored. It would modify the wear bar without
actually affecting the charge, so the wear bar would jump back to the
correct place when the next charging or discharging event occurred.
To genericise, introduce a new item property, "wear_represents", which
indicates how the wear bar is used for this item. Currently defined
values are "mechanical_wear" (straightforward damage to tools that
start out perfect), "technic_RE_charge" (electrical energy, canonically
represented in the meta rather than the wear bar), and "content_level"
(how full a container is). For backcompat, nil is interpreted as
"mechanical_wear". The tool workshop will only repair "mechanical_wear"
tools. As a bonus, set_RE_wear() will only set the wear bar for
"technic_RE_charge" items: this means developers will notice if they
forget to declare wear_represents, but also means that with no further
changes it's possible to have an RE chargeable item that uses its wear
bar to represent something else.
2014-04-28 10:44:07 +01:00
|
|
|
wear_represents = "technic_RE_charge",
|
2013-07-17 15:34:35 -04:00
|
|
|
groups = {not_in_creative_inventory=1},
|
|
|
|
on_use = function(itemstack, user, pointed_thing)
|
|
|
|
mining_drill_mk3_handler(itemstack,user,pointed_thing)
|
|
|
|
return itemstack
|
|
|
|
end,
|
|
|
|
})
|
2013-02-21 22:01:49 +01:00
|
|
|
end
|