Skip to content

Commit

Permalink
[MIRROR] ai z level indicator (Skyrat-SS13#27149)
Browse files Browse the repository at this point in the history
* ai z level indicator (#82376)

## About The Pull Request
https://tgstation13.org/phpBB/viewtopic.php?f=5&t=35669

https://github.com/tgstation/tgstation/assets/70376633/77e1548a-46be-4da9-a6cd-a7f5b2fdf21b

## Why It's Good For The Game

its convenient and especially more convenient on northstar for
orientation

## Changelog
:cl:
qol: AIs now get a z level indicator
/:cl:

---------

Co-authored-by: san7890 <the@ san7890.com>

* ai z level indicator

---------

Co-authored-by: jimmyl <[email protected]>
Co-authored-by: san7890 <the@ san7890.com>
  • Loading branch information
3 people authored Apr 4, 2024
1 parent c0504ac commit ee39ac6
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 2 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@
#define ui_ai_multicam "BOTTOM+1:6,LEFT+1"
#define ui_ai_add_multicam "BOTTOM+1:6,LEFT"
#define ui_ai_take_picture "BOTTOM+2:6,LEFT"
#define ui_ai_floor_indicator "BOTTOM+5,RIGHT"
#define ui_ai_godownup "BOTTOM+5,RIGHT-1"

//pAI
#define ui_pai_software "SOUTH:6,WEST"
Expand Down
67 changes: 65 additions & 2 deletions code/_onclick/hud/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,66 @@
var/mob/living/silicon/ai/AI = usr
AI.drop_new_multicam()

/atom/movable/screen/ai/floor_indicator
icon_state = "zindicator"
screen_loc = ui_ai_floor_indicator

/atom/movable/screen/ai/floor_indicator/Initialize(mapload, datum/hud/hud_owner)
. = ..()
if(istype(hud_owner))
RegisterSignal(hud_owner, COMSIG_HUD_OFFSET_CHANGED, PROC_REF(update_z))
update_z()

/atom/movable/screen/ai/floor_indicator/proc/update_z(datum/hud/source)
SIGNAL_HANDLER
var/mob/living/silicon/ai/ai = get_mob() //if you use this for anyone else i will find you
if(isnull(ai))
return
var/turf/locturf = isturf(ai.loc) ? get_turf(ai.eyeobj) : get_turf(ai) //must be a var cuz error
var/ai_z = locturf.z
var/text = "Level<br/>[ai_z]"
if(SSmapping.level_trait(ai_z, ZTRAIT_STATION))
text = "Floor<br/>[ai_z - 1]"
else if (SSmapping.level_trait(ai_z, ZTRAIT_NOPHASE))
text = "ERROR"
maptext = MAPTEXT_TINY_UNICODE("<div align='center' valign='middle' style='position:relative; top:0px; left:0px'>[text]</div>")

/atom/movable/screen/ai/go_up
name = "go up"
icon_state = "up"
screen_loc = ui_ai_godownup

/atom/movable/screen/ai/go_up/Initialize(mapload)
. = ..()
register_context()

/atom/movable/screen/ai/go_up/add_context(atom/source, list/context, obj/item/held_item, mob/user)
. = ..()
context[SCREENTIP_CONTEXT_LMB] = "Go up a floor"
return CONTEXTUAL_SCREENTIP_SET

/atom/movable/screen/ai/go_up/Click(location,control,params)
var/mob/ai = get_mob() //the core
flick("uppressed",src)
if(!isturf(ai.loc) || usr != ai) //aicard and stuff
return
ai.up()

/atom/movable/screen/ai/go_up/down
name = "go down"
icon_state = "down"

/atom/movable/screen/ai/go_up/down/add_context(atom/source, list/context, obj/item/held_item, mob/user)
. = ..()
context[SCREENTIP_CONTEXT_LMB] = "Go down a floor"
return CONTEXTUAL_SCREENTIP_SET

/atom/movable/screen/ai/go_up/down/Click(location,control,params)
var/mob/ai = get_mob() //the core
flick("downpressed",src)
if(!isturf(ai.loc) || usr != ai) //aicard and stuff
return
ai.down()

/datum/hud/ai
ui_style = 'icons/hud/screen_ai.dmi'
Expand All @@ -187,8 +247,11 @@
static_inventory += using

// Z-level floor change
using = new /atom/movable/screen/floor_menu(null, src)
using.screen_loc = ui_ai_floor_menu
using = new /atom/movable/screen/ai/floor_indicator(null, src) //These come with their own predefined screen locs
static_inventory += using
using = new /atom/movable/screen/ai/go_up(null, src)
static_inventory += using
using = new /atom/movable/screen/ai/go_up/down(null, src)
static_inventory += using

//AI core
Expand Down
Binary file modified icons/hud/screen_ai.dmi
Binary file not shown.

0 comments on commit ee39ac6

Please sign in to comment.