[Broken] Removed news branding

- Ticker files are no longer baked into the game
- Removed secondary outlet
- News window uses outlet name from Json name
- Lowered maximum amount of news items
This commit is contained in:
Tony Bark 2022-08-08 18:29:56 -04:00
parent 40e68bb7e5
commit 5de5a0c315
7 changed files with 42 additions and 95 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -1,35 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/fnn.png-5c63f68777d5a929666ef2d1f774ecb5.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/ticker/fnn.png"
dest_files=[ "res://.import/fnn.png-5c63f68777d5a929666ef2d1f774ecb5.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View file

@ -2,6 +2,22 @@
With the exception of certain policies, the majority of the lore in City Limits comes from the news ticker. During regular gameplay (when there isn't any disasters or financial problems), the news ticker provides fictional turn of events that happen in the city, such as the Kitty Kibble shortage from SimCity 3000.
## Extra Lore
## Configuration
Additionally, I've added my own turn of events with the ``extra_lore.json`` file. Internally, this is known as "Caseyverse" and has a global node of the same name. That node is designed so the game can function without it through the use of the ``is_caseyverse()`` function (which checks for that json file, at the moment) and any future related functions that deal with events.
The news ticker is completely configurable. News can be added or removed from the game without having to touch the code. The configuration is stored in the `config.json` file.
```json
{
"outlet": "Pawprint Press",
"competing_outlet": "Citizen Telegram",
"ticker_files": [
"adverts.json",
"sammy.json",
"kittykibble.json",
"citylife.json",
"extra_lore.json"
]
}
```
The ``outlet`` is the city's news brand, the ``competing_outlet`` is part of the optional ``extra_lore.json`` file, and ```ticker_files``` is an array of filenames that contain the news itself.

View file

@ -1,11 +1,11 @@
{
"primary_outlet": "Pawprint Press",
"secondary_outlet": "FNN",
"outlet": "Pawprint Press",
"competing_outlet": "Citizen Telegram",
"ticker_files": [
"adverts.json",
"sammy.json",
"kittykibble.json",
"citylife.json"
"citylife.json",
"extra_lore.json"
]
}

View file

@ -22,7 +22,6 @@ 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"
Caseyverse="*res://scripts/autoload/caseyverse.gd"
JsonHelper="*res://scripts/autoload/jsonhelper.gd"
[display]

View file

@ -1,7 +1,6 @@
[gd_scene load_steps=46 format=2]
[gd_scene load_steps=45 format=2]
[ext_resource path="res://scenes/maps/MapOne.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/ticker/pawprint-logo.svg" type="Texture" id=2]
[ext_resource path="res://assets/symbols/fontawesome/population.svg" type="Texture" id=3]
[ext_resource path="res://scenes/windows/Advisor.tscn" type="PackedScene" id=4]
[ext_resource path="res://assets/ui/iccom.png" type="Texture" id=5]
@ -269,42 +268,24 @@ __meta__ = {
}
[node name="NewsWindow" type="WindowDialog" parent="Controls/Control Panel/Windows"]
visible = true
anchor_left = 0.0877193
anchor_top = 0.234496
anchor_right = 0.69883
anchor_bottom = 0.656977
anchor_bottom = 0.591085
window_title = "News"
__meta__ = {
"_edit_use_anchors_": true
}
[node name="News" type="ItemList" parent="Controls/Control Panel/Windows/NewsWindow"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = 53.0
[node name="Brand" type="HSplitContainer" parent="Controls/Control Panel/Windows/NewsWindow"]
anchor_left = 0.0175719
anchor_top = 0.0242718
anchor_right = 0.982428
anchor_bottom = 0.23301
anchor_left = 0.00797449
anchor_top = 0.0412844
anchor_right = 0.992026
anchor_bottom = 0.967889
__meta__ = {
"_edit_use_anchors_": true
}
[node name="NewsBrand" type="TextureRect" parent="Controls/Control Panel/Windows/NewsWindow/Brand"]
margin_right = 288.0
margin_bottom = 45.505
texture = ExtResource( 2 )
[node name="NewsMotto" type="Label" parent="Controls/Control Panel/Windows/NewsWindow/Brand"]
margin_left = 300.0
margin_top = 15.0
margin_right = 604.964
margin_bottom = 29.0
align = 2
valign = 1
[node name="Status" type="Panel" parent="Controls/Control Panel"]
anchor_top = 12.95
anchor_right = 25.65

View file

@ -2,13 +2,11 @@ extends Control
const TICKER_PATH = "res://json/ticker/"
const FNN_LOGO = "res://assets/ticker/fnn.png"
const META_FILE = "meta.json"
const CONFIG_FILE = "config.json"
onready var ticker_text = $Status/NewsBtn
onready var ticker_box = $Windows/NewsWindow/News
onready var ticker_window = $Windows/NewsWindow
onready var news_brand = $Windows/NewsWindow/Brand/NewsBrand
onready var news_motto = $Windows/NewsWindow/Brand/NewsMotto
var news_file: String = ""
var rng = RandomNumberGenerator.new()
@ -35,15 +33,8 @@ func _index_news():
randomize()
all_news.shuffle()
func _init():
json_files = JsonHelper.key_value(TICKER_PATH, META_FILE, "ticker_files")
func _ready():
if SimData.city_name == "Furtropolis" or "Furville":
news_brand.texture = load(FNN_LOGO)
if Caseyverse.is_caseyverse():
json_files.append("extra_lore.json")
func _ready():
ticker_window.window_title = JsonHelper.key_value(TICKER_PATH, CONFIG_FILE, "outlet")
_randomize_news(json_files)
@ -87,6 +78,9 @@ func _start_alert(message):
pass
func _randomize_news(files: Array):
if all_news == null:
json_files = JsonHelper.key_value(TICKER_PATH, CONFIG_FILE, "ticker_files")
for file in files:
news_file = str(TICKER_PATH + file)
_load_json()
@ -99,15 +93,11 @@ func _randomize_news(files: Array):
var news_range = rng.randi_range(0, all_news.size() - 1)
var news_text: String = all_news[news_range]
if Caseyverse.is_caseyverse():
news_text = news_text.replace("[competing_outlet]", JsonHelper.key_value(TICKER_PATH, META_FILE, "competing_outlet"))
if "[competing_outlet]" in news_text:
news_text = news_text.replace("[competing_outlet]", JsonHelper.key_value(TICKER_PATH, CONFIG_FILE, "competing_outlet"))
# If city name Furtropolis or Furville use Pawprint Press
if SimData.city_name != "Furtropolis" or "Furville":
news_text = news_text.replace("[outlet]", JsonHelper.key_value(TICKER_PATH, META_FILE, "secondary_outlet"))
else:
# FNN = Furtropolis/Furry News Network
news_text = news_text.replace("[outlet]", JsonHelper.key_value(TICKER_PATH, META_FILE, "primary_outlet"))
if "[outlet]" in news_text:
news_text = news_text.replace("[outlet]", JsonHelper.key_value(TICKER_PATH, CONFIG_FILE, "outlet"))
if "[species]" in news_text:
speices.shuffle()
@ -120,16 +110,12 @@ func _randomize_news(files: Array):
if "[mayor]" in news_text:
news_text = news_text.replace("[mayor]", SimData.mayor_name)
if ticker_box.items.size() > 15:
# Prevent stack overflaw
if ticker_box.items.size() > 10:
ticker_box.clear()
# Prevent duplicates
var prev_news_text = ticker_text.text
if news_text == prev_news_text:
_randomize_news(json_files)
else:
json_files.shuffle()
_add_news(news_text)
_randomize_news(json_files)
_add_news(news_text)
func _add_news(news_item):
ticker_text.text = news_item