From db678a35c5592e3b18ca69e33a213ee326768861 Mon Sep 17 00:00:00 2001 From: DragonTrance Date: Sat, 1 May 2021 18:57:17 -0700 Subject: [PATCH] view your bigness as smolness --- .../code/modules/resize/resize_action.dm | 34 +++++++++++++++++++ hyperstation/code/modules/resize/resizing.dm | 9 +++++ tgstation.dme | 1 + 3 files changed, 44 insertions(+) create mode 100644 hyperstation/code/modules/resize/resize_action.dm diff --git a/hyperstation/code/modules/resize/resize_action.dm b/hyperstation/code/modules/resize/resize_action.dm new file mode 100644 index 00000000..568ab3d0 --- /dev/null +++ b/hyperstation/code/modules/resize/resize_action.dm @@ -0,0 +1,34 @@ +//This action is technically a duplicate of /action/small_sprite +//However, we do our own things... + +/datum/action/sizecode_resize + name = "Toggle Giant Sprite" + desc = "Others will continue to see you giant." + icon_icon = 'icons/mob/screen_gen_old.dmi' + button_icon_state = "health1" //You can change this if you want + background_icon_state = "bg_alien" //But keep this as a distinct background + var/small = FALSE + var/image/small_icon + +/datum/action/sizecode_resize/Grant(mob/M, safety=FALSE) + if(ishuman(M) && !safety) //this probably gets called before a person gets overlays on roundstart, so try again + if(!LAZYLEN(M.overlays)) + addtimer(CALLBACK(src, .proc/Grant, M, TRUE), 5) //https://www.youtube.com/watch?v=QQ-aYZzlDeo + return + + ..() + if(!owner) + return + var/image/I = image(icon=owner.icon,icon_state=owner.icon_state,loc=owner,layer=owner.layer,pixel_x=owner.pixel_x,pixel_y=owner.pixel_y) + I.overlays += owner.overlays + I.override = TRUE + small_icon = I + +/datum/action/sizecode_resize/Trigger() + ..() + if(!small) + owner.add_alt_appearance(/datum/atom_hud/alternate_appearance/basic, "sizecode_smallsprite", small_icon) + else + owner.remove_alt_appearance("sizecode_smallsprite") + small = !small + return TRUE diff --git a/hyperstation/code/modules/resize/resizing.dm b/hyperstation/code/modules/resize/resizing.dm index e78cc839..2ba3f17b 100644 --- a/hyperstation/code/modules/resize/resizing.dm +++ b/hyperstation/code/modules/resize/resizing.dm @@ -13,6 +13,8 @@ var/const/RESIZE_MICRO = 0.25 var/size_multiplier = 1 //multiplier for the mob's icon size atm var/previous_size = 1 +//Cyanosis - Action that resizes the sprite for the client but nobody else. Say goodbye to attacking yourself when someone's above you lmao + var/datum/action/sizecode_resize/small_sprite #define MOVESPEED_ID_SIZE "SIZECODE" #define MOVESPEED_ID_STOMP "STEPPY" @@ -60,6 +62,13 @@ mob/living/get_effective_size() //if(src.size_multiplier >= RESIZE_A_HUGEBIG || src.size_multiplier <= RESIZE_A_TINYMICRO) Will remove clothing when too big or small. Will do later. previous_size = size_multiplier //And, change this now that we are finally done. + //Now check if the mob can get the size action + if(!small_sprite) + small_sprite = new(src) + small_sprite.Remove(src) + if(size_multiplier >= 1.25) //Anything bigger will start to block things + small_sprite.Grant(src) + //handle the big steppy, except nice /mob/living/proc/handle_micro_bump_helping(var/mob/living/tmob) if(ishuman(src)) diff --git a/tgstation.dme b/tgstation.dme index 8157d6eb..da0903ca 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -3088,6 +3088,7 @@ #include "hyperstation\code\modules\patreon\patreon.dm" #include "hyperstation\code\modules\reagents\chemistry\reagents\food_reagents.dm" #include "hyperstation\code\modules\reagents\chemistry\reagents\hydroponics_reactions.dm" +#include "hyperstation\code\modules\resize\resize_action.dm" #include "hyperstation\code\modules\resize\resizing.dm" #include "hyperstation\code\modules\resize\sizechems.dm" #include "hyperstation\code\modules\resize\sizegun.dm"