Update resize pref and some resizing code

This commit is contained in:
Aronai Sieyes
2021-04-07 15:15:51 -04:00
parent a923324c11
commit 081b100e10
18 changed files with 149 additions and 88 deletions
+5
View File
@@ -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
+1 -1
View File
@@ -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)
+17 -5
View File
@@ -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,"<span class='warning'>[L] will lose this size upon moving into an area where this size is not allowed.</span>")
else if(very_big) // made an extreme size in an area that doesn't allow it, assume adminbuse
to_chat(src,"<span class='warning'>[L] will retain this normally unallowed size outside this area.</span>")
L.size_uncapped = TRUE
else if(L.size_uncapped) // made a normal size after having been an extreme adminbuse size
to_chat(src,"<span class='warning'>[L] now returned to normal area-based size limitations.</span>")
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")
@@ -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)
. += "<br>"
@@ -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,"<span class='warning'>The uniform panics and corrects your apparently microscopic size.</span>")
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("<span class='warning'>The space around [H] distorts as they change size!</span>","<span class='notice'>The space around you distorts as you change size!</span>")
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("<span class='warning'>The space around [H] distorts as they return to their original size!</span>","<span class='notice'>The space around you distorts as you return to your original size!</span>")
@@ -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, "<span class='notice'>You are now [resizable ? "susceptible" : "immune"] to being resized.</span>")
/mob/living/carbon/human/proc/handle_flip_vr()
var/original_density = density
var/original_passflags = pass_flags
@@ -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)
@@ -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,"<span class='warning'>That size change would cost [cost] steel, which you don't have.</span>")
//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,"<span class='warning'>Unfortunately, [cost-actually_added] steel was lost due to lack of storage space.</span>")
@@ -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 ..()
+1 -1
View File
@@ -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))
+1 -1
View File
@@ -134,7 +134,7 @@
to_chat(nif.human,"<span class='notice'>The safety features of the NIF Program prevent you from choosing this size.</span>")
return
else
if(nif.human.resize(new_size/100))
if(nif.human.resize(new_size/100, ignore_prefs = TRUE))
to_chat(nif.human,"<span class='notice'>You set the size to [new_size]%</span>")
nif.human.visible_message("<span class='warning'>Swirling grey mist envelops [nif.human] as they change size!</span>","<span class='notice'>Swirling streams of nanites wrap around you as you change size!</span>")
spawn(0)
@@ -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
+5
View File
@@ -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,
+7
View File
@@ -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)
+27 -16
View File
@@ -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
/**
+30 -11
View File
@@ -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, "<span class='notice'>Invalid size.</span>")
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, "<span class='notice'>You set the size to [size_select]%</span>")
if(size_set_to < RESIZE_MINIMUM || size_set_to > RESIZE_MAXIMUM)
to_chat(usr, "<span class='notice'>Note: Resizing limited to 25-200% automatically while outside dormatory areas.</span>") //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, "<span class='notice'>You set the size to [size_select]%</span>")
//
@@ -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, "<font color='blue'>The beam fires into your body, changing your size!</font>")
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, "<span class='warning'>[M] will lose this size upon moving into an area where this size is not allowed.</span>")
else if(very_big) // made an extreme size in an area that doesn't allow it, assume adminbuse
to_chat(firer, "<span class='warning'>[M] will retain this normally unallowed size outside this area.</span>")
M.size_uncapped = TRUE
else if(M.size_uncapped) // made a normal size after having been an extreme adminbuse size
to_chat(firer, "<span class='warning'>[M] now returned to normal area-based size limitations.</span>")
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, "<font color='blue'>The beam fires into your body, changing your size!</font>")
M.updateicon()
return
+39 -28
View File
@@ -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"} />
</Flex.Item>
<Flex.Item basis="32%">
<Button
onClick={() => act("toggle_resize")}
icon={resizable ? "toggle-on" : "toggle-off"}
selected={resizable}
fluid
tooltip={"This button is to toggle your ability to be resized by others. "
+ (resizable ? "Click here to prevent being resized." : "Click here to allow being resized.")}
content={resizable ? "Resizing Allowed" : "No Resizing"} />
</Flex.Item>
<Flex.Item basis="32%" grow={1}>
<Button
onClick={() => act("toggle_steppref")}
icon={step_mechanics_active ? "toggle-on" : "toggle-off"}
selected={step_mechanics_active}
fluid
tooltipPosition="top"
tooltip={step_mechanics_active
? "This setting controls whether or not you participate in size-based step mechanics."
+ "Includes both stepping on others, as well as getting stepped on. Click to disable step mechanics."
: ("You will not participate in step mechanics."
+ " Click to enable step mechanics.")}
content={step_mechanics_active ? "Step Mechanics Enabled" : "Step Mechanics Disabled"} />
</Flex.Item>
<Flex.Item basis="32%">
<Button
onClick={() => act("toggle_fx")}
icon={show_vore_fx ? "toggle-on" : "toggle-off"}
selected={show_vore_fx}
fluid
tooltipPosition="top"
tooltip={show_vore_fx
? "This setting controls whether or not a pred is allowed to mess with your HUD and fullscreen overlays."
+ "Click to disable all FX."
: ("Regardless of Predator Setting, you will not see their FX settings."
+ " Click this to enable showing FX.")}
content={show_vore_fx ? "Show Vore FX" : "Do Not Show Vore FX"} />
</Flex.Item>
<Flex.Item basis="49%">
<Button
onClick={() => act("toggle_leaveremains")}
@@ -736,20 +775,6 @@ const VoreUserPreferences = (props, context) => {
+ " Click this to allow leaving remains.")}
content={digest_leave_remains ? "Allow Leaving Remains Behind" : "Do Not Allow Leaving Remains Behind"} />
</Flex.Item>
<Flex.Item basis="49%">
<Button
onClick={() => act("toggle_steppref")}
icon={step_mechanics_active ? "toggle-on" : "toggle-off"}
selected={step_mechanics_active}
fluid
tooltipPosition="top"
tooltip={step_mechanics_active
? "This setting controls whether or not you participate in size-based step mechanics."
+ "Includes both stepping on others, as well as getting stepped on. Click to disable step mechanics."
: ("You will not participate in step mechanics."
+ " Click to enable step mechanics.")}
content={step_mechanics_active ? "Step Mechanics Enabled" : "Step Mechanics Disabled"} />
</Flex.Item>
<Flex.Item basis="49%">
<Button
onClick={() => act("toggle_pickuppref")}
@@ -764,20 +789,6 @@ const VoreUserPreferences = (props, context) => {
+ " Click this to allow picking up/being picked up.")}
content={pickup_mechanics_active ? "Pick-up Mechanics Enabled" : "Pick-up Mechanics Disabled"} />
</Flex.Item>
<Flex.Item basis="49%">
<Button
onClick={() => act("toggle_fx")}
icon={show_vore_fx ? "toggle-on" : "toggle-off"}
selected={show_vore_fx}
fluid
tooltipPosition="top"
tooltip={show_vore_fx
? "This setting controls whether or not a pred is allowed to mess with your HUD and fullscreen overlays."
+ "Click to disable all FX."
: ("Regardless of Predator Setting, you will not see their FX settings."
+ " Click this to enable showing FX.")}
content={show_vore_fx ? "Show Vore FX" : "Do Not Show Vore FX"} />
</Flex.Item>
<Flex.Item basis="49%">
<Button
fluid
File diff suppressed because one or more lines are too long