Resize proc polish and fixing

This commit is contained in:
Nyks
2021-04-07 02:01:33 +03:00
parent ea2a523ba8
commit 5b3a00a2dc
10 changed files with 34 additions and 29 deletions
+7 -12
View File
@@ -64,28 +64,23 @@ var/const/RESIZE_A_SMALLTINY = (RESIZE_SMALL + RESIZE_TINY) / 2
* Resizes the mob immediately to the desired mod, animating it growing/shrinking.
* It can be used by anything that calls it.
*/
/atom/movable/proc/in_dorms()
var/area/A = get_area(src)
return istype(A, /area/crew_quarters/sleep)
/atom/movable/proc/size_range_check(size_select) //both objects and mobs needs to have that
if((!in_dorms() && (size_select > 200 || size_select < 25)) || (size_select > 600 || size_select <1))
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
/mob/living/proc/resize(var/new_size, var/animate = TRUE, var/mark_unnatural_size = TRUE)
/mob/living/proc/resize(var/new_size, var/animate = TRUE, var/uncapped = FALSE)
if(!uncapped)
new_size = clamp(new_size, RESIZE_TINY, RESIZE_HUGE)
src.size_uncapped = FALSE
if(size_multiplier == new_size)
return 1
size_multiplier = new_size //Change size_multiplier so that other items can interact with them
if(ishuman(src))
var/mob/living/carbon/human/H = src
if(new_size > 2 || new_size < 0.25)
if(mark_unnatural_size) //Will target size be reverted to ordinary bounds when out of dorms or not?
H.unnaturally_resized = TRUE
else
H.unnaturally_resized = FALSE
if(animate)
var/change = new_size - size_multiplier
var/duration = (abs(change)+0.25) SECONDS
+2 -6
View File
@@ -89,12 +89,8 @@
/obj/item/projectile/beam/sizelaser/on_hit(var/atom/target)
var/mob/living/M = target
if(istype(M))
if(!M.in_dorms() || !istype(M, /mob/living/carbon/human))
if(!M.resize(clamp(set_size,0.25,2)))
to_chat(M, "<font color='blue'>The beam fires into your body, changing your size!</font>")
else
if(!M.resize(clamp(set_size,0.01,6)))
to_chat(M, "<font color='blue'>The beam fires into your body, changing your size!</font>")
if(!M.resize(set_size))
to_chat(M, "<font color='blue'>The beam fires into your body, changing your size!</font>")
M.updateicon()
return
return 1