added protector, titanium, growing trees
|
@ -1 +0,0 @@
|
|||
default
|
|
@ -1,9 +1,11 @@
|
|||
drowning = {} -- Exported functions
|
||||
|
||||
local players_under_water = {}
|
||||
local drowning_seconds = {}
|
||||
|
||||
local START_DROWNING_SECONDS = 60
|
||||
local DROWNING_SECONDS = 5
|
||||
local START_DROWNING_SECONDS = 40
|
||||
local FACTOR_DROWNING_SECONDS = 2
|
||||
local MIN_DROWNING_SECONDS = 2
|
||||
local DROWNING_DAMAGE = 1
|
||||
|
||||
local timer = 0
|
||||
|
@ -15,48 +17,65 @@ minetest.register_globalstep(function(dtime)
|
|||
else
|
||||
return
|
||||
end
|
||||
for k, v in pairs(minetest.object_refs) do
|
||||
if v:get_player_name() ~= nil then
|
||||
name = v:get_player_name()
|
||||
if players_under_water[name] == nil then
|
||||
players_under_water[name] = {count=0, drowning=false}
|
||||
for _,player in ipairs(minetest.get_connected_players()) do
|
||||
local player_name = player:get_player_name()
|
||||
if players_under_water[player_name] == nil then
|
||||
players_under_water[player_name] = {count=0}
|
||||
end
|
||||
if IsPlayerInAir(v) == false then
|
||||
players_under_water[name].count = players_under_water[name].count + .5
|
||||
|
||||
if players_under_water[name].drowning and players_under_water[name].count >= DROWNING_SECONDS then
|
||||
v:set_hp(v:get_hp() - DROWNING_DAMAGE)
|
||||
pos = v:getpos()
|
||||
pos.y=pos.y+1
|
||||
minetest.sound_play({name="drowning_gurp"}, {pos = pos, gain = 1.0, max_hear_distance = 16})
|
||||
players_under_water[name].count = players_under_water[name].count - DROWNING_SECONDS
|
||||
elseif not players_under_water[name].drowning and players_under_water[name].count >= START_DROWNING_SECONDS then
|
||||
players_under_water[name] = {count=0, drowning=true}
|
||||
v:set_hp(v:get_hp() - DROWNING_DAMAGE)
|
||||
pos = v:getpos()
|
||||
pos.y=pos.y+1
|
||||
minetest.sound_play({name="drowning_gurp"}, {pos = pos, gain = 1.0, max_hear_distance = 16})
|
||||
if drowning_seconds[player_name] == nil then
|
||||
drowning_seconds[player_name] = START_DROWNING_SECONDS
|
||||
end
|
||||
-- Lua interpretes nil and 0 as true
|
||||
if PlayerNotInLiquid(player) == false then
|
||||
players_under_water[player_name].count = players_under_water[player_name].count + .5
|
||||
if players_under_water[player_name].count >= drowning_seconds[player_name] then
|
||||
if player:get_hp() > 0 then
|
||||
player:set_hp(player:get_hp() - DROWNING_DAMAGE)
|
||||
pos = player:getpos()
|
||||
pos.y=pos.y+1
|
||||
minetest.sound_play({name="drowning_gurp"}, {pos = pos, gain = 1.0, max_hear_distance = 16})
|
||||
players_under_water[player_name].count = players_under_water[player_name].count - drowning_seconds[player_name]
|
||||
drowning_seconds[player_name] = math.floor(drowning_seconds[player_name]/FACTOR_DROWNING_SECONDS)
|
||||
if drowning_seconds[player_name] < MIN_DROWNING_SECONDS then
|
||||
drowning_seconds[player_name] = MIN_DROWNING_SECONDS
|
||||
end
|
||||
else
|
||||
players_under_water[player_name] = {count=0}
|
||||
drowning_seconds[player_name] = START_DROWNING_SECONDS
|
||||
end
|
||||
end
|
||||
elseif players_under_water[name].count > 0 then
|
||||
pos = v:getpos()
|
||||
elseif players_under_water[player_name].count > 0 then
|
||||
pos = player:getpos()
|
||||
pos.y=pos.y+1
|
||||
minetest.sound_play({name="drowning_gasp"}, {pos = pos, gain = 1.0, max_hear_distance = 32})
|
||||
players_under_water[name] = {count=0, drowning=false}
|
||||
players_under_water[player_name] = {count=0}
|
||||
drowning_seconds[player_name] = START_DROWNING_SECONDS
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function IsPlayerInAir(player)
|
||||
-- player:getpos() is at the feet (I think) so add 1 to y to get where the head is?
|
||||
pos = player:getpos()
|
||||
function PlayerNotInLiquid(player)
|
||||
local pos = player:getpos()
|
||||
pos.x = math.floor(pos.x+0.5)
|
||||
pos.y = math.floor(pos.y+1.5)
|
||||
pos.y = math.floor(pos.y+2.0)
|
||||
pos.z = math.floor(pos.z+0.5)
|
||||
|
||||
if minetest.env:get_node(pos).name == "air" then
|
||||
return true
|
||||
-- getting nodename at players head
|
||||
n_head = minetest.env:get_node(pos).name
|
||||
-- checking if node is liquid (0=not 2=lava 3=water) then player is underwater
|
||||
-- this includes flowing water and flowing lava
|
||||
if minetest.get_item_group(n_head, "liquid") ~= 0 then
|
||||
return false
|
||||
end
|
||||
return false
|
||||
return true
|
||||
end
|
||||
|
||||
minetest.register_on_respawnplayer(reset_on_respawn)
|
||||
|
||||
reset_on_respawn = function(player)
|
||||
for _,player in ipairs(minetest.get_connected_players()) do
|
||||
players_under_water[player_name] = {count=0}
|
||||
drowning_seconds[player_name] = START_DROWNING_SECONDS
|
||||
end
|
||||
end
|
|
@ -21,7 +21,7 @@
|
|||
-------------------------------------------------------------------------------
|
||||
minetest.register_abm({
|
||||
nodenames = { "growing_trees:trunk_sprout" },
|
||||
interval = 60,
|
||||
interval = 30,
|
||||
chance = 5,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
|
||||
|
@ -42,7 +42,7 @@ minetest.register_abm({
|
|||
if root_node ~= nil and
|
||||
root_node.name ~= "growing_trees:big_trunk" then
|
||||
|
||||
growing_trees_make_trunk_big(tree_root,SLOWDOWN_SIZE)
|
||||
growing_trees_make_trunk_big(tree_root,SLOWDOWN_TREE_GROWTH_SIZE)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -70,7 +70,7 @@ minetest.register_abm({
|
|||
local node_above = minetest.env:get_node(pos_above)
|
||||
|
||||
if node_above.name == "air" or
|
||||
node_above.name == "growing_trees:leaves" then
|
||||
growing_trees_node_is_type(leaves_type,node_above.name) then
|
||||
|
||||
minetest.env:remove_node(pos)
|
||||
minetest.env:add_node(pos,{type=node,name="growing_trees:trunk"})
|
||||
|
@ -85,18 +85,21 @@ minetest.register_abm({
|
|||
--print("growing horizontaly")
|
||||
--decide which direction to grow trunk
|
||||
local pos_to_grow_to = growing_trees_get_random_next_to(pos)
|
||||
local node_at_pos_to_grow = minetest.env:get_node(pos_to_grow_to)
|
||||
|
||||
--check if pos is feasable
|
||||
--TODO
|
||||
if node_at_pos_to_grow.name == "air" or
|
||||
growing_trees_node_is_type(leaves_type,node_at_pos_to_grow.name) then
|
||||
|
||||
minetest.env:remove_node(pos)
|
||||
minetest.env:add_node(pos,{type=node,name="growing_trees:trunk"})
|
||||
|
||||
minetest.env:add_node(pos_to_grow_to,{type=node,name="growing_trees:trunk_sprout"})
|
||||
|
||||
grown = true
|
||||
minetest.env:remove_node(pos)
|
||||
minetest.env:add_node(pos,{type=node,name="growing_trees:trunk"})
|
||||
|
||||
minetest.env:add_node(pos_to_grow_to,{type=node,name="growing_trees:trunk_sprout"})
|
||||
|
||||
grown = true
|
||||
end
|
||||
else
|
||||
print("Not growing horizontaly twice")
|
||||
growing_trees_debug("verbose","Not growing horizontaly twice")
|
||||
end
|
||||
end
|
||||
growing_trees_debug("verbose","Growing_Trees: trunk_sprout ABM*******************")
|
||||
|
@ -111,7 +114,7 @@ minetest.register_abm({
|
|||
-------------------------------------------------------------------------------
|
||||
minetest.register_abm({
|
||||
nodenames = trunk_static_type,
|
||||
interval = 60,
|
||||
interval = 15,
|
||||
chance = 5,
|
||||
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
|
@ -120,14 +123,17 @@ minetest.register_abm({
|
|||
local treesize,tree_root = growing_trees_get_tree_size(pos)
|
||||
|
||||
--don't add branches to trees to small
|
||||
if treesize < 5 then
|
||||
if treesize < 4 then
|
||||
growing_trees_debug("verbose","Growing_Trees: branch_abm ABM*******************")
|
||||
return
|
||||
end
|
||||
|
||||
local growpos = growing_trees_get_random_next_to(pos)
|
||||
local node_at_pos = minetest.env:get_node(pos)
|
||||
|
||||
if growing_trees_is_tree_structure(growpos) == false then
|
||||
if growing_trees_is_tree_structure(growpos) == false and
|
||||
( node_at_pos.name == "air" or
|
||||
growing_trees_node_is_type(leaves_type,node_at_pos.name)) then
|
||||
|
||||
local distance = growing_trees_min_distance(growpos)
|
||||
local next_to_branch = growing_trees_next_to_branch(growpos,nil)
|
||||
|
@ -140,7 +146,8 @@ minetest.register_abm({
|
|||
else
|
||||
growing_trees_debug("verbose","Growing_Trees: NOT adding branch: " .. distance .. " ntb: " .. dump(next_to_branch) )
|
||||
end
|
||||
|
||||
else
|
||||
growing_trees_debug("info","unable to get valid growpos for branch")
|
||||
end
|
||||
|
||||
growing_trees_debug("verbose","Growing_Trees: branch_add ABM********************")
|
||||
|
@ -172,7 +179,9 @@ minetest.register_abm({
|
|||
|
||||
growing_trees_debug("verbose","Growing_Trees: evaluating growpos information " .. dump(tree_structure) .. " " .. dump(next_to_branch))
|
||||
if tree_structure == false and
|
||||
next_to_branch == false then
|
||||
next_to_branch == false and
|
||||
( node_at_pos.name == "air" or
|
||||
growing_trees_node_is_type(leaves_type,node_at_pos.name)) then
|
||||
growing_trees_debug("verbose","valid growing pos found:" .. printpos(growpos) .. " -> " .. node_at_pos.name )
|
||||
|
||||
local branch = {}
|
||||
|
@ -197,7 +206,7 @@ minetest.register_abm({
|
|||
|
||||
if (treesize > MAX_TREE_SIZE) then
|
||||
growing_trees_debug("info","Growing_Trees: branch maximum tree size reached")
|
||||
if math.random < 0.1 then
|
||||
if math.random() < 0.1 then
|
||||
growing_trees_debug("info","Growing_Trees: aborting branch growth")
|
||||
minetest.env:remove_node(pos)
|
||||
minetest.env:add_node(pos,{type=node,name="growing_trees:leaves"})
|
||||
|
@ -233,7 +242,7 @@ minetest.register_abm({
|
|||
minetest.register_abm({
|
||||
nodenames = { "growing_trees:leaves" },
|
||||
interval = 10,
|
||||
chance = 5,
|
||||
chance = 2,
|
||||
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
|
||||
|
@ -252,7 +261,7 @@ minetest.register_abm({
|
|||
minetest.register_abm({
|
||||
nodenames = { "growing_trees:trunk_sprout" },
|
||||
interval = 5,
|
||||
chance = 5,
|
||||
chance = 2,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
growing_trees_grow_sprout_leaves(pos)
|
||||
end
|
||||
|
@ -261,7 +270,7 @@ minetest.register_abm({
|
|||
minetest.register_abm({
|
||||
nodenames = branch_static_type,
|
||||
interval = 5,
|
||||
chance = 5,
|
||||
chance = 2,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
growing_trees_grow_leaves(pos)
|
||||
end
|
||||
|
|
|
@ -281,16 +281,19 @@ function growing_trees_grow_leaves(pos)
|
|||
for z = pos.z - 2, pos.z + 2 do
|
||||
local currentpos = {x = x, y = y, z = z}
|
||||
|
||||
if current_node ~= nil and
|
||||
current_node.name == "air" then
|
||||
|
||||
if growing_trees_next_to(currentpos,branch_type,true) ~= nil or
|
||||
growing_trees_next_to(currentpos,leaves_type,true) ~= nil and
|
||||
math.random() < 0.2 then
|
||||
minetest.env:add_node(currentpos,{type="node",name="growing_trees:leaves"})
|
||||
local distance = growing_trees_calc_distance(pos,currentpos)
|
||||
|
||||
if distance <= 2 then
|
||||
if current_node ~= nil and
|
||||
current_node.name == "air" then
|
||||
|
||||
if growing_trees_next_to(currentpos,branch_type,true) ~= nil or
|
||||
growing_trees_next_to(currentpos,leaves_type,true) ~= nil and
|
||||
math.random() < 0.2 then
|
||||
minetest.env:add_node(currentpos,{type="node",name="growing_trees:leaves"})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -310,20 +313,50 @@ function growing_trees_grow_sprout_leaves(pos)
|
|||
for z = pos.z - 1, pos.z + 1 do
|
||||
local currentpos = {x = x, y = y, z = z}
|
||||
|
||||
local current_node = minetest.env:get_node(currentpos)
|
||||
|
||||
if current_node ~= nil and
|
||||
current_node.name == "air" then
|
||||
local distance = growing_trees_calc_distance(pos,currentpos)
|
||||
|
||||
if distance <= 1.5 then
|
||||
local current_node = minetest.env:get_node(currentpos)
|
||||
|
||||
if growing_trees_next_to(currentpos,trunk_type,true) ~= nil or
|
||||
growing_trees_next_to(currentpos,leaves_type,true) ~= nil and
|
||||
math.random() < 0.3 then
|
||||
minetest.env:add_node(currentpos,{type="node",name="growing_trees:leaves"})
|
||||
if current_node ~= nil and
|
||||
current_node.name == "air" then
|
||||
|
||||
if growing_trees_next_to(currentpos,trunk_type,true) ~= nil or
|
||||
growing_trees_next_to(currentpos,leaves_type,true) ~= nil and
|
||||
math.random() < 0.3 then
|
||||
minetest.env:add_node(currentpos,{type="node",name="growing_trees:leaves"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
local treesize = growing_trees_get_tree_size({x=pos.x,y=pos.y-1,z=pos.z})
|
||||
|
||||
if treesize > 2 and
|
||||
treesize < 6 then
|
||||
|
||||
for x = pos.x - 3, pos.x + 3 do
|
||||
for y = pos.y - 3, pos.y + 3 do
|
||||
for z = pos.z - 3, pos.z + 3 do
|
||||
local currentpos = {x = x, y = y, z = z}
|
||||
local current_node = minetest.env:get_node(currentpos)
|
||||
|
||||
if current_node ~= nil and
|
||||
current_node.name == "air" then
|
||||
local distance = growing_trees_calc_distance(pos,currentpos)
|
||||
if distance <= 3 then
|
||||
if growing_trees_next_to(currentpos,branch_type,true) ~= nil or
|
||||
growing_trees_next_to(currentpos,leaves_type,true) ~= nil and
|
||||
math.random() < 0.2 then
|
||||
minetest.env:add_node(currentpos,{type="node",name="growing_trees:leaves"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ function growing_trees_place_sprout(pos)
|
|||
|
||||
minetest.env:add_node(pos,{type=node,name="growing_trees:trunk"})
|
||||
minetest.env:add_node(pos_above,{type=node,name="growing_trees:trunk_sprout"})
|
||||
growing_trees_grow_sprout_leaves(pos_above)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -138,4 +138,19 @@ function growing_trees_neighbour_positions(pos,ynodes_too)
|
|||
end
|
||||
|
||||
return retval
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- name: growing_trees_calc_distance(pos1,pos2)
|
||||
--
|
||||
--! @brief calculate 3d distance between to points
|
||||
--
|
||||
--! @param pos1 first position
|
||||
--! @param pos2 second position
|
||||
--! @retval scalar value, distance
|
||||
-------------------------------------------------------------------------------
|
||||
function growing_trees_calc_distance(pos1,pos2)
|
||||
return math.sqrt( math.pow(pos1.x-pos2.x,2) +
|
||||
math.pow(pos1.y-pos2.y,2) +
|
||||
math.pow(pos1.z-pos2.z,2))
|
||||
end
|
|
@ -12,7 +12,7 @@
|
|||
--
|
||||
-- Contact sapier a t gmx net
|
||||
-------------------------------------------------------------------------------
|
||||
local version = "0.0.5"
|
||||
local version = "0.0.8"
|
||||
|
||||
local growing_trees_modpath = minetest.get_modpath("growing_trees")
|
||||
|
||||
|
@ -31,7 +31,8 @@ MAX_TREE_SIZE = 20
|
|||
SLOWDOWN_TREE_GROWTH_SIZE = 10
|
||||
|
||||
function growing_trees_debug(loglevel,text)
|
||||
minetest.log(loglevel,text)
|
||||
--minetest.log(loglevel,text)
|
||||
--print(loglevel .. ": " .. text)
|
||||
end
|
||||
|
||||
local tree_size_setting = minetest.setting_get("growing_trees_max_size")
|
||||
|
|
|
@ -65,8 +65,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
--randomly try to place new growing tree in area
|
||||
if not trunkpos then
|
||||
for i= 0, 5 do
|
||||
local x_try = math.random(xdivs/-2,xdivs/2)
|
||||
local z_try = math.random(zdivs/-2,zdivs/2)
|
||||
local x_try = math.random(minimum_tree_distance/-2,minimum_tree_distance/2)
|
||||
local z_try = math.random(minimum_tree_distance/-2,minimum_tree_distance/2)
|
||||
|
||||
local pos = { x= x_center + x_try,
|
||||
z= z_center+z_try }
|
||||
|
|
|
@ -50,7 +50,7 @@ trunk_static_type = {
|
|||
}
|
||||
|
||||
leaves_type = {
|
||||
"growing_tree:leaves"
|
||||
"growing_trees:leaves"
|
||||
}
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
default
|
||||
moreores
|
|
@ -0,0 +1,87 @@
|
|||
minetest.register_craft({
|
||||
output = 'protector:protect 16',
|
||||
recipe = {
|
||||
{'moreores:silver_ingot', 'moreores:silver_ingot'},
|
||||
{'moreores:silver_ingot', 'moreores:silver_ingot'},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
function isprotect(r,pos,digger)
|
||||
if pos.y < -999 then
|
||||
return false
|
||||
end
|
||||
local ok=true
|
||||
for ix = pos.x-r,pos.x+r do
|
||||
for iy = pos.y-r,pos.y+r do
|
||||
for iz = pos.z-r,pos.z+r do
|
||||
local node_name = minetest.env:get_node({x=ix,y=iy,z=iz})
|
||||
if node_name.name == "protector:protect" then
|
||||
local meta = minetest.env:get_meta({x=ix,y=iy,z=iz})
|
||||
if digger ~= nil then
|
||||
local owner = (meta:get_string("owner"))
|
||||
if owner ~= digger:get_player_name() then
|
||||
ok=false
|
||||
end
|
||||
else
|
||||
ok=false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return ok
|
||||
end
|
||||
|
||||
local old_node_dig = minetest.node_dig
|
||||
function minetest.node_dig(pos, node, digger)
|
||||
local ok=true
|
||||
ok = isprotect(5,pos,digger)
|
||||
if ok == true then
|
||||
old_node_dig(pos, node, digger)
|
||||
else
|
||||
minetest.chat_send_player(digger:get_player_name(), "area protected")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local old_node_place = minetest.item_place
|
||||
function minetest.item_place(itemstack, placer, pointed_thing)
|
||||
if itemstack:get_definition().type == "node" then
|
||||
local ok=true
|
||||
if itemstack:get_name() ~= "protector:protect" then
|
||||
local pos = pointed_thing.above
|
||||
ok = isprotect(5,pos,placer)
|
||||
else
|
||||
local pos = pointed_thing.above
|
||||
ok = isprotect(10,pos,placer)
|
||||
end
|
||||
if ok == true then
|
||||
if itemstack:get_name() == "protector:protect" then
|
||||
local pos = pointed_thing.above
|
||||
--minetest.chat_send_player(placer:get_player_name(), "this block protect ( "..
|
||||
--tostring(pos.x-3) .. " to " .. tostring(pos.x+3).." , "..
|
||||
--tostring(pos.y-3) .. " to " .. tostring(pos.y+3).." , "..
|
||||
--tostring(pos.z-3) .. " to " .. tostring(pos.z+3).." )"
|
||||
--)
|
||||
end
|
||||
return old_node_place(itemstack, placer, pointed_thing)
|
||||
else
|
||||
minetest.chat_send_player(placer:get_player_name(), "area protected")
|
||||
return
|
||||
end
|
||||
end
|
||||
return old_node_place(itemstack, placer, pointed_thing)
|
||||
end
|
||||
protect = {}
|
||||
minetest.register_node("protector:protect", {
|
||||
description = "protect",
|
||||
tile_images = {"glo2.png"},
|
||||
groups = {cracky=3},
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.env:get_meta(pos)
|
||||
meta:set_string("owner", placer:get_player_name() or "")
|
||||
meta:set_string("infotext", "protect (owned by "..
|
||||
meta:get_string("owner")..")")
|
||||
end,
|
||||
})
|
After Width: | Height: | Size: 805 B |
|
@ -0,0 +1 @@
|
|||
default
|
|
@ -0,0 +1,185 @@
|
|||
---
|
||||
---Titanium Mod By Aqua. Be nice this is my first mod!!!
|
||||
---
|
||||
|
||||
---
|
||||
---blocks
|
||||
---
|
||||
|
||||
minetest.register_node( "titanium:titanium_in_ground", {
|
||||
description = "Titanium Ore",
|
||||
tile_images = { "default_stone.png^titanium_titanium_in_ground.png" },
|
||||
is_ground_content = true,
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
drop = 'craft "titanium:titanium" 1',
|
||||
})
|
||||
|
||||
minetest.register_node( "titanium:block", {
|
||||
description = "Titanium Block",
|
||||
tile_images = { "titanium_block.png" },
|
||||
is_ground_content = true,
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craftitem( "titanium:titanium", {
|
||||
description = "Titanium",
|
||||
inventory_image = "titanium_titanium.png",
|
||||
on_place_on_ground = minetest.craftitem_place_item,
|
||||
})
|
||||
|
||||
---
|
||||
---tools
|
||||
---
|
||||
|
||||
minetest.register_tool("titanium:sword", {
|
||||
description = "Titanium Sword",
|
||||
inventory_image = "titanium_sword.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
fleshy={times={[1]=2.00, [2]=0.60, [3]=0.30}, uses=1000, maxlevel=2},
|
||||
snappy={times={[2]=0.70, [3]=0.30}, uses=1000, maxlevel=1},
|
||||
choppy={times={[3]=0.70}, uses=1000, maxlevel=0}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_tool("titanium:axe", {
|
||||
description = "Titanium Axe",
|
||||
inventory_image = "titanium_axe.png",
|
||||
tool_capabilities = {
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
choppy={times={[1]=2.50, [2]=1.50, [3]=1.00}, uses=1500, maxlevel=2},
|
||||
fleshy={times={[2]=1.00, [3]=0.50}, uses=1200, maxlevel=1}
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool("titanium:shovel", {
|
||||
description = "Titanium Shovel",
|
||||
inventory_image = "titanium_shovel.png",
|
||||
tool_capabilities = {
|
||||
max_drop_level=1,
|
||||
groupcaps={
|
||||
crumbly={times={[1]=1.0, [2]=0.50, [3]=0.50}, uses=1500, maxlevel=3}
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool("titanium:pick", {
|
||||
description = "Titanium Pickaxe",
|
||||
inventory_image = "titanium_pick.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.0,
|
||||
max_drop_level=3,
|
||||
groupcaps={
|
||||
cracky={times={[1]=2.4, [2]=1.0, [3]=0.6}, uses=1600, maxlevel=3},
|
||||
crumbly={times={[1]=2.4, [2]=1.0, [3]=0.6}, uses=1600, maxlevel=3},
|
||||
snappy={times={[1]=2.4, [2]=1.0, [3]=0.6}, uses=1600, maxlevel=3}
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
---
|
||||
---crafting
|
||||
---
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'titanium:pick',
|
||||
recipe = {
|
||||
{'titanium:titanium', 'titanium:titanium', 'titanium:titanium'},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'default:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'titanium:axe',
|
||||
recipe = {
|
||||
{'titanium:titanium', 'titanium:titanium', ''},
|
||||
{'titanium:titanium', 'default:stick', ''},
|
||||
{'', 'default:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'titanium:shovel',
|
||||
recipe = {
|
||||
{'', 'titanium:titanium', ''},
|
||||
{'', 'default:stick', ''},
|
||||
{'', 'default:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'titanium:sword',
|
||||
recipe = {
|
||||
{'', 'titanium:titanium', ''},
|
||||
{'', 'titanium:titanium', ''},
|
||||
{'', 'default:stick', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'titanium:block',
|
||||
recipe = {
|
||||
{'titanium:titanium', 'titanium:titanium', 'titanium:titanium'},
|
||||
{'titanium:titanium', 'titanium:titanium', 'titanium:titanium'},
|
||||
{'titanium:titanium', 'titanium:titanium', 'titanium:titanium'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'titanium:titanium 9',
|
||||
recipe = {
|
||||
{'', 'titanium:block', ''},
|
||||
}
|
||||
})
|
||||
|
||||
local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, ore_per_chunk, height_min, height_max)
|
||||
if maxp.y < height_min or minp.y > height_max then
|
||||
return
|
||||
end
|
||||
local y_min = math.max(minp.y, height_min)
|
||||
local y_max = math.min(maxp.y, height_max)
|
||||
local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1)
|
||||
local pr = PseudoRandom(seed)
|
||||
local num_chunks = math.floor(chunks_per_volume * volume)
|
||||
local chunk_size = 3
|
||||
if ore_per_chunk <= 4 then
|
||||
chunk_size = 2
|
||||
end
|
||||
local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk)
|
||||
--print("generate_ore num_chunks: "..dump(num_chunks))
|
||||
for i=1,num_chunks do
|
||||
local y0 = pr:next(y_min, y_max-chunk_size+1)
|
||||
if y0 >= height_min and y0 <= height_max then
|
||||
local x0 = pr:next(minp.x, maxp.x-chunk_size+1)
|
||||
local z0 = pr:next(minp.z, maxp.z-chunk_size+1)
|
||||
local p0 = {x=x0, y=y0, z=z0}
|
||||
for x1=0,chunk_size-1 do
|
||||
for y1=0,chunk_size-1 do
|
||||
for z1=0,chunk_size-1 do
|
||||
if pr:next(1,inverse_chance) == 1 then
|
||||
local x2 = x0+x1
|
||||
local y2 = y0+y1
|
||||
local z2 = z0+z1
|
||||
local p2 = {x=x2, y=y2, z=z2}
|
||||
if minetest.env:get_node(p2).name == wherein then
|
||||
minetest.env:set_node(p2, {name=name})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
generate_ore("titanium:titanium_in_ground", "default:stone", minp, maxp, seed+21, 1/5/5/5, 4, -31000, -400)
|
||||
end)
|
After Width: | Height: | Size: 236 B |
After Width: | Height: | Size: 285 B |
After Width: | Height: | Size: 359 B |
After Width: | Height: | Size: 238 B |
After Width: | Height: | Size: 318 B |
After Width: | Height: | Size: 364 B |
After Width: | Height: | Size: 224 B |