mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Merge pull request #5819 from Altoids1/mood-as-pref
Allows Mood to be enabled as a preference
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#define DISABLE_ARRIVALRATTLE (1<<13)
|
||||
#define COMBOHUD_LIGHTING (1<<14)
|
||||
#define QUIET_ROUND (1<<15) // yogs - Donor features, quiet round; "why isn't this in ~yogs_defines?" - This has to be a unique power of 2, if /tg/ adds another flag it will have merge conflicts and will be obvious this has to be updated. If I put this in a different file it wouldn't be obvious and silently break stuff.
|
||||
#define PREF_MOOD (1<<16) // Yogs -- Ditto on the above, increment this and QUIET_ROUND in the event of conflict
|
||||
|
||||
#define TOGGLES_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|MEMBER_PUBLIC|INTENT_STYLE|MIDROUND_ANTAG|SOUND_INSTRUMENTS|SOUND_SHIP_AMBIENCE|SOUND_PRAYERS|SOUND_ANNOUNCEMENTS)
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ PROCESSING_SUBSYSTEM_DEF(quirks)
|
||||
quirk_points[initial(T.name)] = initial(T.value)
|
||||
|
||||
/datum/controller/subsystem/processing/quirks/proc/AssignQuirks(mob/living/user, client/cli, spawn_effects)
|
||||
if(!checkquirks(user,cli)) return// Yogs -- part of Adding Mood as Preference
|
||||
for(var/V in cli.prefs.all_quirks)
|
||||
var/datum/quirk/Q = quirks[V]
|
||||
if(Q)
|
||||
|
||||
@@ -85,10 +85,21 @@
|
||||
return language_holder
|
||||
|
||||
/datum/mind/proc/transfer_to(mob/new_character, var/force_key_move = 0)
|
||||
var/mood_was_enabled = FALSE//Yogs -- Mood Preferences
|
||||
if(current) // remove ourself from our old body's mind variable
|
||||
current.mind = null
|
||||
UnregisterSignal(current, COMSIG_MOB_DEATH)
|
||||
SStgui.on_transfer(current, new_character)
|
||||
// Yogs start -- Mood preferences
|
||||
if(current?.client.prefs.toggles & PREF_MOOD)
|
||||
mood_was_enabled = TRUE
|
||||
else if(ishuman(current) && CONFIG_GET(flag/disable_human_mood))
|
||||
var/mob/living/carbon/human/H = current
|
||||
if(H.mood_enabled)
|
||||
mood_was_enabled = TRUE
|
||||
var/datum/component/mood/c = H.GetComponent(/datum/component/mood)
|
||||
c.RemoveComponent()
|
||||
// Yogs End
|
||||
|
||||
if(!language_holder)
|
||||
var/datum/language_holder/mob_holder = new_character.get_language_holder(shadow = FALSE)
|
||||
@@ -115,6 +126,11 @@
|
||||
if(iscarbon(new_character))
|
||||
var/mob/living/carbon/C = new_character
|
||||
C.last_mind = src
|
||||
// Yogs start -- Mood preferences
|
||||
if(ishuman(new_character) && mood_was_enabled)
|
||||
var/mob/living/carbon/human/H = C
|
||||
H.AddComponent(/datum/component/mood)
|
||||
// Yogs End
|
||||
transfer_antag_huds(hud_to_transfer) //inherit the antag HUD
|
||||
transfer_actions(new_character)
|
||||
transfer_martial_arts(new_character)
|
||||
|
||||
@@ -540,6 +540,10 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
p_map += " (No longer exists)"
|
||||
if(CONFIG_GET(flag/allow_map_voting))
|
||||
dat += "<b>Preferred Map:</b> <a href='?_src_=prefs;preference=preferred_map;task=input'>[p_map]</a><br>"
|
||||
//yogs start -- Mood preference toggling
|
||||
if(CONFIG_GET(flag/disable_human_mood))
|
||||
dat += "<b>Mood:</b> <a href='?_src_=prefs;preference=mood'>[toggles & PREF_MOOD ? "Enabled" : "Disabled"]</a><br>"
|
||||
//yogs end
|
||||
|
||||
dat += "</td><td width='300px' height='300px' valign='top'>"
|
||||
|
||||
@@ -1021,7 +1025,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
for(var/_V in all_quirks)
|
||||
if(_V == quirk_name)
|
||||
has_quirk = TRUE
|
||||
if(initial(T.mood_quirk) && CONFIG_GET(flag/disable_human_mood))
|
||||
if(initial(T.mood_quirk) && (CONFIG_GET(flag/disable_human_mood) && !(toggles & PREF_MOOD)))//Yogs -- Adds mood to preferences
|
||||
lock_reason = "Mood is disabled."
|
||||
quirk_conflict = TRUE
|
||||
if(has_quirk)
|
||||
@@ -1665,6 +1669,9 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
// yogs start - Custom keybindings
|
||||
if("reset_bindings")
|
||||
reset_keybindings()
|
||||
|
||||
if("mood")
|
||||
toggles ^= PREF_MOOD
|
||||
// yogs end
|
||||
|
||||
ShowChoices(user)
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
/mob/living/carbon/human/ComponentInitialize()
|
||||
. = ..()
|
||||
if(!CONFIG_GET(flag/disable_human_mood))
|
||||
if(!(CONFIG_GET(flag/disable_human_mood)))
|
||||
AddComponent(/datum/component/mood)
|
||||
|
||||
/mob/living/carbon/human/Destroy()
|
||||
|
||||
@@ -1109,7 +1109,7 @@ GLOBAL_LIST_EMPTY(roundstart_races)
|
||||
. += (health_deficiency / 75)
|
||||
else
|
||||
. += (health_deficiency / 25)
|
||||
if(CONFIG_GET(flag/disable_human_mood))
|
||||
if(CONFIG_GET(flag/disable_human_mood) && !H.mood_enabled) // Yogs -- Mood as preference
|
||||
if(!HAS_TRAIT(H, TRAIT_NOHUNGER))
|
||||
var/hungry = (500 - H.nutrition) / 5 //So overeat would be 100 and default level would be 80
|
||||
if((hungry >= 70) && !flight) //Being hungry will still allow you to use a flightsuit/wings.
|
||||
|
||||
@@ -2860,6 +2860,7 @@
|
||||
#include "yogstation\code\controllers\subsystem\research.dm"
|
||||
#include "yogstation\code\controllers\subsystem\ticker.dm"
|
||||
#include "yogstation\code\controllers\subsystem\yogs.dm"
|
||||
#include "yogstation\code\controllers\subsystem\processing\quirks.dm"
|
||||
#include "yogstation\code\datums\action.dm"
|
||||
#include "yogstation\code\datums\mind.dm"
|
||||
#include "yogstation\code\datums\mutations.dm"
|
||||
|
||||
15
yogstation/code/controllers/subsystem/processing/quirks.dm
Normal file
15
yogstation/code/controllers/subsystem/processing/quirks.dm
Normal file
@@ -0,0 +1,15 @@
|
||||
/datum/controller/subsystem/processing/quirks/proc/checkquirks(mob/living/user,client/cli) // Returns true when the player isn't trying to fuckin scum the mood pref stuff to exploit
|
||||
var/mob/living/carbon/human/U = user
|
||||
U.mood_enabled = cli.prefs.toggles & PREF_MOOD // Marks whether this player had moods enabled in preferences at the time of spawning (helps prevent exploitation)
|
||||
|
||||
if(!CONFIG_GET(flag/disable_human_mood) || (cli.prefs.toggles & PREF_MOOD)) // If moods are globally enabled, or this guy does indeed have his mood pref set to Enabled
|
||||
return TRUE //Then resume
|
||||
//Else, we need to check him out.
|
||||
for(var/V in cli.prefs.all_quirks)
|
||||
var/datum/quirk/Q = quirks[V]
|
||||
if(Q)
|
||||
if(initial(Q.mood_quirk))
|
||||
to_chat(src,"<span class='danger'>You cannot have the quirk '[V]' with mood disabled! You shall receive no quirks this round.")
|
||||
message_admins("[key_name(cli)] just tried to exploit the mood pref system to get bonus points for their quirks.")
|
||||
return FALSE
|
||||
return TRUE
|
||||
@@ -1,2 +1,3 @@
|
||||
/mob/living/carbon/human
|
||||
var/gender_ambiguous = 0 //if something goes wrong during gender reassignment this generates a line in examine
|
||||
var/gender_ambiguous = 0 //if something goes wrong during gender reassignment this generates a line in examine
|
||||
var/mood_enabled = FALSE // Marks whether this player had moods enabled in preferences at the time of spawning (helps prevent exploitation)
|
||||
Reference in New Issue
Block a user