diff --git a/basic_machines/chest.lua b/basic_machines/chest.lua index 8748a82..310f476 100644 --- a/basic_machines/chest.lua +++ b/basic_machines/chest.lua @@ -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, diff --git a/basis/lib.lua b/basis/lib.lua index fda1525..9d9a319 100644 --- a/basis/lib.lua +++ b/basis/lib.lua @@ -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 diff --git a/liquids/tank.lua b/liquids/tank.lua index 7c92919..58996fb 100644 --- a/liquids/tank.lua +++ b/liquids/tank.lua @@ -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", diff --git a/tools/repairkit.lua b/tools/repairkit.lua index 5ea2092..7b09757 100644 --- a/tools/repairkit.lua +++ b/tools/repairkit.lua @@ -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