From 8ed5b4aaf0af2b67bd6758ab0295d7bc4b8ccb93 Mon Sep 17 00:00:00 2001 From: EttyKitty <20323032+EttyKitty@users.noreply.github.com> Date: Mon, 25 Nov 2024 21:38:19 +0300 Subject: [PATCH] refactor: Replace a bunch of global vars with macro (#151) --- objects/obj_pnunit/Alarm_5.gml | 3 ++- objects/obj_popup/Create_0.gml | 5 ++-- scripts/scr_add_artifact/scr_add_artifact.gml | 3 ++- .../scr_draw_unit_image.gml | 7 +++--- .../scr_draw_unit_stat_data.gml | 3 ++- .../scr_keyboard_helpers.gml | 22 +++++++++-------- .../scr_marine_struct/scr_marine_struct.gml | 24 ++++++++++--------- .../scr_pen_And_paper/scr_pen_And_paper.gml | 4 ++-- scripts/scr_ui_manage/scr_ui_manage.gml | 8 ++++--- .../scr_unit_detail_text.gml | 11 +++++---- .../scr_unit_equip_functions.gml | 2 +- 11 files changed, 53 insertions(+), 39 deletions(-) diff --git a/objects/obj_pnunit/Alarm_5.gml b/objects/obj_pnunit/Alarm_5.gml index 5b964bff5..bc7b098da 100644 --- a/objects/obj_pnunit/Alarm_5.gml +++ b/objects/obj_pnunit/Alarm_5.gml @@ -81,7 +81,8 @@ i=0; if (marine_dead[i]=0) and (unit.gene_seed_mutations.mucranoid==1) and (ally[i]=false){ var muck=floor(random(200))+1; if (muck=50){ //slime is armour destroyed due to mucranoid - if (array_contains(global.power_armour,unit.armour())){ + var _power_armour = ARR_power_armour; + if (array_contains(_power_armour,unit.armour())){ unit.update_armour("", false, false); obj_ncombat.mucra[marine_co[i]]=1; obj_ncombat.slime+=1; diff --git a/objects/obj_popup/Create_0.gml b/objects/obj_popup/Create_0.gml index 5607fab00..f01d097e4 100644 --- a/objects/obj_popup/Create_0.gml +++ b/objects/obj_popup/Create_0.gml @@ -334,8 +334,9 @@ calculate_equipment_needs = function (){ // This checks to see if there is any more in the armoury if (req_armour=="Power Armour"){ - for (i=0;i0){ - for (var i=0;i1) and (bionic_count <=4)){ diff --git a/scripts/scr_unit_equip_functions/scr_unit_equip_functions.gml b/scripts/scr_unit_equip_functions/scr_unit_equip_functions.gml index baf98ea5a..8d858e94d 100644 --- a/scripts/scr_unit_equip_functions/scr_unit_equip_functions.gml +++ b/scripts/scr_unit_equip_functions/scr_unit_equip_functions.gml @@ -28,7 +28,7 @@ function scr_update_unit_armour(new_armour, from_armoury=true, to_armoury=true, if (_new_power_armour){ require_carpace=true; if (new_armour=="Power Armour"){ - armour_list = global.power_armour; + armour_list = ARR_power_armour; } } else if (new_armour="Terminator Armour"){ require_carpace=true;