Skip to content

Commit

Permalink
slight changes to bh overrides and qdel signals
Browse files Browse the repository at this point in the history
  • Loading branch information
xDanilcusx committed Apr 1, 2024
1 parent bf995f4 commit 295ae64
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ GLOBAL_LIST_EMPTY(all_ai_behavior_overrides)

/// Override this to check if we want our behavior to be valid for the checked_xeno, passes the common factor of "distance" which is the distance between the checked_xeno and src parent
/datum/component/ai_behavior_override/proc/check_behavior_validity(mob/living/carbon/xenomorph/checked_xeno, distance)
if(length(currently_assigned) >= max_assigned && !(checked_xeno in currently_assigned))
if(!search_assign || length(currently_assigned) >= max_assigned && !(checked_xeno in currently_assigned))
remove_from_queue(checked_xeno)
return FALSE

Expand All @@ -71,12 +71,12 @@ GLOBAL_LIST_EMPTY(all_ai_behavior_overrides)
RegisterSignal(processing_xeno, COMSIG_PARENT_QDELETING, PROC_REF(remove_from_queue), TRUE)
currently_assigned |= processing_xeno

else if(!LAZYLEN(currently_assigned))
qdel(src)

return TRUE

/datum/component/ai_behavior_override/proc/remove_from_queue(mob/removed_xeno)
SIGNAL_HANDLER
LAZYREMOVE(currently_assigned, removed_xeno)
UnregisterSignal(removed_xeno, COMSIG_PARENT_QDELETING)

if(!search_assign && !LAZYLEN(currently_assigned))
qdel(src)
21 changes: 9 additions & 12 deletions code/modules/admin/game_master/game_master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ GLOBAL_VAR_INIT(radio_communication_clarity, 100)
#define SELECTABLE_XENO_BEHAVIORS list("Attack", "Capture", "Hive", "Build")
#define SELECTABLE_XENO_BEHAVIORS_ASSOC list("Attack" = /datum/component/ai_behavior_override/attack, "Capture" = /datum/component/ai_behavior_override/capture, "Hive" = /datum/component/ai_behavior_override/hive, "Build" = /datum/component/ai_behavior_override/build)

#define DEFAULT_BEHAVIOR_LIFE_SPAN 15
#define DEFAULT_BEHAVIOR_LIFE_SPAN 0

// Objective stuff
#define OBJECTIVE_NUMBER_OPTIONS list("zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine")
Expand Down Expand Up @@ -416,20 +416,15 @@ GLOBAL_VAR_INIT(radio_communication_clarity, 100)

return TRUE

if(!LAZYACCESS(modifiers, SHIFT_CLICK))
for(var/deselected_xeno in controlled_xenos)
deselect_xeno(deselected_xeno)

if(isxeno(object))
if(object in controlled_xenos)
deselect_xeno(object)
return TRUE

if(!LAZYACCESS(modifiers, SHIFT_CLICK))
for(var/deselected_xeno in controlled_xenos)
deselect_xeno(deselected_xeno)

select_xeno(object)
return TRUE

for(var/deselected_xeno in controlled_xenos)
deselect_xeno(deselected_xeno)
else
select_xeno(object)
return TRUE

if(OBJECTIVE_CLICK_INTERCEPT_ACTION)
Expand Down Expand Up @@ -527,6 +522,7 @@ GLOBAL_VAR_INIT(radio_communication_clarity, 100)
select_xeno(cycled_xeno)

/datum/game_master/proc/select_xeno(selected_xeno)
RegisterSignal(selected_xeno, COMSIG_PARENT_QDELETING, PROC_REF(deselect_xeno), TRUE)
controlled_xenos |= selected_xeno
if(controlled_xenos?[selected_xeno])
return
Expand All @@ -537,6 +533,7 @@ GLOBAL_VAR_INIT(radio_communication_clarity, 100)
game_master_client.images |= selection_image

/datum/game_master/proc/deselect_xeno(deselected_xeno)
UnregisterSignal(deselected_xeno, COMSIG_PARENT_QDELETING)
game_master_client.images -= controlled_xenos[deselected_xeno]
controlled_xenos -= deselected_xeno

Expand Down

0 comments on commit 295ae64

Please sign in to comment.