rework miner experience in rudimentary direction (#58)
* rework miner experience in rudimentary direction * remove useless print
This commit is contained in:
parent
aa2455c400
commit
e1b068bafe
@ -153,6 +153,7 @@ minetest.register_node("default:stones_on_floor", {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
drop = "default:stone_item 2",
|
drop = "default:stone_item 2",
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -541,6 +542,7 @@ default.register_wool("black")
|
|||||||
|
|
||||||
minetest.register_node("default:stone", {
|
minetest.register_node("default:stone", {
|
||||||
description = "Stone",
|
description = "Stone",
|
||||||
|
|
||||||
tiles = {"default_stone.png"},
|
tiles = {"default_stone.png"},
|
||||||
groups = {cracky = 3, stone= 1},
|
groups = {cracky = 3, stone= 1},
|
||||||
drop = {
|
drop = {
|
||||||
@ -551,6 +553,7 @@ minetest.register_node("default:stone", {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
sounds = default.sounds.stone(),
|
sounds = default.sounds.stone(),
|
||||||
|
miner_xp ={xp = 10,rnd = 20},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("default:desert_stone", {
|
minetest.register_node("default:desert_stone", {
|
||||||
@ -662,6 +665,7 @@ minetest.register_node("default:stone_with_coal", {
|
|||||||
groups = {cracky = 2},
|
groups = {cracky = 2},
|
||||||
drop = "default:coal_lump",
|
drop = "default:coal_lump",
|
||||||
sounds = default.sounds.stone(),
|
sounds = default.sounds.stone(),
|
||||||
|
miner_xp ={xp = -1, rm = true}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("default:stone_with_iron", {
|
minetest.register_node("default:stone_with_iron", {
|
||||||
@ -669,6 +673,7 @@ minetest.register_node("default:stone_with_iron", {
|
|||||||
tiles = {"default_stone_with_iron.png"},
|
tiles = {"default_stone_with_iron.png"},
|
||||||
groups = {cracky = 2},
|
groups = {cracky = 2},
|
||||||
sounds = default.sounds.stone(),
|
sounds = default.sounds.stone(),
|
||||||
|
miner_xp = {xp = 50},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("default:stone_with_copper", {
|
minetest.register_node("default:stone_with_copper", {
|
||||||
@ -705,6 +710,7 @@ minetest.register_node("default:stone_with_diamond", {
|
|||||||
groups = {hard = 2},
|
groups = {hard = 2},
|
||||||
drop = "default:diamond",
|
drop = "default:diamond",
|
||||||
sounds = default.sounds.stone(),
|
sounds = default.sounds.stone(),
|
||||||
|
miner_xp = {xp = 14, lvls = 5}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("default:stone_with_ruby", {
|
minetest.register_node("default:stone_with_ruby", {
|
||||||
|
@ -405,36 +405,38 @@ skills.register_tool("bow", 1, 30, {
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
minetest.override_item("default:stone_with_coal", {
|
-- minetest.override_item("default:stone_with_coal", {
|
||||||
on_dig = function(pos, node, player)
|
-- on_dig = function(pos, node, player)
|
||||||
if skills.lvls[player:get_player_name()] then
|
-- if skills.lvls[player:get_player_name()] then
|
||||||
xp.add_xp(player, (skills.lvls[player:get_player_name()]["miner"]-1))
|
-- xp.add_xp(player, (skills.lvls[player:get_player_name()]["miner"]-1))
|
||||||
end
|
-- end
|
||||||
minetest.node_dig(pos, node, player)
|
-- minetest.node_dig(pos, node, player)
|
||||||
end,
|
-- end,
|
||||||
})
|
-- })
|
||||||
|
--
|
||||||
minetest.override_item("default:stone_with_diamond", {
|
-- minetest.override_item("default:stone_with_diamond", {
|
||||||
on_dig = function(pos, node, player)
|
-- on_dig = function(pos, node, player)
|
||||||
if skills.lvls[player:get_player_name()] and skills.lvls[player:get_player_name()]["miner"] > 5 then
|
-- if skills.lvls[player:get_player_name()] and skills.lvls[player:get_player_name()]["miner"] > 5 then
|
||||||
xp.add_xp(player,xp.get_xp(xp.player_levels[player:get_player_name()], 14))
|
-- xp.add_xp(player,xp.get_xp(xp.player_levels[player:get_player_name()], 14))
|
||||||
end
|
-- end
|
||||||
minetest.node_dig(pos, node, player)
|
-- minetest.node_dig(pos, node, player)
|
||||||
end,
|
-- end,
|
||||||
})
|
-- })
|
||||||
|
--
|
||||||
minetest.override_item("default:stone", {
|
-- minetest.override_item("default:stone", {
|
||||||
on_dig = function(pos, node, player)
|
-- on_dig = function(pos, node, player)
|
||||||
if skills.lvls[player:get_player_name()] and skills.lvls[player:get_player_name()]["miner"] then
|
-- if skills.lvls[player:get_player_name()] and skills.lvls[player:get_player_name()]["miner"] then
|
||||||
if skills.lvls[player:get_player_name()]["miner"] > 1 then
|
-- if skills.lvls[player:get_player_name()]["miner"] > 1 then
|
||||||
if math.random(0, 20) == 1 then
|
-- if math.random(0, 20) == 1 then
|
||||||
xp.add_xp(player,10)
|
-- xp.add_xp(player,10)
|
||||||
end
|
-- end
|
||||||
end
|
-- end
|
||||||
end
|
-- end
|
||||||
minetest.node_dig(pos, node, player)
|
-- minetest.node_dig(pos, node, player)
|
||||||
end,
|
-- end,
|
||||||
})
|
--
|
||||||
|
--
|
||||||
|
-- })
|
||||||
|
|
||||||
local modpath = minetest.get_modpath("skills")
|
local modpath = minetest.get_modpath("skills")
|
||||||
|
|
||||||
|
@ -182,7 +182,34 @@ function xp.crafter_xp()
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function xp.miner_xp()
|
||||||
|
minetest.register_on_dignode(function(pos, oldnode, digger)
|
||||||
|
local miner_xp = minetest.registered_nodes[oldnode.name].miner_xp
|
||||||
|
local player = digger:get_player_name()
|
||||||
|
local player_lvls = skills.lvls[player]
|
||||||
|
if not miner_xp then
|
||||||
|
elseif miner_xp.rm then
|
||||||
|
if player_lvls then
|
||||||
|
xp.add_xp(digger, (player_lvls["miner"]-1))
|
||||||
|
|
||||||
|
end
|
||||||
|
elseif miner_xp.lvls then
|
||||||
|
if player_lvls and player_lvls["miner"] > 5 then
|
||||||
|
xp.add_xp(digger,xp.get_xp(xp.player_levels[player], 14))
|
||||||
|
end
|
||||||
|
elseif miner_xp.rnd then
|
||||||
|
if math.random(miner_xp.rnd) == miner_xp.rnd then
|
||||||
|
xp.add_xp(digger, miner_xp.xp)
|
||||||
|
end
|
||||||
|
elseif miner_xp.xp then
|
||||||
|
xp.add_xp(digger, miner_xp.xp)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
xp.miner_xp()
|
||||||
xp.crafter_xp()
|
xp.crafter_xp()
|
||||||
xp.explorer_xp()
|
xp.explorer_xp()
|
||||||
|
|
||||||
xp.load_xp()
|
xp.load_xp()
|
||||||
xp.load_levels()
|
xp.load_levels()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user