diff --git a/dialog/advisors/cityplanner.json b/json/advisors/cityplanner.json similarity index 100% rename from dialog/advisors/cityplanner.json rename to json/advisors/cityplanner.json diff --git a/dialog/advisors/finacial.json b/json/advisors/finacial.json similarity index 100% rename from dialog/advisors/finacial.json rename to json/advisors/finacial.json diff --git a/dialog/advisors/transport.json b/json/advisors/transport.json similarity index 100% rename from dialog/advisors/transport.json rename to json/advisors/transport.json diff --git a/dialog/policies/cityplanner_analysis.json b/json/policies/cityplanner_analysis.json similarity index 100% rename from dialog/policies/cityplanner_analysis.json rename to json/policies/cityplanner_analysis.json diff --git a/dialog/policies/proposels.json b/json/policies/proposels.json similarity index 100% rename from dialog/policies/proposels.json rename to json/policies/proposels.json diff --git a/json/ticker/adverts.json b/json/ticker/adverts.json new file mode 100644 index 0000000..3f22894 --- /dev/null +++ b/json/ticker/adverts.json @@ -0,0 +1,10 @@ +{ + "ticker": [ + "[outlet]: Don't Blame Us If You're Not Paying Attention", + "[outlet]: Information With As Few Words As Possible.", + "This Space For Rent.", + "[outlet]: Properly Spelled Words From Beginning To End.", + "[outlet]: Journalistic Integrity Without All The Advertising.", + "[outlet]: No Advertisements Since Before The Beginning." + ] +} \ No newline at end of file diff --git a/json/ticker/citylife.json b/json/ticker/citylife.json new file mode 100644 index 0000000..9149490 --- /dev/null +++ b/json/ticker/citylife.json @@ -0,0 +1,17 @@ +{ + "ticker": [ + "50 Car Pile-Up Results In New City Sculpture.", + "After 36 Years Of Marriage, Man Discovers Wife Is Actually A Rare Yucca Plant.", + "All Raccoons Cheat At Poker, Researchers Say.", + "Cat Hijacks Municipal Bus; Riders Applaud Good Timing At Stops And Courteous Meows.", + "Tommy B. Saif Sez: No Left Turn, Except Buses.", + "Truckload Of Apples Overturns, [city] Diner Offers Applesauce Special.", + "Ordinary Days In [city] Become Common.", + "Semicolon Declared Sexier Than Comma At Grammarian's Fete.", + "Spotted Owl Spotted.", + "Crime Lord Spotted In [city]; Mayor Says \"No Comment\".", + "Cat Burglar Spotted, Mistaken For Dalmatian.", + "Local citizens confused about New Spark Box Pro XL Series U.", + "Customers of the New Spark Box Pro XL Series U confirm that it has Knuckles." + ] +} \ No newline at end of file diff --git a/json/ticker/international.json b/json/ticker/international.json new file mode 100644 index 0000000..680607f --- /dev/null +++ b/json/ticker/international.json @@ -0,0 +1,5 @@ +{ + "ticker": [ + "Astronomer Warns of Physics Experiment That Could Destroy Our Entire Galaxy" + ] +} \ No newline at end of file diff --git a/json/ticker/kittykibble.json b/json/ticker/kittykibble.json new file mode 100644 index 0000000..5cd0190 --- /dev/null +++ b/json/ticker/kittykibble.json @@ -0,0 +1,11 @@ +{ + "ticker": [ + "Local Merchants Puzzled By Rumors Of Kitty Kibble Shortage; \"We Have Plenty,\" Say Most.", + "No Kitty Kibble Shortage Says Local Representative Of Kitty Kibble Association.", + "Rumors Persist In Kitty Kibble Shortage; Unfounded Say Many.", + "Cats Say Not Enough Being Done In Kitty Kibble Shortage.", + "Cats Concerned By Rumors Of Kitty Kibble Shortage; Buy In Bulk.", + "Is Kitty Kibble Shortage A Hoax? Cats Search For Truth.", + "Enough Kitty Kibble For Twenty Years, Experts Agree." + ] +} \ No newline at end of file diff --git a/json/ticker/sammy.json b/json/ticker/sammy.json new file mode 100644 index 0000000..21c269b --- /dev/null +++ b/json/ticker/sammy.json @@ -0,0 +1,8 @@ +{ + "ticker": [ + "From The Desk Of Wise Guy Sammy: One Word In This Ticker Is Mispelled.", + "From The Desk Of Wise Guy Sammy: One Word In This Ticker Is Sdrawkcab (Backwards).", + "From The Desk Of Wise Guy Sammy: It Is Easier To Get Forgiveness Than Permission.", + "From The Desk Of Wise Guy Sammy: You Can't Outwait A Bureaucracy." + ] +} \ No newline at end of file diff --git a/dialog/ticker/ticker.json b/json/ticker/ticker.json similarity index 98% rename from dialog/ticker/ticker.json rename to json/ticker/ticker.json index 5baa469..2134d2e 100644 --- a/dialog/ticker/ticker.json +++ b/json/ticker/ticker.json @@ -132,7 +132,7 @@ "text": "[species] Discovers Picayune Newspaper Lying on the Ground; Throws It Away." }, "55": { - "text": "Local [species] Bill Flopsby Heads County Commission On Snuggles And Hugs." + "text": "Local citizen, Bill Flopsby Heads County Commission On Snuggles And Hugs." }, "56": { "text": "[species] Offers To Let City Bus Run Him Over For Lifetime Salad Bar Privileges." diff --git a/dialog/ticker/ticker_alerts.json b/json/ticker/ticker_alerts.json similarity index 100% rename from dialog/ticker/ticker_alerts.json rename to json/ticker/ticker_alerts.json diff --git a/json/zones/tower_names.json b/json/zones/tower_names.json new file mode 100644 index 0000000..cca5c32 --- /dev/null +++ b/json/zones/tower_names.json @@ -0,0 +1,5 @@ +{ + "tower_names": [ + {} + ] +} \ No newline at end of file diff --git a/project.godot b/project.godot index ec76d78..64623cd 100644 --- a/project.godot +++ b/project.godot @@ -25,6 +25,7 @@ config/windows_native_icon="res://icon.ico" SimData="*res://scripts/autoload/sim_data.gd" SimEvents="*res://scripts/autoload/sim_events.gd" SimTime="*res://scripts/autoload/sim_time.gd" +ZoneData="*res://scripts/autoload/zone_data.gd" [display] diff --git a/scripts/advisor_window.gd b/scripts/advisor_window.gd index e3b533a..fb36861 100644 --- a/scripts/advisor_window.gd +++ b/scripts/advisor_window.gd @@ -29,9 +29,9 @@ func _init_advisor(file, advisor): SimData.Advisors.CITY_PLANNER: match file: JsonFile.ANNOUNCEMENTS: - dialogue_file = "res://dialog/advisors/cityplanner.json" + dialogue_file = "res://json/advisors/cityplanner.json" JsonFile.ANALYSIS: - dialogue_file = "res://dialog/policies/cityplanner_analysis.json" + dialogue_file = "res://json/policies/cityplanner_analysis.json" avatar_texture.texture = preload("res://sprites/avatars/cindy.png") name_label.text = "Cindy Diamond" @@ -40,9 +40,9 @@ func _init_advisor(file, advisor): SimData.Advisors.FINANCIAL: match file: JsonFile.ANNOUNCEMENTS: - dialogue_file = "res://dialog/advisors/finacial.json" + dialogue_file = "res://json/advisors/finacial.json" JsonFile.ANALYSIS: - dialogue_file = "res://dialog/policies/finacial_analysis.json" + dialogue_file = "res://json/policies/finacial_analysis.json" avatar_texture.texture = preload("res://sprites/avatars/kit.png") name_label.text = "Kit Welsh" @@ -51,9 +51,9 @@ func _init_advisor(file, advisor): SimData.Advisors.TRANSPORT: match file: JsonFile.ANNOUNCEMENTS: - dialogue_file = "res://dialog/advisors/transport.json" + dialogue_file = "res://json/advisors/transport.json" JsonFile.ANALYSIS: - dialogue_file = "res://dialog/policies/transport_analysis.json" + dialogue_file = "res://json/policies/transport_analysis.json" avatar_texture.texture = preload("res://sprites/avatars/zc.png") name_label.text = "Zack Casey" diff --git a/scripts/autoload/power_grid.gd b/scripts/autoload/power_grid.gd new file mode 100644 index 0000000..9af894b --- /dev/null +++ b/scripts/autoload/power_grid.gd @@ -0,0 +1,7 @@ +extends Node + +var power_grid: int # Number of power stations in the area. Helps provide redundancies. +var power_capacity: int +var current_power_cap: int +var prev_power_cap: int +var has_power: bool diff --git a/scripts/autoload/sim_data.gd b/scripts/autoload/sim_data.gd index f77974b..e42dfd1 100644 --- a/scripts/autoload/sim_data.gd +++ b/scripts/autoload/sim_data.gd @@ -14,18 +14,6 @@ var current_power_cap: int var prev_power_cap: int var has_power: bool -var res_tax: int = 1 -var comm_tax: int = 1 -var indust_tax: int = 1 - -var res_income: int -var comm_income: int -var ind_income: int - -var fire_tax: int -var police_tax: int -var power_tax: int - var ticker_files: Array = [ "adverts.json", "sammy.json" diff --git a/scripts/autoload/zone_data.gd b/scripts/autoload/zone_data.gd new file mode 100644 index 0000000..ddf30e5 --- /dev/null +++ b/scripts/autoload/zone_data.gd @@ -0,0 +1,13 @@ +extends Node + +var res_tax: int = 1 +var comm_tax: int = 1 +var indust_tax: int = 1 + +var res_income: int +var comm_income: int +var ind_income: int + +var fire_tax: int +var police_tax: int +var power_tax: int diff --git a/scripts/tax_window.gd b/scripts/tax_window.gd index 9587407..3843f20 100644 --- a/scripts/tax_window.gd +++ b/scripts/tax_window.gd @@ -11,32 +11,32 @@ onready var ind_rate = $PrecentCtr/IndPctLbl onready var annual_income = $IncomeCtr/IcnomeLbl func _ready(): - if SimData.res_tax >= 0: - res_slider.value = SimData.res_tax - res_rate.text = str(SimData.res_tax) + "%" + if ZoneData.res_tax >= 0: + res_slider.value = ZoneData.res_tax + res_rate.text = str(ZoneData.res_tax) + "%" - if SimData.res_tax >= 0: - com_slider.value = SimData.comm_tax - com_rate.text = str(SimData.comm_tax) + "%" + if ZoneData.res_tax >= 0: + com_slider.value = ZoneData.comm_tax + com_rate.text = str(ZoneData.comm_tax) + "%" - if SimData.indust_tax >= 0: - ind_slider.value = SimData.indust_tax - ind_rate.text = str(SimData.indust_tax) + "%" + if ZoneData.indust_tax >= 0: + ind_slider.value = ZoneData.indust_tax + ind_rate.text = str(ZoneData.indust_tax) + "%" func _process(delta): - var total_income = int(SimData.res_income + SimData.comm_income + SimData.ind_income) + var total_income = int(ZoneData.res_income + ZoneData.comm_income + ZoneData.ind_income) - if SimData.prev_month < SimData.month and total_income > 1: + if SimTime.prev_month < SimTime.month and total_income > 1: annual_income.text = str(total_income) + "/mo" func _on_ResSlider_value_changed(value): - SimData.res_tax = int(value) + ZoneData.res_tax = int(value) res_rate.text = str(value) + "%" func _on_ComSlider_value_changed(value): - SimData.comm_tax = int(value) + ZoneData.comm_tax = int(value) com_rate.text = str(value) + "%" func _on_IndSlider_value_changed(value): - SimData.indust_tax = int(value) + ZoneData.indust_tax = int(value) ind_rate.text = str(value) + "%" diff --git a/scripts/ticker.gd b/scripts/ticker.gd index 1221670..cb1e653 100644 --- a/scripts/ticker.gd +++ b/scripts/ticker.gd @@ -2,76 +2,110 @@ extends ColorRect onready var ticker_text = $TickerTxt -var news_file = "" +const ticker_path = "res://json/ticker/" + +var news_file: String = "" var rng = RandomNumberGenerator.new() -var news_keys = [] +var all_news = [] var speices = [ "Cat", "Fennec", "Fox" ] +var json_files = [ + "adverts.json", + # "sammy.json" +] func _index_news(): - var news = _load_news() - news_keys.clear() - - for key in news: - news_keys.append(news[key]) + var news = _load_json() + all_news.clear() + all_news = news["ticker"] randomize() - news_keys.shuffle() + all_news.shuffle() + +func _process(delta): + var prev_json_Files = json_files + + var city_life = [ + "citylife.json", + "kittykibble.json" + ] + + if _array_check(city_life, json_files): + match SimData.has_power: + true: + prev_json_Files = json_files + for files in city_life: + json_files.append(files) + + false: + prev_json_Files = json_files + for files in city_life: + json_files.append(files) + +func _array_check(list1, list2): + for item in list1: + if item in list2: + return true + + return false -func _load_news(): +func _load_json(): var file = File.new() if file.file_exists(news_file): file.open(news_file, file.READ) - var dialogue = parse_json(file.get_as_text()) - return dialogue - + var result = parse_json(file.get_as_text()) + return result + func _ready(): SimData.city_name = SimData.city_name.capitalize() SimData.mayor_name = SimData.mayor_name.capitalize() SimEvents.connect("send_alert", self, "_start_alert") SimEvents.connect("resume_news", self, "_resume_ticker") - _random_news("res://dialog/ticker/ticker.json") + _random_news(json_files) func _start_alert(message): SimData.on_alert = true - news_file = "res://dialog/ticker/ticker_alerts.json" - ticker_text.text = news_keys[message].text + news_file = str(ticker_path + "ticker_alerts.json") + ticker_text = all_news -func _random_news(file): - news_file = file +func _random_news(files: Array): + for file in files: + news_file = str(ticker_path + file) + _load_json() + _index_news() rng.randomize() - _load_news() - _index_news() + randomize() + all_news.shuffle() - var max_mange = news_keys.size() - 1 - var ticker_range = rng.randi_range(0, max_mange) - var news = news_keys[ticker_range].text + var news_range = rng.randi_range(0, all_news.size() - 1) + var news_text: String = all_news[news_range] - if SimData.has_ctower or SimData.city_name == "Furtropolis" or "Furville" and "[outlet]" in news: + if SimData.has_ctower or SimData.city_name == "Furtropolis" or "Furville" and "[outlet]" in news_text: # FNN = Furtropolis/Furry News Network - news = news.replace("[outlet]", "FNN") - elif "[outlet]" in news: - news = news.replace("[outlet]", "Pawprint Press") - - if "[species]" in news: + news_text.replace("[outlet]", "FNN") + else: + news_text.replace("[outlet]", "Pawprint Press") + + if "[species]" in news_text: randomize() speices.shuffle() - news = news.replace("[species]", speices[rng.randi()%speices.size()]) + var speices_range = rng.randi_range(speices.size() - 1) + news_text.replace("[species]", speices[speices_range]) + + if "[city]" in news_text: + news_text.replace("[city]", SimData.city_name) + + if "[mayor]" in news_text: + news_text.replace("[mayor]", SimData.mayor_name) - if "[city]" in news: - news = news.replace("[city]", SimData.city_name) - - if "[mayor]" in news: - news = news.replace("[mayor]", SimData.mayor_name) - - ticker_text.text = news + ticker_text.text = news_text func _resume_ticker(): - _random_news("res://dialog/ticker/ticker.json") + _random_news(json_files) func _on_RotateNews_timeout(): - _random_news("res://dialog/ticker/ticker.json") + _random_news(json_files)