Skip to content

Commit dd2d2c0

Browse files
committed
Moved __SimCallbackClass to a separate script
1 parent bc11b04 commit dd2d2c0

7 files changed

Lines changed: 25 additions & 6 deletions

File tree

SimThreads.yyp

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
function __SimCallbackClass(_callback, _args) constructor {
2+
callback = _callback;
3+
args = _args;
4+
}

scripts/__SimCallbackClass/__SimCallbackClass.yy

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/__simsanitize/__simsanitize.gml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ function __SimSanitize(_entry, _args = undefined) {
88
} else {
99
if (!variable_instance_exists(_newEntry, "args")) {
1010
_newEntry.args = _mainArgs;
11+
} else if (_newEntry.args == undefined) {
12+
_newEntry.args = _mainArgs;
1113
}
1214
}
1315
return _newEntry;

scripts/simcallback/simcallback.gml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,5 @@
22
/// @param callback
33
/// @param args
44
function SimCallback(_callback, _args = undefined) {
5-
return new __SimCallback(_callback, _args);
6-
}
7-
8-
function __SimCallback(_callback, _args) constructor {
9-
callback = _callback;
10-
args = _args;
5+
return new __SimCallbackClass(_callback, _args);
116
}

scripts/simthread/simthread.gml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ function SimThread(_maxExecution = infinity) constructor {
1616
__currentTimer = time_source_create(time_source_global, 1, time_source_units_frames, method(self, __Update), [], -1);
1717
time_source_start(__currentTimer);
1818

19+
#region Public Methods
1920
/// @desc Forces the Simthread to stop whatever code is being executed during the response (in the case of a loop).
2021
/// Note: This only interrupts the loop, but not the current callback that's still processing. You will need to call return; or exit; to exit out of the callback.
2122
/// @self SimThread
@@ -171,7 +172,9 @@ function SimThread(_maxExecution = infinity) constructor {
171172
++__size;
172173
return _response;
173174
}
175+
#endregion
174176

177+
#region Private Methods
175178
static __Execute = function() {
176179
__pos = __pos % __size;
177180
__pushNextPointer = 1;
@@ -227,4 +230,5 @@ function SimThread(_maxExecution = infinity) constructor {
227230
time_source_stop(__currentTimer);
228231
}
229232
}
233+
#endregion
230234
}

scripts/simtick/simtick.gml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ function SimTick(_ticks = game_get_speed(gamespeed_fps)) constructor {
2626
}, [], -1);
2727
time_source_start(__currentTimer);
2828

29+
#region Public Methods
2930
/// @desc Pauses the SimTick
3031
/// @self SimTick
3132
/// @returns {Struct.SimTick}
@@ -117,4 +118,5 @@ function SimTick(_ticks = game_get_speed(gamespeed_fps)) constructor {
117118
time_source_destroy(__currentTimer);
118119
__ticksQueue = undefined;
119120
}
121+
#endregion
120122
}

0 commit comments

Comments
 (0)