aboutsummaryrefslogtreecommitdiff
path: root/game/src/CreditsMenu/CreditsMenu.gd
diff options
context:
space:
mode:
author Spartan322 <Megacake1234@gmail.com>2023-04-28 10:22:15 +0200
committer Spartan322 <Megacake1234@gmail.com>2023-04-28 10:22:15 +0200
commita52c2b828ad5ade0c2e3d61f687951b25a727c88 (patch)
treec2a5c68798e3522620f4a1bfbe6718803eacdea4 /game/src/CreditsMenu/CreditsMenu.gd
parent10053cf259c55ee45803268a844edf1011d8a16b (diff)
Add some license conformance for Godot
Add License Attribution for OpenVic2, Godot, FreeType, ENet, and mbed TLS in credits with redirect links to licenses Add contributor and donor list for Godot to credits Add link button for Godot, redirects to https://godotengine.org
Diffstat (limited to 'game/src/CreditsMenu/CreditsMenu.gd')
-rw-r--r--game/src/CreditsMenu/CreditsMenu.gd74
1 files changed, 74 insertions, 0 deletions
diff --git a/game/src/CreditsMenu/CreditsMenu.gd b/game/src/CreditsMenu/CreditsMenu.gd
index 52c1711..0e9df6b 100644
--- a/game/src/CreditsMenu/CreditsMenu.gd
+++ b/game/src/CreditsMenu/CreditsMenu.gd
@@ -17,6 +17,9 @@ signal back_button_pressed
@export_file("*.csv")
var core_credits_path : String
+@export
+var godot_engine_scene : PackedScene
+
@export_group("Label Variants", "label_variants_")
@export
var label_variants_project : StringName
@@ -114,10 +117,81 @@ func _add_project_credits(project : Dictionary) -> void:
credits_list.add_child(project_credits_list)
+func _add_godot_credits() -> void:
+ var godot_credits_list = VBoxContainer.new()
+ godot_credits_list.name = 'CreditsGodot'
+ var godot_engine = godot_engine_scene.instantiate()
+ godot_credits_list.add_child(godot_engine)
+ godot_credits_list.add_child(HSeparator.new())
+
+ var author_dict := Engine.get_author_info()
+ _add_label(godot_credits_list, "Contributors", label_variants_role)
+
+ for role in author_dict:
+ var role_parent = VBoxContainer.new()
+
+ for person in author_dict[role]:
+ _add_label(role_parent, person, label_variants_person)
+
+ _add_label(godot_credits_list, role.replace("_", " ").capitalize(), label_variants_role)
+ godot_credits_list.add_child(role_parent)
+ godot_credits_list.add_child(HSeparator.new())
+
+ var donor_dict := Engine.get_donor_info()
+ _add_label(godot_credits_list, "Donors", label_variants_role)
+
+ for role in donor_dict:
+ if donor_dict[role].size() == 0 or donor_dict[role][0].begins_with("None"): continue
+ var role_parent = VBoxContainer.new()
+
+ for person in donor_dict[role]:
+ _add_label(role_parent, person, label_variants_person)
+
+ _add_label(godot_credits_list, role.replace("_", " ").capitalize(), label_variants_role)
+ godot_credits_list.add_child(role_parent)
+ godot_credits_list.add_child(HSeparator.new())
+
+ credits_list.add_child(godot_credits_list)
+
+func _add_link_button(node : Node, text : String, url: String, type_variation : StringName) -> void:
+ var button := LinkButton.new()
+ button.name = 'LinkButton' + text
+ button.text = text
+ button.uri = url
+ button.size_flags_horizontal = SIZE_SHRINK_CENTER
+ button.theme_type_variation = type_variation
+ node.add_child(button)
+
+func _add_licenses() -> void:
+ var license_list = VBoxContainer.new()
+ license_list.name = 'Licenses'
+ _add_label(license_list, "Third-Party Licenses", label_variants_project)
+ license_list.add_child(HSeparator.new())
+
+ var license_info := {
+ "OpenVic2": ["GPLv3", "https://github.com/OpenVic2Project/OpenVic2/blob/main/LICENSE.md"],
+ "Godot": ["MIT", "https://github.com/godotengine/godot/blob/master/LICENSE.txt"],
+ "FreeType": ["FreeType License", "https://gitlab.freedesktop.org/freetype/freetype/-/blob/master/docs/FTL.TXT"],
+ "ENet": ["MIT", "http://enet.bespin.org/License.html"],
+ "mbed TLS": ["APLv2", "https://github.com/Mbed-TLS/mbedtls/blob/development/LICENSE"]
+ }
+ # Add additional licenses required for attribution here
+ # These licenses should also either be displayed or exported alongside this project
+
+ for project in license_info:
+ _add_label(license_list, project, label_variants_role)
+ _add_link_button(license_list, license_info[project][0], license_info[project][1], label_variants_person)
+ license_list.add_child(HSeparator.new())
+
+ credits_list.add_child(license_list)
+
+
# REQUIREMENTS:
# * SS-17
func _ready():
_add_project_credits(_load_credit_file(core_credits_path))
+ _add_godot_credits()
+ _add_licenses()
# REQUIREMENTS:
# * UI-38