mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
* commit 1 - get me out * she lives * adds wizards * thing * surprise end hits take 1 * s * d * surprise end hits take 2 * montreal * REAl * strangelight * guilford fall * natural disasters * envelope * h * lady elect * test 321 * test 123 Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> * hot toes test * ss * redundancy * s * test 2 * s² * s³ * s²³ * a pray! * life and limb * epic problem * hmm * update * fixes something * fixes something² * adds slaughter demons to the game * rend it * hmm * restores something * adds clockwork cult into the game * adds changelings to the game * cassevetes * test 101 * :) * against * shut the door * adds darkspawn to the game * sad * cashout * adds vampires to the game * 2 * summer freeze * pink frosty * test111 * adds game to the game * 2 * syndrome * test * test 2 * test 3 * test 4 * adds replay to the game? * maybe? * slo * hrn * test II * test III * test IV * new technique * ahm hum * d * sensible * c * ss13 * a * v * f --------- Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
44 lines
1.9 KiB
Plaintext
44 lines
1.9 KiB
Plaintext
#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/i in target)
|
|
if(!isatom(i))
|
|
continue
|
|
var/atom/the_atom = i
|
|
ADD_TRAIT(the_atom,trait,source)
|
|
else if(isatom(target))
|
|
var/atom/the_atom2 = target
|
|
ADD_TRAIT(the_atom2,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/i in target)
|
|
if(!isatom(i))
|
|
continue
|
|
var/atom/the_atom = i
|
|
REMOVE_TRAIT(the_atom,trait,source)
|
|
else if(isatom(target))
|
|
var/atom/the_atom2 = target
|
|
REMOVE_TRAIT(the_atom2,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)
|