kaadmy / pixture

A Minetest subgame geared towards minimalist survival
http://www.minetest.net
Other
33 stars 7 forks source link

Achievements broken #35

Closed asl97 closed 8 years ago

asl97 commented 8 years ago
Issues:
  1. Achievements doesn't persist
  2. Error when opening Achievements menu when player haven't achieve any yet
cause:
  1. https://github.com/kaadmy/pixture/commit/7f6b73246d7524d34f7c800edd51b6cef0cd227c
  2. https://github.com/kaadmy/pixture/commit/1a69d651b69dd1a4e91f8fd759b9c58af8d60611
reason:
  1. The achievements file isn't loaded when starting. This was hidden in the past because it get reloaded every time a player join the server.
  2. The achievement table doesn't contain the player and thus it error when it try to index nil at line 152. This was hidden in the past because
    1. When a player join, the "First join" achievement initialize the player table
    2. The "like_clockwork" trigger cover the problem when the "First join" achievement was removed even though the achievement itself doesn't exists.
solution:
  1. Add load_achievements() at the end of the file
  2. Add an minetest.register_on_newplayer to initialize the player table
kaadmy commented 8 years ago

Nice catch, I removed on_joinplayer because I didn't see that it also loaded achievements :)