Skip to content

Commit

Permalink
fix: Unset global variable crashing artificer armour (Adeptus-Dominus…
Browse files Browse the repository at this point in the history
…#215)

add error handling to drawing unit imagine.
as stated should fix:
https://discord.com/channels/714022226810372107/1318224998179012669
  • Loading branch information
OH296 authored Dec 16, 2024
1 parent ab72c41 commit dd0af92
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/scr_draw_unit_image/scr_draw_unit_image.gml
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ function scr_draw_unit_image(_background=false){
var modest_livery = obj_controller.modest_livery;
var progenitor_visuals = obj_controller.progenitor_visuals;
var draw_sequence = [];
try {
if (name_role()!="") and (base_group=="astartes"){
for (var i = 1; i <= 2; i++) {
ui_weapon[i]=spr_weapon_blank;
Expand All @@ -426,7 +427,7 @@ function scr_draw_unit_image(_background=false){
var specialist_colours=obj_ini.col_special;
var specific_armour_sprite = "none";
var unit_chapter = global.chapter_name;
var unit_progenitor = progenitor_visuals ? progenitor_map() : "";
var unit_progenitor = progenitor_visuals ? progenitor_map() : 0;
var unit_is_sniper = false;
var unit_role = role();
var unit_wep1=weapon_one();
Expand Down Expand Up @@ -1041,7 +1042,7 @@ function scr_draw_unit_image(_background=false){
draw_sprite(spr_ultra_honor_guard2,2,x_surface_offset,y_surface_offset);
}
}
if (unit_chapter=="Blood Angels" || global.chapter_id == eCHAPTERS.BLOOD_ANGELS){
if (unit_chapter=="Blood Angels" || unit_progenitor == eCHAPTERS.BLOOD_ANGELS){
if (unit_role=="Chapter Master"){

armour_bypass=true;
Expand Down Expand Up @@ -1158,7 +1159,7 @@ function scr_draw_unit_image(_background=false){
}

if (body.torso.backpack_variation % 3 == 0) {
if (unit_progenitor=="Dark Angels"){
if (unit_progenitor == ePROGENITOR.DARK_ANGELS){
if array_contains(["MK5 Heresy", "MK6 Corvus","MK7 Aquila", "MK8 Errant", "Artificer Armour"], unit_armour){
_backpack_sprite = spr_da_backpack;
complex_set.add_to_area("backpack",spr_da_backpack);
Expand Down Expand Up @@ -1729,6 +1730,9 @@ function scr_draw_unit_image(_background=false){
}
// if (race()!="1"){draw_set_color(38144);draw_rectangle(0,x_surface_offset,y_surface_offset+166,0+231,0);}
}
}catch(_exception) {
handle_exception(_exception);
}

draw_set_alpha(1);

Expand Down

0 comments on commit dd0af92

Please sign in to comment.