Skip to content

Commit 87cffd9

Browse files
Adds mood change indicator for ghosts (Monkestation#3322)
* darkest dungeon mood * pass tests
1 parent 53c6475 commit 87cffd9

File tree

8 files changed

+46
-5
lines changed

8 files changed

+46
-5
lines changed

code/__DEFINES/atom_hud.dm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
#define PERMIT_HUD "25"
5454
// for implants to let you see sensor field
5555
#define SENSOR_HUD "26"
56+
// for mood change
57+
#define MOOD_HUD "27"
5658
//monkestation edit end
5759

5860
//by default everything in the hud_list of an atom is an image
@@ -73,6 +75,7 @@
7375
#define DATA_HUD_FAN 10
7476
#define DATA_HUD_PERMIT 11 //monkestation edit
7577
#define DATA_HUD_SENSORS 12 //monkestation edit
78+
#define DATA_HUD_MOOD 13 //monkestation edit
7679

7780
// Notification action types
7881
#define NOTIFY_JUMP "jump"

code/datums/hud.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ GLOBAL_LIST_INIT(huds, list(
2020
DATA_HUD_FAN = new/datum/atom_hud/data/human/fan_hud(),
2121
DATA_HUD_PERMIT = new/datum/atom_hud/data/human/permit(), //monkestation edit
2222
DATA_HUD_SENSORS = new/datum/atom_hud/data/human/medical/basic/sensors(), //monkestation edit - CYBERNETICS
23+
DATA_HUD_MOOD = new/datum/atom_hud/mood(), //monkestation edit
2324
))
2425

2526
/datum/atom_hud

code/datums/mood.dm

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,23 @@
5858
var/datum/hud/hud = mob_to_make_moody.hud_used
5959
hud.show_hud(hud.hud_version)
6060

61+
//MONKESTATION ADDITION START
62+
var/datum/atom_hud/mood/hud = GLOB.huds[DATA_HUD_MOOD]
63+
hud.add_atom_to_hud(mob_to_make_moody)
64+
//MONKESTATION ADDITION END
65+
6166
/datum/mood/proc/clear_parent_ref()
6267
SIGNAL_HANDLER
6368

6469
unmodify_hud()
6570
mob_parent.lose_area_sensitivity(MOOD_DATUM_TRAIT)
6671
UnregisterSignal(mob_parent, list(COMSIG_MOB_HUD_CREATED, COMSIG_ENTER_AREA, COMSIG_LIVING_REVIVE, COMSIG_MOB_STATCHANGE, COMSIG_QDELETING))
6772

73+
//MONKESTATION ADDITION START
74+
var/datum/atom_hud/mood/hud = GLOB.huds[DATA_HUD_MOOD]
75+
hud.remove_atom_from_hud(mob_parent)
76+
//MONKESTATION ADDITION END
77+
6878
mob_parent = null
6979

7080
/datum/mood/Destroy(force)
@@ -164,6 +174,7 @@
164174

165175
mood_events[category] = the_event
166176
the_event.category = category
177+
update_mood_hud(type) //monkestation addition
167178
update_mood()
168179

169180
if (the_event.timeout)
@@ -492,6 +503,27 @@
492503
return TRUE
493504
return FALSE
494505

506+
//MONKESTATION ADDITION START
507+
/// Update the mood change indicator based on the mood_change of the mood_event
508+
/datum/mood/proc/update_mood_hud(datum/mood_event/type)
509+
if (!ispath(type))
510+
CRASH("A non path ([type]), was used to change a mood hud. This shouldn't be happening.")
511+
if(QDELETED(mob_parent) || !istype(mob_parent.hud_list))
512+
return
513+
if(initial(type.hidden) || !initial(type.mood_change))
514+
return
515+
var/image/holder = mob_parent.hud_list[MOOD_HUD]
516+
var/icon/I = icon(mob_parent.icon, mob_parent.icon_state, mob_parent.dir)
517+
holder.pixel_y = I.Height() - world.icon_size + 12
518+
holder.layer = LOW_MOB_LAYER
519+
holder.icon_state = null
520+
if(initial(type.mood_change) > 0)
521+
holder.icon_state = "hud_good_mood"
522+
else
523+
holder.icon_state = "hud_bad_mood"
524+
addtimer(VARSET_CALLBACK(holder, icon_state, null), 19, (TIMER_UNIQUE|TIMER_OVERRIDE))
525+
//MONKESTATION ADDITION END
526+
495527
#undef MINOR_INSANITY_PEN
496528
#undef MAJOR_INSANITY_PEN
497529
#undef MOOD_CATEGORY_NUTRITION

code/game/data_huds.dm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@
9090
for(var/mob/camera/ai_eye/eye as anything in GLOB.aiEyes)
9191
eye.update_ai_detect_hud()
9292

93+
//MONKESTATION ADDITION
94+
/datum/atom_hud/mood
95+
hud_icons = list(MOOD_HUD)
96+
9397
/* MED/SEC/DIAG HUD HOOKS */
9498

9599
/*

code/modules/mob/dead/observer/observer.dm

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
3737
var/health_scan = FALSE //Are health scans currently enabled?
3838
var/chem_scan = FALSE //Are chem scans currently enabled?
3939
var/gas_scan = FALSE //Are gas scans currently enabled?
40-
var/list/datahuds = list(DATA_HUD_SECURITY_ADVANCED, DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC_ADVANCED) //list of data HUDs shown to ghosts.
40+
var/list/datahuds = list(DATA_HUD_SECURITY_ADVANCED, DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC_ADVANCED, DATA_HUD_MOOD) //list of data HUDs shown to ghosts. monkestation addition here
4141
var/ghost_orbit = GHOST_ORBIT_CIRCLE
4242

4343
//These variables store hair data if the ghost originates from a species with head and/or facial hair.
@@ -770,9 +770,10 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
770770
var/datum/atom_hud/data_hud = GLOB.huds[hudtype]
771771
data_hud.hide_from(src)
772772

773+
//MONKESTATION
773774
/mob/dead/observer/verb/toggle_data_huds()
774-
set name = "Toggle Sec/Med/Diag HUD"
775-
set desc = "Toggles whether you see medical/security/diagnostic HUDs"
775+
set name = "Toggle Sec/Med/Diag/Mood HUD"
776+
set desc = "Toggles whether you see medical/security/diagnostic/mood HUDs"
776777
set category = "Ghost"
777778

778779
if(data_huds_on) //remove old huds

code/modules/mob/living/carbon/carbon_defines.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
blood_volume = BLOOD_VOLUME_NORMAL
33
gender = MALE
44
pressure_resistance = 15
5-
hud_possible = list(HEALTH_HUD,STATUS_HUD,ANTAG_HUD,GLAND_HUD,NANITE_HUD,DIAG_NANITE_FULL_HUD,SENSOR_HUD)
5+
hud_possible = list(HEALTH_HUD,STATUS_HUD,ANTAG_HUD,GLAND_HUD,NANITE_HUD,DIAG_NANITE_FULL_HUD,SENSOR_HUD,MOOD_HUD)
66
has_limbs = TRUE
77
held_items = list(null, null)
88
num_legs = 0 //Populated on init through list/bodyparts

code/modules/mob/living/carbon/human/human_defines.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
icon = 'icons/mob/species/human/human.dmi'
66
icon_state = "human_basic"
77
appearance_flags = KEEP_TOGETHER|TILE_BOUND|PIXEL_SCALE|LONG_GLIDE
8-
hud_possible = list(HEALTH_HUD,STATUS_HUD,ID_HUD,WANTED_HUD,IMPLOYAL_HUD,IMPCHEM_HUD,IMPTRACK_HUD,ANTAG_HUD,GLAND_HUD,SENTIENT_DISEASE_HUD,FAN_HUD,NANITE_HUD,DIAG_NANITE_FULL_HUD,PERMIT_HUD,SENSOR_HUD)
8+
hud_possible = list(HEALTH_HUD,STATUS_HUD,ID_HUD,WANTED_HUD,IMPLOYAL_HUD,IMPCHEM_HUD,IMPTRACK_HUD,ANTAG_HUD,GLAND_HUD,SENTIENT_DISEASE_HUD,FAN_HUD,NANITE_HUD,DIAG_NANITE_FULL_HUD,PERMIT_HUD,SENSOR_HUD,MOOD_HUD)
99
hud_type = /datum/hud/human
1010
pressure_resistance = 25
1111
can_buckle = TRUE

icons/mob/huds/hud.dmi

2.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)