diff --git a/addons/godotsteam/androidarm64/libgodotsteam.android.template_debug.arm64.so b/addons/godotsteam/androidarm64/libgodotsteam.android.template_debug.arm64.so new file mode 100644 index 0000000..21679d6 Binary files /dev/null and b/addons/godotsteam/androidarm64/libgodotsteam.android.template_debug.arm64.so differ diff --git a/addons/godotsteam/androidarm64/libgodotsteam.android.template_release.arm64.so b/addons/godotsteam/androidarm64/libgodotsteam.android.template_release.arm64.so new file mode 100644 index 0000000..4c58005 Binary files /dev/null and b/addons/godotsteam/androidarm64/libgodotsteam.android.template_release.arm64.so differ diff --git a/addons/godotsteam/androidarm64/libsteam_api.so b/addons/godotsteam/androidarm64/libsteam_api.so new file mode 100644 index 0000000..4c0bd94 Binary files /dev/null and b/addons/godotsteam/androidarm64/libsteam_api.so differ diff --git a/addons/godotsteam/editor/steamworks_panel.gd b/addons/godotsteam/editor/steamworks_panel.gd new file mode 100644 index 0000000..a43b78b --- /dev/null +++ b/addons/godotsteam/editor/steamworks_panel.gd @@ -0,0 +1,8 @@ +@tool +extends Control + +@onready var container_frame: VBoxContainer = %ContainerFrame + + +func add_companion_dock(companion_dock: Control) -> void: + container_frame.add_child(companion_dock) diff --git a/addons/godotsteam/editor/steamworks_panel.gd.uid b/addons/godotsteam/editor/steamworks_panel.gd.uid new file mode 100644 index 0000000..fa8bce3 --- /dev/null +++ b/addons/godotsteam/editor/steamworks_panel.gd.uid @@ -0,0 +1 @@ +uid://1oo0gvamoxgp diff --git a/addons/godotsteam/editor/steamworks_panel.tscn b/addons/godotsteam/editor/steamworks_panel.tscn new file mode 100644 index 0000000..fdaf9c1 --- /dev/null +++ b/addons/godotsteam/editor/steamworks_panel.tscn @@ -0,0 +1,125 @@ +[gd_scene load_steps=6 format=3 uid="uid://cyniebd6yahu5"] + +[ext_resource type="Script" uid="uid://1oo0gvamoxgp" path="res://addons/godotsteam/editor/steamworks_panel.gd" id="1_qn6cd"] +[ext_resource type="Script" uid="uid://b4nvgu7h84u53" path="res://addons/godotsteam/editor/updates/updates.gd" id="2_qn6cd"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_qn6cd"] +content_margin_top = 2.0 +content_margin_bottom = 2.0 +bg_color = Color(0.0980392, 0.0980392, 0.0980392, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_qf1vo"] +content_margin_top = 2.0 +content_margin_bottom = 2.0 +bg_color = Color(0.337255, 0.619608, 1, 1) + +[sub_resource type="Theme" id="Theme_sqmbs"] +ProgressBar/styles/background = SubResource("StyleBoxFlat_qn6cd") +ProgressBar/styles/fill = SubResource("StyleBoxFlat_qf1vo") + +[node name="Steamworks" type="Control"] +process_mode = 3 +custom_minimum_size = Vector2(0, 150) +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_qn6cd") +metadata/_edit_lock_ = true + +[node name="Scroller" type="ScrollContainer" parent="."] +custom_minimum_size = Vector2(0, 150) +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +metadata/_edit_lock_ = true + +[node name="DockFrame" type="TabContainer" parent="Scroller"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +current_tab = 0 +metadata/_edit_lock_ = true + +[node name="Updates" type="MarginContainer" parent="Scroller/DockFrame"] +unique_name_in_owner = true +layout_mode = 2 +theme_override_constants/margin_left = 10 +theme_override_constants/margin_top = 10 +theme_override_constants/margin_right = 10 +theme_override_constants/margin_bottom = 10 +script = ExtResource("2_qn6cd") +metadata/_tab_index = 0 +metadata/_edit_lock_ = true + +[node name="ContainerFrame" type="VBoxContainer" parent="Scroller/DockFrame/Updates"] +unique_name_in_owner = true +layout_mode = 2 +theme_override_constants/separation = 10 +metadata/_edit_lock_ = true + +[node name="HFrame" type="HBoxContainer" parent="Scroller/DockFrame/Updates/ContainerFrame"] +layout_mode = 2 +theme_override_constants/separation = 25 +metadata/_edit_lock_ = true + +[node name="Type" type="Label" parent="Scroller/DockFrame/Updates/ContainerFrame/HFrame"] +custom_minimum_size = Vector2(125, 25) +layout_mode = 2 +text = "GodotSteam" +metadata/_edit_lock_ = true + +[node name="InstalledLabel" type="Label" parent="Scroller/DockFrame/Updates/ContainerFrame/HFrame"] +unique_name_in_owner = true +layout_mode = 2 +text = "Installed version 4.18" +metadata/_edit_lock_ = true + +[node name="UpdateLabel" type="Label" parent="Scroller/DockFrame/Updates/ContainerFrame/HFrame"] +unique_name_in_owner = true +layout_mode = 2 +metadata/_edit_lock_ = true + +[node name="Updating" type="HBoxContainer" parent="Scroller/DockFrame/Updates/ContainerFrame/HFrame"] +layout_mode = 2 +size_flags_horizontal = 10 +theme_override_constants/separation = 25 +metadata/_edit_lock_ = true + +[node name="Downloading" type="ProgressBar" parent="Scroller/DockFrame/Updates/ContainerFrame/HFrame/Updating"] +unique_name_in_owner = true +visible = false +custom_minimum_size = Vector2(200, 30) +layout_mode = 2 +theme = SubResource("Theme_sqmbs") +step = 1.0 +rounded = true +metadata/_edit_lock_ = true + +[node name="InstallButton" type="Button" parent="Scroller/DockFrame/Updates/ContainerFrame/HFrame/Updating"] +unique_name_in_owner = true +visible = false +layout_mode = 2 +text = "Install" +metadata/_edit_lock_ = true + +[node name="UpdateButton" type="Button" parent="Scroller/DockFrame/Updates/ContainerFrame/HFrame/Updating"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 8 +disabled = true +text = "Up-to-date" +metadata/_edit_lock_ = true + +[node name="CancelButton" type="Button" parent="Scroller/DockFrame/Updates/ContainerFrame/HFrame/Updating"] +unique_name_in_owner = true +visible = false +layout_mode = 2 +text = "Cancel" +metadata/_edit_lock_ = true diff --git a/addons/godotsteam/editor/ui/steam.svg b/addons/godotsteam/editor/ui/steam.svg new file mode 100644 index 0000000..f3daeb9 --- /dev/null +++ b/addons/godotsteam/editor/ui/steam.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addons/godotsteam/editor/ui/steam.svg.import b/addons/godotsteam/editor/ui/steam.svg.import new file mode 100644 index 0000000..5a52b8c --- /dev/null +++ b/addons/godotsteam/editor/ui/steam.svg.import @@ -0,0 +1,43 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dhn3vkdxvetbn" +path="res://.godot/imported/steam.svg-1c1b1c87b286630e8735047e7af015ac.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://addons/godotsteam/editor/ui/steam.svg" +dest_files=["res://.godot/imported/steam.svg-1c1b1c87b286630e8735047e7af015ac.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/addons/godotsteam/editor/updates/confirmation.gd b/addons/godotsteam/editor/updates/confirmation.gd new file mode 100644 index 0000000..42bab81 --- /dev/null +++ b/addons/godotsteam/editor/updates/confirmation.gd @@ -0,0 +1,59 @@ +@tool +extends ConfirmationDialog + +signal cancel_update +signal continue_update + +@onready var cancel_button: Button = %Cancel +@onready var continue_button: Button = %Continue +@onready var downloading: ProgressBar = %Downloading +@onready var message: Label = %Message +@onready var version_title: Label = %VersionTitle + + +func _ready() -> void: + connect_signals() + set_defaults() + + +#region Setup +func set_defaults() -> void: + size = Vector2(450, 330) + get_ok_button().visible = false + get_cancel_button().visible = false +#endregion + + +#region Signals +func connect_signals() -> void: + cancel_button.pressed.connect(_on_cancel_pressed) + continue_button.pressed.connect(_on_continue_pressed) + + +func _on_cancel_pressed() -> void: + cancel_update.emit() + queue_free() + + +func _on_continue_pressed() -> void: + continue_update.emit() +#endregion + + +#region Updating text +func update_interface(version_string: String, is_downloader: bool) -> void: + if not is_node_ready(): await ready + cancel_button.visible = true + continue_button.visible = not is_downloader + downloading.visible = is_downloader + if is_downloader: + message.text = "You are downloading the update, please wait. Closing this window will cancel the update." + version_title.text = "Downloading GodotSteam %s" % version_string + else: + message.text = "You are about to update plug-in version to %s. The editor will restart at the end of this process." % version_string + version_title.text = "Update To GodotSteam %s" % version_string + + +func update_progress(new_percentage: int) -> void: + downloading.value = new_percentage +#endregion diff --git a/addons/godotsteam/editor/updates/confirmation.gd.uid b/addons/godotsteam/editor/updates/confirmation.gd.uid new file mode 100644 index 0000000..34d6b0d --- /dev/null +++ b/addons/godotsteam/editor/updates/confirmation.gd.uid @@ -0,0 +1 @@ +uid://bjb747gou4fbo diff --git a/addons/godotsteam/editor/updates/confirmation.tscn b/addons/godotsteam/editor/updates/confirmation.tscn new file mode 100644 index 0000000..0436141 --- /dev/null +++ b/addons/godotsteam/editor/updates/confirmation.tscn @@ -0,0 +1,174 @@ +[gd_scene format=3 uid="uid://bb6pyk4s77qvo"] + +[ext_resource type="Script" uid="uid://bjb747gou4fbo" path="res://addons/godotsteam/editor/updates/confirmation.gd" id="1_fskym"] +[ext_resource type="Texture2D" uid="uid://dhn3vkdxvetbn" path="res://addons/godotsteam/editor/ui/steam.svg" id="1_xklt4"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cnr4s"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_jjufo"] + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_fskym"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0ql43"] +content_margin_left = 10.0 +content_margin_top = 5.0 +content_margin_right = 10.0 +content_margin_bottom = 5.0 +bg_color = Color(0.3372549, 0.61960787, 1, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_apu4b"] +content_margin_left = 10.0 +content_margin_top = 5.0 +content_margin_right = 10.0 +content_margin_bottom = 5.0 +bg_color = Color(0.09803922, 0.09803922, 0.09803922, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_bi3ss"] +content_margin_left = 10.0 +content_margin_top = 5.0 +content_margin_right = 10.0 +content_margin_bottom = 5.0 +bg_color = Color(0, 0, 0, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_cnr4s"] +content_margin_top = 2.0 +content_margin_bottom = 2.0 +bg_color = Color(0.09803922, 0.09803922, 0.09803922, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_jjufo"] +content_margin_top = 2.0 +content_margin_bottom = 2.0 +bg_color = Color(0.3372549, 0.61960787, 1, 1) + +[sub_resource type="Theme" id="Theme_cnr4s"] +AcceptDialog/constants/title_height = 0 +AcceptDialog/styles/embedded_border = SubResource("StyleBoxEmpty_cnr4s") +AcceptDialog/styles/embedded_unfocused_border = SubResource("StyleBoxEmpty_jjufo") +AcceptDialog/styles/panel = SubResource("StyleBoxEmpty_fskym") +Button/colors/font_color = Color(1, 1, 1, 1) +Button/styles/hover = SubResource("StyleBoxFlat_0ql43") +Button/styles/normal = SubResource("StyleBoxFlat_apu4b") +Button/styles/pressed = SubResource("StyleBoxFlat_bi3ss") +ProgressBar/styles/background = SubResource("StyleBoxFlat_cnr4s") +ProgressBar/styles/fill = SubResource("StyleBoxFlat_jjufo") + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_fskym"] +bg_color = Color(0.15686275, 0.15686275, 0.15686275, 1) +border_width_bottom = 3 +border_color = Color(0.3372549, 0.61960787, 1, 1) + +[node name="Confirmation" type="ConfirmationDialog" unique_id=1649782113] +transparent_bg = true +oversampling_override = 1.0 +title = "Updating GodotSteam" +initial_position = 1 +size = Vector2i(450, 330) +visible = true +wrap_controls = false +unresizable = true +borderless = true +min_size = Vector2i(450, 200) +keep_title_visible = false +content_scale_mode = 1 +theme = SubResource("Theme_cnr4s") +ok_button_text = "Continue" +dialog_hide_on_ok = false +dialog_close_on_escape = false +script = ExtResource("1_fskym") +metadata/_edit_lock_ = true + +[node name="Panel" type="Panel" parent="." unique_id=336687509] +custom_minimum_size = Vector2(450, 330) +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -225.0 +offset_top = -165.0 +offset_right = 225.0 +offset_bottom = 165.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 4 +size_flags_vertical = 4 +theme_override_styles/panel = SubResource("StyleBoxFlat_fskym") +metadata/_edit_lock_ = true + +[node name="Margin" type="MarginContainer" parent="Panel" unique_id=598549467] +custom_minimum_size = Vector2(450, 330) +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_left = 50 +theme_override_constants/margin_top = 50 +theme_override_constants/margin_right = 50 +theme_override_constants/margin_bottom = 50 +metadata/_edit_lock_ = true + +[node name="VFrame" type="VBoxContainer" parent="Panel/Margin" unique_id=7442794] +layout_mode = 2 +theme_override_constants/separation = 15 +metadata/_edit_lock_ = true + +[node name="HFrame" type="HBoxContainer" parent="Panel/Margin/VFrame" unique_id=1314013334] +layout_mode = 2 +theme_override_constants/separation = 15 +metadata/_edit_lock_ = true + +[node name="Icon" type="TextureRect" parent="Panel/Margin/VFrame/HFrame" unique_id=521288466] +custom_minimum_size = Vector2(26, 30) +layout_mode = 2 +texture = ExtResource("1_xklt4") +expand_mode = 1 +stretch_mode = 5 +metadata/_edit_lock_ = true + +[node name="VersionTitle" type="Label" parent="Panel/Margin/VFrame/HFrame" unique_id=906249057] +unique_name_in_owner = true +custom_minimum_size = Vector2(275, 30) +layout_mode = 2 +theme_override_colors/font_outline_color = Color(1, 1, 1, 1) +theme_override_constants/outline_size = 1 +theme_override_font_sizes/font_size = 18 +text = "Downloading GodotSteam 99.99" +metadata/_edit_lock_ = true + +[node name="Message" type="Label" parent="Panel/Margin/VFrame" unique_id=345793881] +unique_name_in_owner = true +custom_minimum_size = Vector2(315, 85) +layout_mode = 2 +size_flags_vertical = 0 +text = "You are about to update plug-in version to %s. The editor will restart at the end of this process." +autowrap_mode = 3 +metadata/_edit_lock_ = true + +[node name="Downloading" type="ProgressBar" parent="Panel/Margin/VFrame" unique_id=1922739661] +unique_name_in_owner = true +custom_minimum_size = Vector2(0, 30) +layout_mode = 2 +step = 1.0 +value = 50.0 +metadata/_edit_lock_ = true + +[node name="Options" type="HBoxContainer" parent="Panel/Margin/VFrame" unique_id=2126576529] +layout_mode = 2 +size_flags_vertical = 10 +theme_override_constants/separation = 15 +alignment = 2 +metadata/_edit_lock_ = true + +[node name="Continue" type="Button" parent="Panel/Margin/VFrame/Options" unique_id=851000998] +unique_name_in_owner = true +layout_mode = 2 +text = "Continue" +metadata/_edit_lock_ = true + +[node name="Cancel" type="Button" parent="Panel/Margin/VFrame/Options" unique_id=1895267580] +unique_name_in_owner = true +layout_mode = 2 +text = "Cancel" +metadata/_edit_lock_ = true diff --git a/addons/godotsteam/editor/updates/updates.gd b/addons/godotsteam/editor/updates/updates.gd new file mode 100644 index 0000000..c115c31 --- /dev/null +++ b/addons/godotsteam/editor/updates/updates.gd @@ -0,0 +1,186 @@ +@tool +extends MarginContainer +### +# Super-huge thanks to Nathan Hoad and Marcus Skov for ideas and inspiration on how to create a +# plug-in updater. +### + +const TEMP_FILE = "user://update.zip" +const VERSION_URL: StringName = "https://godotengine.org/asset-library/api/asset/2445" + +var download_location: String = "" +var downloading_update: bool = false +# This will act as both our version checker and update downloader +var http_request: HTTPRequest = null +var is_actively_downloading: bool = false +var new_version: String = "" + +@onready var cancel_button: Button = %CancelButton +@onready var downloading: ProgressBar = %Downloading +@onready var install_button: Button = %InstallButton +@onready var installed_label: Label = %InstalledLabel +@onready var update_label: Label = %UpdateLabel +@onready var update_button: Button = %UpdateButton + + +func _ready() -> void: + connect_signals() + set_defaults() + check_for_updates() + + +func _process(delta: float) -> void: + if is_actively_downloading: + downloading.value = http_request.get_downloaded_bytes() * 100 / http_request.get_body_size() + + +#region Setup +func set_defaults() -> void: + downloading.value = 0 + installed_label.text = "Installed version %s" % Steam.get_godotsteam_version() + update_button.text = "Up-to-date" + update_button.disabled = true + update_label.text = "" + updating_visibility(false, false, false, true) +#endregion + + +#region Signals +func connect_signals() -> void: + cancel_button.pressed.connect(_on_cancel_pressed) + install_button.pressed.connect(_on_install_pressed) + update_button.pressed.connect(_on_update_pressed) +#endregion + + +#region Checking for updates +func check_for_updates() -> void: + if not ProjectSettings.get_setting("steam/updates/godotsteam/check_for_updates"): + return + + http_request = HTTPRequest.new() + add_child(http_request) + http_request.request_completed.connect(_on_http_request_completed) + if http_request.request(VERSION_URL) != OK: + printerr("Failed to request GodotSteam plug-in remote current version") + + +func _on_http_request_completed(result: int, _response_code: int, _headers: PackedStringArray, body: PackedByteArray) -> void: + http_request.request_completed.disconnect(_on_http_request_completed) + http_request.queue_free() + + if result != HTTPRequest.RESULT_SUCCESS: + return + var response = JSON.parse_string(body.get_string_from_utf8()) + if response == null: + return + + download_location = response.download_url + new_version = response.version_string + + if convert_version(new_version) > convert_version(Steam.get_godotsteam_version()): + print("New GodotSteam version %s available" % new_version) + update_label.text = "New version %s" % new_version + update_button.text = "Download" + update_button.disabled = false +#endregion + + +#region Updating versions +func _on_cancel_pressed() -> void: + updating_visibility(false, false, false, true) + + if is_actively_downloading: + http_request.cancel_request() + http_request.queue_free() + is_actively_downloading = false + update_label.text = "Canceling %s plug-in update download" % new_version + else: + DirAccess.remove_absolute(TEMP_FILE) + update_label.text = "Canceling %s plug-in update and deleting temporary files" % new_version + + update_button.text = "Download" + update_button.disabled = false + update_label.text = "New version %s" % new_version + + +func _on_install_pressed() -> void: + print("Removing older GodotSteam %s plug-in" % Steam.get_godotsteam_version()) + OS.move_to_trash(ProjectSettings.globalize_path("res://addons/godotsteam")) + + update_button.text = "Unpacking" + print("Unpacking new %s plug-in" % new_version) + var zip_reader: ZIPReader = ZIPReader.new() + zip_reader.open(TEMP_FILE) + var files: PackedStringArray = zip_reader.get_files() + + var base_path := files[1] + # Remove archive folder + files.remove_at(0) + # Remove assets folder + files.remove_at(0) + + for path in files: + var new_file_path: String = path.replace(base_path, "") + if path.ends_with("/"): + DirAccess.make_dir_recursive_absolute("res://addons/%s" % new_file_path) + else: + var file: FileAccess = FileAccess.open("res://addons/%s" % new_file_path, FileAccess.WRITE) + file.store_buffer(zip_reader.read_file(path)) + + zip_reader.close() + restart_post_update() + + +func _on_update_pressed() -> void: + is_actively_downloading = true + update_label.text = "Downloading %s plug-in update, please wait" % new_version + updating_visibility(true, true, false, false) + + http_request = HTTPRequest.new() + add_child(http_request) + http_request.request_completed.connect(_on_download_request_completed) + if http_request.request(download_location) != OK: + printerr("Failed to request %s plug-in update download" % new_version) + is_actively_downloading = false + update_button.text = "Failed" + update_button.disabled = false + return + + +func _on_download_request_completed(result: int, _response_code: int, _headers: PackedStringArray, body: PackedByteArray) -> void: + http_request.request_completed.disconnect(_on_download_request_completed) + http_request.queue_free() + is_actively_downloading = false + updating_visibility(true, false, true, false) + + if result != HTTPRequest.RESULT_SUCCESS: + printerr("Failed to download new GodotSteam version %s" % result) + update_button.disabled = false + return + + update_label.text = "Update downloaded, ready to install %s" % new_version + var zip_file: FileAccess = FileAccess.open(TEMP_FILE, FileAccess.WRITE) + zip_file.store_buffer(body) + zip_file.close() + + +func restart_post_update() -> void: + update_button.text = "Restarting" + update_label.text = "Updated to version %s, restarting the editor" % new_version + DirAccess.remove_absolute(TEMP_FILE) + EditorInterface.restart_editor(true) +#endregion + + +#region Helpers +func convert_version(version_string: String) -> int: + return int(version_string.replace(".", "").rpad(4, "0")) + + +func updating_visibility(cancel: bool, download: bool, install: bool, update: bool) -> void: + cancel_button.visible = cancel + downloading.visible = download + install_button.visible = install + update_button.visible = update +#endregion diff --git a/addons/godotsteam/editor/updates/updates.gd.uid b/addons/godotsteam/editor/updates/updates.gd.uid new file mode 100644 index 0000000..75d0d30 --- /dev/null +++ b/addons/godotsteam/editor/updates/updates.gd.uid @@ -0,0 +1 @@ +uid://b4nvgu7h84u53 diff --git a/addons/godotsteam/godotsteam.gdextension b/addons/godotsteam/godotsteam.gdextension new file mode 100644 index 0000000..0a2e48b --- /dev/null +++ b/addons/godotsteam/godotsteam.gdextension @@ -0,0 +1,29 @@ +[configuration] +entry_symbol = "godotsteam_init" +compatibility_minimum = "4.4" + +[libraries] +android.debug.arm64 = "res://addons/godotsteam/androidarm64/libgodotsteam.android.template_debug.arm64.so" +android.release.arm64 = "res://addons/godotsteam/androidarm64/libgodotsteam.android.template_release.arm64.so" +linux.debug.arm64 = "res://addons/godotsteam/linuxarm64/libgodotsteam.linux.template_debug.arm64.so" +linux.debug.x86_64 = "res://addons/godotsteam/linux64/libgodotsteam.linux.template_debug.x86_64.so" +linux.debug.x86_32 = "res://addons/godotsteam/linux32/libgodotsteam.linux.template_debug.x86_32.so" +linux.release.arm64 = "res://addons/godotsteam/linuxarm64/libgodotsteam.linux.template_release.arm64.so" +linux.release.x86_64 = "res://addons/godotsteam/linux64/libgodotsteam.linux.template_release.x86_64.so" +linux.release.x86_32 = "res://addons/godotsteam/linux32/libgodotsteam.linux.template_release.x86_32.so" +macos.debug = "res://addons/godotsteam/osx/libgodotsteam.macos.template_debug.dylib" +macos.release = "res://addons/godotsteam/osx/libgodotsteam.macos.template_release.dylib" +windows.debug.x86_64 = "res://addons/godotsteam/win64/libgodotsteam.windows.template_debug.x86_64.dll" +windows.debug.x86_32 = "res://addons/godotsteam/win32/libgodotsteam.windows.template_debug.x86_32.dll" +windows.release.x86_64 = "res://addons/godotsteam/win64/libgodotsteam.windows.template_release.x86_64.dll" +windows.release.x86_32 = "res://addons/godotsteam/win32/libgodotsteam.windows.template_release.x86_32.dll" + +[dependencies] +android.arm64 = { "res://addons/godotsteam/androidarm64/libsteam_api.so": "" } +linux.arm64 = { "res://addons/godotsteam/linuxarm64/libsteam_api.so": "" } +linux.x86_64 = { "res://addons/godotsteam/linux64/libsteam_api.so": "" } +linux.x86_32 = { "res://addons/godotsteam/linux32/libsteam_api.so": "" } +macos.universal = { "res://addons/godotsteam/osx/libsteam_api.dylib": "" } +windows.x86_64 = { "res://addons/godotsteam/win64/steam_api64.dll": "" } +windows.x86_32 = { "res://addons/godotsteam/win32/steam_api.dll": "" } + diff --git a/addons/godotsteam/godotsteam.gdextension.uid b/addons/godotsteam/godotsteam.gdextension.uid new file mode 100644 index 0000000..f48f1c8 --- /dev/null +++ b/addons/godotsteam/godotsteam.gdextension.uid @@ -0,0 +1 @@ +uid://d4gadhvchsddo diff --git a/addons/godotsteam/godotsteam_plugin.gd b/addons/godotsteam/godotsteam_plugin.gd new file mode 100644 index 0000000..84868f9 --- /dev/null +++ b/addons/godotsteam/godotsteam_plugin.gd @@ -0,0 +1,86 @@ +@tool +class_name GodotSteamPlugin +extends EditorPlugin + +const EDITOR_PANEL = preload("uid://cyniebd6yahu5") + +static var dock_frame + +var link_changelog: String = "[url=https://godotsteam.com/changelog/gdextension/]changelog[/url]" +var link_website: String = "[url=https://godotsteam.com]website[/url]" +var steamworks_dock: Control + + +## Used specifically to add/remove additional dock content +static func get_dock_frame() -> Control: + return dock_frame + + +func _enable_plugin() -> void: + print("GodotSteam GDExtension updater functionality enabled") + + +func _disable_plugin() -> void: + print("GodotSteam GDEXtension updater functionality disabled") + + +func _enter_tree() -> void: + print_rich("GodotSteam v%s | %s | %s" % [Steam.get_godotsteam_version(), link_website, link_changelog]) + add_project_settings() + add_steamworks_dock() + + +func _exit_tree() -> void: + remove_steamworks_dock() + + +func _make_visible(visible) -> void: + if steamworks_dock: + steamworks_dock.set_visible(visible) + + +#region Add and remove things +func add_project_settings() -> void: + # Used for the Updater looking for redist files and SteamCMD + if not ProjectSettings.has_setting("steam/updates/godotsteam/check_for_updates"): + ProjectSettings.set_setting("steam/updates/godotsteam/check_for_updates", true) + ProjectSettings.add_property_info({ + "name": "steam/updates/godotsteam/check_for_updates", + "type": TYPE_BOOL + }) + ProjectSettings.set_initial_value("steam/updates/godotsteam/check_for_updates", true) + ProjectSettings.set_as_basic("steam/updates/godotsteam/check_for_updates", true) + # Which channel of updates to pull from + # Sponsors repo should require the user to have access to that repository already + # In theory, they can connect via SSH? + if not ProjectSettings.has_setting("steam/updates/godotsteam/update_channel"): + ProjectSettings.set_setting("steam/updates/godotsteam/update_channel", 0) + ProjectSettings.add_property_info({ + "name": "steam/updates/godotsteam/update_channel", + "type": TYPE_INT, + "hint": PROPERTY_HINT_ENUM, + "hint_string": "Community, Sponsors" + }) + ProjectSettings.set_initial_value("steam/updates/godotsteam/update_channel", 0) + ProjectSettings.set_as_basic("steam/updates/godotsteam/update_channel", true) + + +func add_steamworks_dock() -> void: + steamworks_dock = EDITOR_PANEL.instantiate() + # This will be used when 4.4.x is deprecated + #add_control_to_dock(DockSlot.DOCK_SLOT_BOTTOM, steamworks_dock) + # This is deprecated as of 4.6; when it is removed then 4.4.x will be deprecated for GodotSteam + add_control_to_bottom_panel(steamworks_dock, "Steamworks") + dock_frame = steamworks_dock + + +func remove_steamworks_dock() -> void: + # This will be used when 4.4.x is deprecated + #remove_control_from_docks(steamworks_dock) + # This is deprecated as of 4.6; when it is removed then 4.4.x will be deprecated for GodotSteam + remove_control_from_bottom_panel(steamworks_dock) + # This may be causing crashes for some people and is unnecessary with the call above + # steamworks_dock.queue_free() + steamworks_dock = null + dock_frame = null +#endregion diff --git a/addons/godotsteam/godotsteam_plugin.gd.uid b/addons/godotsteam/godotsteam_plugin.gd.uid new file mode 100644 index 0000000..e46d46d --- /dev/null +++ b/addons/godotsteam/godotsteam_plugin.gd.uid @@ -0,0 +1 @@ +uid://btts11rgropcp diff --git a/addons/godotsteam/license.md b/addons/godotsteam/license.md new file mode 100644 index 0000000..ecadf79 --- /dev/null +++ b/addons/godotsteam/license.md @@ -0,0 +1,23 @@ +MIT License + +Copyright (c) 2015-Current | GP Garcia, Chris Ridenour, and Contributors + +View all contributors at https://godotsteam.com/contribute/contributors/ + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/addons/godotsteam/linux32/libgodotsteam.linux.template_debug.x86_32.so b/addons/godotsteam/linux32/libgodotsteam.linux.template_debug.x86_32.so new file mode 100644 index 0000000..c179a45 Binary files /dev/null and b/addons/godotsteam/linux32/libgodotsteam.linux.template_debug.x86_32.so differ diff --git a/addons/godotsteam/linux32/libgodotsteam.linux.template_release.x86_32.so b/addons/godotsteam/linux32/libgodotsteam.linux.template_release.x86_32.so new file mode 100644 index 0000000..c260762 Binary files /dev/null and b/addons/godotsteam/linux32/libgodotsteam.linux.template_release.x86_32.so differ diff --git a/addons/godotsteam/linux32/libsteam_api.so b/addons/godotsteam/linux32/libsteam_api.so new file mode 100644 index 0000000..cd2df7a Binary files /dev/null and b/addons/godotsteam/linux32/libsteam_api.so differ diff --git a/addons/godotsteam/linux64/libgodotsteam.linux.template_debug.x86_64.so b/addons/godotsteam/linux64/libgodotsteam.linux.template_debug.x86_64.so new file mode 100644 index 0000000..71964f6 Binary files /dev/null and b/addons/godotsteam/linux64/libgodotsteam.linux.template_debug.x86_64.so differ diff --git a/addons/godotsteam/linux64/libgodotsteam.linux.template_release.x86_64.so b/addons/godotsteam/linux64/libgodotsteam.linux.template_release.x86_64.so new file mode 100644 index 0000000..0c0ae39 Binary files /dev/null and b/addons/godotsteam/linux64/libgodotsteam.linux.template_release.x86_64.so differ diff --git a/addons/godotsteam/linux64/libsteam_api.so b/addons/godotsteam/linux64/libsteam_api.so new file mode 100644 index 0000000..9a16ad9 Binary files /dev/null and b/addons/godotsteam/linux64/libsteam_api.so differ diff --git a/addons/godotsteam/linuxarm64/libgodotsteam.linux.template_debug.arm64.so b/addons/godotsteam/linuxarm64/libgodotsteam.linux.template_debug.arm64.so new file mode 100644 index 0000000..9e8d044 Binary files /dev/null and b/addons/godotsteam/linuxarm64/libgodotsteam.linux.template_debug.arm64.so differ diff --git a/addons/godotsteam/linuxarm64/libgodotsteam.linux.template_release.arm64.so b/addons/godotsteam/linuxarm64/libgodotsteam.linux.template_release.arm64.so new file mode 100644 index 0000000..4d2606c Binary files /dev/null and b/addons/godotsteam/linuxarm64/libgodotsteam.linux.template_release.arm64.so differ diff --git a/addons/godotsteam/linuxarm64/libsteam_api.so b/addons/godotsteam/linuxarm64/libsteam_api.so new file mode 100644 index 0000000..da30b41 Binary files /dev/null and b/addons/godotsteam/linuxarm64/libsteam_api.so differ diff --git a/addons/godotsteam/osx/libgodotsteam.macos.template_debug.dylib b/addons/godotsteam/osx/libgodotsteam.macos.template_debug.dylib new file mode 100644 index 0000000..b34adb5 Binary files /dev/null and b/addons/godotsteam/osx/libgodotsteam.macos.template_debug.dylib differ diff --git a/addons/godotsteam/osx/libgodotsteam.macos.template_release.dylib b/addons/godotsteam/osx/libgodotsteam.macos.template_release.dylib new file mode 100644 index 0000000..bb056ae Binary files /dev/null and b/addons/godotsteam/osx/libgodotsteam.macos.template_release.dylib differ diff --git a/addons/godotsteam/osx/libsteam_api.dylib b/addons/godotsteam/osx/libsteam_api.dylib new file mode 100644 index 0000000..3e1a940 Binary files /dev/null and b/addons/godotsteam/osx/libsteam_api.dylib differ diff --git a/addons/godotsteam/plugin.cfg b/addons/godotsteam/plugin.cfg new file mode 100644 index 0000000..6926545 --- /dev/null +++ b/addons/godotsteam/plugin.cfg @@ -0,0 +1,7 @@ +[plugin] + +name="GodotSteam GDExtension Updater" +description="An updater for GodotSteam GDExtension. This is not required to use Steamworks functionality, just updating the plug-in." +author="Gramps Garcia, GodotSteam" +version="4.19.1" +script="godotsteam_plugin.gd" diff --git a/addons/godotsteam/readme.md b/addons/godotsteam/readme.md new file mode 100644 index 0000000..f0de3cd --- /dev/null +++ b/addons/godotsteam/readme.md @@ -0,0 +1,95 @@ +# GodotSteam for GDExtension | Community Edition +An ecosystem of tools for [Godot Engine](https://godotengine.org) and [Valve's Steam](https://store.steampowered.com). For the Windows, Linux, and Mac platforms. + + +Additional Flavors +--- +Standard Module | Standard Plug-ins | Server Module | Server Plug-ins | Examples +--- | --- | --- | --- | --- +[Godot 2.x](https://codeberg.org/godotsteam/godotsteam/src/branch/godot2) | [GDNative](https://codeberg.org/godotsteam/godotsteam/src/branch/gdnative) | [Server 3.x](https://codeberg.org/godotsteam/godotsteam-server/src/branch/godot3) | [GDNative](https://codeberg.org/godotsteam/godotsteam-server/src/branch/gdnative) | [Skillet](https://codeberg.org/godotsteam/skillet) +[Godot 3.x](https://codeberg.org/godotsteam/godotsteam/src/branch/godot3) | [GDExtension](https://codeberg.org/godotsteam/godotsteam/src/branch/gdextension) | [Server 4.x](https://codeberg.org/godotsteam/godotsteam-server/src/branch/godot4) | [GDExtension](https://codeberg.org/godotsteam/godotsteam-server/src/branch/gdextension) | [Skillet UGC Editor](https://codeberg.org/godotsteam/skillet/src/branch/ugc_editor) +[Godot 4.x](https://codeberg.org/godotsteam/godotsteam/src/branch/godot4) | --- | --- | --- | --- +[MultiplayerPeer](https://codeberg.org/godotsteam/multiplayerpeer)| --- | --- | --- | --- + + +Documentation +--- +[Documentation is available here](https://godotsteam.com/). You can also check out the Search Help section inside Godot Engine. [To start, try checking out our tutorial on initializing Steam.](https://godotsteam.com/tutorials/initializing/) There are additional tutorials, with more in the works. You can also [check out additional Godot and Steam related videos, text, additional tools, plug-ins, etc. here.](https://godotsteam.com/resources/external/) + +Feel free to chat with us about GodotSteam or ask for assistance on the [Stoat server](https://stt.gg/9DxQ3Dcd) or [IRC on Libera Chat](irc://irc.libera.chat/#godotsteam). + + +Donate +--- +Pull-requests are the best way to help the project out but you can also donate through [Github Sponsors](https://github.com/sponsors/Gramps) or [LiberaPay](https://liberapay.com/godotsteam/donate)! [You can read more about donor perks here.](https://godotsteam.com/contribute/donations/) [You can also view all our awesome donors here.](https://godotsteam.com/contribute/donors/) + + +Current Build +--- +You can [download pre-compiled versions of this repo here](https://codeberg.org/godotsteam/godotsteam/releases). + +**Version 4.19.1 Changes** + +- Changed: commented out possible issue with removing dock node +- Fixed: in-editor docs error, thanks to ***evanwang0*** + +[You can read more change-logs here](https://godotsteam.com/changelog/gdextension/). + + +Compatibility +--- +While rare, sometimes Steamworks SDK updates will break compatilibity with older GodotSteam versions. Any compatability breaks are noted below. Newer API files (dll, so, dylib) _should_ still work for older versions. + +Steamworks SDK Version | GodotSteam Version +---|--- +1.63 or newer | 4.17 +1.62 | 4.14 or 4.16.2 +1.61 | 4.12 to 4.13 +1.60 | 4.6 to 4.11 +1.59 | 4.6 to 4.8 +1.58a or older | 4.5.4 or older + +Versions of GodotSteam that have compatibility breaks introduced. + +GodotSteam Version | Broken Compatibility +---|--- +4.8 | Networking identity system removed, replaced with Steam IDs +4.9 | sendMessages returns an Array +4.11 | setLeaderboardDetailsMax removed +4.13 | getItemDefinitionProperty return a dictionary, html_needs_paint key 'bgra' changed to 'rbga' +4.14 | Removed first argument for stat request in steamInit and steamInitEx, steamInit returns intended bool value +4.16 | Variety of small break points, refer to [4.16 changelog for details](https://godotsteam.com/changelog/godot4/#version-416) +4.17 | Windows projects using Steam SDK 1.63 are meant to work with Proton 11 or Experimental on Linux / Steam Deck. +4.19 | Lots of changes to Voice functions, refer to [4.19 changelog for details](https://godotsteam.com/changelog/godot4/#version-419) + + +Known Issues +--- +- GDExtension for 4.4 is **not** compatible with 4.3.x or lower. Please check the versions you are using. +- Overlay will not work in the editor but will work in export projects when uploaded to Steam. This seems to a limitation with Vulkan currently. + + +Quick How-To +--- +For complete instructions on how to build the GDExtension version of GodotSteam, [please refer to our documentation's 'How-To GDExtension' section.](https://godotsteam.com/howto/gdextension/) It will have the most up-to-date information. + +Alternatively, you can just [download the pre-compiled versions in our Releases section](https://codeberg.org/godotsteam/godotsteam/releases) or [from the Godot Asset Library](https://godotengine.org/asset-library/asset/2445) and skip compiling it yourself! + + +Usage +--- +Once the plug-in is added to your project, the Steam class should be available and ready to go. Enabling the plug-in in the ProjectSettings only affects the Steamworks dock and not the actual functionality. + +Do not use the GDExtension version of GodotSteam with any of the module versions whether it be our pre-compiled versions or ones you compile. They are not compatible with each other. + +When exporting with the GDExtension version, please use the normal Godot Engine templates instead of our GodotSteam templates or you will have a lot of issues. + + +No LLM Policy / No "AI" Policy +--- +No LLMs are allowed to be used for issues, patches, or pull-requests. They will be closed or rejected and the submitter may be blocked from future submissions. + + +License +--- +MIT license diff --git a/addons/godotsteam/win32/libgodotsteam.windows.template_debug.x86_32.dll b/addons/godotsteam/win32/libgodotsteam.windows.template_debug.x86_32.dll new file mode 100644 index 0000000..0148e36 Binary files /dev/null and b/addons/godotsteam/win32/libgodotsteam.windows.template_debug.x86_32.dll differ diff --git a/addons/godotsteam/win32/libgodotsteam.windows.template_release.x86_32.dll b/addons/godotsteam/win32/libgodotsteam.windows.template_release.x86_32.dll new file mode 100644 index 0000000..45fe5da Binary files /dev/null and b/addons/godotsteam/win32/libgodotsteam.windows.template_release.x86_32.dll differ diff --git a/addons/godotsteam/win32/steam_api.dll b/addons/godotsteam/win32/steam_api.dll new file mode 100644 index 0000000..5869b19 Binary files /dev/null and b/addons/godotsteam/win32/steam_api.dll differ diff --git a/addons/godotsteam/win64/libgodotsteam.windows.template_debug.x86_64.dll b/addons/godotsteam/win64/libgodotsteam.windows.template_debug.x86_64.dll new file mode 100644 index 0000000..2d345af Binary files /dev/null and b/addons/godotsteam/win64/libgodotsteam.windows.template_debug.x86_64.dll differ diff --git a/addons/godotsteam/win64/libgodotsteam.windows.template_release.x86_64.dll b/addons/godotsteam/win64/libgodotsteam.windows.template_release.x86_64.dll new file mode 100644 index 0000000..f7688fa Binary files /dev/null and b/addons/godotsteam/win64/libgodotsteam.windows.template_release.x86_64.dll differ diff --git a/addons/godotsteam/win64/steam_api64.dll b/addons/godotsteam/win64/steam_api64.dll new file mode 100644 index 0000000..43e7291 Binary files /dev/null and b/addons/godotsteam/win64/steam_api64.dll differ diff --git a/addons/godotsteam/win64/~libgodotsteam.windows.template_debug.x86_64.dll b/addons/godotsteam/win64/~libgodotsteam.windows.template_debug.x86_64.dll new file mode 100644 index 0000000..2d345af Binary files /dev/null and b/addons/godotsteam/win64/~libgodotsteam.windows.template_debug.x86_64.dll differ diff --git a/core/ai/agents/human/Gathering.fbx.import b/core/ai/agents/human/Gathering.fbx.import index 77161ac..10d88fd 100644 --- a/core/ai/agents/human/Gathering.fbx.import +++ b/core/ai/agents/human/Gathering.fbx.import @@ -4,12 +4,12 @@ importer="scene" importer_version=1 type="PackedScene" uid="uid://bvrn4woiabto5" -path="res://.godot/imported/gathering.fbx-8cf29bfb4073eff7f1a8c8f2f1200637.scn" +path="res://.godot/imported/Gathering.fbx-010ce6eb774e1ef5173d7b91f43194c4.scn" [deps] -source_file="res://core/ai/agents/human/gathering.fbx" -dest_files=["res://.godot/imported/gathering.fbx-8cf29bfb4073eff7f1a8c8f2f1200637.scn"] +source_file="res://core/ai/agents/human/Gathering.fbx" +dest_files=["res://.godot/imported/Gathering.fbx-010ce6eb774e1ef5173d7b91f43194c4.scn"] [params] diff --git a/core/ai/agents/human/Idle.fbx.import b/core/ai/agents/human/Idle.fbx.import index 167decd..b6c9360 100644 --- a/core/ai/agents/human/Idle.fbx.import +++ b/core/ai/agents/human/Idle.fbx.import @@ -4,12 +4,12 @@ importer="scene" importer_version=1 type="PackedScene" uid="uid://cfe0ylyx1lfaa" -path="res://.godot/imported/idle.fbx-e84be0400dfd82eeca47497734059eba.scn" +path="res://.godot/imported/Idle.fbx-55b141029a6b8b2285a4fdfb57ee0c93.scn" [deps] -source_file="res://core/ai/agents/human/idle.fbx" -dest_files=["res://.godot/imported/idle.fbx-e84be0400dfd82eeca47497734059eba.scn"] +source_file="res://core/ai/agents/human/Idle.fbx" +dest_files=["res://.godot/imported/Idle.fbx-55b141029a6b8b2285a4fdfb57ee0c93.scn"] [params] diff --git a/core/ai/agents/human/Sitting.fbx.import b/core/ai/agents/human/Sitting.fbx.import index 48320ac..eca4b3a 100644 --- a/core/ai/agents/human/Sitting.fbx.import +++ b/core/ai/agents/human/Sitting.fbx.import @@ -4,12 +4,12 @@ importer="scene" importer_version=1 type="PackedScene" uid="uid://cuphreeff7ihw" -path="res://.godot/imported/sitting.fbx-28ba14b5efd99e4f9dac90f909835595.scn" +path="res://.godot/imported/Sitting.fbx-83aa57848ecefeeaff20ef595a19a7b3.scn" [deps] -source_file="res://core/ai/agents/human/sitting.fbx" -dest_files=["res://.godot/imported/sitting.fbx-28ba14b5efd99e4f9dac90f909835595.scn"] +source_file="res://core/ai/agents/human/Sitting.fbx" +dest_files=["res://.godot/imported/Sitting.fbx-83aa57848ecefeeaff20ef595a19a7b3.scn"] [params] diff --git a/core/ai/agents/human/Walking.fbx.import b/core/ai/agents/human/Walking.fbx.import index a1a2991..fe26159 100644 --- a/core/ai/agents/human/Walking.fbx.import +++ b/core/ai/agents/human/Walking.fbx.import @@ -4,12 +4,12 @@ importer="scene" importer_version=1 type="PackedScene" uid="uid://o8dn1hc1lyly" -path="res://.godot/imported/walking.fbx-2ef52b3a6cd770e898c2eff1dbd7eecc.scn" +path="res://.godot/imported/Walking.fbx-280a67ae546347dd1478504ff6b11a6e.scn" [deps] -source_file="res://core/ai/agents/human/walking.fbx" -dest_files=["res://.godot/imported/walking.fbx-2ef52b3a6cd770e898c2eff1dbd7eecc.scn"] +source_file="res://core/ai/agents/human/Walking.fbx" +dest_files=["res://.godot/imported/Walking.fbx-280a67ae546347dd1478504ff6b11a6e.scn"] [params] diff --git a/core/ai/agents/human/gathering.res b/core/ai/agents/human/gathering.res index 1835763..ae8b604 100644 Binary files a/core/ai/agents/human/gathering.res and b/core/ai/agents/human/gathering.res differ diff --git a/core/ai/agents/human/walking.res b/core/ai/agents/human/walking.res index 9938a01..146bcfb 100644 Binary files a/core/ai/agents/human/walking.res and b/core/ai/agents/human/walking.res differ diff --git a/core/scene_manager/scene_manager.gd b/core/scene_manager/scene_manager.gd index 597c766..bf7542a 100644 --- a/core/scene_manager/scene_manager.gd +++ b/core/scene_manager/scene_manager.gd @@ -5,6 +5,7 @@ extends CanvasLayer @onready var loading_screen = $LoadingScreen @export var transition_duration: float = 1 + func _ready() -> void: color_rect.color.a = 0.0 color_rect.mouse_filter = Control.MOUSE_FILTER_IGNORE diff --git a/core/steam_manager/achievement_manager.gd b/core/steam_manager/achievement_manager.gd new file mode 100644 index 0000000..dcb57e7 --- /dev/null +++ b/core/steam_manager/achievement_manager.gd @@ -0,0 +1,73 @@ +extends Node + +#Achievement e statistiche devono essere pubblicati live nel backend +#Steamworks anche se il gioco non è ancora uscito altrimenti le chiamate ritornano errore +const KNOWN := [ + "ACH_FIRST_WIN", + "ACH_PLAY_10_GAMES", + "ACH_REACH_LEVEL_5", +] + +#how it works: +#func _on_player_won() -> void: +# Achievements.unlock("ACH_FIRST_WIN") #unlock the achievement at first win + +#func _on_match_finished(coins_collected: int) -> void: + #update stats + #... + #check thresholds and unlock achievements +# if Stats.get_int("stat_games_played") >= 10: +# Achievements.unlock("ACH_PLAY_10_GAMES") +# if Stats.get_int("stat_total_coins") >= 100: +# Achievements.unlock("ACH_COLLECT_100_COINS") + +signal unlocked(api_name: String) + +func _ready() -> void: + if not SteamManager.is_on_steam: + return + + Steam.user_achievement_stored.connect(_on_achievement_stored) + Steam.global_achievement_percentages_ready.connect(_on_global_percentages_ready) + Steam.requestGlobalAchievementPercentages() # asincrona + +func _on_global_percentages_ready(_game: int, _result: int) -> void: + pass + +func unlock(api_name: String) -> void: + if not KNOWN.has(api_name): + push_warning("Achievement unknown: %s" % api_name) + return + if is_unlocked(api_name): + return + if not Steam.setAchievement(api_name): + push_error("setAchievement failed (is published on Steam?): %s" % api_name) + return + Steam.storeStats() + unlocked.emit(api_name) + +func is_unlocked(api_name: String) -> bool: + var data: Dictionary = Steam.getAchievement(api_name) + return data.get("achieved", false) + +func get_display_name(api_name: String) -> String: + return Steam.getAchievementDisplayAttribute(api_name, "name") + +func get_description(api_name: String) -> String: + return Steam.getAchievementDisplayAttribute(api_name, "desc") + +#Global percentage of player who have unlocked the achievement +func get_global_percent(api_name: String) -> float: + var data: Dictionary = Steam.getAchievementAchievedPercent(api_name) + if not data.get("ret", false): + return -1.0 #global percentage not yet available + return data.get("percent", 0.0) + +#for development only: reset an achievement +func clear(api_name: String) -> void: + Steam.clearAchievement(api_name) + Steam.storeStats() + +func _on_achievement_stored(_game: int, _group: bool, api_name: String, + current: int, maximum: int) -> void: + print("Achievement confirmed by server: %s (%d/%d)" % [api_name, current, maximum]) diff --git a/core/steam_manager/achievement_manager.gd.uid b/core/steam_manager/achievement_manager.gd.uid new file mode 100644 index 0000000..70b6192 --- /dev/null +++ b/core/steam_manager/achievement_manager.gd.uid @@ -0,0 +1 @@ +uid://vcuh547okpvj diff --git a/core/steam_manager/stats_manager.gd b/core/steam_manager/stats_manager.gd new file mode 100644 index 0000000..dead46e --- /dev/null +++ b/core/steam_manager/stats_manager.gd @@ -0,0 +1,62 @@ +extends Node + +#Achievement e statistiche devono essere pubblicati live nel backend +#Steamworks anche se il gioco non è ancora uscito altrimenti le chiamate ritornano errore +const KNOWN := [ + "stat_games_played", + "stat_total_score", + "stat_distance_km", +] + +#how it works: +#func _on_match_finished(score: int) -> void: +# Stats.add_int("stat_games_played", 1) +# Stats.set_int("stat_total_score", Stats.get_int("stat_total_score") + score) +# Stats.store() #only one push at the end of the game +# if Stats.get_int("stat_games_played") >= 10: +# Achievements.unlock("ACH_PLAY_10_GAMES") #it call storeStats() + +func _ready() -> void: + if not SteamManager.is_on_steam: + return + + Steam.user_stats_stored.connect(_on_stats_stored) + +func get_int(stat: String) -> int: + return Steam.getStatInt(stat) + +func get_float(stat: String) -> float: + return Steam.getStatFloat(stat) + +func set_int(stat: String, value: int) -> void: + if not KNOWN.has(stat): + push_warning("Stat not found: %s" % stat) + return + if not Steam.setStatInt(stat, value): + push_error("setStatInt failed (incremental with value less than current value? is published on steam?): %s" % stat) + +func set_float(stat: String, value: float) -> void: + if not KNOWN.has(stat): + push_warning("Stat not found: %s" % stat) + return + if not Steam.setStatFloat(stat, value): + push_error("setStatFloat failed: %s" % stat) + +func add_int(stat: String, amount: int = 1) -> void: + set_int(stat, get_int(stat) + amount) + +func update_avg_rate(stat: String, count_this_session: float, session_length: float) -> void: + Steam.updateAvgRateStat(stat, count_this_session, session_length) + +#Send all data to server; call it at the end of the game of when exit +func store() -> void: + if not Steam.storeStats(): + push_error("storeStats failed; data saved locally") + +#Development only: reset stats +func reset_all(include_achievements: bool = false) -> void: + Steam.resetAllStats(include_achievements) + Steam.storeStats() + +func _on_stats_stored(_game: int, result: int) -> void: + print("Stats save on server, result=%d" % result) diff --git a/core/steam_manager/stats_manager.gd.uid b/core/steam_manager/stats_manager.gd.uid new file mode 100644 index 0000000..d8f01e4 --- /dev/null +++ b/core/steam_manager/stats_manager.gd.uid @@ -0,0 +1 @@ +uid://bc3w8330cgc53 diff --git a/core/steam_manager/steam_manager.gd b/core/steam_manager/steam_manager.gd new file mode 100644 index 0000000..2446cd9 --- /dev/null +++ b/core/steam_manager/steam_manager.gd @@ -0,0 +1,27 @@ +extends Node + +const APP_ID: int = 4809260 #Train Goes Choo Choo + +var is_on_steam: bool = false + +func _init() -> void: + OS.set_environment("SteamAppId", str(APP_ID)) + OS.set_environment("SteamGameId", str(APP_ID)) + +func _ready() -> void: + process_mode = Node.PROCESS_MODE_ALWAYS + + var init := Steam.steamInitEx() + if init['status'] != Steam.STEAM_API_INIT_RESULT_OK: + push_error("Steam not initialized: %s" % init['verbal']) + return + + is_on_steam = true + Steam.overlay_toggled.connect(_on_overlay_toggled) + +func _process(_delta: float) -> void: + if is_on_steam: + Steam.run_callbacks() # every frame, always + +func _on_overlay_toggled(active: bool, _user_initiated: bool, _app_id: int) -> void: + get_tree().paused = active diff --git a/core/steam_manager/steam_manager.gd.uid b/core/steam_manager/steam_manager.gd.uid new file mode 100644 index 0000000..96afc4c --- /dev/null +++ b/core/steam_manager/steam_manager.gd.uid @@ -0,0 +1 @@ +uid://b8u4wynp6d6so diff --git a/project.godot b/project.godot index 83f68e9..9c69694 100644 --- a/project.godot +++ b/project.godot @@ -18,6 +18,7 @@ config/icon="uid://bfar1kk3pgq8f" [autoload] +SteamManager="*uid://b8u4wynp6d6so" UIEvents="*uid://dehu28iq27mbn" GameState="*uid://b17g2w2g101o6" CollectionManager="*uid://22orqdm34hfm" @@ -25,6 +26,8 @@ AudioManager="*uid://dcttbbavtwtsg" SceneManager="*uid://bw8hwkw55j675" ShaderWarmup="*res://core/shader_warmup.gd" TweenFX="*uid://d2n10rw2dnx8o" +AchievementManager="*uid://vcuh547okpvj" +StatsManager="*uid://bc3w8330cgc53" [display] @@ -35,7 +38,7 @@ window/stretch/aspect="expand" [editor_plugins] -enabled=PackedStringArray("res://addons/TweenFX/plugin.cfg") +enabled=PackedStringArray("res://addons/TweenFX/plugin.cfg", "res://addons/godotsteam/plugin.cfg") [global_group] @@ -188,3 +191,10 @@ global_water_color={ "type": "color", "value": Color(0, 0, 0, 1) } + +[steam] + +initialization/app_id=0 +initialization/initialize_on_startup=false +initialization/embed_callbacks=false +multiplayer_peer/max_channels=4 diff --git a/steam_appid.txt b/steam_appid.txt new file mode 100644 index 0000000..85e7243 --- /dev/null +++ b/steam_appid.txt @@ -0,0 +1 @@ +4809260 \ No newline at end of file