diff --git a/code/__defines/misc_vr.dm b/code/__defines/misc_vr.dm index 55973cdafc3..244f2fedc39 100644 --- a/code/__defines/misc_vr.dm +++ b/code/__defines/misc_vr.dm @@ -67,6 +67,11 @@ #define MAT_PLASTITANIUMGLASS "plastitanium glass" #define MAT_GOLDHULL "gold hull" +#define RESIZE_MINIMUM 0.25 +#define RESIZE_MAXIMUM 2 +#define RESIZE_MINIMUM_DORMS 0.01 +#define RESIZE_MAXIMUM_DORMS 6 + #define RESIZE_HUGE 2 #define RESIZE_BIG 1.5 #define RESIZE_NORMAL 1 diff --git a/code/game/dna/dna2_helpers.dm b/code/game/dna/dna2_helpers.dm index 9fc924dae83..f4b6a24c6a6 100644 --- a/code/game/dna/dna2_helpers.dm +++ b/code/game/dna/dna2_helpers.dm @@ -222,7 +222,7 @@ // Playerscale var/size = dna.GetUIValueRange(DNA_UI_PLAYERSCALE, player_sizes_list.len) if((0 < size) && (size <= player_sizes_list.len)) - H.resize(player_sizes_list[player_sizes_list[size]], TRUE) + H.resize(player_sizes_list[player_sizes_list[size]], TRUE, ignore_prefs = TRUE) // Tail/Taur Color H.r_tail = dna.GetUIValueRange(DNA_UI_TAIL_R, 255) diff --git a/code/modules/admin/verbs/resize.dm b/code/modules/admin/verbs/resize.dm index dddaeb9ec13..fc723c52781 100644 --- a/code/modules/admin/verbs/resize.dm +++ b/code/modules/admin/verbs/resize.dm @@ -5,12 +5,24 @@ if(!check_rights(R_ADMIN, R_FUN)) return - var/size_multiplier = input(usr, "Input size multiplier.", "Resize", 1) - L.resize(size_multiplier, TRUE, TRUE) - if(size_multiplier >= RESIZE_TINY && size_multiplier <= RESIZE_HUGE) - L.size_uncapped = FALSE - else + var/size_multiplier = input(usr, "Input size multiplier.", "Resize", 1) as num|null + if(!size_multiplier) + return //cancelled + + size_multiplier = clamp(size_multiplier, 0.01, 1000) + var/can_be_big = L.has_large_resize_bounds() + var/very_big = is_extreme_size(size_multiplier) + + if(very_big && can_be_big) // made an extreme size in an area that allows it, don't assume adminbuse + to_chat(src,"[L] will lose this size upon moving into an area where this size is not allowed.") + else if(very_big) // made an extreme size in an area that doesn't allow it, assume adminbuse + to_chat(src,"[L] will retain this normally unallowed size outside this area.") L.size_uncapped = TRUE + else if(L.size_uncapped) // made a normal size after having been an extreme adminbuse size + to_chat(src,"[L] now returned to normal area-based size limitations.") + L.size_uncapped = FALSE + + L.resize(size_multiplier, animate = TRUE, uncapped = TRUE, ignore_prefs = TRUE) log_and_message_admins("has changed [key_name(L)]'s size multiplier to [size_multiplier].") feedback_add_details("admin_verb","RESIZE") \ No newline at end of file diff --git a/code/modules/client/preference_setup/vore/02_size.dm b/code/modules/client/preference_setup/vore/02_size.dm index a1149821d2b..5af5db28b23 100644 --- a/code/modules/client/preference_setup/vore/02_size.dm +++ b/code/modules/client/preference_setup/vore/02_size.dm @@ -45,7 +45,7 @@ character.weight_gain = pref.weight_gain character.weight_loss = pref.weight_loss character.fuzzy = pref.fuzzy - character.resize(pref.size_multiplier, animate = FALSE) + character.resize(pref.size_multiplier, animate = FALSE, ignore_prefs = TRUE) /datum/category_item/player_setup_item/vore/size/content(var/mob/user) . += "
" diff --git a/code/modules/clothing/under/miscellaneous_vr.dm b/code/modules/clothing/under/miscellaneous_vr.dm index 762ea621095..67d08d29404 100644 --- a/code/modules/clothing/under/miscellaneous_vr.dm +++ b/code/modules/clothing/under/miscellaneous_vr.dm @@ -79,6 +79,8 @@ return var/new_size = input("Put the desired size (25-200%), or (1-600%) in dormitory areas.", "Set Size", 200) as num|null + if(!new_size) + return //cancelled //Check AGAIN because we accepted user input which is blocking. if (src != H.w_uniform) @@ -88,9 +90,9 @@ if (H.stat || H.restrained()) return - if (isnull(H.size_multiplier)) + if (isnull(H.size_multiplier)) // Why would this ever be the case? to_chat(H,"The uniform panics and corrects your apparently microscopic size.") - H.resize(RESIZE_NORMAL) + H.resize(RESIZE_NORMAL, ignore_prefs = TRUE) H.update_icons() //Just want the matrix transform return @@ -102,7 +104,7 @@ if(new_size != H.size_multiplier) if(!original_size) original_size = H.size_multiplier - H.resize(new_size/100) + H.resize(new_size/100, ignore_prefs = TRUE) // Ignores prefs because you can only resize yourself H.visible_message("The space around [H] distorts as they change size!","The space around you distorts as you change size!") else //They chose their current size. return @@ -111,7 +113,7 @@ . = ..() if(. && ishuman(M) && original_size) var/mob/living/carbon/human/H = M - H.resize(original_size) + H.resize(original_size, ignore_prefs = TRUE) original_size = null H.visible_message("The space around [H] distorts as they return to their original size!","The space around you distorts as you return to your original size!") diff --git a/code/modules/mob/living/carbon/human/emote_vr.dm b/code/modules/mob/living/carbon/human/emote_vr.dm index a23fb2a8008..d8deee8e7bf 100644 --- a/code/modules/mob/living/carbon/human/emote_vr.dm +++ b/code/modules/mob/living/carbon/human/emote_vr.dm @@ -181,15 +181,6 @@ return FALSE -/mob/living/carbon/human/verb/toggle_resizing_immunity() - set name = "Toggle Resizing Immunity" - set desc = "Toggles your ability to resist resizing attempts" - set category = "IC" - - resizable = !resizable - to_chat(src, "You are now [resizable ? "susceptible" : "immune"] to being resized.") - - /mob/living/carbon/human/proc/handle_flip_vr() var/original_density = density var/original_passflags = pass_flags diff --git a/code/modules/mob/living/carbon/human/species/station/protean_vr/protean_blob.dm b/code/modules/mob/living/carbon/human/species/station/protean_vr/protean_blob.dm index 52918b03bb5..3a1f4957298 100644 --- a/code/modules/mob/living/carbon/human/species/station/protean_vr/protean_blob.dm +++ b/code/modules/mob/living/carbon/human/species/station/protean_vr/protean_blob.dm @@ -432,7 +432,7 @@ var/global/list/disallowed_protean_accessories = list( var/atom/reform_spot = blob.drop_location() //Size update - resize(blob.size_multiplier, FALSE) + resize(blob.size_multiplier, FALSE, ignore_prefs = TRUE) //Move them back where the blob was forceMove(reform_spot) diff --git a/code/modules/mob/living/carbon/human/species/station/protean_vr/protean_powers.dm b/code/modules/mob/living/carbon/human/species/station/protean_vr/protean_powers.dm index 8a84a153311..c8e46b86007 100644 --- a/code/modules/mob/living/carbon/human/species/station/protean_vr/protean_powers.dm +++ b/code/modules/mob/living/carbon/human/species/station/protean_vr/protean_powers.dm @@ -300,14 +300,14 @@ //Sizing up if(cost > 0) if(refactory.use_stored_material(MAT_STEEL,cost)) - user.resize(size_factor) + user.resize(size_factor, ignore_prefs = TRUE) else to_chat(user,"That size change would cost [cost] steel, which you don't have.") //Sizing down (or not at all) else if(cost <= 0) cost = abs(cost) var/actually_added = refactory.add_stored_material(MAT_STEEL,cost) - user.resize(size_factor) + user.resize(size_factor, ignore_prefs = TRUE) if(actually_added != cost) to_chat(user,"Unfortunately, [cost-actually_added] steel was lost due to lack of storage space.") diff --git a/code/modules/mob/living/simple_mob/subtypes/vore/morph/morph.dm b/code/modules/mob/living/simple_mob/subtypes/vore/morph/morph.dm index 7b2da460081..4a843eed80e 100644 --- a/code/modules/mob/living/simple_mob/subtypes/vore/morph/morph.dm +++ b/code/modules/mob/living/simple_mob/subtypes/vore/morph/morph.dm @@ -121,7 +121,7 @@ else if(ismob(target)) var/mob/living/M = target - resize(M.size_multiplier) + resize(M.size_multiplier, ignore_prefs = TRUE) //Morphed is weaker melee_damage_lower = melee_damage_disguised @@ -165,7 +165,7 @@ maptext = null size_multiplier = our_size_multiplier - resize(size_multiplier) + resize(size_multiplier, ignore_prefs = TRUE) //Baseline stats melee_damage_lower = initial(melee_damage_lower) @@ -183,7 +183,7 @@ /mob/living/simple_mob/vore/hostile/morph/will_show_tooltip() return (!morphed) -/mob/living/simple_mob/vore/hostile/morph/resize(var/new_size, var/animate = TRUE) +/mob/living/simple_mob/vore/hostile/morph/resize(var/new_size, var/animate = TRUE, var/uncapped = FALSE, var/ignore_prefs = FALSE) if(morphed && !ismob(form)) return return ..() diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index bd7c1d0d499..fc0c3bebdd2 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -192,7 +192,7 @@ var/datum/preferences/B = O.client.prefs for(var/language in B.alternate_languages) O.add_language(language) - O.resize(B.size_multiplier, animate = TRUE) //VOREStation Addition: add size prefs to borgs + O.resize(B.size_multiplier, animate = TRUE, ignore_prefs = TRUE) //VOREStation Addition: add size prefs to borgs O.fuzzy = B.fuzzy //VOREStation Addition: add size prefs to borgs callHook("borgify", list(O)) diff --git a/code/modules/nifsoft/software/15_misc.dm b/code/modules/nifsoft/software/15_misc.dm index 2b173346ce0..dede84b0d92 100644 --- a/code/modules/nifsoft/software/15_misc.dm +++ b/code/modules/nifsoft/software/15_misc.dm @@ -134,7 +134,7 @@ to_chat(nif.human,"The safety features of the NIF Program prevent you from choosing this size.") return else - if(nif.human.resize(new_size/100)) + if(nif.human.resize(new_size/100, ignore_prefs = TRUE)) to_chat(nif.human,"You set the size to [new_size]%") nif.human.visible_message("Swirling grey mist envelops [nif.human] as they change size!","Swirling streams of nanites wrap around you as you change size!") spawn(0) diff --git a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Vore_vr.dm b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Vore_vr.dm index 3cf6276998e..20af3a57e3f 100644 --- a/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Vore_vr.dm +++ b/code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Vore_vr.dm @@ -13,8 +13,7 @@ mrate_static = TRUE /datum/reagent/macrocillin/affect_blood(var/mob/living/carbon/M, var/alien, var/removed) - if(M.size_range_check(M.size_multiplier)) - M.resize(M.size_multiplier+0.01)//Incrrease 1% per tick. + M.resize(M.size_multiplier+0.01, uncapped = M.has_large_resize_bounds()) //Incrrease 1% per tick. return /datum/reagent/microcillin @@ -27,8 +26,7 @@ mrate_static = TRUE /datum/reagent/microcillin/affect_blood(var/mob/living/carbon/M, var/alien, var/removed) - if(M.size_range_check(M.size_multiplier)) - M.resize(M.size_multiplier-0.01) //Decrease 1% per tick. + M.resize(M.size_multiplier-0.01, uncapped = M.has_large_resize_bounds()) //Decrease 1% per tick. return diff --git a/code/modules/vore/eating/vore_vr.dm b/code/modules/vore/eating/vore_vr.dm index 2985b7c489f..3c4ac857248 100644 --- a/code/modules/vore/eating/vore_vr.dm +++ b/code/modules/vore/eating/vore_vr.dm @@ -45,6 +45,7 @@ V::::::V V::::::VO:::::::OOO:::::::ORR:::::R R:::::REE::::::EEEEEE //Actual preferences var/digestable = TRUE var/devourable = TRUE + var/resizable = TRUE var/feeding = TRUE var/absorbable = TRUE //TFF 14/12/19 - choose whether allowing absorbing var/digest_leave_remains = FALSE @@ -122,6 +123,7 @@ V::::::V V::::::VO:::::::OOO:::::::ORR:::::R R:::::REE::::::EEEEEE digestable = json_from_file["digestable"] devourable = json_from_file["devourable"] + resizable = json_from_file["resizable"] feeding = json_from_file["feeding"] absorbable = json_from_file["absorbable"] //TFF 14/12/19 - choose whether allowing absorbing digest_leave_remains = json_from_file["digest_leave_remains"] @@ -141,6 +143,8 @@ V::::::V V::::::VO:::::::OOO:::::::ORR:::::R R:::::REE::::::EEEEEE digestable = TRUE if(isnull(devourable)) devourable = TRUE + if(isnull(resizable)) + resizable = TRUE if(isnull(feeding)) feeding = TRUE if(isnull(absorbable)) @@ -175,6 +179,7 @@ V::::::V V::::::VO:::::::OOO:::::::ORR:::::R R:::::REE::::::EEEEEE "version" = version, "digestable" = digestable, "devourable" = devourable, + "resizable" = resizable, "absorbable" = absorbable, "feeding" = feeding, "digest_leave_remains" = digest_leave_remains, diff --git a/code/modules/vore/eating/vorepanel_vr.dm b/code/modules/vore/eating/vorepanel_vr.dm index 2d5e4d36e96..b5b29fa7dfe 100644 --- a/code/modules/vore/eating/vorepanel_vr.dm +++ b/code/modules/vore/eating/vorepanel_vr.dm @@ -208,6 +208,7 @@ data["prefs"] = list( "digestable" = host.digestable, "devourable" = host.devourable, + "resizable" = host.resizable, "feeding" = host.feeding, "absorbable" = host.absorbable, "digest_leave_remains" = host.digest_leave_remains, @@ -358,6 +359,12 @@ host.client.prefs_vr.devourable = host.devourable unsaved_changes = TRUE return TRUE + if("toggle_resize") + host.resizable = !host.resizable + if(host.client.prefs_vr) + host.client.prefs_vr.resizable = host.resizable + unsaved_changes = TRUE + return TRUE if("toggle_feed") host.feeding = !host.feeding if(host.client.prefs_vr) diff --git a/code/modules/vore/resizing/resize_vr.dm b/code/modules/vore/resizing/resize_vr.dm index f7267752073..fa11f0cbbdd 100644 --- a/code/modules/vore/resizing/resize_vr.dm +++ b/code/modules/vore/resizing/resize_vr.dm @@ -49,21 +49,25 @@ GLOBAL_VAR(size_uncapped_mobs_timer) /mob/living/get_effective_size() return size_multiplier -/** - * Resizes the mob immediately to the desired mod, animating it growing/shrinking. - * It can be used by anything that calls it. - */ - /atom/movable/proc/size_range_check(size_select) //both objects and mobs needs to have that var/area/A = get_area(src) //Get the atom's area to check for size limit. if((A.limit_mob_size && (size_select > 200 || size_select < 25)) || (size_select > 600 || size_select <1)) return FALSE return TRUE +/atom/movable/proc/has_large_resize_bounds() + var/area/A = get_area(src) //Get the atom's area to check for size limit. + return !A.limit_mob_size + +/proc/is_extreme_size(size) + return (size < RESIZE_MINIMUM || size > RESIZE_MAXIMUM) + /proc/add_to_uncapped_list(var/mob/living/L) if(L.size_uncapped) return if(!GLOB.size_uncapped_mobs.len) + //Could be a subsystem but arguably a giant waste of time to make into a subsystem. A subsystem that is paused on and off all the time? Eh. + //If you're that worried, make metrics for how often this even runs and then decide. GLOB.size_uncapped_mobs_timer = addtimer(CALLBACK(GLOBAL_PROC, .check_uncapped_list), 2 SECONDS, TIMER_LOOP | TIMER_UNIQUE | TIMER_STOPPABLE) GLOB.size_uncapped_mobs |= weakref(L) @@ -80,26 +84,33 @@ GLOBAL_VAR(size_uncapped_mobs_timer) /proc/check_uncapped_list() for(var/weakref/wr in GLOB.size_uncapped_mobs) var/mob/living/L = wr.resolve() - var/area/A = get_area(L) - if(!istype(L)) + if(!istype(L) || L.size_uncapped) GLOB.size_uncapped_mobs -= wr continue - if((A.limit_mob_size && !L.size_uncapped) && (L.size_multiplier <= RESIZE_TINY || L.size_multiplier >= RESIZE_HUGE)) - L.resize(L.size_multiplier) + // If we get here, you're a mob, and you don't have admin exclusion (size_uncapped) to being big, and you're very likely big. + // If you're not abnormally big, the below will do nothing, so it's fine to run anyway. + if(!L.has_large_resize_bounds()) + L.resize(L.size_multiplier, ignore_prefs = TRUE) //Calling this will have resize() clamp it GLOB.size_uncapped_mobs -= wr if(!GLOB.size_uncapped_mobs.len) deltimer(GLOB.size_uncapped_mobs_timer) GLOB.size_uncapped_mobs_timer = null -/mob/living/proc/resize(var/new_size, var/animate = TRUE, var/uncapped = FALSE) +/** + * Resizes the mob immediately to the desired mod, animating it growing/shrinking. + * It can be used by anything that calls it. + */ + + +/mob/living/proc/resize(var/new_size, var/animate = TRUE, var/uncapped = FALSE, var/ignore_prefs = FALSE) if(!uncapped) - new_size = clamp(new_size, RESIZE_TINY, RESIZE_HUGE) - src.size_uncapped = FALSE + new_size = clamp(new_size, RESIZE_MINIMUM, RESIZE_MAXIMUM) remove_from_uncapped_list(src) - else + else if(is_extreme_size(new_size)) add_to_uncapped_list(src) + if(size_multiplier == new_size) return 1 @@ -130,8 +141,8 @@ GLOBAL_VAR(size_uncapped_mobs_timer) else update_transform() //Lame way -/mob/living/carbon/human/resize(var/new_size, var/animate = TRUE) - if(!resizable) +/mob/living/carbon/human/resize(var/new_size, var/animate = TRUE, var/uncapped = FALSE, var/ignore_prefs = FALSE) + if(!resizable && !ignore_prefs) return 1 if(species) vis_height = species.icon_height @@ -144,7 +155,7 @@ GLOBAL_VAR(size_uncapped_mobs_timer) apply_hud(index, HI) // Optimize mannequins - never a point to animating or doing HUDs on these. -/mob/living/carbon/human/dummy/mannequin/resize(var/new_size, var/animate = TRUE) +/mob/living/carbon/human/dummy/mannequin/resize(var/new_size, var/animate = TRUE, var/uncapped = FALSE, var/ignore_prefs = FALSE) size_multiplier = new_size /** diff --git a/code/modules/vore/resizing/sizegun_vr.dm b/code/modules/vore/resizing/sizegun_vr.dm index d042c6cb34d..88d0154befe 100644 --- a/code/modules/vore/resizing/sizegun_vr.dm +++ b/code/modules/vore/resizing/sizegun_vr.dm @@ -44,12 +44,15 @@ set category = "Object" set src in view(1) - var/size_select = input("Put the desired size (25-200%), (1-600%) in dormitory areas.", "Set Size", size_set_to * 100) as num - if(!size_range_check(size_select)) - to_chat(usr, "Invalid size.") - return - size_set_to = (size_select/100) + var/size_select = input("Put the desired size (25-200%), (1-600%) in dormitory areas.", "Set Size", size_set_to * 100) as num|null + if(!size_select) + return //cancelled + //We do valid resize testing in actual firings because people move after setting these things. + //Just a basic clamp here to the valid ranges. + size_set_to = clamp((size_select/100), RESIZE_MINIMUM_DORMS, RESIZE_MAXIMUM_DORMS) to_chat(usr, "You set the size to [size_select]%") + if(size_set_to < RESIZE_MINIMUM || size_set_to > RESIZE_MAXIMUM) + to_chat(usr, "Note: Resizing limited to 25-200% automatically while outside dormatory areas.") //hint that we clamp it in resize /obj/item/weapon/gun/energy/sizegun/examine(mob/user) . = ..() @@ -66,8 +69,10 @@ set category = "Object" set src in view(1) - var/size_select = input("Put the desired size", "Set Size", size_set_to * 100) as num - size_set_to = max(1,size_select/100) //No negative numbers + var/size_select = input("Put the desired size (1-600%)", "Set Size", size_set_to * 100) as num|null + if(!size_select) + return //cancelled + size_set_to = clamp((size_select/100), 0, 1000) //eheh to_chat(usr, "You set the size to [size_select]%") // @@ -88,8 +93,10 @@ /obj/item/projectile/beam/sizelaser/on_hit(var/atom/target) var/mob/living/M = target + var/ignoring_prefs = (target == firer ? TRUE : FALSE) // Resizing yourself + if(istype(M)) - if(!M.resize(set_size)) + if(!M.resize(set_size, uncapped = M.has_large_resize_bounds(), ignore_prefs = ignoring_prefs)) to_chat(M, "The beam fires into your body, changing your size!") M.updateicon() return @@ -97,11 +104,23 @@ /obj/item/projectile/beam/sizelaser/admin/on_hit(var/atom/target) var/mob/living/M = target + if(istype(M)) - M.resize(set_size, TRUE, TRUE) - if(set_size >= RESIZE_TINY && set_size <= RESIZE_HUGE) + + var/can_be_big = M.has_large_resize_bounds() + var/very_big = is_extreme_size(set_size) + + if(very_big && can_be_big) // made an extreme size in an area that allows it, don't assume adminbuse + to_chat(firer, "[M] will lose this size upon moving into an area where this size is not allowed.") + else if(very_big) // made an extreme size in an area that doesn't allow it, assume adminbuse + to_chat(firer, "[M] will retain this normally unallowed size outside this area.") + M.size_uncapped = TRUE + else if(M.size_uncapped) // made a normal size after having been an extreme adminbuse size + to_chat(firer, "[M] now returned to normal area-based size limitations.") M.size_uncapped = FALSE - M.size_uncapped = TRUE + + M.resize(set_size, uncapped = TRUE, ignoring_prefs = TRUE) // Always ignores prefs, caution is advisable + to_chat(M, "The beam fires into your body, changing your size!") M.updateicon() return diff --git a/tgui/packages/tgui/interfaces/VorePanel.js b/tgui/packages/tgui/interfaces/VorePanel.js index 60cd967d75c..b0a87f20985 100644 --- a/tgui/packages/tgui/interfaces/VorePanel.js +++ b/tgui/packages/tgui/interfaces/VorePanel.js @@ -592,6 +592,7 @@ const VoreUserPreferences = (props, context) => { const { digestable, devourable, + resizable, feeding, absorbable, digest_leave_remains, @@ -722,6 +723,44 @@ const VoreUserPreferences = (props, context) => { : "Click here to turn on hunger noises.")} content={noisy ? "Hunger Noises Enabled" : "Hunger Noises Disabled"} /> + +