Cleanup and revisions

pull/8/head
Jake Funke 2018-03-11 14:30:10 -07:00
parent 2644370a40
commit eed6e61199
2 changed files with 5 additions and 14 deletions

View File

@ -124,7 +124,7 @@ class Plant(object):
# Constructor
self.plant_id = str(uuid.uuid4())
self.life_stages = (3600*24, (3600*24)*3, (3600*24)*10, (3600*24)*20, (3600*24)*30)
# self.life_stages = (2, 4, 6, 8, 10)
# self.life_stages = (2, 4, 6, 8, 10) # debug mode
self.stage = 0
self.mutation = 0
self.species = random.randint(0,len(self.species_list)-1)
@ -142,7 +142,6 @@ class Plant(object):
# must water plant first day
self.watered_timestamp = int(time.time())-(24*3600)-1
self.watered_24h = False
# visitors are coming
self.visitors = []
def migrate_properties(self):
@ -290,7 +289,6 @@ class Plant(object):
# Should this reset to 1? Seems unfair.. for now generations will
# persist through death.
next_generation = self.generation
self.write_lock = True
self.kill_plant()
while self.write_lock:
@ -347,7 +345,6 @@ class DataManager(object):
savefile_path = os.path.join(botany_dir, savefile_name)
#set this.savefile_path to guest_garden path
garden_db_path = os.path.join(game_dir, 'sqlite/garden_db.sqlite')
garden_json_path = os.path.join(game_dir, 'garden_file.json')
harvest_file_path = os.path.join(botany_dir, 'harvest_file.dat')
@ -376,7 +373,6 @@ class DataManager(object):
death_check_thread = threading.Thread(target=self.death_check_update, args=(this_plant,))
death_check_thread.daemon = True
death_check_thread.start()
autosave_thread = threading.Thread(target=self.autosave, args=(this_plant,))
autosave_thread.daemon = True
autosave_thread.start()
@ -566,8 +562,7 @@ class DataManager(object):
json.dump(plant_info, outfile)
def harvest_plant(self, this_plant):
# TODO: could just use a sqlite query to retrieve all of user's dead
# plants
# TODO: plant history feature - could just use a sqlite query to retrieve all of user's dead plants
# harvest is a dict of dicts
# harvest contains one entry for each plant id

View File

@ -525,7 +525,6 @@ class CursedMenu(object):
conn = sqlite3.connect(garden_db_path)
c = conn.cursor()
c.execute("SELECT * FROM visitors WHERE garden_name = '{}' ORDER BY weekly_visits".format(self.plant.owner))
# if c.rowcount:
visitor_data = c.fetchall()
conn.close()
visitor_block = ""
@ -545,6 +544,7 @@ class CursedMenu(object):
return visitor_block
def get_user_string(self, xpos=3, ypos=15):
# doesn't allow non-alphanumeric text
user_string = ""
user_input = 0
while user_input != 10:
@ -572,7 +572,6 @@ class CursedMenu(object):
weekly_visitor_text = self.get_weekly_visitors()
self.draw_info_text("this week you've been visited by: ", 6)
self.draw_info_text(weekly_visitor_text, 7)
# user input section (can't get getstr to work)
guest_garden = self.get_user_string()
if not guest_garden:
self.clear_info_pane()
@ -626,11 +625,8 @@ class CursedMenu(object):
try:
self.visit_handler()
except Exception as exception:
print exception;
traceback.print_exc()
# self.screen.refresh()
self.screen.refresh()
# traceback.print_exc()
if request == "garden":
try:
self.draw_garden()