Guest User

Untitled

a guest
Apr 3rd, 2016
71
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- check a solution placed by player (checker node at pos) and give prizes if correct
  2. local function check_solution(pos, player)
  3. local meta = minetest.get_meta(pos)
  4. local sol = meta:get_string('solution')
  5. if node_is_spec_digit({x=pos.x, y=pos.y+1, z=pos.z}, sol) then
  6. if meta:get_string('b_saytext') == 'true' then
  7. minetest.chat_send_player(player:get_player_name(), meta:get_string('s_saytext'))
  8. end
  9. if meta:get_string('b_dispense') == 'true' then
  10. minetest.add_item({x=pos.x, y=pos.y+2, z=pos.z}, meta:get_inventory():get_list('dispense')[1])
  11.  
  12. end
  13.  
  14. -- make solution node indestructible by students
  15. minetest.set_node({x=pos.x, y=pos.y, z=pos.z}, {name="teaching:lab"})
  16. end
  17. end
RAW Paste Data