Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ChapterMaster.yyp
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@
{"id":{"name":"__HTTPParent","path":"scripts/__HTTPParent/__HTTPParent.yy",},},
{"id":{"name":"__StructToDSMap","path":"scripts/__StructToDSMap/__StructToDSMap.yy",},},
{"id":{"name":"Armamentarium","path":"scripts/Armamentarium/Armamentarium.yy",},},
{"id":{"name":"artifact_functions","path":"scripts/artifact_functions/artifact_functions.yy",},},
{"id":{"name":"scr_artifact_functions","path":"scripts/scr_artifact_functions/scr_artifact_functions.yy",},},
{"id":{"name":"ArtifactStruct","path":"scripts/ArtifactStruct/ArtifactStruct.yy",},},
{"id":{"name":"AudioManager","path":"scripts/AudioManager/AudioManager.yy",},},
{"id":{"name":"ColourItem","path":"scripts/ColourItem/ColourItem.yy",},},
Expand Down Expand Up @@ -767,7 +767,7 @@
{"id":{"name":"HTTPGet","path":"scripts/HTTPGet/HTTPGet.yy",},},
{"id":{"name":"HTTPGetFile","path":"scripts/HTTPGetFile/HTTPGetFile.yy",},},
{"id":{"name":"HTTPRequest","path":"scripts/HTTPRequest/HTTPRequest.yy",},},
{"id":{"name":"instance_create","path":"scripts/instance_create/instance_create.yy",},},
{"id":{"name":"scr_instance_functions","path":"scripts/scr_instance_functions/scr_instance_functions.yy",},},
{"id":{"name":"is_specialist","path":"scripts/is_specialist/is_specialist.yy",},},
{"id":{"name":"JsonFileListLoader","path":"scripts/JsonFileListLoader/JsonFileListLoader.yy",},},
{"id":{"name":"LocalizationManager","path":"scripts/LocalizationManager/LocalizationManager.yy",},},
Expand Down
6 changes: 1 addition & 5 deletions objects/obj_fleet/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@ pla_fleet = instance_nearest(x, y, obj_p_fleet);
ene_fleet = instance_nearest(x, y, obj_en_fleet);
victory = false;

instance_deactivate_all(true);
instance_activate_object(obj_controller);
instance_activate_object(obj_ini);
instance_activate_object(obj_cursor);
instance_activate_object(obj_img);
instance_deactivate_all_safe();

