Add TA5 ex points feature for hyperloop tank and chest
This commit is contained in:
parent
9f645843ff
commit
6a1beeaaec
@ -365,7 +365,7 @@ minetest.register_node("techage:chest_ta4", {
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
hyperloop.after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||
end,
|
||||
ta4_formspec = hyperloop.WRENCH_MENU,
|
||||
ta5_formspec = {menu=hyperloop.WRENCH_MENU, ex_points=10},
|
||||
ta_after_formspec = hyperloop.after_formspec,
|
||||
allow_metadata_inventory_put = ta4_allow_metadata_inventory_put,
|
||||
allow_metadata_inventory_take = ta4_allow_metadata_inventory_take,
|
||||
|
@ -343,3 +343,32 @@ function techage.wrench_tooltip(x, y)
|
||||
"tooltip["..x..","..y..";0.5,0.5;"..tooltip..";#0C3D32;#FFFFFF]"
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Player TA5 Experience Points
|
||||
-------------------------------------------------------------------------------
|
||||
function techage.get_expoints(player)
|
||||
if player and player.get_meta then
|
||||
local meta = player:get_meta()
|
||||
if meta then
|
||||
return meta:get_int("techage_ex_points")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function techage.add_expoint(player)
|
||||
if player and player.get_meta then
|
||||
local meta = player:get_meta()
|
||||
if meta then
|
||||
meta:set_int("techage_ex_points", meta:get_int("techage_ex_points") + 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function techage.set_expoints(player, ex_points)
|
||||
if player and player.get_meta then
|
||||
local meta = player:get_meta()
|
||||
if meta then
|
||||
meta:set_int("techage_ex_points", ex_points)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -242,7 +242,7 @@ minetest.register_node("techage:ta4_tank", {
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
on_rightclick = on_rightclick,
|
||||
ta4_formspec = hyperloop.WRENCH_MENU,
|
||||
ta5_formspec = {menu=hyperloop.WRENCH_MENU, ex_points=20},
|
||||
ta_after_formspec = hyperloop.after_formspec,
|
||||
can_dig = can_dig,
|
||||
paramtype2 = "facedir",
|
||||
|
@ -149,7 +149,18 @@ local function settings_menu(pos, playername)
|
||||
local number = techage.get_node_number(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local ndef = minetest.registered_nodes[node.name]
|
||||
local form_def = ndef and (ndef.ta3_formspec or ndef.ta4_formspec)
|
||||
local form_def
|
||||
|
||||
if ndef then
|
||||
if ndef.ta3_formspec or ndef.ta4_formspec then
|
||||
form_def = ndef.ta3_formspec or ndef.ta4_formspec
|
||||
elseif ndef.ta5_formspec then
|
||||
local player = minetest.get_player_by_name(playername)
|
||||
if techage.get_expoints(player) >= ndef.ta5_formspec.ex_points then
|
||||
form_def = ndef.ta5_formspec.menu
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context[playername] = pos
|
||||
if form_def then
|
||||
|
Loading…
Reference in New Issue
Block a user