Skip to content

Commit

Permalink
clrf to lf
Browse files Browse the repository at this point in the history
  • Loading branch information
Antoonij authored Dec 28, 2024
1 parent 3f99d06 commit 9922150
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 47 deletions.
14 changes: 7 additions & 7 deletions code/__HELPERS/bitflags.dm
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))
80 changes: 40 additions & 40 deletions code/datums/components/pref_viewer.dm
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())

0 comments on commit 9922150

Please sign in to comment.