Skip to content

Commit

Permalink
Give_to improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
Drulikar committed Jun 28, 2023
1 parent f7d30c9 commit 96c03d2
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions code/controllers/subsystem/minimap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -395,18 +395,24 @@ SUBSYSTEM_DEF(minimaps)
owner.client.screen += map
minimap_displayed = !minimap_displayed

/datum/action/minimap/give_to(mob/M)
/datum/action/minimap/give_to(mob/target)
. = ..()

if(default_overwatch_level)
map = SSminimaps.fetch_minimap_object(default_overwatch_level, minimap_flags)
else
RegisterSignal(M, COMSIG_MOVABLE_Z_CHANGED, PROC_REF(on_owner_z_change))
if(!SSminimaps.minimaps_by_z["[M.z]"] || !SSminimaps.minimaps_by_z["[M.z]"].hud_image)
RegisterSignal(target, COMSIG_MOVABLE_Z_CHANGED, PROC_REF(on_owner_z_change))

var/turf/turf_gotten = get_turf(target)
if(!turf_gotten)
return
var/z_level = turf_gotten.z

if(!SSminimaps.minimaps_by_z["[z_level]"] || !SSminimaps.minimaps_by_z["[z_level]"].hud_image)
return
map = SSminimaps.fetch_minimap_object(M.z, minimap_flags)
map = SSminimaps.fetch_minimap_object(z_level, minimap_flags)

/datum/action/minimap/remove_from(mob/M)
/datum/action/minimap/remove_from(mob/target)
. = ..()
if(minimap_displayed)
owner?.client?.screen -= map
Expand Down

0 comments on commit 96c03d2

Please sign in to comment.