-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: godotsteam basic integration, including test achievement
Adds a GodotSteam autoload, references to godot-steam templates, and some handling for creating and dropping a test achievement. Working pretty well! Expects to be run in a version of godot compiled with godot-steam as a godot extension: https://github.com/CoaguCo-Industries/GodotSteam/releases/tag/v4.6
- Loading branch information
1 parent
a99ad16
commit 29d4467
Showing
7 changed files
with
102 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
extends Node | ||
|
||
## vars ########################################################3 | ||
|
||
const STEAM_APP_ID = 2779710 | ||
var enabled: bool = false | ||
|
||
# Steam variables | ||
var is_on_steam_deck: bool = false | ||
var is_online: bool = false | ||
var is_owned: bool = false | ||
var steam_app_id: int = 480 | ||
var steam_id: int = 0 | ||
var steam_username: String = "" | ||
|
||
## init ########################################################3 | ||
|
||
func _init() -> void: | ||
OS.set_environment("SteamAppId", str(STEAM_APP_ID)) | ||
OS.set_environment("SteamGameId", str(STEAM_APP_ID)) | ||
|
||
## ready ########################################################3 | ||
|
||
func _ready(): | ||
# if not OS.has_feature("steam"): | ||
# return | ||
init_steam() | ||
|
||
## process ########################################################3 | ||
|
||
func _process(_delta): | ||
# if not OS.has_feature("steam"): | ||
# return | ||
Steam.run_callbacks() | ||
|
||
## init steam ########################################################3 | ||
|
||
func init_steam() -> void: | ||
var status = Steam.steamInitEx() | ||
|
||
if status.get("status") != 0: | ||
Log.warn("Steam init failed, disabling steam interactions", status) | ||
enabled = false | ||
return | ||
|
||
Log.pr("Steam init success, enabling steam interactions", status) | ||
enabled = true | ||
|
||
# Gather additional data | ||
is_on_steam_deck = Steam.isSteamRunningOnSteamDeck() | ||
is_online = Steam.loggedOn() | ||
is_owned = Steam.isSubscribed() | ||
steam_id = Steam.getSteamID() | ||
steam_username = Steam.getPersonaName() | ||
|
||
Log.pr("Steam init data", { | ||
is_on_steam_deck=is_on_steam_deck, | ||
is_online=is_online, | ||
is_owned=is_owned, | ||
steam_id=steam_id, | ||
steam_username=steam_username, | ||
}) | ||
|
||
## achievements ########################################################3 | ||
|
||
func set_achievement(achv): | ||
if enabled: | ||
Steam.setAchievement(achv) | ||
Steam.storeStats() | ||
|
||
func clear_achievement(achv): | ||
if enabled: | ||
Steam.clearAchievement(achv) | ||
Steam.storeStats() | ||
|
||
func clear_test_achievements(): | ||
clear_achievement(TEST_ACHIEVEMENT) | ||
|
||
const TEST_ACHIEVEMENT="TEST_ACHIEVEMENT" | ||
|
||
func set_test_achievement(): | ||
set_achievement(TEST_ACHIEVEMENT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters