diff --git a/scripts/autoload/sim_data.gd b/scripts/autoload/sim_data.gd index ca602f8..be2b550 100644 --- a/scripts/autoload/sim_data.gd +++ b/scripts/autoload/sim_data.gd @@ -14,6 +14,7 @@ var month: int = 1 var prev_month: int var day: int = 1 var prev_day: int +var last_total_days: int var total_days: int = 1 var power_grid: int # Number of power stations in the area. Helps provide redundancies. @@ -79,9 +80,6 @@ enum Ordinances { TIRE_RECYCLE } -func get_week(): - return (10 + total_days - day) / 7 - #func starting_budget(lev = Level.EASY): # match lev: # Level.EASY: diff --git a/scripts/command_handler.gd b/scripts/command_handler.gd index 6de481e..5cc718c 100644 --- a/scripts/command_handler.gd +++ b/scripts/command_handler.gd @@ -11,9 +11,17 @@ const valid_commands = [ ["money", [ARG_STRING] ], ["whereyoufrom", [ARG_STRING] ], ["whatyearisit", [ARG_STRING] ], - ["show_policy", [ARG_INT]] + ["show_policy", [ARG_INT]], + ["set_month", [ARG_INT]], + ["set_year", [ARG_INT]] ] +func set_month(month): + SimData.month = month + +func set_year(year): + SimData.year = year + func show_policy(policy): SimEvents.emit_signal("policy_message", policy) diff --git a/scripts/game.gd b/scripts/game.gd index d4e01de..9e508eb 100644 --- a/scripts/game.gd +++ b/scripts/game.gd @@ -17,23 +17,29 @@ func _resume_rotation(): func _on_DayCycle_timeout(): + if SimData.prev_month < 12: + SimData.last_total_days = SimData.total_days + SimData.total_days += 1 + + # Increment the number days until it reaches 30 if SimData.prev_day < 30: - SimData.prev_day = SimData.day SimData.day += 1 + # Reset the number of days to 1 on day 30 and increment the month if SimData.prev_day == 30: - SimData.prev_day = SimData.day SimData.day = 1 SimData.prev_month = SimData.month SimData.month += 1 SimEvents.emit_signal("budget") - + + # Increment the year on the 12th month if SimData.prev_month == 12: SimData.prev_year = SimData.year SimData.total_days = 1 SimData.month = 1 SimData.year += 1 + SimData.last_total_days = SimData.total_days SimData.prev_day = SimData.day func _on_TurtleBtn_toggled(button_pressed):