Skip to content

Commit 9b76c5c

Browse files
committed
Prevent losing control when loading save
1 parent 8be1d93 commit 9b76c5c

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

Extensions/PlatformBehavior/platformerobjectruntimebehavior.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ namespace gdjs {
342342
// Clear user inputs between frames only if requested.
343343
this._clearInputsBetweenFrames = !!options.clearMemory;
344344
// And we are not using the default controls.
345-
this._ignoreDefaultControlsAsSyncedByNetwork = true;
345+
this._ignoreDefaultControlsAsSyncedByNetwork = !options.keepControl;
346346
}
347347

348348
updateFromBehaviorData(oldBehaviorData, newBehaviorData): boolean {

Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ namespace gdjs {
174174
// Clear user inputs between frames only if requested.
175175
this._clearInputsBetweenFrames = !!options.clearMemory;
176176
// And we are not using the default controls.
177-
this._ignoreDefaultControlsAsSyncedByNetwork = true;
177+
this._ignoreDefaultControlsAsSyncedByNetwork = !options.keepControl;
178178
}
179179

180180
updateFromBehaviorData(oldBehaviorData, newBehaviorData): boolean {

GDJS/Runtime/scenestack.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ namespace gdjs {
3737
_loadGameFromSave(saveState: GameSaveState): void {
3838
const options: UpdateFromNetworkSyncDataOptions = {
3939
clearMemory: true,
40+
keepControl: true,
4041
};
4142

4243
this._runtimeGame.updateFromNetworkSyncData(

GDJS/Runtime/types/project-data.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ declare type GetNetworkSyncDataOptions = {
4747

4848
declare type UpdateFromNetworkSyncDataOptions = {
4949
clearMemory?: boolean;
50+
keepControl?: boolean;
5051
};
5152

5253
/** Object containing basic properties for all objects synchronizing over the network. */

0 commit comments

Comments
 (0)