Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix for missing Traitbound Elements Handlers #4879

Merged
merged 2 commits into from
Nov 13, 2023
Merged
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
25 changes: 20 additions & 5 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@
_L = target._status_traits; \
_L[trait] = list(source); \
SEND_SIGNAL(target, SIGNAL_ADDTRAIT(trait), trait); \
if(trait in GLOB.traits_with_elements){ \
target.AddElement(GLOB.traits_with_elements[trait]); \
} \
} else { \
_L = target._status_traits; \
if (_L[trait]) { \
_L[trait] |= list(source); \
} else { \
_L[trait] = list(source); \
SEND_SIGNAL(target, SIGNAL_ADDTRAIT(trait), trait); \
if(trait in GLOB.traits_with_elements){ \
target.AddElement(GLOB.traits_with_elements[trait]); \
} \
} \
} \
} while (0)
Expand All @@ -38,6 +44,9 @@
if (!length(_L[trait])) { \
_L -= trait; \
SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(trait), trait); \
if(trait in GLOB.traits_with_elements) { \
target.RemoveElement(GLOB.traits_with_elements[trait]); \
} \
}; \
if (!length(_L)) { \
target._status_traits = null \
Expand All @@ -62,6 +71,9 @@
if (!length(_traits_list[trait])) { \
_traits_list -= trait; \
SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(trait), trait); \
if(trait in GLOB.traits_with_elements) { \
target.RemoveElement(GLOB.traits_with_elements[trait]); \
} \
}; \
if (!length(_traits_list)) { \
target._status_traits = null \
Expand All @@ -78,8 +90,11 @@
if (!length(_L[_T])) { \
_L -= _T; \
SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(_T), _T); \
if(trait in GLOB.traits_with_elements) { \
target.RemoveElement(GLOB.traits_with_elements[trait]); \
}; \
};\
};\
if (!length(_L)) { \
target._status_traits = null\
};\
Expand All @@ -101,8 +116,11 @@
if (!length(_L[_T])) { \
_L -= _T; \
SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(_T)); \
if(_T in GLOB.traits_with_elements) { \
target.RemoveElement(GLOB.traits_with_elements[_T]); \
}; \
};\
};\
if (!length(_L)) { \
target._status_traits = null\
};\
Expand All @@ -124,9 +142,6 @@
/// Example trait
// #define TRAIT_X "t_x"

/// cannot be removed without admin intervention
#define ROUNDSTART_TRAIT "roundstart"

//-- mob traits --
/// Apply this to make a mob not dense, and remove it when you want it to no longer make them undense, other sorces of undesity will still apply. Always define a unique source when adding a new instance of this!
#define TRAIT_UNDENSE "undense"
Expand Down Expand Up @@ -355,6 +370,8 @@ GLOBAL_LIST(trait_name_map)
/// Example trait source
// #define TRAIT_SOURCE_Y "t_s_y"
#define TRAIT_SOURCE_INHERENT "t_s_inherent"
/// cannot be removed without admin intervention
#define ROUNDSTART_TRAIT "roundstart"
//-- mob traits --
///Status trait coming from lying down through update_canmove()
#define LYING_TRAIT "lying"
Expand All @@ -364,8 +381,6 @@ GLOBAL_LIST(trait_name_map)
#define TRAIT_SOURCE_HIVE "t_s_hive"
///Status trait coming from being buckled.
#define TRAIT_SOURCE_BUCKLE "t_s_buckle"
///Status trait coming from roundstart quirks (that don't exist yet). Unremovable by REMOVE_TRAIT
#define TRAIT_SOURCE_QUIRK "t_s_quirk"
///Status trait coming from being assigned as [acting] squad leader.
#define TRAIT_SOURCE_SQUAD_LEADER "t_s_squad_leader"
///Status trait coming from their job
Expand Down
8 changes: 4 additions & 4 deletions code/modules/character_traits/biology_traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@
to_chat(target, SPAN_WARNING("Your species is too sophisticated for you be able to recieve the lisping trait."))
return

ADD_TRAIT(target, TRAIT_LISPING, TRAIT_SOURCE_QUIRK)
ADD_TRAIT(target, TRAIT_LISPING, ROUNDSTART_TRAIT)
target.speech_problem_flag = TRUE

..()

/datum/character_trait/biology/lisp/unapply_trait(mob/living/carbon/human/target)
REMOVE_TRAIT(target, TRAIT_LISPING, TRAIT_SOURCE_QUIRK)
REMOVE_TRAIT(target, TRAIT_LISPING, ROUNDSTART_TRAIT)
target.speech_problem_flag = FALSE
..()

Expand Down Expand Up @@ -127,9 +127,9 @@
to_chat(target, SPAN_WARNING("Only riflemen can have the Hardcore trait."))
return

ADD_TRAIT(target, TRAIT_HARDCORE, TRAIT_SOURCE_QUIRK)
ADD_TRAIT(target, TRAIT_HARDCORE, ROUNDSTART_TRAIT)
..()

/datum/character_trait/biology/hardcore/unapply_trait(mob/living/carbon/human/target)
REMOVE_TRAIT(target, TRAIT_HARDCORE, TRAIT_SOURCE_QUIRK)
REMOVE_TRAIT(target, TRAIT_HARDCORE, ROUNDSTART_TRAIT)
..()