Files
Bubberstation/code/datums/elements/nav_computer_icon.dm
Cruix 3a25ac7f94 Nav computer icons (#88169)
## About The Pull Request

To add context when placing a custom shuttle location, added additional
icons to the shuttle navigation computer view for a few important
objects:
* The shuttle computer
* The shuttle navigation computer
* Turrets
* <strike>The firing trajectory of the Yamato cannon</strike>
* External airlocks

<details>
<summary>Images</summary>

Old:

![oldSyndiShuttle](https://github.com/user-attachments/assets/2cd5fd5c-bdb3-4dc9-9e1f-f48157c839be)

New:

![newSyndiShuttle](https://github.com/user-attachments/assets/c8a2d82d-1d5c-41f6-b37a-c54d536ec051)
</details>

## Why It's Good For The Game

It's much easier to place the syndicate shuttle / white ship in a
convenient location when you know exactly where the turrets and external
airlocks are going to be when you land. Showing the shuttle computers
also helps to communicate the orientation of the ship to anyone who is
not already familiar with the outline, since the computers are usually
placed right at the front, where the pilot is sitting.

## Changelog

🆑
add: Shuttle navigation computers now show the location of airlocks,
turrets, and the shuttle control consoles on the ship outline while
placing a custom landing location.
/🆑
2024-12-21 23:10:15 +01:00

45 lines
1.4 KiB
Plaintext

/**
* element for atoms that have helper icons overlayed on their position in the shuttle navigation computer, such as airlocks
*/
/datum/element/nav_computer_icon
element_flags = ELEMENT_BESPOKE
argument_hash_start_idx = 2
var/use_icon
var/use_icon_state
var/only_show_on_shuttle_edge
/datum/element/nav_computer_icon/Attach(datum/target, use_icon, use_icon_state, only_show_on_shuttle_edge)
. = ..()
if(!isatom(target))
return ELEMENT_INCOMPATIBLE
src.use_icon = use_icon
src.use_icon_state = use_icon_state
src.only_show_on_shuttle_edge = only_show_on_shuttle_edge
RegisterSignal(target, COMSIG_SHUTTLE_NAV_COMPUTER_IMAGE_REQUESTED, PROC_REF(provide_image))
/datum/element/nav_computer_icon/proc/provide_image(datum/source, list/images_out)
SIGNAL_HANDLER
var/obj/source_obj = source
var/turf/source_turf = get_turf(source_obj)
if(!source_turf)
return
if(only_show_on_shuttle_edge)
var/isOnEdge = FALSE
for(var/direction in GLOB.cardinals)
var/turf/turf = get_step(source_obj, direction)
if(!istype(turf?.loc, /area/shuttle))
isOnEdge = TRUE
break
if(!isOnEdge)
return
var/image/the_image = image(use_icon, source_turf, use_icon_state)
the_image.dir = source_obj.dir
images_out += the_image
/datum/element/nav_computer_icon/Detach(datum/source)
. = ..()
UnregisterSignal(source, COMSIG_SHUTTLE_NAV_COMPUTER_IMAGE_REQUESTED)