Skip to content

Commit

Permalink
Tiny holomap code cleanup (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorDinamit authored Jul 9, 2023
1 parent 8ddd4bf commit 0ddaf29
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions code/modules/holomap/ship_holomap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -102,29 +102,31 @@
return TRUE

/obj/machinery/ship_map/proc/startWatching(var/mob/user)
if(isliving(user) && anchored && !(stat & (NOPOWER|BROKEN)))
if(user.client)
holomap_datum.station_map.loc = GLOB.global_hud.holomap // Put the image on the holomap hud
holomap_datum.station_map.alpha = 0 // Set to transparent so we can fade in
animate(holomap_datum.station_map, alpha = 255, time = 5, easing = LINEAR_EASING)
flick("station_map_activate", src)
user.client.screen |= GLOB.global_hud.holomap
user.client.images |= holomap_datum.station_map

watching_mob = user
GLOB.moved_event.register(watching_mob, src, /obj/machinery/ship_map/proc/checkPosition)
GLOB.destroyed_event.register(watching_mob, src, /obj/machinery/ship_map/proc/stopWatching)
update_use_power(POWER_USE_ACTIVE)

if(bogus)
to_chat(user, SPAN_WARNING("The holomap failed to initialize. This area of space cannot be mapped."))
else
to_chat(user, SPAN_NOTICE("A hologram of your current location appears before your eyes."))
if(!isliving(user) || !anchored || !operable() || !user.client)
return FALSE

holomap_datum.station_map.loc = GLOB.global_hud.holomap // Put the image on the holomap hud
holomap_datum.station_map.alpha = 0 // Set to transparent so we can fade in
animate(holomap_datum.station_map, alpha = 255, time = 5, easing = LINEAR_EASING)
flick("station_map_activate", src)
user.client.screen |= GLOB.global_hud.holomap
user.client.images |= holomap_datum.station_map

watching_mob = user
GLOB.moved_event.register(watching_mob, src, /obj/machinery/ship_map/proc/checkPosition)
GLOB.destroyed_event.register(watching_mob, src, /obj/machinery/ship_map/proc/stopWatching)
update_use_power(POWER_USE_ACTIVE)

if(bogus)
to_chat(user, SPAN_WARNING("The holomap failed to initialize. This area of space cannot be mapped."))
else
to_chat(user, SPAN_NOTICE("A hologram of your current location appears before your eyes."))

START_PROCESSING_MACHINE(src, MACHINERY_PROCESS_SELF)

START_PROCESSING_MACHINE(src, MACHINERY_PROCESS_SELF)

/obj/machinery/ship_map/Process()
if((stat & (NOPOWER|BROKEN)))
if(!operable())
stopWatching()
return PROCESS_KILL

Expand Down

0 comments on commit 0ddaf29

Please sign in to comment.