Skip to content

Commit

Permalink
tweak: VV fixes and tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
dageavtobusnick committed Jan 3, 2025
1 parent 4b351d4 commit 13c3ba4
Show file tree
Hide file tree
Showing 34 changed files with 1,411 additions and 256 deletions.
22 changes: 0 additions & 22 deletions code/__DEFINES/icon_smoothing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,6 @@

#define SMOOTH_DIAGONAL (1 << 12) //if atom should smooth diagonally, this should be present in 'smooth' var

DEFINE_BITFIELD(smoothing_flags, list(
"SMOOTH_CORNERS" = SMOOTH_CORNERS,
"SMOOTH_BITMASK" = SMOOTH_BITMASK,
"SMOOTH_DIAGONAL_CORNERS" = SMOOTH_DIAGONAL_CORNERS,
"SMOOTH_BORDER" = SMOOTH_BORDER,
"SMOOTH_QUEUED" = SMOOTH_QUEUED,
"SMOOTH_OBJ" = SMOOTH_OBJ,
"SMOOTH_BORDER_OBJECT" = SMOOTH_BORDER_OBJECT,
"SMOOTH_BROKEN_TURF" = SMOOTH_BROKEN_TURF,
"SMOOTH_BURNT_TURF" = SMOOTH_BURNT_TURF,
))

