-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
47 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#define HASBIT(CONTAINER, FLAG) ((CONTAINER) & (FLAG)) | ||
|
||
#define SETBIT(CONTAINER, FLAG) (CONTAINER |= (FLAG)) | ||
|
||
#define CLEARBIT(CONTAINER, FLAG) (CONTAINER &= ~(FLAG)) | ||
|
||
#define TOGGLEBIT(CONTAINER, FLAG) (CONTAINER ^= (FLAG)) | ||
#define HASBIT(CONTAINER, FLAG) ((CONTAINER) & (FLAG)) | ||
|
||
#define SETBIT(CONTAINER, FLAG) (CONTAINER |= (FLAG)) | ||
|
||
#define CLEARBIT(CONTAINER, FLAG) (CONTAINER &= ~(FLAG)) | ||
|
||
#define TOGGLEBIT(CONTAINER, FLAG) (CONTAINER ^= (FLAG)) |
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 |
---|---|---|
@@ -1,40 +1,40 @@ | ||
/datum/component/pref_viewer | ||
var/list/preferences_to_show | ||
|
||
/datum/component/pref_viewer/Destroy(force) | ||
LAZYNULL(preferences_to_show) | ||
|
||
return ..() | ||
|
||
/datum/component/pref_viewer/Initialize( | ||
list/preferences_to_show | ||
) | ||
if(!ismob(parent)) | ||
return COMPONENT_INCOMPATIBLE | ||
|
||
src.preferences_to_show = preferences_to_show | ||
|
||
/datum/component/pref_viewer/RegisterWithParent() | ||
RegisterSignal(parent, COMSIG_MOB_RUN_EXAMINATE, PROC_REF(on_examine)) | ||
|
||
/datum/component/pref_viewer/UnregisterFromParent() | ||
UnregisterSignal(parent, COMSIG_MOB_RUN_EXAMINATE) | ||
|
||
/datum/component/pref_viewer/proc/on_examine(mob/target, list/result) | ||
SIGNAL_HANDLER | ||
|
||
if(!istype(target) || !target.client) | ||
return | ||
|
||
INVOKE_ASYNC(src, PROC_REF(modify_examine), target, result) | ||
|
||
/datum/component/pref_viewer/proc/modify_examine(mob/target, list/result) | ||
for(var/datum/preference_info/pref as anything in preferences_to_show) | ||
var/datum/preference_toggle/pref_toggle = pref.get_preference_toggle() | ||
|
||
if(!HASBIT(target.client.prefs.toggles, pref_toggle::preftoggle_bitflag) \ | ||
&& !HASBIT(target.client.prefs.toggles2, pref_toggle::preftoggle_bitflag) | ||
) | ||
continue | ||
|
||
LAZYADD(result, pref.get_examine_text()) | ||
/datum/component/pref_viewer | ||
var/list/preferences_to_show | ||
|
||
/datum/component/pref_viewer/Destroy(force) | ||
LAZYNULL(preferences_to_show) | ||
|
||
return ..() | ||
|
||
/datum/component/pref_viewer/Initialize( | ||
list/preferences_to_show | ||
) | ||
if(!ismob(parent)) | ||
return COMPONENT_INCOMPATIBLE | ||
|
||
src.preferences_to_show = preferences_to_show | ||
|
||
/datum/component/pref_viewer/RegisterWithParent() | ||
RegisterSignal(parent, COMSIG_MOB_RUN_EXAMINATE, PROC_REF(on_examine)) | ||
|
||
/datum/component/pref_viewer/UnregisterFromParent() | ||
UnregisterSignal(parent, COMSIG_MOB_RUN_EXAMINATE) | ||
|
||
/datum/component/pref_viewer/proc/on_examine(mob/target, list/result) | ||
SIGNAL_HANDLER | ||
|
||
if(!istype(target) || !target.client) | ||
return | ||
|
||
INVOKE_ASYNC(src, PROC_REF(modify_examine), target, result) | ||
|
||
/datum/component/pref_viewer/proc/modify_examine(mob/target, list/result) | ||
for(var/datum/preference_info/pref as anything in preferences_to_show) | ||
var/datum/preference_toggle/pref_toggle = pref.get_preference_toggle() | ||
|
||
if(!HASBIT(target.client.prefs.toggles, pref_toggle::preftoggle_bitflag) \ | ||
&& !HASBIT(target.client.prefs.toggles2, pref_toggle::preftoggle_bitflag) | ||
) | ||
continue | ||
|
||
LAZYADD(result, pref.get_examine_text()) |