column[0] = "";
column_width[0] = 0; // This is determined at the pre-battle screen
Expand Down
4 changes: 1 addition & 3 deletions objects/obj_popup/Alarm_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ if (battle_special == 3.1) {
obj_ncombat.threat = 4;
obj_ncombat.formation_set = 3;

instance_deactivate_all(true);
instance_activate_object(obj_ini);
instance_activate_object(obj_controller);
instance_deactivate_all_safe();
instance_activate_object(obj_ncombat);

_roster = new Roster();
Expand Down
8 changes: 2 additions & 6 deletions objects/obj_popup/Destroy_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ if ((image == "chaos_symbol") && (title == "Concealed Heresy") && instance_exist
// ** Starts the battle **
is_in_combat = true;

instance_deactivate_all(true);
instance_activate_object(obj_controller);
instance_activate_object(obj_ini);
instance_deactivate_all_safe();
instance_activate_object(obj_drop_select);

instance_create(0, 0, obj_ncombat);
Expand Down Expand Up @@ -97,9 +95,7 @@ if (instance_exists(obj_controller)) {

scr_civil_roster(obj_ncombat.battle_loc, obj_ncombat.battle_id, true);

instance_deactivate_all(true);
instance_activate_object(obj_controller);
instance_activate_object(obj_ini);
instance_deactivate_all_safe();
instance_activate_object(obj_temp_meeting);
instance_activate_object(obj_ncombat);
instance_activate_object(obj_centerline);
Expand Down
4 changes: 1 addition & 3 deletions objects/obj_star_select/Mouse_50.gml
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,7 @@ if (!instance_exists(obj_saveload) && !instance_exists(obj_drop_select)) {

combating = 1;

instance_deactivate_all(true);
instance_activate_object(obj_controller);
instance_activate_object(obj_ini);
instance_deactivate_all_safe();
instance_activate_object(p_fleet);
instance_activate_object(obj_star);

Expand Down
9 changes: 2 additions & 7 deletions objects/obj_turn_end/Mouse_56.gml
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,8 @@ if (!instance_exists(obj_saveload) && !instance_exists(obj_popup) && !instance_e

add_fleet_ships_to_combat(battle_pobject[current_battle], _battle_instance);

instance_deactivate_all(true);
instance_activate_object(obj_controller);
instance_activate_object(obj_ini);
instance_deactivate_all_safe();
instance_activate_object(_battle_instance);
instance_activate_object(obj_cursor);
}
}

Expand All @@ -111,9 +108,7 @@ if (!instance_exists(obj_saveload) && !instance_exists(obj_popup) && !instance_e

combating = 1;

instance_deactivate_all(true);
instance_activate_object(obj_controller);
instance_activate_object(obj_ini);
instance_deactivate_all_safe();
instance_activate_object(battle_object[current_battle]);

var _battle_obj = battle_object[current_battle];
Expand Down
17 changes: 12 additions & 5 deletions scripts/GitHubOAuth/GitHubOAuth.gml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ function GitHubOAuth(_clientID, _clientSecret = undefined) constructor {
__GitHubError("requestAuthenticationViaWebPage: Web-flow authentication is only supported on desktop platforms, please use device-flow for non-desktop platforms");
}

// Ensure server does not exist
if (__github_worker.__server != undefined || __GitHubSystem().__pollTimesource != undefined) {
// Ensure no active request (centralized check handles deactivated worker)
if (__GitHubHasActiveRequest()) {
__GitHubWarn("requestAuthenticationViaWebPage: Request is already in progress, ensure there is not another authentication request in-progress.");
return;
}
Expand All @@ -49,8 +49,8 @@ function GitHubOAuth(_clientID, _clientSecret = undefined) constructor {
/// @arg {Array.String} scope An array of authentication scopes.
/// @returns {Struct.GitHubRequest}
static requestAuthentication = function(_scope) {
// Ensure server does not exist
if (__GitHubSystem().__pollTimesource != undefined || __github_worker.__server != undefined) {
// Ensure no active request (centralized check handles deactivated worker)
if (__GitHubHasActiveRequest()) {
__GitHubWarn("requestAuthentication: Request is already in progress, ensure there is not another authentication request in-progress.");
return;
}
Expand Down Expand Up @@ -134,7 +134,7 @@ function GitHubOAuth(_clientID, _clientSecret = undefined) constructor {
/// @desc Returns if there is an active authentication request in-progress.
/// @returns {Bool}
static hasActiveRequest = function() {
return __GitHubSystem().__pollTimesource != undefined || __github_worker.__server != undefined;
return __GitHubHasActiveRequest();
};

/// @func setAuthenticationCallback(callback)
Expand Down Expand Up @@ -371,6 +371,13 @@ function GitHubOAuth(_clientID, _clientSecret = undefined) constructor {
};
}

/// @ignore
// Centralized active-request check - ensures worker is visible before checking __server (deactivated hides handle)
function __GitHubHasActiveRequest() {
Comment thread
EttyKitty marked this conversation as resolved.
__GitHubEnsureInstance();
return __GitHubSystem().__pollTimesource != undefined || (__github_worker.__server != undefined);
}

/// Stops and destroys the device-flow polling timesource and clears the poll state.
/// Shared by the timeout branch, terminal-error path, success callback, errorback
/// and cancelAuthentication so lifecycle handling cannot diverge.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
/// Request a server shutdown
/// @ignore
function __GitHubRequestServerShutdown() {
__GitHubEnsureInstance();

// Only schedule a shutdown when a web-flow server exists. Starting the delayed shutdown
// without a server would destroy a server created by a later request.
if (__github_worker.__server == undefined) {
Expand Down
2 changes: 2 additions & 0 deletions scripts/__GitHubServerShutdown/__GitHubServerShutdown.gml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
/// Actual shutdown
/// @ignore
function __GitHubServerShutdown() {
__GitHubEnsureInstance();

// Check server for an active web-flow authentication
if (__github_worker.__server != undefined) {
// Destroy the network
Expand Down
30 changes: 21 additions & 9 deletions scripts/__GitHubTick/__GitHubTick.gml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,29 @@
/// @ignore
function __GitHubTick() {
var _system = __GitHubSystem();
var _expire = _system.__authenticationExpireTime;

if (_system.__authenticationExpireTime != undefined && _system.__authenticationExpireTime > 0) {
if (_expire != undefined && _expire > 0) {
_system.__authenticationExpireTime--;
} else if (_system.__authenticationExpireTime != undefined && _system.__authenticationExpireTime <= 0 && __github_worker.__server != undefined && !__GitHubServerShuttingDown()) {
// Always request the shutdown first so a throwing timeout callback
// cannot leave the authentication server active
__GitHubRequestServerShutdown();
return;
}

if (_expire == undefined || _expire > 0) {
Comment thread
EttyKitty marked this conversation as resolved.
return;
}

__GitHubEnsureInstance();

if (__github_worker.__server == undefined || __GitHubServerShuttingDown()) {
return;
}

// Always request the shutdown first so a throwing timeout callback
// cannot leave the authentication server active
__GitHubRequestServerShutdown();

// Fire the timeout callback only once per shutdown sequence.
if (is_callable(_system.__authenticationTimeoutCallback)) {
_system.__authenticationTimeoutCallback();
}
// Fire the timeout callback only once per shutdown sequence.
if (is_callable(_system.__authenticationTimeoutCallback)) {
_system.__authenticationTimeoutCallback();
}
}
6 changes: 1 addition & 5 deletions scripts/__GitHubWarn/__GitHubWarn.gml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,5 @@

/// @ignore
function __GitHubWarn(_string) {
if (GITHUB_GML_RUNNING_FROM_IDE) {
show_error($" \nGitHub.gml:\n{_string}\n ", true);
} else {
show_debug_message($"GitHub.gml: Warning! {_string}");
}
show_debug_message($"GitHub.gml: Warning! {_string}");
}
13 changes: 0 additions & 13 deletions scripts/instance_create/instance_create.yy

This file was deleted.

6 changes: 2 additions & 4 deletions scripts/scr_ancient_ruins/scr_ancient_ruins.gml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ function scr_ancient_ruins_setup() {
/// @self Struct.PlanetData
function scr_ruins_suprise_attack_player() {
try {
instance_deactivate_all(true);
instance_activate_object(obj_controller);
instance_activate_object(obj_ini);
instance_deactivate_all_safe();
instance_activate_object(obj_star_select);
instance_activate_object(obj_star);
instance_activate_object(obj_ground_mission);
Expand Down Expand Up @@ -342,7 +340,7 @@ function ruins_exploration_main_sequence() {
add_option({
str1: "To Battle",
choice_func: function() {
instance_deactivate_all(true);
instance_deactivate_all_safe();
instance_activate_object(obj_ground_mission);
instance_activate_object(obj_popup);
var _explore_feature = obj_ground_mission.explore_feature;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions scripts/scr_dialogue/scr_dialogue.gml
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,7 @@ function scr_dialogue(diplo_keyphrase, data = {}) {
}
scr_civil_roster(obj_ncombat.battle_loc, obj_ncombat.battle_id, true);

instance_deactivate_all(true);
instance_activate_object(obj_controller);
instance_activate_object(obj_ini);
instance_deactivate_all_safe();
instance_activate_object(obj_temp_meeting);
instance_activate_object(obj_ncombat);
instance_activate_object(obj_centerline);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,7 @@ function drop_select_unit_selection() {
obj_controller.last_raid_form = formation_possible[formation_current];
}

instance_deactivate_all(true);
instance_activate_object(obj_controller);
instance_activate_object(obj_ini);
instance_deactivate_all_safe();
instance_activate_object(obj_drop_select);

// 135 ; temporary balancing
Expand Down
4 changes: 1 addition & 3 deletions scripts/scr_inquisition_mission/scr_inquisition_mission.gml
Original file line number Diff line number Diff line change
Expand Up @@ -786,9 +786,7 @@ function necron_tomb_mission_sequence() {
}

if (battle > 0) {
instance_deactivate_all(true);
instance_activate_object(obj_controller);
instance_activate_object(obj_ini);
instance_deactivate_all_safe();
instance_activate_object(obj_star);

instance_create(0, 0, obj_ncombat);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,16 @@ function instances_exist_any(instance_set = []) {
}
return _exists;
}

/// @desc Deactivates all instances but preserves critical infrastructure workers.
function instance_deactivate_all_safe() {
instance_deactivate_all(true);
Comment thread
EttyKitty marked this conversation as resolved.
instance_activate_object(__github_worker);
instance_activate_object(obj_persistent);
instance_activate_object(obj_garbage_collector);
instance_activate_object(obj_img);
instance_activate_object(obj_controller);
instance_activate_object(obj_ini);
instance_activate_object(obj_cursor);
instance_activate_object(obj_timer);
}
13 changes: 13 additions & 0 deletions scripts/scr_instance_functions/scr_instance_functions.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions scripts/scr_purge_world/scr_purge_world.gml
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,7 @@ function scr_purge_world(action_type, action_score) {
obj_controller.cooldown = 30;
combating = 1; // Start battle here

instance_deactivate_all(true);
instance_activate_object(obj_controller);
instance_activate_object(obj_ini);
instance_deactivate_all_safe();
instance_activate_object(obj_drop_select);

instance_create(0, 0, obj_ncombat);
Expand Down
Loading