/// Components of a smoothing junction
/// Redefinitions of the diagonal directions so they can be stored in one var without conflicts
Expand All @@ -52,17 +41,6 @@ DEFINE_BITFIELD(smoothing_flags, list(
#define SOUTHWEST_JUNCTION (1<<6)
#define NORTHWEST_JUNCTION (1<<7)

DEFINE_BITFIELD(smoothing_junction, list(
"NORTH_JUNCTION" = NORTH_JUNCTION,
"SOUTH_JUNCTION" = SOUTH_JUNCTION,
"EAST_JUNCTION" = EAST_JUNCTION,
"WEST_JUNCTION" = WEST_JUNCTION,
"NORTHEAST_JUNCTION" = NORTHEAST_JUNCTION,
"SOUTHEAST_JUNCTION" = SOUTHEAST_JUNCTION,
"SOUTHWEST_JUNCTION" = SOUTHWEST_JUNCTION,
"NORTHWEST_JUNCTION" = NORTHWEST_JUNCTION,
))

/*smoothing macros*/

#define QUEUE_SMOOTH(thing_to_queue) if(thing_to_queue.smooth & (SMOOTH_CORNERS|SMOOTH_BITMASK)) {SSicon_smooth.add_to_queue(thing_to_queue)}
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/vv.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#define VV_NULL "NULL"
#define VV_RESTORE_DEFAULT "Restore to Default"
#define VV_MARKED_DATUM "Marked Datum"
#define VV_BITFIELD "Bitfield"
#define VV_REGEX "Regex"

// Flags for debug_variable() that do little things to what we end up rendering
Expand Down
9 changes: 9 additions & 0 deletions code/__HELPERS/_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1180,3 +1180,12 @@ proc/dd_sortedObjectList(list/incoming)
used_key_list[input_key] = 1
return input_key



/**
* Checks to make sure that the lists have the exact same contents, ignores the order of the contents.
*/
/proc/lists_equal_unordered(list/list_one, list/list_two)
// This ensures that both lists contain the same elements by checking if the difference between them is empty in both directions.
return !length(list_one ^ list_two)

31 changes: 0 additions & 31 deletions code/_globalvars/bitfields.dm

This file was deleted.

30 changes: 30 additions & 0 deletions code/_globalvars/bitfields/admin.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
DEFINE_BITFIELD(mute_category, list(
"MUTE_IC" = MUTE_IC,
"MUTE_OOC" = MUTE_OOC,
"MUTE_PRAY" = MUTE_PRAY,
"MUTE_ADMINHELP" = MUTE_ADMINHELP,
"MUTE_DEADCHAT" = MUTE_DEADCHAT,
"MUTE_TTS" = SMOOTH_OBJMUTE_TTS,
"MUTE_EMOTE" = MUTE_EMOTE,
))

DEFINE_BITFIELD(rights, list(
"R_BUILDMODE" = R_BUILDMODE,
"R_ADMIN" = R_ADMIN,
"R_BAN" = R_BAN,
"R_EVENT" = R_EVENT,
"R_SERVER" = R_SERVER,
"R_DEBUG" = R_DEBUG,
"R_POSSESS" = R_POSSESS,
"R_PERMISSIONS" = R_PERMISSIONS,
"R_STEALTH" = R_STEALTH,
"R_REJUVINATE" = R_REJUVINATE,
"R_VAREDIT" = R_VAREDIT,
"R_SOUNDS" = R_SOUNDS,
"R_SPAWN" = R_SPAWN,
"R_MOD" = R_MOD,
"R_MENTOR" = R_MENTOR,
"R_PROCCALL" = R_PROCCALL,
"R_VIEWRUNTIMES" = R_VIEWRUNTIMES,
))

56 changes: 56 additions & 0 deletions code/_globalvars/bitfields/bitfields.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
GLOBAL_LIST_INIT(bitfields, generate_bitfields())

/// Specifies a bitfield for smarter debugging
/datum/bitfield
/// The variable name that contains the bitfield
var/variable

/// An associative list of the readable flag and its true value
var/list/flags



/datum/bitfield/can_vv_delete()
return FALSE

/datum/bitfield/vv_edit_var(var_name, var_value)
return FALSE // no.

/// Turns /datum/bitfield subtypes into a list for use in debugging
/proc/generate_bitfields()
var/list/bitfields = list()
for (var/_bitfield in subtypesof(/datum/bitfield))
var/datum/bitfield/bitfield = new _bitfield
bitfields[bitfield.variable] = bitfield.flags
return bitfields


/proc/translate_bitfield(variable_type, variable_name, variable_value)
if(variable_type != VV_BITFIELD)
return variable_value

var/list/flags = list()
for(var/flag in GLOB.bitfields[variable_name])
if(variable_value & GLOB.bitfields[variable_name][flag])
flags += flag
if(length(flags))
return jointext(flags, ", ")
return "NONE"

/proc/input_bitfield(mob/user, bitfield, current_value)
if(!user || !(bitfield in GLOB.bitfields))
return
var/list/currently_checked = list()
for(var/name in GLOB.bitfields[bitfield])
currently_checked[name] = (current_value & GLOB.bitfields[bitfield][name])

var/list/result = tgui_input_checkbox_list(user, "Редактирование битового поля для [bitfield].", "Битовое поле", currently_checked)
if(isnull(result) || !islist(result))
return

var/new_result = 0
for(var/name in GLOB.bitfields[bitfield])
if(result[name])
new_result |= GLOB.bitfields[bitfield][name]
return new_result

120 changes: 120 additions & 0 deletions code/_globalvars/bitfields/declarations.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
DEFINE_BITFIELD(appearance_flags, list(
"LONG_GLIDE" = LONG_GLIDE,
"RESET_COLOR" = RESET_COLOR,
"RESET_ALPHA" = RESET_ALPHA,
"RESET_TRANSFORM" = RESET_TRANSFORM,
"NO_CLIENT_COLOR" = NO_CLIENT_COLOR,
"KEEP_TOGETHER" = KEEP_TOGETHER,
"KEEP_APART" = KEEP_APART,
"PLANE_MASTER" = PLANE_MASTER,
"TILE_BOUND" = TILE_BOUND,
"PIXEL_SCALE" = PIXEL_SCALE,
"PASS_MOUSE" = PASS_MOUSE,
"TILE_MOVER" = TILE_MOVER,
))

DEFINE_BITFIELD(vis_flags, list(
"VIS_HIDE" = VIS_HIDE,
"VIS_INHERIT_DIR" = VIS_INHERIT_DIR,
"VIS_INHERIT_ICON" = VIS_INHERIT_ICON,
"VIS_INHERIT_ICON_STATE" = VIS_INHERIT_ICON_STATE,
"VIS_INHERIT_ID" = VIS_INHERIT_ID,
"VIS_INHERIT_LAYER" = VIS_INHERIT_LAYER,
"VIS_INHERIT_PLANE" = VIS_INHERIT_PLANE,
"VIS_UNDERLAY" = VIS_UNDERLAY,
))

DEFINE_BITFIELD(datum_flags, list(
"DF_ISPROCESSING" = DF_ISPROCESSING,
"DF_VAR_EDITED" = DF_VAR_EDITED,
"DF_USE_TAG" = DF_USE_TAG,
))

DEFINE_BITFIELD(turf_flags, list(
"NOJAUNT" = NOJAUNT,
"UNUSED_RESERVATION_TURF" = UNUSED_RESERVATION_TURF,
"RESERVATION_TURF" = RESERVATION_TURF,
"NO_LAVA_GEN" = NO_LAVA_GEN,
"NO_RUINS" = NO_RUINS,
))

DEFINE_BITFIELD(pass_flags, list(
"PASSTABLE" = PASSTABLE,
"PASSGLASS" = PASSGLASS,
"PASSGRILLE" = PASSGRILLE,
"PASSBLOB" = PASSBLOB,
"PASSMOB" = PASSMOB,
"LETPASSTHROW" = LETPASSTHROW,
"PASSMACHINE" = PASSMACHINE,
"PASSSTRUCTURE" = PASSSTRUCTURE,
"PASSFLAPS" = PASSFLAPS,
"PASSFENCE" = PASSFENCE,
"PASSDOOR" = PASSDOOR,
"PASSVEHICLE" = PASSVEHICLE,
"PASSITEM" = PASSITEM,
"LETPASSCLICKS" = LETPASSCLICKS,
))

DEFINE_BITFIELD(pass_flags_self, list(
"PASSTABLE" = PASSTABLE,
"PASSGLASS" = PASSGLASS,
"PASSGRILLE" = PASSGRILLE,
"PASSBLOB" = PASSBLOB,
"PASSMOB" = PASSMOB,
"LETPASSTHROW" = LETPASSTHROW,
"PASSMACHINE" = PASSMACHINE,
"PASSSTRUCTURE" = PASSSTRUCTURE,
"PASSFLAPS" = PASSFLAPS,
"PASSFENCE" = PASSFENCE,
"PASSDOOR" = PASSDOOR,
"PASSVEHICLE" = PASSVEHICLE,
"PASSITEM" = PASSITEM,
"LETPASSCLICKS" = LETPASSCLICKS,
))


DEFINE_BITFIELD(gas_type, list(
"LINDA_SPAWN_HEAT" = LINDA_SPAWN_HEAT,
"LINDA_SPAWN_20C" = LINDA_SPAWN_20C,
"LINDA_SPAWN_TOXINS" = LINDA_SPAWN_TOXINS,
"LINDA_SPAWN_OXYGEN" = LINDA_SPAWN_OXYGEN,
"LINDA_SPAWN_CO2" = LINDA_SPAWN_CO2,
"LINDA_SPAWN_NITROGEN" = LINDA_SPAWN_NITROGEN,
"LINDA_SPAWN_N2O" = LINDA_SPAWN_N2O,
"LINDA_SPAWN_AGENT_B" = LINDA_SPAWN_AGENT_B,
"LINDA_SPAWN_AIR" = LINDA_SPAWN_AIR,
))

DEFINE_BITFIELD(spawn_contents, list(
"LINDA_SPAWN_HEAT" = LINDA_SPAWN_HEAT,
"LINDA_SPAWN_20C" = LINDA_SPAWN_20C,
"LINDA_SPAWN_TOXINS" = LINDA_SPAWN_TOXINS,
"LINDA_SPAWN_OXYGEN" = LINDA_SPAWN_OXYGEN,
"LINDA_SPAWN_CO2" = LINDA_SPAWN_CO2,
"LINDA_SPAWN_NITROGEN" = LINDA_SPAWN_NITROGEN,
"LINDA_SPAWN_N2O" = LINDA_SPAWN_N2O,
"LINDA_SPAWN_AGENT_B" = LINDA_SPAWN_AGENT_B,
"LINDA_SPAWN_AIR" = LINDA_SPAWN_AIR,
))

DEFINE_BITFIELD(qdel_flags, list(
"QDEL_ITEM_ADMINS_WARNED" = QDEL_ITEM_ADMINS_WARNED,
"QDEL_ITEM_SUSPENDED_FOR_LAG" = QDEL_ITEM_SUSPENDED_FOR_LAG,
))

DEFINE_BITFIELD(movement_type, list(
"GROUND" = GROUND,
"FLYING" = FLYING,
"VENTCRAWLING" = VENTCRAWLING,
"FLOATING" = FLOATING,
"PHASING" = PHASING,
"UPSIDE_DOWN" = UPSIDE_DOWN,
))

DEFINE_BITFIELD(area_flags, list(
"UNIQUE_AREA" = UNIQUE_AREA,
"CAVES_ALLOWED" = CAVES_ALLOWED,
"FLORA_ALLOWED" = FLORA_ALLOWED,
"MOB_SPAWN_ALLOWED" = MOB_SPAWN_ALLOWED,
"MEGAFAUNA_SPAWN_ALLOWED" = MEGAFAUNA_SPAWN_ALLOWED,
))
62 changes: 62 additions & 0 deletions code/_globalvars/bitfields/food.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
DEFINE_BITFIELD(disliked_food, list(
"MEAT" = MEAT,
"VEGETABLES" = VEGETABLES,
"RAW" = RAW,
"JUNKFOOD" = JUNKFOOD,
"GRAIN" = GRAIN,
"FRUIT" = FRUIT,
"DAIRY" = DAIRY,
"FRIED" = FRIED,
"ALCOHOL" = ALCOHOL,
"SUGAR" = SUGAR,
"EGG" = EGG,
"GROSS" = GROSS,
"TOXIC" = TOXIC,
))
DEFINE_BITFIELD(liked_food, list(
"MEAT" = MEAT,
"VEGETABLES" = VEGETABLES,
"RAW" = RAW,
"JUNKFOOD" = JUNKFOOD,
"GRAIN" = GRAIN,
"FRUIT" = FRUIT,
"DAIRY" = DAIRY,
"FRIED" = FRIED,
"ALCOHOL" = ALCOHOL,
"SUGAR" = SUGAR,
"EGG" = EGG,
"GROSS" = GROSS,
"TOXIC" = TOXIC,
))

DEFINE_BITFIELD(toxic_food, list(
"MEAT" = MEAT,
"VEGETABLES" = VEGETABLES,
"RAW" = RAW,
"JUNKFOOD" = JUNKFOOD,
"GRAIN" = GRAIN,
"FRUIT" = FRUIT,
"DAIRY" = DAIRY,
"FRIED" = FRIED,
"ALCOHOL" = ALCOHOL,
"SUGAR" = SUGAR,
"EGG" = EGG,
"GROSS" = GROSS,
"TOXIC" = TOXIC,
))

DEFINE_BITFIELD(foodtype, list(
"MEAT" = MEAT,
"VEGETABLES" = VEGETABLES,
"RAW" = RAW,
"JUNKFOOD" = JUNKFOOD,
"GRAIN" = GRAIN,
"FRUIT" = FRUIT,
"DAIRY" = DAIRY,
"FRIED" = FRIED,
"ALCOHOL" = ALCOHOL,
"SUGAR" = SUGAR,
"EGG" = EGG,
"GROSS" = GROSS,
"TOXIC" = TOXIC,
))
27 changes: 27 additions & 0 deletions code/_globalvars/bitfields/icon_smoothing.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
DEFINE_BITFIELD(smoothing_flags, list(
"SMOOTH_CORNERS" = SMOOTH_CORNERS,
"SMOOTH_BITMASK" = SMOOTH_BITMASK,
"SMOOTH_DIAGONAL_CORNERS" = SMOOTH_DIAGONAL_CORNERS,
"SMOOTH_BORDER" = SMOOTH_BORDER,
"SMOOTH_QUEUED" = SMOOTH_QUEUED,
"SMOOTH_OBJ" = SMOOTH_OBJ,
"SMOOTH_BORDER_OBJECT" = SMOOTH_BORDER_OBJECT,
"SMOOTH_BROKEN_TURF" = SMOOTH_BROKEN_TURF,
"SMOOTH_BURNT_TURF" = SMOOTH_BURNT_TURF,
"SMOOTH_FALSE" = SMOOTH_FALSE,
"SMOOTH_TRUE" = SMOOTH_TRUE,
"SMOOTH_MORE" = SMOOTH_MORE,
"SMOOTH_DIAGONAL" = SMOOTH_DIAGONAL,
))


DEFINE_BITFIELD(smoothing_junction, list(
"NORTH_JUNCTION" = NORTH_JUNCTION,
"SOUTH_JUNCTION" = SOUTH_JUNCTION,
"EAST_JUNCTION" = EAST_JUNCTION,
"WEST_JUNCTION" = WEST_JUNCTION,
"NORTHEAST_JUNCTION" = NORTHEAST_JUNCTION,
"SOUTHEAST_JUNCTION" = SOUTHEAST_JUNCTION,
"SOUTHWEST_JUNCTION" = SOUTHWEST_JUNCTION,
"NORTHWEST_JUNCTION" = NORTHWEST_JUNCTION,
))
6 changes: 6 additions & 0 deletions code/_globalvars/bitfields/jobs.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DEFINE_BITFIELD(department_flag, list(
"JOBCAT_ENGSEC" = JOBCAT_ENGSEC,
"JOBCAT_MEDSCI" = JOBCAT_MEDSCI,
"JOBCAT_SUPPORT" = JOBCAT_SUPPORT,
"JOBCAT_KARMA" = JOBCAT_KARMA,
))
Loading

0 comments on commit 13c3ba4

Please sign in to comment.