From cbd99e5aaff17b90cfeb977002ffa61d61ee98f2 Mon Sep 17 00:00:00 2001 From: JaySparrow Date: Wed, 15 Jul 2020 23:17:41 -0500 Subject: [PATCH 1/2] Health and speed relative to size Pikmin nerf, oh no. Health scales with size. And, being big or small nerfs speed a little. --- hyperstation/code/modules/resize/resizing.dm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hyperstation/code/modules/resize/resizing.dm b/hyperstation/code/modules/resize/resizing.dm index 41b78119..251a0cb1 100644 --- a/hyperstation/code/modules/resize/resizing.dm +++ b/hyperstation/code/modules/resize/resizing.dm @@ -7,6 +7,8 @@ var/const/RESIZE_SMALL = 0.75 var/const/RESIZE_TINY = 0.50 var/const/RESIZE_MICRO = 0.25 +#define MOVESPEED_ID_SIZE "SIZECODE" + //averages var/const/RESIZE_A_MACROHUGE = (RESIZE_MACRO + RESIZE_HUGE) / 2 var/const/RESIZE_A_HUGEBIG = (RESIZE_HUGE + RESIZE_BIG) / 2 @@ -33,9 +35,18 @@ mob/living/get_effective_size() /mob/living/proc/resize(var/new_size, var/animate = TRUE) if(size_multiplier == new_size) return 1 - + var/oldsize = size_multiplier //Store the old value size_multiplier = new_size //Change size_multiplier so that other items can interact with them src.update_transform() //WORK DAMN YOU + //Going to change the health and speed values too + var/inverse_size_multiplier = (1 / size_multiplier) //Get a positive value + src.remove_movespeed_modifier(MOVESPEED_ID_SIZE) + src.add_movespeed_modifier(MOVESPEED_ID_SIZE, multiplicative_slowdown = max(size_multiplier, inverse_size_multiplier)) + var/healthmod_old = ((oldsize * 50) - 50) //Get the old value to see what we must change. + var/healthmod_new = ((size_multiplier * 50) - 50) //A size of one would be zero. Big boys get health, small ones lose health. + var/healthchange = healthmod_new - healthmod_old //Get ready to apply the new value, and subtract the old one. (Negative values become positive) + src.maxHealth += healthchange + src.health += healthchange //handle the big steppy, except nice /mob/living/proc/handle_micro_bump_helping(var/mob/living/tmob) From 36257c0d9a9bff0b1ae812570bbc415a175c6a62 Mon Sep 17 00:00:00 2001 From: JaySparrow Date: Thu, 16 Jul 2020 03:05:10 -0500 Subject: [PATCH 2/2] SIZE CODE 3 AM, WOOO. MAYBE IT WORKS NOW. --- code/game/machinery/cloning.dm | 1 + code/modules/mob/dead/new_player/new_player.dm | 3 ++- code/modules/mob/living/carbon/life.dm | 5 +++++ code/modules/mob/living/carbon/update_icons.dm | 1 - hyperstation/code/modules/resize/resizing.dm | 10 +++++----- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index e3c2cfd3..7926f028 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -206,6 +206,7 @@ H.suiciding = FALSE H.custom_body_size = H.client.prefs.body_size //H.size_multiplier = (max(min( round((H.custom_body_size)), MAX_BODYSIZE),MIN_BODYSIZE)* 0.01) //Not working dont know why. + H.resize(H.custom_body_size * 0.01) attempting = FALSE return TRUE diff --git a/code/modules/mob/dead/new_player/new_player.dm b/code/modules/mob/dead/new_player/new_player.dm index 7a027c69..0dbcf362 100644 --- a/code/modules/mob/dead/new_player/new_player.dm +++ b/code/modules/mob/dead/new_player/new_player.dm @@ -580,7 +580,8 @@ H.name = real_name //h13 assign your characters custom height. if (H.custom_body_size) //Do they have it set? - H.size_multiplier = (max(min( round((H.custom_body_size)), MAX_BODYSIZE),MIN_BODYSIZE)* 0.01) + //H.size_multiplier = (max(min( round((H.custom_body_size)), MAX_BODYSIZE),MIN_BODYSIZE)* 0.01) //Old method + H.resize(H.custom_body_size * 0.01) //h13 give your starting impregchance (30%) if (H.breedable == TRUE) H.impregchance = 30 diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index 801a6cd2..87f4c208 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -1,6 +1,11 @@ /mob/living/carbon/Life() set invisibility = 0 + //Hyper Change + if(size_multiplier != previous_size) + sleep(1) + resize(size_multiplier) + if(notransform) return diff --git a/code/modules/mob/living/carbon/update_icons.dm b/code/modules/mob/living/carbon/update_icons.dm index 03df1cab..5c67b69a 100644 --- a/code/modules/mob/living/carbon/update_icons.dm +++ b/code/modules/mob/living/carbon/update_icons.dm @@ -69,7 +69,6 @@ if(previous_size > 1 && size_multiplier > 1) //macro stays a macro. We just scale the sprite with no offset changes ntransform.Scale(size_multiplier/previous_size) //scale the sprite accordingly - previous_size = size_multiplier if(changed) animate(src, transform = ntransform, time = 2, pixel_y = final_pixel_y, dir = final_dir, easing = EASE_IN|EASE_OUT) diff --git a/hyperstation/code/modules/resize/resizing.dm b/hyperstation/code/modules/resize/resizing.dm index 251a0cb1..a272aa48 100644 --- a/hyperstation/code/modules/resize/resizing.dm +++ b/hyperstation/code/modules/resize/resizing.dm @@ -33,20 +33,20 @@ mob/living/get_effective_size() return src.size_multiplier /mob/living/proc/resize(var/new_size, var/animate = TRUE) - if(size_multiplier == new_size) + size_multiplier = new_size //This will be passed into update_transform() and used to change health and speed. + if(size_multiplier == previous_size) return 1 - var/oldsize = size_multiplier //Store the old value - size_multiplier = new_size //Change size_multiplier so that other items can interact with them src.update_transform() //WORK DAMN YOU //Going to change the health and speed values too var/inverse_size_multiplier = (1 / size_multiplier) //Get a positive value src.remove_movespeed_modifier(MOVESPEED_ID_SIZE) - src.add_movespeed_modifier(MOVESPEED_ID_SIZE, multiplicative_slowdown = max(size_multiplier, inverse_size_multiplier)) - var/healthmod_old = ((oldsize * 50) - 50) //Get the old value to see what we must change. + src.add_movespeed_modifier(MOVESPEED_ID_SIZE, multiplicative_slowdown = (max(size_multiplier, inverse_size_multiplier) - 1)) + var/healthmod_old = ((previous_size * 50) - 50) //Get the old value to see what we must change. var/healthmod_new = ((size_multiplier * 50) - 50) //A size of one would be zero. Big boys get health, small ones lose health. var/healthchange = healthmod_new - healthmod_old //Get ready to apply the new value, and subtract the old one. (Negative values become positive) src.maxHealth += healthchange src.health += healthchange + previous_size = size_multiplier //And, change this now that we are finally done. //handle the big steppy, except nice /mob/living/proc/handle_micro_bump_helping(var/mob/living/tmob)