Skip to content

Commit

Permalink
Probably need cleanup I guess
Browse files Browse the repository at this point in the history
  • Loading branch information
morrowwolf committed Oct 27, 2023
1 parent c244681 commit 89a39f7
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions code/modules/admin/game_master/game_master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,7 @@ GLOBAL_VAR_INIT(radio_communication_clarity, 100)
return TRUE

SSminimaps.remove_marker(object)
for(var/list/cycled_objective in GLOB.game_master_objectives)
var/atom/objective_object = locate(cycled_objective["object_ref"])
if(objective_object == object)
GLOB.game_master_objectives.Remove(list(cycled_objective))
remove_objective(object)
return TRUE

if(tgui_alert(user, "Do you want to make [object] an objective?", "Confirmation", list("Yes", "No")) != "Yes")
Expand Down Expand Up @@ -308,6 +305,8 @@ GLOBAL_VAR_INIT(radio_communication_clarity, 100)

var/object_ref = REF(object)

RegisterSignal(object, COMSIG_PARENT_QDELETING, PROC_REF(remove_objective))

GLOB.game_master_objectives += list(list(
"object_name" = object.name,
"objective_info" = (objective_info || ""),
Expand All @@ -327,6 +326,14 @@ GLOBAL_VAR_INIT(radio_communication_clarity, 100)
current_submenus += new new_menu_type(user, object)
return TRUE

/datum/game_master/proc/remove_objective(datum/destroying_datum)
SIGNAL_HANDLER

for(var/list/cycled_objective in GLOB.game_master_objectives)
var/atom/objective_object = locate(cycled_objective["object_ref"])
if(objective_object == destroying_datum)
GLOB.game_master_objectives.Remove(list(cycled_objective))
UnregisterSignal(objective_object, COMSIG_PARENT_QDELETING)

#undef DEFAULT_SPAWN_XENO_STRING
#undef GAME_MASTER_AI_XENOS
Expand Down

0 comments on commit 89a39f7

Please sign in to comment.