mirror of
https://github.com/tonytins/citylimits.git
synced 2025-03-15 12:21:22 +00:00
Removed some redundant code
- Change month and day within debug console - Removed get_week() in SimData
This commit is contained in:
parent
622eea364e
commit
ae1b600928
3 changed files with 19 additions and 7 deletions
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Add table
Reference in a new issue