Skip to content

Commit

Permalink
Marker objective checks
Browse files Browse the repository at this point in the history
  • Loading branch information
morrowwolf committed Oct 27, 2023
1 parent e717851 commit b7f97cd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
16 changes: 16 additions & 0 deletions code/controllers/subsystem/minimap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,22 @@ SUBSYSTEM_DEF(minimaps)
for(var/flag in GLOB.all_minimap_flags)
minimaps_by_z["[z_level]"].images_assoc["[flag]"] -= source

/// Checks if the source has a marker already set
/datum/controller/subsystem/minimaps/proc/has_marker(atom/source)
var/turf/turf_gotten = get_turf(source)

if(!turf_gotten)
return

var/z_level = turf_gotten.z

if(minimaps_by_z["[z_level]"])
for(var/flag in GLOB.all_minimap_flags)
if(source in minimaps_by_z["[z_level]"].images_assoc["[flag]"])
return TRUE

return FALSE

/**
* Fetches a /atom/movable/screen/minimap instance or creates on if none exists
* Note this does not destroy them when the map is unused, might be a potential thing to do?
Expand Down
18 changes: 11 additions & 7 deletions code/modules/admin/game_master/game_master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -242,20 +242,19 @@ GLOBAL_VAR_INIT(radio_communication_clarity, 100)
return TRUE

if(OBJECTIVE_CLICK_INTERCEPT_ACTION)
if(object in GLOB.game_master_objectives)
var/turf/object_turf = get_turf(object)

if(!object_turf)
return TRUE

if(SSminimaps.has_marker(object))
if(tgui_alert(user, "Do you want to remove [object] as an objective?", "Confirmation", list("Yes", "No")) != "Yes")
return TRUE

SSminimaps.remove_marker(object)
GLOB.game_master_objectives -= object
return TRUE

var/turf/object_turf = get_turf(object)
if(!object_turf)
return TRUE

var/z_level = object_turf.z

if(tgui_alert(user, "Do you want to make [object] an objective?", "Confirmation", list("Yes", "No")) != "Yes")
return TRUE

Expand All @@ -277,6 +276,11 @@ GLOBAL_VAR_INIT(radio_communication_clarity, 100)

background.overlays += icon

var/z_level = object_turf?.z

if(!object || !z_level)
return

SSminimaps.add_marker(object, z_level, MINIMAP_FLAG_USCM, given_image = background)

/// objective_info needs to be implemented both in the game master menu and overwatch TGUI
Expand Down

0 comments on commit b7f97cd

Please sign in to comment.