From 6000f96dbc4de60f1088f06a3e7586aff7d307ca Mon Sep 17 00:00:00 2001 From: Ghommie Date: Wed, 24 Jul 2019 02:00:30 +0200 Subject: [PATCH] deleted some boolean variables in favor of bitflags. --- code/__DEFINES/citadel_defines.dm | 8 ++++- code/_globalvars/bitfields.dm | 10 ++++++ .../code/modules/arousal/arousal.dm | 12 +++---- .../code/modules/arousal/organs/_genitals.dm | 32 +++++++------------ .../code/modules/arousal/organs/breasts.dm | 7 ++-- .../code/modules/arousal/organs/eggsack.dm | 3 +- .../code/modules/arousal/organs/penis.dm | 3 +- .../code/modules/arousal/organs/testicles.dm | 8 ++--- .../code/modules/arousal/organs/vagina.dm | 3 +- .../code/modules/arousal/organs/womb.dm | 3 +- 10 files changed, 43 insertions(+), 46 deletions(-) diff --git a/code/__DEFINES/citadel_defines.dm b/code/__DEFINES/citadel_defines.dm index b366a792e5..035e660176 100644 --- a/code/__DEFINES/citadel_defines.dm +++ b/code/__DEFINES/citadel_defines.dm @@ -27,7 +27,13 @@ //genital flags #define GENITAL_BLACKLISTED (1 << 0) //for genitals that shouldn't be added to GLOB.genitals_list. -#define MASTURBATE_LINKED_ORGAN (1<<1) //used to pass our mission to the linked organ +#define GENITAL_INTERNAL (1<<1) +#define GENITAL_HIDDEN (1<<2) +#define GENITAL_THROUGH_CLOTHES (1<<3) +#define GENITAL_FUID_PRODUCTION (1<<4) +#define CAN_MASTURBATE_WITH (1<<5) +#define MASTURBATE_LINKED_ORGAN (1<<6) //used to pass our mission to the linked organ +#define CAN_CLIMAX_WITH (1<<7) #define COCK_SIZE_MIN 1 #define COCK_SIZE_MAX 20 diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index bb9fc98b8e..3c7af9af7e 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -177,4 +177,14 @@ GLOBAL_LIST_INIT(bitfields, list( "CAN_CARRY" = CAN_CARRY, "CAN_RESIST" = CAN_RESIST ), + "genital_flags" = list( + "GENITAL_BLACKLISTED" = GENITAL_BLACKLISTED, + "GENITAL_INTERNAL" = GENITAL_INTERNAL, + "GENITAL_HIDDEN" = GENITAL_HIDDEN, + "GENITAL_THROUGH_CLOTHES" = GENITAL_THROUGH_CLOTHES, + "GENITAL_FUID_PRODUCTION" = GENITAL_FUID_PRODUCTION, + "CAN_MASTURBATE_WITH" = CAN_MASTURBATE_WITH, + "MASTURBATE_LINKED_ORGAN" = MASTURBATE_LINKED_ORGAN, + "CAN_CLIMAX_WITH" = CAN_CLIMAX_WITH + ) )) \ No newline at end of file diff --git a/modular_citadel/code/modules/arousal/arousal.dm b/modular_citadel/code/modules/arousal/arousal.dm index 924c507e7d..f5b27b2c15 100644 --- a/modular_citadel/code/modules/arousal/arousal.dm +++ b/modular_citadel/code/modules/arousal/arousal.dm @@ -182,13 +182,13 @@ to_chat(src, "You aren't aroused enough for that.") /obj/item/organ/genital/proc/climaxable(mob/living/carbon/human/H, silent = FALSE) //returns the fluid source (ergo reagents holder) if found. - if(producing) + if(CHECK_BITFIELD(genital_flags, GENITAL_FUID_PRODUCTION)) . = reagents else if(linked_organ) . = linked_organ.reagents - else if(!silent) - to_chat(H, "Your [name] is unable to produce it's own fluids, it's missing the organs for it.") + if(!. && !silent) + to_chat(H, "Your [name] is unable to produce it's own fluids, it's missing the organs for it.") /mob/living/carbon/human/proc/do_climax(datum/reagents/R, atom/target, obj/item/organ/genital/G, spill = TRUE) if(!G) @@ -273,7 +273,7 @@ var/list/worn_stuff = get_equipped_items() for(var/obj/item/organ/genital/G in internal_organs) - if(G.can_masturbate_with && G.is_exposed(worn_stuff)) //filter out what you can't masturbate with + if(CHECK_BITFIELD(G.genital_flags, CAN_MASTURBATE_WITH) && G.is_exposed(worn_stuff)) //filter out what you can't masturbate with if(CHECK_BITFIELD(G.genital_flags, MASTURBATE_LINKED_ORGAN) && !G.linked_organ) continue genitals_list += G @@ -287,7 +287,7 @@ var/list/worn_stuff = get_equipped_items() for(var/obj/item/organ/genital/G in internal_organs) - if(G.can_climax && G.is_exposed(worn_stuff)) //filter out what you can't masturbate with + if(CHECK_BITFIELD(G.genital_flags, CAN_CLIMAX_WITH) && G.is_exposed(worn_stuff)) //filter out what you can't masturbate with genitals_list += G if(genitals_list.len) var/obj/item/organ/genital/ret_organ = input(src, "with what?", "Climax", null) as null|obj in genitals_list @@ -352,7 +352,7 @@ return if(forced_climax) //Something forced us to cum, this is not a masturbation thing and does not progress to the other checks for(var/obj/item/organ/genital/G in internal_organs) - if(!G.can_climax) //Skip things like wombs and testicles + if(!CHECK_BITFIELD(G.genital_flags, CAN_CLIMAX_WITH)) //Skip things like wombs and testicles continue var/mob/living/partner var/check_target diff --git a/modular_citadel/code/modules/arousal/organs/_genitals.dm b/modular_citadel/code/modules/arousal/organs/_genitals.dm index 292cc5f4ee..38c39d4756 100644 --- a/modular_citadel/code/modules/arousal/organs/_genitals.dm +++ b/modular_citadel/code/modules/arousal/organs/_genitals.dm @@ -3,11 +3,9 @@ w_class = WEIGHT_CLASS_NORMAL var/shape = "human" var/sensitivity = AROUSAL_START_VALUE - var/genital_flags - var/can_masturbate_with = FALSE + var/genital_flags //see citadel_defines.dm var/masturbation_verb = "masturbate" var/orgasm_verb = "cumming" //present continous - var/can_climax = FALSE var/fluid_transfer_factor = 0 //How much would a partner get in them if they climax using this? var/size = 2 //can vary between num or text, just used in icon_state strings var/fluid_id = null @@ -15,21 +13,17 @@ var/fluid_efficiency = 1 var/fluid_rate = 1 var/fluid_mult = 1 - var/producing = FALSE var/aroused_state = FALSE //Boolean used in icon_state strings var/aroused_amount = 50 //This is a num from 0 to 100 for arousal percentage for when to use arousal state icons. var/obj/item/organ/genital/linked_organ var/linked_organ_slot //only one of the two organs needs this to be set up. update_link() will handle linking the rest. - var/through_clothes = FALSE - var/internal = FALSE - var/hidden = FALSE var/layer_index = GENITAL_LAYER_INDEX //Order should be very important. FIRST vagina, THEN testicles, THEN penis, as this affects the order they are rendered in. /obj/item/organ/genital/Initialize() . = ..() if(fluid_id) create_reagents(fluid_max_volume) - if(producing) + if(CHECK_BITFIELD(genital_flags, GENITAL_FUID_PRODUCTION)) reagents.add_reagent(fluid_id, fluid_max_volume) update() @@ -53,9 +47,9 @@ var/list/exposed_genitals = list() //Keeping track of them so we don't have to iterate through every genitalia and see if exposed /obj/item/organ/genital/proc/is_exposed() - if(!owner || hidden || internal) + if(!owner || CHECK_BITFIELD(genital_flags, GENITAL_INTERNAL|GENITAL_HIDDEN)) return FALSE - if(through_clothes) + if(CHECK_BITFIELD(genital_flags, GENITAL_THROUGH_CLOTHES)) return TRUE switch(zone) //update as more genitals are added @@ -69,18 +63,18 @@ /obj/item/organ/genital/proc/toggle_visibility(visibility) switch(visibility) if("Always visible") - through_clothes = TRUE - hidden = FALSE + ENABLE_BITFIELD(genital_flags, GENITAL_THROUGH_CLOTHES) + DISABLE_BITFIELD(genital_flags, GENITAL_HIDDEN) if(!(src in owner.exposed_genitals)) owner.exposed_genitals += src if("Hidden by clothes") - through_clothes = FALSE - hidden = TRUE + DISABLE_BITFIELD(genital_flags, GENITAL_THROUGH_CLOTHES) + DISABLE_BITFIELD(genital_flags, GENITAL_HIDDEN) if(src in owner.exposed_genitals) owner.exposed_genitals -= src if("Always hidden") - through_clothes = FALSE - hidden = TRUE + DISABLE_BITFIELD(genital_flags, GENITAL_THROUGH_CLOTHES) + ENABLE_BITFIELD(genital_flags, GENITAL_HIDDEN) if(src in owner.exposed_genitals) owner.exposed_genitals -= src @@ -97,7 +91,7 @@ for(var/obj/item/organ/O in internal_organs) if(isgenital(O)) var/obj/item/organ/genital/G = O - if(!G.internal) + if(!CHECK_BITFIELD(G.genital_flags, GENITAL_INTERNAL)) genital_list += G if(!genital_list.len) //There is nothing to expose return @@ -121,7 +115,7 @@ if(!reagents || !owner) return reagents.maximum_volume = fluid_max_volume - if(fluid_id && producing) + if(fluid_id && CHECK_BITFIELD(genital_flags, GENITAL_FUID_PRODUCTION)) generate_fluid() /obj/item/organ/genital/proc/generate_fluid() @@ -235,8 +229,6 @@ //start scanning for genitals //var/list/worn_stuff = H.get_equipped_items()//cache this list so it's not built again for(var/obj/item/organ/genital/G in H.internal_organs) - if(G.hidden) - return //we're gunna just hijack this for updates. if(G.is_exposed()) //Checks appropriate clothing slot and if it's through_clothes LAZYADD(genitals_to_add[G.layer_index], G) //Now we added all genitals that aren't internal and should be rendered diff --git a/modular_citadel/code/modules/arousal/organs/breasts.dm b/modular_citadel/code/modules/arousal/organs/breasts.dm index 3fec45006b..6079c9364f 100644 --- a/modular_citadel/code/modules/arousal/organs/breasts.dm +++ b/modular_citadel/code/modules/arousal/organs/breasts.dm @@ -7,13 +7,10 @@ slot = ORGAN_SLOT_BREASTS size = BREASTS_SIZE_DEF fluid_id = "milk" - var/amount = 2 - producing = TRUE shape = "pair" - can_masturbate_with = TRUE + genital_flags = CAN_MASTURBATE_WITH|CAN_CLIMAX_WITH|GENITAL_FUID_PRODUCTION masturbation_verb = "massage" orgasm_verb = "leaking" - can_climax = TRUE fluid_transfer_factor = 0.5 /obj/item/organ/genital/breasts/update_appearance() @@ -32,7 +29,7 @@ desc += " You estimate that they're [uppertext(size)]-cups." else desc += " You wouldn't measure them in cup sizes." - if(producing && aroused_state) + if(CHECK_BITFIELD(genital_flags, GENITAL_FUID_PRODUCTION) && aroused_state) desc += " They're leaking [fluid_id]." var/string if(owner) diff --git a/modular_citadel/code/modules/arousal/organs/eggsack.dm b/modular_citadel/code/modules/arousal/organs/eggsack.dm index 624b2c24cd..ebdefd2371 100644 --- a/modular_citadel/code/modules/arousal/organs/eggsack.dm +++ b/modular_citadel/code/modules/arousal/organs/eggsack.dm @@ -5,10 +5,9 @@ icon = 'modular_citadel/icons/obj/genitals/ovipositor.dmi' zone = BODY_ZONE_PRECISE_GROIN slot = ORGAN_SLOT_TESTICLES - genital_flags = GENITAL_BLACKLISTED //unimplemented + genital_flags = GENITAL_INTERNAL|GENITAL_BLACKLISTED //unimplemented linked_organ_slot = ORGAN_SLOT_PENIS color = null //don't use the /genital color since it already is colored - internal = TRUE var/egg_girth = EGG_GIRTH_DEF var/cum_mult = CUM_RATE_MULT var/cum_rate = CUM_RATE diff --git a/modular_citadel/code/modules/arousal/organs/penis.dm b/modular_citadel/code/modules/arousal/organs/penis.dm index 5ab9868895..0441f78774 100644 --- a/modular_citadel/code/modules/arousal/organs/penis.dm +++ b/modular_citadel/code/modules/arousal/organs/penis.dm @@ -5,9 +5,8 @@ icon = 'modular_citadel/icons/obj/genitals/penis.dmi' zone = BODY_ZONE_PRECISE_GROIN slot = ORGAN_SLOT_PENIS - can_masturbate_with = TRUE masturbation_verb = "stroke" - can_climax = TRUE + genital_flags = CAN_MASTURBATE_WITH|CAN_CLIMAX_WITH fluid_transfer_factor = 0.5 size = 2 //arbitrary value derived from length and girth for sprites. layer_index = PENIS_LAYER_INDEX diff --git a/modular_citadel/code/modules/arousal/organs/testicles.dm b/modular_citadel/code/modules/arousal/organs/testicles.dm index 2e1b330095..e06a10b9fc 100644 --- a/modular_citadel/code/modules/arousal/organs/testicles.dm +++ b/modular_citadel/code/modules/arousal/organs/testicles.dm @@ -7,13 +7,11 @@ slot = ORGAN_SLOT_TESTICLES size = BALLS_SIZE_MIN linked_organ_slot = ORGAN_SLOT_PENIS - genital_flags = MASTURBATE_LINKED_ORGAN + genital_flags = CAN_MASTURBATE_WITH|MASTURBATE_LINKED_ORGAN|GENITAL_FUID_PRODUCTION var/size_name = "average" shape = "single" var/sack_size = BALLS_SACK_SIZE_DEF fluid_id = "semen" - producing = TRUE - can_masturbate_with = TRUE masturbation_verb = "massage" layer_index = TESTICLES_LAYER_INDEX var/size_linked = FALSE @@ -77,9 +75,7 @@ sack_size = D.features["balls_sack_size"] shape = D.features["balls_shape"] if(D.features["balls_shape"] == "Hidden") - internal = TRUE - else - internal = FALSE + ENABLE_BITFIELD(genital_flags, GENITAL_INTERNAL) fluid_id = D.features["balls_fluid"] fluid_rate = D.features["balls_cum_rate"] fluid_mult = D.features["balls_cum_mult"] diff --git a/modular_citadel/code/modules/arousal/organs/vagina.dm b/modular_citadel/code/modules/arousal/organs/vagina.dm index 1b4b088015..0df954fd79 100644 --- a/modular_citadel/code/modules/arousal/organs/vagina.dm +++ b/modular_citadel/code/modules/arousal/organs/vagina.dm @@ -6,9 +6,8 @@ zone = BODY_ZONE_PRECISE_GROIN slot = "vagina" size = 1 //There is only 1 size right now - can_masturbate_with = TRUE + genital_flags = CAN_MASTURBATE_WITH|CAN_CLIMAX_WITH masturbation_verb = "finger" - can_climax = TRUE fluid_transfer_factor = 0.1 //Yes, some amount is exposed to you, go get your AIDS layer_index = VAGINA_LAYER_INDEX var/cap_length = 8//D E P T H (cap = capacity) diff --git a/modular_citadel/code/modules/arousal/organs/womb.dm b/modular_citadel/code/modules/arousal/organs/womb.dm index d99206d0f1..3c4ce225f4 100644 --- a/modular_citadel/code/modules/arousal/organs/womb.dm +++ b/modular_citadel/code/modules/arousal/organs/womb.dm @@ -5,7 +5,6 @@ icon_state = "womb" zone = BODY_ZONE_PRECISE_GROIN slot = ORGAN_SLOT_WOMB - internal = TRUE + genital_flags = GENITAL_INTERNAL|GENITAL_FUID_PRODUCTION fluid_id = "femcum" - producing = TRUE linked_organ_slot = ORGAN_SLOT_VAGINA \ No newline at end of file