-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathsteam_init.gd
More file actions
38 lines (28 loc) · 821 Bytes
/
steam_init.gd
File metadata and controls
38 lines (28 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
extends Node
var app_id
var steam_id
var is_online: bool
var is_game_owned: bool
func is_steam_enabled():
return OS.has_feature("steam") or OS.is_debug_build()
func _init():
OS.set_environment("SteamAppID", str(app_id))
OS.set_environment("SteamGameID", str(app_id))
func _ready():
if not is_steam_enabled():
return
var init = Steam.steamInit()
print("Did Steam initialize?: "+str(init))
if init['status'] != 1:
print("Failed to initialize Steam. "+str(init['verbal'])+" Shutting down...")
get_tree().quit()
steam_id = Steam.getSteamID()
is_online = Steam.loggedOn()
is_game_owned = Steam.isSubscribed()
if is_game_owned == false:
print("User does not own this game")
get_tree().quit()
func _process(delta):
Steam.run_callbacks()
func get_profile_name():
return Steam.getPersonaName()