-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1468 from Yawn-Wider/voreupdate
Voreupdate [MDB IGNORE] [IDB IGNORE]
- Loading branch information
Showing
747 changed files
with
25,674 additions
and
16,838 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#undef ASSERT | ||
|
||
/// Override BYOND's native ASSERT to optionally specify a message | ||
#define ASSERT(condition, message...) \ | ||
if (!(condition)) { \ | ||
CRASH(assertion_message(__FILE__, __LINE__, #condition, ##message)) \ | ||
} | ||
|
||
/proc/assertion_message(file, line, condition, message) | ||
if (!isnull(message)) | ||
message = " - [message]" | ||
|
||
return "[file]:[line]:Assertion failed: [condition][message]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Used to direct channels to speak into. | ||
#define SAY_CHANNEL "Say" | ||
#define RADIO_CHANNEL "Radio" | ||
#define ME_CHANNEL "Me" | ||
#define OOC_CHANNEL "OOC" | ||
#define ADMIN_CHANNEL "Admin" | ||
#define LOOC_CHANNEL "LOOC" | ||
#define WHIS_CHANNEL "Whis" | ||
#define SUBTLE_CHANNEL "Subtle" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
#define SIGNAL_ADDTRAIT(trait_ref) "addtrait [trait_ref]" | ||
#define SIGNAL_REMOVETRAIT(trait_ref) "removetrait [trait_ref]" | ||
|
||
// trait accessor defines | ||
#define ADD_TRAIT(target, trait, source) \ | ||
do { \ | ||
var/list/_L; \ | ||
if (!target._status_traits) { \ | ||
target._status_traits = list(); \ | ||
_L = target._status_traits; \ | ||
_L[trait] = list(source); \ | ||
SEND_SIGNAL(target, SIGNAL_ADDTRAIT(trait), 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); \ | ||
} \ | ||
} \ | ||
} while (0) | ||
#define REMOVE_TRAIT(target, trait, sources) \ | ||
do { \ | ||
var/list/_L = target._status_traits; \ | ||
var/list/_S; \ | ||
if (sources && !islist(sources)) { \ | ||
_S = list(sources); \ | ||
} else { \ | ||
_S = sources\ | ||
}; \ | ||
if (_L?[trait]) { \ | ||
for (var/_T in _L[trait]) { \ | ||
if ((!_S && (_T != ROUNDSTART_TRAIT)) || (_T in _S)) { \ | ||
_L[trait] -= _T \ | ||
} \ | ||
};\ | ||
if (!length(_L[trait])) { \ | ||
_L -= trait; \ | ||
SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(trait), trait); \ | ||
}; \ | ||
if (!length(_L)) { \ | ||
target._status_traits = null \ | ||
}; \ | ||
} \ | ||
} while (0) | ||
#define REMOVE_TRAIT_NOT_FROM(target, trait, sources) \ | ||
do { \ | ||
var/list/_traits_list = target._status_traits; \ | ||
var/list/_sources_list; \ | ||
if (sources && !islist(sources)) { \ | ||
_sources_list = list(sources); \ | ||
} else { \ | ||
_sources_list = sources\ | ||
}; \ | ||
if (_traits_list?[trait]) { \ | ||
for (var/_trait_source in _traits_list[trait]) { \ | ||
if (!(_trait_source in _sources_list)) { \ | ||
_traits_list[trait] -= _trait_source \ | ||
} \ | ||
};\ | ||
if (!length(_traits_list[trait])) { \ | ||
_traits_list -= trait; \ | ||
SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(trait), trait); \ | ||
}; \ | ||
if (!length(_traits_list)) { \ | ||
target._status_traits = null \ | ||
}; \ | ||
} \ | ||
} while (0) | ||
#define REMOVE_TRAITS_NOT_IN(target, sources) \ | ||
do { \ | ||
var/list/_L = target._status_traits; \ | ||
var/list/_S = sources; \ | ||
if (_L) { \ | ||
for (var/_T in _L) { \ | ||
_L[_T] &= _S;\ | ||
if (!length(_L[_T])) { \ | ||
_L -= _T; \ | ||
SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(_T), _T); \ | ||
}; \ | ||
};\ | ||
if (!length(_L)) { \ | ||
target._status_traits = null\ | ||
};\ | ||
}\ | ||
} while (0) | ||
|
||
#define REMOVE_TRAITS_IN(target, sources) \ | ||
do { \ | ||
var/list/_L = target._status_traits; \ | ||
var/list/_S = sources; \ | ||
if (sources && !islist(sources)) { \ | ||
_S = list(sources); \ | ||
} else { \ | ||
_S = sources\ | ||
}; \ | ||
if (_L) { \ | ||
for (var/_T in _L) { \ | ||
_L[_T] -= _S;\ | ||
if (!length(_L[_T])) { \ | ||
_L -= _T; \ | ||
SEND_SIGNAL(target, SIGNAL_REMOVETRAIT(_T)); \ | ||
}; \ | ||
};\ | ||
if (!length(_L)) { \ | ||
target._status_traits = null\ | ||
};\ | ||
}\ | ||
} while (0) | ||
|
||
#define HAS_TRAIT(target, trait) (target._status_traits?[trait] ? TRUE : FALSE) | ||
#define HAS_TRAIT_FROM(target, trait, source) (HAS_TRAIT(target, trait) && (source in target._status_traits[trait])) | ||
#define HAS_TRAIT_FROM_ONLY(target, trait, source) (HAS_TRAIT(target, trait) && (source in target._status_traits[trait]) && (length(target._status_traits[trait]) == 1)) | ||
#define HAS_TRAIT_NOT_FROM(target, trait, source) (HAS_TRAIT(target, trait) && (length(target._status_traits[trait] - source) > 0)) | ||
/// Returns a list of trait sources for this trait. Only useful for wacko cases and internal futzing | ||
/// You should not be using this | ||
#define GET_TRAIT_SOURCES(target, trait) (target._status_traits?[trait] || list()) | ||
/// Returns the amount of sources for a trait. useful if you don't want to have a "thing counter" stuck around all the time | ||
#define COUNT_TRAIT_SOURCES(target, trait) length(GET_TRAIT_SOURCES(target, trait)) | ||
/// A simple helper for checking traits in a mob's mind | ||
#define HAS_MIND_TRAIT(target, trait) (HAS_TRAIT(target, trait) || (target.mind ? HAS_TRAIT(target.mind, trait) : FALSE)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// This file contains all of the "static" define strings that tie to a trait. | ||
// WARNING: The sections here actually matter in this file as it's tested by CI. Please do not toy with the sections." | ||
|
||
// BEGIN TRAIT DEFINES | ||
|
||
/* | ||
Remember to update _globalvars/traits.dm if you're adding/removing/renaming traits. | ||
*/ | ||
|
||
/// Trait given to a mob that is currently thinking (giving off the "thinking" icon), used in an IC context | ||
#define TRAIT_THINKING_IN_CHARACTER "currently_thinking_IC" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// This file contains all of the trait sources, or all of the things that grant traits. | ||
// Several things such as `type` or `REF(src)` may be used in the ADD_TRAIT() macro as the "source", but this file contains all of the defines for immutable static strings. | ||
|
||
/// cannot be removed without admin intervention | ||
#define ROUNDSTART_TRAIT "roundstart" | ||
/// This trait comes from when a mob is currently typing. | ||
#define CURRENTLY_TYPING_TRAIT "currently_typing" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// This file should contain every single global trait in the game in a type-based list, as well as any additional trait-related information that's useful to have on a global basis. | ||
// This file is used in linting, so make sure to add everything alphabetically and what-not. | ||
// Do consider adding your trait entry to the similar list in `admin_tooling.dm` if you want it to be accessible to admins (which is probably the case for 75% of traits). | ||
|
||
// Please do note that there is absolutely no bearing on what traits are added to what subtype of `/datum`, this is just an easily referenceable list sorted by type. | ||
// The only thing that truly matters about traits is the code that is built to handle the traits, and where that code is located. Nothing else. | ||
|
||
GLOBAL_LIST_INIT(traits_by_type, list( | ||
/mob = list( | ||
"TRAIT_THINKING_IN_CHARACTER" = TRAIT_THINKING_IN_CHARACTER, | ||
) | ||
)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#define TRAIT_CALLBACK_ADD(target, trait, source) CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(___TraitAdd), ##target, ##trait, ##source) | ||
#define TRAIT_CALLBACK_REMOVE(target, trait, source) CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(___TraitRemove), ##target, ##trait, ##source) | ||
|
||
///DO NOT USE ___TraitAdd OR ___TraitRemove as a replacement for ADD_TRAIT / REMOVE_TRAIT defines. To be used explicitly for callback. | ||
/proc/___TraitAdd(target, trait, source) | ||
if(!target || !trait || !source) | ||
return | ||
|
||
if(islist(target)) | ||
for(var/datum/listed_target in target) | ||
ADD_TRAIT(listed_target, trait, source) | ||
return | ||
|
||
ASSERT(isdatum(target), "Invalid target used in TRAIT_CALLBACK_ADD! Expected a datum reference, got [target] instead.") | ||
|
||
var/datum/datum_target = target | ||
ADD_TRAIT(datum_target, trait, source) | ||
|
||
///DO NOT USE ___TraitAdd OR ___TraitRemove as a replacement for ADD_TRAIT / REMOVE_TRAIT defines. To be used explicitly for callback. | ||
/proc/___TraitRemove(target, trait, source) | ||
if(!target || !trait || !source) | ||
return | ||
|
||
if(islist(target)) | ||
for(var/datum/listed_target in target) | ||
REMOVE_TRAIT(listed_target, trait, source) | ||
return | ||
|
||
ASSERT(isdatum(target), "Invalid target used in TRAIT_CALLBACK_REMOVE! Expected a datum reference, got [target] instead.") | ||
|
||
var/datum/datum_target = target | ||
REMOVE_TRAIT(datum_target, trait, source) | ||
|
||
|
||
/// Proc that handles adding multiple traits to a target via a list. Must have a common source and target. | ||
/datum/proc/add_traits(list/list_of_traits, source) | ||
ASSERT(islist(list_of_traits), "Invalid arguments passed to add_traits! Invoked on [src] with [list_of_traits], source being [source].") | ||
for(var/trait in list_of_traits) | ||
ADD_TRAIT(src, trait, source) | ||
|
||
/// Proc that handles removing multiple traits from a target via a list. Must have a common source and target. | ||
/datum/proc/remove_traits(list/list_of_traits, source) | ||
ASSERT(islist(list_of_traits), "Invalid arguments passed to remove_traits! Invoked on [src] with [list_of_traits], source being [source].") | ||
for(var/trait in list_of_traits) | ||
REMOVE_TRAIT(src, trait, source) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.