Skip to content

Commit

Permalink
Adds mood change indicator for ghosts (#3322)
Browse files Browse the repository at this point in the history
* darkest dungeon mood

* pass tests
  • Loading branch information
PotatoTomahto authored Sep 13, 2024
1 parent 53c6475 commit 87cffd9
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 5 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/atom_hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
#define PERMIT_HUD "25"
// for implants to let you see sensor field
#define SENSOR_HUD "26"
// for mood change
#define MOOD_HUD "27"
//monkestation edit end

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

// Notification action types
#define NOTIFY_JUMP "jump"
Expand Down
1 change: 1 addition & 0 deletions code/datums/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ GLOBAL_LIST_INIT(huds, list(
DATA_HUD_FAN = new/datum/atom_hud/data/human/fan_hud(),
DATA_HUD_PERMIT = new/datum/atom_hud/data/human/permit(), //monkestation edit
DATA_HUD_SENSORS = new/datum/atom_hud/data/human/medical/basic/sensors(), //monkestation edit - CYBERNETICS
DATA_HUD_MOOD = new/datum/atom_hud/mood(), //monkestation edit
))

/datum/atom_hud
Expand Down
32 changes: 32 additions & 0 deletions code/datums/mood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,23 @@
var/datum/hud/hud = mob_to_make_moody.hud_used
hud.show_hud(hud.hud_version)

//MONKESTATION ADDITION START
var/datum/atom_hud/mood/hud = GLOB.huds[DATA_HUD_MOOD]
hud.add_atom_to_hud(mob_to_make_moody)
//MONKESTATION ADDITION END

/datum/mood/proc/clear_parent_ref()
SIGNAL_HANDLER

unmodify_hud()
mob_parent.lose_area_sensitivity(MOOD_DATUM_TRAIT)
UnregisterSignal(mob_parent, list(COMSIG_MOB_HUD_CREATED, COMSIG_ENTER_AREA, COMSIG_LIVING_REVIVE, COMSIG_MOB_STATCHANGE, COMSIG_QDELETING))

//MONKESTATION ADDITION START
var/datum/atom_hud/mood/hud = GLOB.huds[DATA_HUD_MOOD]
hud.remove_atom_from_hud(mob_parent)
//MONKESTATION ADDITION END

mob_parent = null

/datum/mood/Destroy(force)
Expand Down Expand Up @@ -164,6 +174,7 @@

mood_events[category] = the_event
the_event.category = category
update_mood_hud(type) //monkestation addition
update_mood()

if (the_event.timeout)
Expand Down Expand Up @@ -492,6 +503,27 @@
return TRUE
return FALSE

//MONKESTATION ADDITION START
/// Update the mood change indicator based on the mood_change of the mood_event
/datum/mood/proc/update_mood_hud(datum/mood_event/type)
if (!ispath(type))
CRASH("A non path ([type]), was used to change a mood hud. This shouldn't be happening.")
if(QDELETED(mob_parent) || !istype(mob_parent.hud_list))
return
if(initial(type.hidden) || !initial(type.mood_change))
return
var/image/holder = mob_parent.hud_list[MOOD_HUD]
var/icon/I = icon(mob_parent.icon, mob_parent.icon_state, mob_parent.dir)
holder.pixel_y = I.Height() - world.icon_size + 12
holder.layer = LOW_MOB_LAYER
holder.icon_state = null
if(initial(type.mood_change) > 0)
holder.icon_state = "hud_good_mood"
else
holder.icon_state = "hud_bad_mood"
addtimer(VARSET_CALLBACK(holder, icon_state, null), 19, (TIMER_UNIQUE|TIMER_OVERRIDE))
//MONKESTATION ADDITION END

#undef MINOR_INSANITY_PEN
#undef MAJOR_INSANITY_PEN
#undef MOOD_CATEGORY_NUTRITION
Expand Down
4 changes: 4 additions & 0 deletions code/game/data_huds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@
for(var/mob/camera/ai_eye/eye as anything in GLOB.aiEyes)
eye.update_ai_detect_hud()

//MONKESTATION ADDITION
/datum/atom_hud/mood
hud_icons = list(MOOD_HUD)

/* MED/SEC/DIAG HUD HOOKS */

/*
Expand Down
7 changes: 4 additions & 3 deletions code/modules/mob/dead/observer/observer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
var/health_scan = FALSE //Are health scans currently enabled?
var/chem_scan = FALSE //Are chem scans currently enabled?
var/gas_scan = FALSE //Are gas scans currently enabled?
var/list/datahuds = list(DATA_HUD_SECURITY_ADVANCED, DATA_HUD_MEDICAL_ADVANCED, DATA_HUD_DIAGNOSTIC_ADVANCED) //list of data HUDs shown to ghosts.
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
var/ghost_orbit = GHOST_ORBIT_CIRCLE

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

//MONKESTATION
/mob/dead/observer/verb/toggle_data_huds()
set name = "Toggle Sec/Med/Diag HUD"
set desc = "Toggles whether you see medical/security/diagnostic HUDs"
set name = "Toggle Sec/Med/Diag/Mood HUD"
set desc = "Toggles whether you see medical/security/diagnostic/mood HUDs"
set category = "Ghost"

if(data_huds_on) //remove old huds
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/carbon_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
blood_volume = BLOOD_VOLUME_NORMAL
gender = MALE
pressure_resistance = 15
hud_possible = list(HEALTH_HUD,STATUS_HUD,ANTAG_HUD,GLAND_HUD,NANITE_HUD,DIAG_NANITE_FULL_HUD,SENSOR_HUD)
hud_possible = list(HEALTH_HUD,STATUS_HUD,ANTAG_HUD,GLAND_HUD,NANITE_HUD,DIAG_NANITE_FULL_HUD,SENSOR_HUD,MOOD_HUD)
has_limbs = TRUE
held_items = list(null, null)
num_legs = 0 //Populated on init through list/bodyparts
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/human_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
icon = 'icons/mob/species/human/human.dmi'
icon_state = "human_basic"
appearance_flags = KEEP_TOGETHER|TILE_BOUND|PIXEL_SCALE|LONG_GLIDE
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)
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)
hud_type = /datum/hud/human
pressure_resistance = 25
can_buckle = TRUE
Expand Down
Binary file modified icons/mob/huds/hud.dmi
Binary file not shown.

0 comments on commit 87cffd9

Please sign in to comment.