@@ -37,19 +37,43 @@ if (!result.ok) {
3737## Callback Pumping
3838
3939Greenworks exposes an EventEmitter-style API. Node3D currently uses explicit
40- callback polling:
40+ callback polling. Event names use Greenworks' kebab-case strings, and
41+ Greenworks positional event arguments become named object fields:
4142
4243``` ts
4344import { update } from ' @node-3d/steam-api' ;
4445
4546for (const event of update ()) {
46- console .log (event );
47+ switch (event .type ) {
48+ case ' game-overlay-activated' :
49+ console .log (event .active );
50+ break ;
51+ case ' steam-server-connect-failure' :
52+ console .log (event .result , event .stillRetrying );
53+ break ;
54+ case ' dlc-installed' :
55+ console .log (event .appId );
56+ break ;
57+ }
4758}
4859```
4960
5061` update() ` calls ` steam.runCallbacks() ` and then drains
5162` callbacks.pollCallbacks() ` .
5263
64+ Implemented event mappings:
65+
66+ | Greenworks event | Node3D callback payload |
67+ | --- | --- |
68+ | ` game-overlay-activated ` , ` isActive ` | ` { type: 'game-overlay-activated', active, userInitiated, appId, overlayPid } ` |
69+ | ` steam-servers-connected ` | ` { type: 'steam-servers-connected' } ` |
70+ | ` steam-servers-disconnected ` | ` { type: 'steam-servers-disconnected', result } ` |
71+ | ` steam-server-connect-failure ` , ` statusCode ` | ` { type: 'steam-server-connect-failure', result, stillRetrying } ` |
72+ | ` steam-shutdown ` | ` { type: 'steam-shutdown' } ` |
73+ | ` dlc-installed ` , ` appId ` | ` { type: 'dlc-installed', appId } ` |
74+ | ` new-url-launch-parameters ` | ` { type: 'new-url-launch-parameters' } ` |
75+ | ` floating-gamepad-text-input-dismissed ` | ` { type: 'floating-gamepad-text-input-dismissed' } ` |
76+
5377## Current Capability Mappings
5478
5579| Greenworks | Node3D |
@@ -58,26 +82,76 @@ for (const event of update()) {
5882| ` greenworks.initAPI() ` | ` steam.initEx() ` |
5983| ` greenworks.restartAppIfNecessary(appId) ` | ` steam.restartAppIfNecessary(appId) ` |
6084| ` greenworks.isSteamRunning() ` | ` steam.isSteamRunning() ` |
85+ | ` greenworks.isSteamRunningOnSteamDeck() ` | ` utils.isSteamRunningOnSteamDeck() ` |
6186| ` greenworks.getSteamId() ` | ` user.getSteamId() ` |
6287| ` greenworks.getAppId() ` | ` utils.getAppId() ` |
88+ | ` greenworks.getAppBuildId() ` | ` apps.getAppBuildId() ` |
6389| ` greenworks.getCurrentGameLanguage() ` | ` apps.getCurrentGameLanguage() ` |
6490| ` greenworks.getCurrentUILanguage() ` | ` utils.getSteamUiLanguage() ` |
6591| ` greenworks.getAppInstallDir(appId, buffer, buffer_size) ` | ` apps.getAppInstallDir(appId) ` |
92+ | ` greenworks.getCurrentGameInstallDir() ` | ` apps.getCurrentGameInstallDir() ` |
93+ | ` greenworks.getLaunchCommandLine() ` | ` apps.getLaunchCommandLine() ` |
94+ | ` greenworks.activateGameOverlay(option) ` | ` friends.activateGameOverlay(dialog) ` |
95+ | ` greenworks.activateGameOverlayToWebPage(url) ` | ` friends.activateGameOverlayToWebPage(url) ` |
96+ | ` greenworks.activateGameOverlayToStore(appId, storeFlag) ` | ` friends.activateGameOverlayToStore(appId, flag) ` |
6697| ` greenworks.isGameOverlayEnabled() ` | ` utils.isOverlayEnabled() ` |
6798| ` greenworks.isSteamInBigPictureMode() ` | ` utils.isSteamInBigPictureMode() ` |
6899| ` greenworks.isSubscribedApp(appId) ` | ` apps.isSubscribedApp(appId) ` |
69100| ` greenworks.isAppInstalled(appId) ` | ` apps.isAppInstalled(appId) ` |
101+ | ` greenworks.getImageSize(handle) ` | ` utils.getImageSize(image) ` |
102+ | ` greenworks.getImageRGBA(handle) ` | ` utils.getImageRgba(image) ` |
70103| ` greenworks.getIPCountry() ` | ` utils.getIpCountry() ` |
71104| ` greenworks.getDLCCount() ` | ` apps.getDlcCount() ` |
72105| ` greenworks.getDLCDataByIndex(index) ` | ` apps.getDlcDataByIndex(index) ` |
73106| ` greenworks.isDLCInstalled(appId) ` | ` apps.isDlcInstalled(appId) ` |
107+ | ` greenworks.installDLC(appId) ` | ` apps.installDlc(appId) ` |
108+ | ` greenworks.uninstallDLC(appId) ` | ` apps.uninstallDlc(appId) ` |
74109| ` greenworks.getAuthSessionTicket(success, error) ` | ` user.getAuthSessionTicket() ` |
75110| ` greenworks.cancelAuthTicket(handle) ` | ` user.cancelAuthTicket(handle) ` |
111+ | ` greenworks.activateAchievement(name, success, error) ` | ` userStats.setAchievement(name) ` |
112+ | ` greenworks.indicateAchievementProgress(name, current, max) ` | ` userStats.indicateAchievementProgress(name, current, max) ` |
113+ | ` greenworks.getAchievement(name, success, error) ` | ` userStats.getAchievement(name) ` |
114+ | ` greenworks.clearAchievement(name, success, error) ` | ` userStats.clearAchievement(name) ` |
115+ | ` greenworks.getAchievementNames() ` | ` userStats.getAchievementNames() ` |
76116| ` greenworks.getNumberOfAchievements() ` | ` userStats.getNumAchievements() ` |
77117| ` greenworks.getStatInt(name) ` | ` userStats.getStatInt(name) ` |
78118| ` greenworks.getStatFloat(name) ` | ` userStats.getStatFloat(name) ` |
119+ | ` greenworks.setStat(name, value) ` | ` userStats.setStat(name, value) ` |
120+ | ` greenworks.storeStats(success, error) ` | ` userStats.storeStats() ` |
79121| ` greenworks.resetAllStats(achievementsToo) ` | ` userStats.resetAllStats(achievementsToo) ` |
80122
123+ ## Enum Mappings
124+
125+ Greenworks enum objects are available as top-level Node3D exports with the same
126+ object names:
127+
128+ ``` ts
129+ import { FriendFlags , LobbyType , Result } from ' @node-3d/steam-api' ;
130+ ```
131+
132+ Available enum objects:
133+
134+ - ` FriendFlags `
135+ - ` FriendRelationship `
136+ - ` PersonaChange `
137+ - ` AccountType `
138+ - ` ChatEntryType `
139+ - ` ChatMemberStateChange `
140+ - ` LobbyComparison `
141+ - ` LobbyDistanceFilter `
142+ - ` LobbyType `
143+ - ` Result `
144+ - ` UGCMatchingType `
145+ - ` UGCQueryType `
146+ - ` UserUGCList `
147+ - ` UserUGCListSortOrder `
148+ - ` UGCItemState `
149+ - ` FloatingGamepadTextInputMode `
150+ - ` P2PSendType `
151+
152+ ` FriendFlags.Suggested ` is not exported because it was removed from the
153+ Steamworks SDK and Greenworks had already disabled that member in source.
154+
81155## Stat and Achievement Differences
82156
83157Greenworks combines integer and floating point stat writes:
@@ -86,17 +160,19 @@ Greenworks combines integer and floating point stat writes:
86160greenworks .setStat (' score' , 10 );
87161```
88162
89- Node3D exposes the underlying type choice explicitly:
163+ Node3D supports the combined helper and also exposes the underlying type choice
164+ explicitly:
90165
91166``` ts
92167import { userStats } from ' @node-3d/steam-api' ;
93168
169+ userStats .setStat (' score' , 10 );
94170userStats .setStatInt (' score' , 10 );
95171userStats .setStatFloat (' accuracy' , 0.75 );
96172```
97173
98174Greenworks uses callback-style achievement helpers for set/get/clear. Node3D
99- currently exposes direct-return equivalents:
175+ exposes direct-return equivalents:
100176
101177``` ts
102178userStats .setAchievement (' ACH_WIN_ONE_GAME' );
@@ -125,5 +201,5 @@ Currently missing major Greenworks capability families:
125201- workshop and UGC,
126202- archive utilities,
127203- floating gamepad text input,
128- - many Greenworks event outcomes,
129- - Greenworks enum object exports .
204+ - Greenworks event outcomes tied to missing API families ,
205+ - Greenworks constants that require additional SDK libraries .
0 commit comments