forked from minetest-mods/technic
update
This commit is contained in:
parent
9d2979f365
commit
01b21d49af
@ -10,11 +10,14 @@ registered_power_tools_count=registered_power_tools_count+1
|
||||
end
|
||||
|
||||
register_power_tool ("technic:mining_drill",60000)
|
||||
register_power_tool ("technic:chainsaw",40000)
|
||||
register_power_tool ("technic:chainsaw",30000)
|
||||
register_power_tool ("technic:laser_mk1",40000)
|
||||
register_power_tool ("technic:battery",10000)
|
||||
register_power_tool ("technic:sonic_screwdriver",15000)
|
||||
register_power_tool ("technic:flashlight",30000)
|
||||
register_power_tool ("technic:red_energy_crystal",100000)
|
||||
register_power_tool ("technic:green_energy_crystal",250000)
|
||||
register_power_tool ("technic:blue_energy_crystal",500000)
|
||||
|
||||
minetest.register_alias("battery", "technic:battery")
|
||||
minetest.register_alias("battery_box", "technic:battery_box")
|
||||
@ -41,8 +44,7 @@ minetest.register_craft({
|
||||
minetest.register_tool("technic:battery",
|
||||
{description = "RE Battery",
|
||||
inventory_image = "technic_battery.png",
|
||||
energy_charge = 0,
|
||||
tool_capabilities = {max_drop_level=0, groupcaps={fleshy={times={}, uses=10000, maxlevel=0}}}})
|
||||
tool_capabilities = {load=0,max_drop_level=0, groupcaps={fleshy={times={}, uses=10000, maxlevel=0}}}})
|
||||
|
||||
minetest.register_craftitem("technic:battery_box", {
|
||||
description = "Battery box",
|
||||
@ -149,6 +151,12 @@ temp=65536-temp
|
||||
return math.floor(temp)
|
||||
end
|
||||
|
||||
function set_RE_wear (item_stack,load1,max_load)
|
||||
local temp=65536-math.floor(load1/max_load*65535)
|
||||
item_stack["wear"]=tostring(temp)
|
||||
return item_stack
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"technic:battery_box","technic:battery_box1","technic:battery_box2","technic:battery_box3","technic:battery_box4",
|
||||
"technic:battery_box5","technic:battery_box6","technic:battery_box7","technic:battery_box8"
|
||||
@ -167,10 +175,42 @@ minetest.register_abm({
|
||||
elseif i==0 then hacky_swap_node(pos,"technic:battery_box") end
|
||||
meta:set_float("last_side_shown",i)
|
||||
end
|
||||
|
||||
--loading registered power tools
|
||||
local inv = meta:get_inventory()
|
||||
if inv:is_empty("src")==false then
|
||||
srcstack = inv:get_stack("src", 1)
|
||||
src_item=srcstack:to_table()
|
||||
item_meta=srcstack:get_metadata()
|
||||
if src_item["metadata"]=="" then src_item["metadata"]="0" end --create meta for not used before tool/item
|
||||
|
||||
local item_max_charge = nil
|
||||
local counter=registered_power_tools_count-1
|
||||
for i=1, counter,1 do
|
||||
if power_tools[i].tool_name==src_item["name"] then
|
||||
item_max_charge=power_tools[i].max_charge
|
||||
end
|
||||
end
|
||||
if item_max_charge then
|
||||
load1=tonumber((src_item["metadata"]))
|
||||
load_step=1000
|
||||
if load1<item_max_charge and charge>0 then
|
||||
if charge-load_step<0 then load_step=charge end
|
||||
if load1+load_step>item_max_charge then load_step=item_max_charge-load1 end
|
||||
load1=load1+load_step
|
||||
charge=charge-load_step
|
||||
set_RE_wear(src_item,load1,item_max_charge)
|
||||
src_item["metadata"]=tostring(load1)
|
||||
inv:set_stack("src", 1, src_item)
|
||||
end
|
||||
meta:set_int("battery_charge",charge)
|
||||
end
|
||||
end
|
||||
|
||||
-- dischargin registered power tools
|
||||
if inv:is_empty("dst") == false then
|
||||
srcstack = inv:get_stack("dst", 1)
|
||||
src_item=srcstack:to_table()
|
||||
local item_max_charge = nil
|
||||
local counter=registered_power_tools_count-1
|
||||
for i=1, counter,1 do
|
||||
@ -179,46 +219,22 @@ minetest.register_abm({
|
||||
end
|
||||
end
|
||||
if item_max_charge then
|
||||
local load1=tonumber((src_item["wear"]))
|
||||
load1=get_RE_item_load(load1,item_max_charge)
|
||||
load_step=1000
|
||||
if load1<item_max_charge and charge>0 then
|
||||
if charge-load_step<0 then load_step=charge end
|
||||
if load1+load_step>item_max_charge then load_step=item_max_charge-load1 end
|
||||
load1=load1+load_step
|
||||
charge=charge-load_step
|
||||
|
||||
load1=set_RE_item_load(load1,item_max_charge)
|
||||
src_item["wear"]=tostring(load1)
|
||||
inv:set_stack("src", 1, src_item)
|
||||
end
|
||||
meta:set_int("battery_charge",charge)
|
||||
end
|
||||
end
|
||||
|
||||
if inv:is_empty("dst") == false then
|
||||
srcstack = inv:get_stack("dst", 1)
|
||||
src_item=srcstack:to_table()
|
||||
if src_item["name"]== "technic:battery" then
|
||||
local load1=tonumber((src_item["wear"]))
|
||||
load1=get_RE_item_load(load1,10000)
|
||||
if src_item["metadata"]=="" then src_item["metadata"]="0" end --create meta for not used before battery/crystal
|
||||
local load1=tonumber((src_item["metadata"]))
|
||||
load_step=1000
|
||||
if load1>0 and charge<max_charge then
|
||||
if charge+load_step>max_charge then load_step=max_charge-charge end
|
||||
if load1-load_step<0 then load_step=load1 end
|
||||
load1=load1-load_step
|
||||
charge=charge+load_step
|
||||
|
||||
load1=set_RE_item_load(load1,10000)
|
||||
src_item["wear"]=tostring(load1)
|
||||
set_RE_wear(src_item,load1,item_max_charge)
|
||||
src_item["metadata"]=tostring(load1)
|
||||
inv:set_stack("dst", 1, src_item)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
meta:set_int("battery_charge",charge)
|
||||
meta:set_string("infotext", "Battery box: "..charge.."/"..max_charge);
|
||||
|
||||
local load = math.floor(charge/60000 * 100)
|
||||
meta:set_string("formspec",
|
||||
@ -310,10 +326,10 @@ i=1
|
||||
|
||||
i=i+1
|
||||
until false
|
||||
|
||||
meta:set_float("battery_charge",charge)
|
||||
meta:set_string("infotext", "Battery box: "..charge.."/"..max_charge);
|
||||
|
||||
charge=math.floor(charge)
|
||||
charge_string=tostring(charge)
|
||||
meta:set_string("infotext", "Battery box: "..charge_string.."/"..max_charge);
|
||||
meta:set_int("battery_charge",charge)
|
||||
|
||||
end
|
||||
})
|
||||
|
11
chainsaw.lua
11
chainsaw.lua
@ -7,19 +7,18 @@ minetest.register_tool("technic:chainsaw", {
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type=="node" then
|
||||
item=itemstack:to_table()
|
||||
local charge=tonumber((item["wear"]))
|
||||
if charge ==0 then charge =65535 end
|
||||
charge=get_RE_item_load(charge,mining_drill_max_charge)
|
||||
if item["metadata"]=="" or item["metadata"]=="0" then return end --tool not charged
|
||||
charge=tonumber(item["metadata"])
|
||||
charge_to_take=600;
|
||||
if charge-charge_to_take>0 then
|
||||
charge_to_take=chainsaw_dig_it(minetest.get_pointed_thing_position(pointed_thing, above),user,charge_to_take)
|
||||
charge=charge-charge_to_take;
|
||||
charge=set_RE_item_load(charge,mining_drill_max_charge)
|
||||
item["wear"]=tostring(charge)
|
||||
set_RE_wear(item,charge,chainsaw_max_charge)
|
||||
item["metadata"]=tostring(charge)
|
||||
itemstack:replace(item)
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
103
flashlight.lua
103
flashlight.lua
@ -29,15 +29,8 @@ end
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
local player_name = player:get_player_name()
|
||||
table.insert(players, player_name)
|
||||
last_wielded[player_name] = flashlight_weared(player)
|
||||
local pos = player:getpos()
|
||||
local rounded_pos = {x=round(pos.x),y=round(pos.y)+1,z=round(pos.z)}
|
||||
local wielded_item = player:get_wielded_item():get_name()
|
||||
if flashlight_weared(player)==true then
|
||||
-- Neuberechnung des Lichts erzwingen
|
||||
minetest.env:add_node(rounded_pos,{type="node",name="technic:light_off"})
|
||||
minetest.env:add_node(rounded_pos,{type="node",name="air"})
|
||||
end
|
||||
player_positions[player_name] = {}
|
||||
player_positions[player_name]["x"] = rounded_pos.x;
|
||||
player_positions[player_name]["y"] = rounded_pos.y;
|
||||
@ -67,58 +60,55 @@ end)
|
||||
minetest.register_globalstep(function(dtime)
|
||||
for i,player_name in ipairs(players) do
|
||||
local player = minetest.env:get_player_by_name(player_name)
|
||||
if flashlight_weared(player)==true then
|
||||
-- Fackel ist in der Hand
|
||||
flashlight_weared=check_for_flashlight(player)
|
||||
local pos = player:getpos()
|
||||
local rounded_pos = {x=round(pos.x),y=round(pos.y)+1,z=round(pos.z)}
|
||||
if (last_wielded[player_name] ~= true) or (player_positions[player_name]["x"] ~= rounded_pos.x or player_positions[player_name]["y"] ~= rounded_pos.y or player_positions[player_name]["z"] ~= rounded_pos.z) then
|
||||
-- Fackel gerade in die Hand genommen oder zu neuem Node bewegt
|
||||
local is_air = minetest.env:get_node_or_nil(rounded_pos)
|
||||
if is_air == nil or (is_air ~= nil and (is_air.name == "air" or is_air.name == "technic:light")) then
|
||||
-- wenn an aktueller Position "air" ist, Fackellicht setzen
|
||||
local old_pos = {x=player_positions[player_name]["x"], y=player_positions[player_name]["y"], z=player_positions[player_name]["z"]}
|
||||
|
||||
if last_wielded[player_name] and not flashlight_weared then --remove light, flashlight weared out or was removed from hotbar
|
||||
local node=minetest.env:get_node_or_nil(old_pos)
|
||||
if node then
|
||||
if node.name=="technic:light" then
|
||||
minetest.env:add_node(old_pos,{type="node",name="technic:light_off"})
|
||||
minetest.env:add_node(old_pos,{type="node",name="air"})
|
||||
last_wielded[player_name]=false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
player_moved=not(old_pos.x==rounded_pos.x and old_pos.y==rounded_pos.y and old_pos.z==rounded_pos.z)
|
||||
if player_moved and last_wielded[player_name] and flashlight_weared then
|
||||
|
||||
local node=minetest.env:get_node_or_nil(rounded_pos)
|
||||
if node then
|
||||
if node.name=="air" then
|
||||
minetest.env:add_node(rounded_pos,{type="node",name="technic:light"})
|
||||
end
|
||||
if (player_positions[player_name]["x"] ~= rounded_pos.x or player_positions[player_name]["y"] ~= rounded_pos.y or player_positions[player_name]["z"] ~= rounded_pos.z) then
|
||||
-- wenn Position geänder, dann altes Licht löschen
|
||||
local old_pos = {x=player_positions[player_name]["x"], y=player_positions[player_name]["y"], z=player_positions[player_name]["z"]}
|
||||
-- Neuberechnung des Lichts erzwingen
|
||||
local is_light = minetest.env:get_node_or_nil(old_pos)
|
||||
if is_light ~= nil and is_light.name == "technic:light" then
|
||||
end
|
||||
local node=minetest.env:get_node_or_nil(old_pos)
|
||||
if node then
|
||||
if node.name=="technic:light" then
|
||||
minetest.env:add_node(old_pos,{type="node",name="technic:light_off"})
|
||||
minetest.env:add_node(old_pos,{type="node",name="air"})
|
||||
end
|
||||
end
|
||||
-- gemerkte Position ist nun die gerundete neue Position
|
||||
player_positions[player_name]["x"] = rounded_pos.x
|
||||
player_positions[player_name]["y"] = rounded_pos.y
|
||||
player_positions[player_name]["z"] = rounded_pos.z
|
||||
|
||||
else if not last_wielded[player_name] and flashlight_weared then
|
||||
local node=minetest.env:get_node_or_nil(rounded_pos)
|
||||
if node then
|
||||
if node.name=="air" then
|
||||
minetest.env:add_node(rounded_pos,{type="node",name="technic:light"})
|
||||
end
|
||||
end
|
||||
player_positions[player_name]["x"] = rounded_pos.x
|
||||
player_positions[player_name]["y"] = rounded_pos.y
|
||||
player_positions[player_name]["z"] = rounded_pos.z
|
||||
last_wielded[player_name]=true
|
||||
end
|
||||
|
||||
last_wielded[player_name] = true;
|
||||
elseif last_wielded[player_name] == true then
|
||||
-- Fackel nicht in der Hand, aber beim letzten Durchgang war die Fackel noch in der Hand
|
||||
local pos = player:getpos()
|
||||
local rounded_pos = {x=round(pos.x),y=round(pos.y)+1,z=round(pos.z)}
|
||||
repeat
|
||||
local is_light = minetest.env:get_node_or_nil(rounded_pos)
|
||||
if is_light ~= nil and is_light.name == "technic:light" then
|
||||
-- minetest.env:remove_node(rounded_pos)
|
||||
-- Erzwinge Neuberechnung des Lichts
|
||||
minetest.env:add_node(rounded_pos,{type="node",name="technic:light_off"})
|
||||
minetest.env:add_node(rounded_pos,{type="node",name="air"})
|
||||
end
|
||||
until minetest.env:get_node_or_nil(rounded_pos) ~= "technic:light"
|
||||
local old_pos = {x=player_positions[player_name]["x"], y=player_positions[player_name]["y"], z=player_positions[player_name]["z"]}
|
||||
repeat
|
||||
is_light = minetest.env:get_node_or_nil(old_pos)
|
||||
if is_light ~= nil and is_light.name == "technic:light" then
|
||||
-- minetest.env:remove_node(old_pos)
|
||||
-- Erzwinge Neuberechnung des Lichts
|
||||
minetest.env:add_node(old_pos,{type="node",name="technic:light_off"})
|
||||
minetest.env:add_node(old_pos,{type="node",name="air"})
|
||||
end
|
||||
until minetest.env:get_node_or_nil(old_pos) ~= "technic:light"
|
||||
last_wielded[player_name] = true
|
||||
end
|
||||
end
|
||||
end)
|
||||
@ -128,6 +118,7 @@ minetest.register_node("technic:light", {
|
||||
tile_images = {"technic_light.png"},
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = true,
|
||||
light_propagates = true,
|
||||
sunlight_propagates = true,
|
||||
@ -142,6 +133,7 @@ minetest.register_node("technic:light_off", {
|
||||
tile_images = {"technic_light.png"},
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = true,
|
||||
light_propagates = true,
|
||||
sunlight_propagates = true,
|
||||
@ -151,27 +143,24 @@ minetest.register_node("technic:light_off", {
|
||||
},
|
||||
})
|
||||
|
||||
function flashlight_weared (player)
|
||||
flashlight_on=false
|
||||
function check_for_flashlight (player)
|
||||
local inv = player:get_inventory()
|
||||
local hotbar=inv:get_list("main")
|
||||
for i=1,8,1 do
|
||||
|
||||
if hotbar[i]:get_name() == "technic:flashlight" then
|
||||
item=hotbar[i]:to_table()
|
||||
local charge=tonumber((item["wear"]))
|
||||
if charge ==0 then charge =65535 end
|
||||
charge=get_RE_item_load(charge,flashlight_max_charge)
|
||||
if item["metadata"]=="" or item["metadata"]=="0" then return false end --flashlight not charghed
|
||||
charge=tonumber(item["metadata"])
|
||||
if charge-2>0 then
|
||||
flashlight_on=true
|
||||
charge =charge-2;
|
||||
charge=set_RE_item_load(charge,flashlight_max_charge)
|
||||
item["wear"]=tostring(charge)
|
||||
set_RE_wear(item,charge,flashlight_max_charge)
|
||||
item["metadata"]=tostring(charge)
|
||||
hotbar[i]:replace(item)
|
||||
inv:set_stack("main",i,hotbar[i])
|
||||
end
|
||||
return flashlight_on
|
||||
return true
|
||||
end
|
||||
end
|
||||
return flashlight_on
|
||||
end
|
||||
return false
|
||||
end
|
48
items.lua
48
items.lua
@ -52,21 +52,6 @@ minetest.register_node( "technic:diamond_block", {
|
||||
drop = 'craft "technic:diamond_block" 1',
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:red_energy_crystal',
|
||||
recipe = {
|
||||
{'moreores:gold_ingot', 'technic:battery', 'group:dye,basecolor_red'},
|
||||
{'technic:battery', 'technic:diamond_block', 'technic:battery'},
|
||||
{'group:dye,basecolor_red', 'technic:battery', 'moreores:gold_ingot'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem( "technic:red_energy_crystal", {
|
||||
description = "Red Energy Crystal",
|
||||
inventory_image = minetest.inventorycube("technic_diamond_block_red.png", "technic_diamond_block_red.png", "technic_diamond_block_red.png"),
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:green_energy_crystal',
|
||||
recipe = {
|
||||
@ -76,12 +61,6 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem( "technic:green_energy_crystal", {
|
||||
description = "Green Energy Crystal",
|
||||
inventory_image = minetest.inventorycube("technic_diamond_block_green.png", "technic_diamond_block_green.png", "technic_diamond_block_green.png"),
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'technic:blue_energy_crystal',
|
||||
recipe = {
|
||||
@ -91,11 +70,30 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem( "technic:blue_energy_crystal", {
|
||||
description = "Blue Energy Crystal",
|
||||
inventory_image = minetest.inventorycube("technic_diamond_block_blue.png", "technic_diamond_block_blue.png", "technic_diamond_block_blue.png"),
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
minetest.register_craft({
|
||||
output = 'technic:red_energy_crystal',
|
||||
recipe = {
|
||||
{'moreores:gold_ingot', 'technic:battery', 'group:dye,basecolor_red'},
|
||||
{'technic:battery', 'technic:diamond_block', 'technic:battery'},
|
||||
{'group:dye,basecolor_red', 'technic:battery', 'moreores:gold_ingot'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_tool("technic:blue_energy_crystal",
|
||||
{description = "Blue Energy Crystal",
|
||||
inventory_image = minetest.inventorycube("technic_diamond_block_blue.png", "technic_diamond_block_blue.png", "technic_diamond_block_blue.png"),
|
||||
tool_capabilities = {load=0,max_drop_level=0, groupcaps={fleshy={times={}, uses=10000, maxlevel=0}}}})
|
||||
|
||||
minetest.register_tool("technic:green_energy_crystal",
|
||||
{description = "Green Energy Crystal",
|
||||
inventory_image = minetest.inventorycube("technic_diamond_block_green.png", "technic_diamond_block_green.png", "technic_diamond_block_green.png"),
|
||||
tool_capabilities = {load=0,max_drop_level=0, groupcaps={fleshy={times={}, uses=10000, maxlevel=0}}}})
|
||||
|
||||
minetest.register_tool("technic:red_energy_crystal",
|
||||
{description = "Red Energy Crystal",
|
||||
inventory_image = minetest.inventorycube("technic_diamond_block_red.png", "technic_diamond_block_red.png", "technic_diamond_block_red.png"),
|
||||
tool_capabilities = {load=0,max_drop_level=0, groupcaps={fleshy={times={}, uses=10000, maxlevel=0}}}})
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -7,14 +7,13 @@ minetest.register_tool("technic:mining_drill", {
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type=="node" then
|
||||
item=itemstack:to_table()
|
||||
local charge=tonumber((item["wear"]))
|
||||
if charge ==0 then charge =65535 end
|
||||
charge=get_RE_item_load(charge,mining_drill_max_charge)
|
||||
if item["metadata"]=="" or item["metadata"]=="0" then return end --tool not charged
|
||||
charge=tonumber(item["metadata"])
|
||||
if charge-200>0 then
|
||||
drill_dig_it(minetest.get_pointed_thing_position(pointed_thing, above),user)
|
||||
charge =charge-200;
|
||||
charge=set_RE_item_load(charge,mining_drill_max_charge)
|
||||
item["wear"]=tostring(charge)
|
||||
item["metadata"]=tostring(charge)
|
||||
set_RE_wear(item,charge,mining_drill_max_charge)
|
||||
itemstack:replace(item)
|
||||
end
|
||||
return itemstack
|
||||
|
@ -1,17 +1,42 @@
|
||||
laser_mk1_max_charge=40000
|
||||
|
||||
local laser_shoot = function(itemstack, player, pointed_thing)
|
||||
local laser_straight_mode=0
|
||||
local playerpos=player:getpos()
|
||||
local dir=player:get_look_dir()
|
||||
if pointed_thing.type=="node" then
|
||||
pos=minetest.get_pointed_thing_position(pointed_thing, above)
|
||||
local node = minetest.env:get_node(pos)
|
||||
if node.name~="ignore" then
|
||||
minetest.node_dig(pos,node,player)
|
||||
end
|
||||
laser_straight_mode=1
|
||||
end
|
||||
|
||||
direction_y=math.abs(math.floor(dir.y*100))
|
||||
print (direction_y)
|
||||
if direction_y>50 then entity_name="technic:laser_beam_entityV"
|
||||
else entity_name="technic:laser_beam_entity" end
|
||||
local obj=minetest.env:add_entity({x=playerpos.x,y=playerpos.y+1.6,z=playerpos.z},entity_name)
|
||||
|
||||
if laser_straight_mode==1 then
|
||||
pos1=minetest.get_pointed_thing_position(pointed_thing, under)
|
||||
pos1.x=math.floor(pos1.x)
|
||||
pos1.y=math.floor(pos1.y)
|
||||
pos1.z=math.floor(pos1.z)
|
||||
obj=minetest.env:add_entity(pos1,entity_name)
|
||||
else
|
||||
obj=minetest.env:add_entity({x=playerpos.x,y=playerpos.y+1.6,z=playerpos.z},entity_name)
|
||||
end
|
||||
if obj:get_luaentity().player == nil then
|
||||
obj:get_luaentity().player = player
|
||||
end
|
||||
obj:setvelocity({x=dir.x*10, y=dir.y*10, z=dir.z*10})
|
||||
if laser_straight_mode==1 and direction_y<50 then
|
||||
obj:setvelocity({x=dir.x*8, y=0, z=dir.z*8})
|
||||
else if laser_straight_mode==1 and direction_y>50 then
|
||||
obj:setvelocity({x=0, y=dir.y*8, z=dir.z*8})
|
||||
end
|
||||
end
|
||||
if laser_straight_mode==0 then
|
||||
obj:setvelocity({x=dir.x*8, y=dir.y*8, z=dir.z*8})
|
||||
end
|
||||
obj:setacceleration({x=0, y=0, z=0})
|
||||
obj:setyaw(player:get_look_yaw()+math.pi)
|
||||
if obj:get_luaentity().player == nil then
|
||||
@ -29,14 +54,13 @@ minetest.register_tool("technic:laser_mk1", {
|
||||
stack_max = 1,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
item=itemstack:to_table()
|
||||
local charge=tonumber((item["wear"]))
|
||||
if charge ==0 then charge =65535 end
|
||||
charge=get_RE_item_load(charge,laser_mk1_max_charge)
|
||||
if item["metadata"]=="" or item["metadata"]=="0" then return end
|
||||
local charge=tonumber((item["metadata"]))
|
||||
if charge-400>0 then
|
||||
laser_shoot(item, user, pointed_thing)
|
||||
charge =charge-400;
|
||||
charge=set_RE_item_load(charge,laser_mk1_max_charge)
|
||||
item["wear"]=tostring(charge)
|
||||
item["metadata"]=tostring(charge)
|
||||
charge=set_RE_wear(item,charge,laser_mk1_max_charge)
|
||||
itemstack:replace(item)
|
||||
end
|
||||
return itemstack
|
||||
|
6
ores.lua
6
ores.lua
@ -192,10 +192,10 @@ local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume,
|
||||
end
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
generate_ore("technic:mineral_diamond", "default:stone", minp, maxp, seed+21, 1/11/11/11, 2, -31000, -450)
|
||||
generate_ore("technic:mineral_uranium", "default:stone", minp, maxp, seed+22, 1/11/11/11, 1, -300, -100)
|
||||
generate_ore("technic:mineral_diamond", "default:stone", minp, maxp, seed+21, 1/11/11/11, 4, -31000, -450)
|
||||
generate_ore("technic:mineral_uranium", "default:stone", minp, maxp, seed+22, 1/10/10/10, 3, -300, -80)
|
||||
generate_ore("technic:mineral_chromium", "default:stone", minp, maxp, seed+23, 1/10/10/10, 2, -31000, -100)
|
||||
generate_ore("technic:mineral_zinc", "default:stone", minp, maxp, seed+24, 1/9/9/9, 5, -31000, 2)
|
||||
generate_ore("technic:mineral_zinc", "default:stone", minp, maxp, seed+24, 1/9/9/9, 4, -31000, 2)
|
||||
generate_ore("technic:marble", "default:stone", minp, maxp, seed+25, 1/128, 20, -100, -32)
|
||||
generate_ore("technic:granite", "default:stone", minp, maxp, seed+25, 1/128, 15, -190, -90)
|
||||
end)
|
@ -12,9 +12,8 @@ sonic_screwdriver_max_charge=15000
|
||||
if minetest.registered_nodes[node_name].paramtype2 == "facedir" or minetest.registered_nodes[node_name].paramtype2 == "wallmounted" then
|
||||
if node.param2==nil then return end
|
||||
item=itemstack:to_table()
|
||||
local charge=tonumber((item["wear"]))
|
||||
if charge ==0 then charge =65535 end
|
||||
charge=get_RE_item_load(charge,sonic_screwdriver_max_charge)
|
||||
if item["metadata"]=="" or item["metadata"]=="0" then return end
|
||||
local charge=tonumber((item["metadata"]))
|
||||
if charge-100>0 then
|
||||
minetest.sound_play("technic_sonic_screwdriver", {pos = pos, gain = 0.3, max_hear_distance = 10,})
|
||||
local n = node.param2
|
||||
@ -34,8 +33,8 @@ sonic_screwdriver_max_charge=15000
|
||||
meta:from_table(meta0)
|
||||
|
||||
charge =charge-100;
|
||||
charge=set_RE_item_load(charge,sonic_screwdriver_max_charge)
|
||||
item["wear"]=tostring(charge)
|
||||
item["metadata"]=tostring(charge)
|
||||
set_RE_wear(item,charge,sonic_screwdriver_max_charge)
|
||||
itemstack:replace(item)
|
||||
end
|
||||
return itemstack
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 4.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 15 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 9.6 KiB |
Loading…
Reference in New Issue
Block a user