Skip to content
This repository has been archived by the owner on Sep 8, 2022. It is now read-only.

[MIRROR] Refactors area moods to optionally restrict to jobs (+ new area moods!) #1011

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion code/datums/components/mood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@
/datum/component/mood/proc/check_area_mood(datum/source, var/area/A)
SIGNAL_HANDLER

if(A.mood_bonus)

if(A.mood_check())
if(get_event("area")) //walking between areas that give mood bonus should first clear the bonus from the previous one
clear_event(null, "area")
add_event(null, "area", /datum/mood_event/area, list(A.mood_bonus, A.mood_message))
Expand Down
27 changes: 27 additions & 0 deletions code/game/area/Space_Station_13_areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,19 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
lighting_colour_bulb = "#ffebc1"
sound_environment = SOUND_AREA_WOODFLOOR

<<<<<<< HEAD
=======
/area/crew_quarters/bar/mood_check(mob/living/carbon/human/subject)
. = ..()
if (HAS_TRAIT(subject, TRAIT_LIGHT_DRINKER))
. = FALSE

/area/crew_quarters/bar/lounge
name = "Bar lounge"
icon_state = "lounge"
sound_environment = SOUND_AREA_SMALL_SOFTFLOOR

>>>>>>> 815472638b... Refactors area moods to optionally restrict to jobs (+ new area moods!) (#7502)
/area/crew_quarters/bar/Initialize(mapload)
. = ..()
GLOB.bar_areas += src
Expand Down Expand Up @@ -991,6 +1004,9 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
name = "Brig"
icon_state = "brig"
mood_bonus = -3
mood_job_allowed = list(JOB_NAME_HEADOFSECURITY,JOB_NAME_WARDEN,JOB_NAME_SECURITYOFFICER,JOB_NAME_BRIGPHYSICIAN,JOB_NAME_DETECTIVE)
mood_job_reverse = TRUE

mood_message = "<span class='warning'>I hate cramped brig cells.\n</span>"

/area/security/courtroom
Expand All @@ -1002,6 +1018,8 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
name = "Prison Wing"
icon_state = "sec_prison"
mood_bonus = -4
mood_job_allowed = list(JOB_NAME_HEADOFSECURITY,JOB_NAME_WARDEN, JOB_NAME_SECURITYOFFICER) // JUSTICE!
mood_job_reverse = TRUE
mood_message = "<span class='warning'>I'm trapped here with little hope of escape!\n</span>"

/area/security/processing
Expand Down Expand Up @@ -1379,6 +1397,9 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
name = "Armory"
icon_state = "armory"
ambience_index = AMBIENCE_DANGER
mood_job_allowed = list(JOB_NAME_WARDEN)
mood_bonus = 1
mood_message = "<span class='nicegreen'>It's good to be home.</span>"

/area/ai_monitored/storage/eva
name = "EVA Storage"
Expand All @@ -1399,6 +1420,9 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
name = "AI Upload Chamber"
icon_state = "ai_upload"
sound_environment = SOUND_AREA_SMALL_ENCLOSED
mood_job_allowed = list(JOB_NAME_RESEARCHDIRECTOR, JOB_NAME_CAPTAIN)
mood_bonus = 4
mood_message = "<span class='nicegreen'>The AI will bend to my will!\n</span>"

/area/ai_monitored/turret_protected/ai_upload_foyer
name = "AI Upload Access"
Expand Down Expand Up @@ -1460,6 +1484,9 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
name = "Telecomms Control Room"
icon_state = "tcomsatcomp"
sound_environment = SOUND_AREA_MEDIUM_SOFTFLOOR
mood_job_allowed = list(JOB_NAME_CHIEFENGINEER, JOB_NAME_STATIONENGINEER)
mood_bonus = 2
mood_message = "<span class='nicegreen'>It's good to see these in working order.\n</span>"

/area/tcommsat/server
name = "Telecomms Server Room"
Expand Down
18 changes: 18 additions & 0 deletions code/game/area/areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@

var/mood_bonus = 0 //Mood for being here
var/mood_message = "<span class='nicegreen'>This area is pretty nice!\n</span>" //Mood message for being here, only shows up if mood_bonus != 0
/// if defined, restricts what jobs get this buff using JOB_NAME defines (-candycane/etherware)
var/list/mood_job_allowed = null
/// if true, mood_job_allowed will represent jobs exempt from getting the mood.
var/mood_job_reverse = FALSE

///Will objects this area be needing power?
var/requires_power = TRUE
Expand Down Expand Up @@ -720,3 +724,17 @@ GLOBAL_LIST_EMPTY(teleportlocs)

/area/get_virtual_z_level()
return get_virtual_z(get_turf(src))

/// if it returns true, the mood effect assigned to the area is defined. Defaults to checking mood_job_allowed
/area/proc/mood_check(mob/living/carbon/human/subject)
if(!mood_bonus)
return FALSE

. = TRUE

if(!length(mood_job_allowed))
return .
if(!(subject.mind?.assigned_role in mood_job_allowed))
. = FALSE
if(mood_job_reverse)
return !. // the most eye bleeding syntax ive written