From 9ee85193a00df782f07797f20d7e3d6313f175c0 Mon Sep 17 00:00:00 2001 From: Alphas00 <154434082+Alphas00@users.noreply.github.com> Date: Sun, 26 Jan 2025 19:55:58 +0100 Subject: [PATCH 01/12] Universal Height Toggle --- .../code/modules/mob/living/species.dm | 6 +++ .../code/modules/resize/height_limits.dm | 44 +++++++++++++++++++ tgstation.dme | 1 + 3 files changed, 51 insertions(+) create mode 100644 GainStation13/code/modules/resize/height_limits.dm diff --git a/GainStation13/code/modules/mob/living/species.dm b/GainStation13/code/modules/mob/living/species.dm index 5ab43d3b93..ab129d5a62 100644 --- a/GainStation13/code/modules/mob/living/species.dm +++ b/GainStation13/code/modules/mob/living/species.dm @@ -271,7 +271,13 @@ fatness_delay = min(fatness_delay, delay_cap) return fatness_delay +/datum/species/proc/grant_resize_others(mob/living/carbon/human/H) + if(!H.resize_others) + H.resize_others = new(src) + H.resize_others.Grant(H) + /datum/species/proc/handle_fatness(mob/living/carbon/human/H) + grant_resize_others(H) handle_helplessness(H) H.handle_modular_items() diff --git a/GainStation13/code/modules/resize/height_limits.dm b/GainStation13/code/modules/resize/height_limits.dm new file mode 100644 index 0000000000..fa2f40f059 --- /dev/null +++ b/GainStation13/code/modules/resize/height_limits.dm @@ -0,0 +1,44 @@ +/mob/ + var/datum/action/resize_others/resize_others + var/see_resized_others = FALSE + +/datum/action/resize_others + name = "Toggle Others' Giant Sprites" + desc = "Others will now look small to you." + 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/resize_others/Trigger() + ..() + owner.see_resized_others = !owner.see_resized_others + return TRUE + +/datum/atom_hud/alternate_appearance/basic/showSmall + +/datum/atom_hud/alternate_appearance/basic/showSmall/New() + ..() + for(var/mob in GLOB.player_list) + if(mobShouldSee(mob)) + add_hud_to(mob) + +/datum/atom_hud/alternate_appearance/basic/blessedAware/mobShouldSee(mob/M) + if(M.mind) + if(M.see_resized_others == TRUE) + return TRUE + return FALSE + +/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_REF(Grant), M, TRUE), 5) //https://www.youtube.com/watch?v=QQ-aYZzlDeo + return + + ..() + if(!owner) + return + + owner.add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/showSmall, "gscode_smallsprite", small_icon, FALSE) + message_admins("generated") diff --git a/tgstation.dme b/tgstation.dme index e6836a43b0..35cccafc22 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -4075,6 +4075,7 @@ #include "GainStation13\code\modules\research\designs\nutri_designs.dm" #include "GainStation13\code\modules\research\nanites\nanite_programs\fattening.dm" #include "GainStation13\code\modules\research\techweb\nutritech_nodes.dm" +#include "GainStation13\code\modules\resize\height_limits.dm" #include "GainStation13\code\modules\surgery\organs\augments.dm" #include "GainStation13\code\modules\surgery\organs\tongue.dm" #include "GainStation13\code\modules\vehicles\grocery_cart_scooter.dm" From 2070a6e5c72b2aa427c0e430b3d757bd2d9681a7 Mon Sep 17 00:00:00 2001 From: Alphas00 <154434082+Alphas00@users.noreply.github.com> Date: Sun, 26 Jan 2025 22:00:27 +0100 Subject: [PATCH 02/12] Toggle Button working --- .../code/modules/resize/height_limits.dm | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/GainStation13/code/modules/resize/height_limits.dm b/GainStation13/code/modules/resize/height_limits.dm index fa2f40f059..6f83c0af98 100644 --- a/GainStation13/code/modules/resize/height_limits.dm +++ b/GainStation13/code/modules/resize/height_limits.dm @@ -8,14 +8,31 @@ 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/resize_others/Trigger() ..() owner.see_resized_others = !owner.see_resized_others + if(owner.see_resized_others) + for(var/mob/living/L in GLOB.mob_living_list) + if(L.size_multiplier > 1) + L.add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/showSmall, "gscode_smallsprite", GenerateSprite(L), FALSE) + var/datum/atom_hud/alternate_appearance/AA = L.alternate_appearances["gscode_smallsprite"] + if(L != owner) + AA.add_to_single_hud(owner, L) + else + for(var/mob/living/L in GLOB.mob_living_list) + if(L.size_multiplier > 1) + var/datum/atom_hud/alternate_appearance/AA = L.alternate_appearances["gscode_smallsprite"] + if(AA) + AA.remove_from_single_hud(owner, L) return TRUE +/datum/action/resize_others/proc/GenerateSprite(mob/living/L) + var/image/I = image(icon=L.icon,icon_state=L.icon_state,loc=L,layer=L.layer,pixel_x=L.pixel_x,pixel_y=L.pixel_y) + I.overlays += L.overlays + I.override = TRUE + return I + /datum/atom_hud/alternate_appearance/basic/showSmall /datum/atom_hud/alternate_appearance/basic/showSmall/New() @@ -24,21 +41,5 @@ if(mobShouldSee(mob)) add_hud_to(mob) -/datum/atom_hud/alternate_appearance/basic/blessedAware/mobShouldSee(mob/M) - if(M.mind) - if(M.see_resized_others == TRUE) - return TRUE +/datum/atom_hud/alternate_appearance/basic/showSmall/mobShouldSee(mob/M) return FALSE - -/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_REF(Grant), M, TRUE), 5) //https://www.youtube.com/watch?v=QQ-aYZzlDeo - return - - ..() - if(!owner) - return - - owner.add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/showSmall, "gscode_smallsprite", small_icon, FALSE) - message_admins("generated") From 695db655d57e7122a9027a37a9fe76f433d3df29 Mon Sep 17 00:00:00 2001 From: Alphas00 <154434082+Alphas00@users.noreply.github.com> Date: Sun, 26 Jan 2025 23:35:27 +0100 Subject: [PATCH 03/12] Verb Toggle --- .../code/modules/mob/living/species.dm | 6 -- .../code/modules/resize/height_limits.dm | 57 +++++++++++-------- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/GainStation13/code/modules/mob/living/species.dm b/GainStation13/code/modules/mob/living/species.dm index ab129d5a62..5ab43d3b93 100644 --- a/GainStation13/code/modules/mob/living/species.dm +++ b/GainStation13/code/modules/mob/living/species.dm @@ -271,13 +271,7 @@ fatness_delay = min(fatness_delay, delay_cap) return fatness_delay -/datum/species/proc/grant_resize_others(mob/living/carbon/human/H) - if(!H.resize_others) - H.resize_others = new(src) - H.resize_others.Grant(H) - /datum/species/proc/handle_fatness(mob/living/carbon/human/H) - grant_resize_others(H) handle_helplessness(H) H.handle_modular_items() diff --git a/GainStation13/code/modules/resize/height_limits.dm b/GainStation13/code/modules/resize/height_limits.dm index 6f83c0af98..8e03af704c 100644 --- a/GainStation13/code/modules/resize/height_limits.dm +++ b/GainStation13/code/modules/resize/height_limits.dm @@ -2,31 +2,6 @@ var/datum/action/resize_others/resize_others var/see_resized_others = FALSE -/datum/action/resize_others - name = "Toggle Others' Giant Sprites" - desc = "Others will now look small to you." - 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 - -/datum/action/resize_others/Trigger() - ..() - owner.see_resized_others = !owner.see_resized_others - if(owner.see_resized_others) - for(var/mob/living/L in GLOB.mob_living_list) - if(L.size_multiplier > 1) - L.add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/showSmall, "gscode_smallsprite", GenerateSprite(L), FALSE) - var/datum/atom_hud/alternate_appearance/AA = L.alternate_appearances["gscode_smallsprite"] - if(L != owner) - AA.add_to_single_hud(owner, L) - else - for(var/mob/living/L in GLOB.mob_living_list) - if(L.size_multiplier > 1) - var/datum/atom_hud/alternate_appearance/AA = L.alternate_appearances["gscode_smallsprite"] - if(AA) - AA.remove_from_single_hud(owner, L) - return TRUE - /datum/action/resize_others/proc/GenerateSprite(mob/living/L) var/image/I = image(icon=L.icon,icon_state=L.icon_state,loc=L,layer=L.layer,pixel_x=L.pixel_x,pixel_y=L.pixel_y) I.overlays += L.overlays @@ -43,3 +18,35 @@ /datum/atom_hud/alternate_appearance/basic/showSmall/mobShouldSee(mob/M) return FALSE + +/client/verb/toggle_others_giant() + set name = "Toggle Others' Giant Sprite" + set category = "Preferences" + set desc = "Change display settings to and from displaying others' giant sprites." + message_admins("Working") + mob.see_resized_others = !mob.see_resized_others + if(mob.see_resized_others) + for(var/mob/living/L in GLOB.mob_living_list) + if(L && L.size_multiplier > 1) + L.add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/showSmall, "gscode_smallsprite", GenerateSprite(L), FALSE) + var/datum/atom_hud/alternate_appearance/AA = L.alternate_appearances["gscode_smallsprite"] + if(L != mob) + message_admins(mob.name) + AA.add_to_single_hud(mob, L) + message_admins("Done") + else + for(var/mob/living/L in GLOB.mob_living_list) + if(L && L.size_multiplier > 1 && L.alternate_appearances) + message_admins(L.name) + var/datum/atom_hud/alternate_appearance/AA = L.alternate_appearances["gscode_smallsprite"] + if(AA) + AA.remove_from_single_hud(mob, L) + message_admins("Removed") + +/client/proc/GenerateSprite(mob/living/L) + if(!L) + return + var/image/I = image(icon=L.icon,icon_state=L.icon_state,loc=L,layer=L.layer,pixel_x=L.pixel_x,pixel_y=L.pixel_y) + I.overlays += L.overlays + I.override = TRUE + return I From 1225e366e8b2f597b49e90fd191f3694e37f4547 Mon Sep 17 00:00:00 2001 From: Alphas00 <154434082+Alphas00@users.noreply.github.com> Date: Mon, 27 Jan 2025 16:25:52 +0100 Subject: [PATCH 04/12] Lists, sprite updates, rotation and translate --- .../code/modules/resize/height_limits.dm | 75 ++++++++++++------- 1 file changed, 46 insertions(+), 29 deletions(-) diff --git a/GainStation13/code/modules/resize/height_limits.dm b/GainStation13/code/modules/resize/height_limits.dm index 8e03af704c..d90917dfbe 100644 --- a/GainStation13/code/modules/resize/height_limits.dm +++ b/GainStation13/code/modules/resize/height_limits.dm @@ -1,12 +1,8 @@ -/mob/ - var/datum/action/resize_others/resize_others - var/see_resized_others = FALSE +GLOBAL_LIST_EMPTY(enabled_smallsprite) +GLOBAL_LIST_EMPTY(see_toggle_smallsprite) -/datum/action/resize_others/proc/GenerateSprite(mob/living/L) - var/image/I = image(icon=L.icon,icon_state=L.icon_state,loc=L,layer=L.layer,pixel_x=L.pixel_x,pixel_y=L.pixel_y) - I.overlays += L.overlays - I.override = TRUE - return I +/mob/ + var/see_resized_others = FALSE /datum/atom_hud/alternate_appearance/basic/showSmall @@ -23,30 +19,51 @@ set name = "Toggle Others' Giant Sprite" set category = "Preferences" set desc = "Change display settings to and from displaying others' giant sprites." - message_admins("Working") - mob.see_resized_others = !mob.see_resized_others - if(mob.see_resized_others) - for(var/mob/living/L in GLOB.mob_living_list) - if(L && L.size_multiplier > 1) - L.add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/showSmall, "gscode_smallsprite", GenerateSprite(L), FALSE) + if(!mob.see_resized_others) + mob.see_resized_others = !mob.see_resized_others + GLOB.see_toggle_smallsprite += mob + for(var/mob/living/L in GLOB.enabled_smallsprite) + if(L && L != mob && L.alternate_appearances && L.alternate_appearances["gscode_smallsprite"]) var/datum/atom_hud/alternate_appearance/AA = L.alternate_appearances["gscode_smallsprite"] - if(L != mob) - message_admins(mob.name) - AA.add_to_single_hud(mob, L) - message_admins("Done") + AA.add_to_single_hud(mob, L) else - for(var/mob/living/L in GLOB.mob_living_list) - if(L && L.size_multiplier > 1 && L.alternate_appearances) - message_admins(L.name) + mob.see_resized_others = !mob.see_resized_others + GLOB.see_toggle_smallsprite -= mob + for(var/mob/living/L in GLOB.enabled_smallsprite) + if(L && L.alternate_appearances && L.alternate_appearances["gscode_smallsprite"]) var/datum/atom_hud/alternate_appearance/AA = L.alternate_appearances["gscode_smallsprite"] - if(AA) - AA.remove_from_single_hud(mob, L) - message_admins("Removed") + AA.remove_from_single_hud(mob, L) -/client/proc/GenerateSprite(mob/living/L) - if(!L) - return - var/image/I = image(icon=L.icon,icon_state=L.icon_state,loc=L,layer=L.layer,pixel_x=L.pixel_x,pixel_y=L.pixel_y) - I.overlays += L.overlays +/mob/living/proc/regenerate_smallsprite() + if(alternate_appearances && alternate_appearances["gscode_smallsprite"]) + for(var/mob/M in GLOB.see_toggle_smallsprite) + var/datum/atom_hud/alternate_appearance/AA = alternate_appearances["gscode_smallsprite"] + AA.remove_from_single_hud(M, src) + remove_alt_appearance("gscode_smallsprite") + if(size_multiplier > 1) + if(!GLOB.enabled_smallsprite[src]) + GLOB.enabled_smallsprite += src + add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/showSmall, "gscode_smallsprite", generate_smallsprite(), FALSE) + for(var/mob/M in GLOB.see_toggle_smallsprite) + if(M != src) + var/datum/atom_hud/alternate_appearance/AA = alternate_appearances["gscode_smallsprite"] + AA.add_to_single_hud(M, src) + return TRUE + else + if(GLOB.enabled_smallsprite[src]) + GLOB.enabled_smallsprite -= src + return FALSE + +/mob/living/proc/generate_smallsprite() + var/image/I = image(icon=icon, icon_state=icon_state, loc=src, layer=layer, pixel_x=pixel_x, pixel_y=pixel_y) + I.overlays += overlays I.override = TRUE + var/matrix/ntransform = matrix(lying, MATRIX_ROTATE) + if(lying != 0) + ntransform.Translate(0, -get_standard_pixel_y_offset(lying)) + I.transform = ntransform return I + +/mob/living/BiologicalLife(delta_time, times_fired) + . = ..() + regenerate_smallsprite() From 0a0fa49403d40fe5917bdb1f0b94584efe70c6e9 Mon Sep 17 00:00:00 2001 From: Alphas00 <154434082+Alphas00@users.noreply.github.com> Date: Mon, 27 Jan 2025 17:32:57 +0100 Subject: [PATCH 05/12] Comments, toggle chat notification --- .../code/modules/resize/height_limits.dm | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/GainStation13/code/modules/resize/height_limits.dm b/GainStation13/code/modules/resize/height_limits.dm index d90917dfbe..db9bdba405 100644 --- a/GainStation13/code/modules/resize/height_limits.dm +++ b/GainStation13/code/modules/resize/height_limits.dm @@ -1,20 +1,20 @@ + +//Lists to keep track of: +// - Mobs with a sprite size over 100% +// - Mobs with the toggle activated +// Done to reduce the amount of mobs that need to be taken into account when the toggle is switched and for updating the seen sprite GLOBAL_LIST_EMPTY(enabled_smallsprite) GLOBAL_LIST_EMPTY(see_toggle_smallsprite) +//var to know if one has the toggle activated or not /mob/ var/see_resized_others = FALSE /datum/atom_hud/alternate_appearance/basic/showSmall -/datum/atom_hud/alternate_appearance/basic/showSmall/New() - ..() - for(var/mob in GLOB.player_list) - if(mobShouldSee(mob)) - add_hud_to(mob) - -/datum/atom_hud/alternate_appearance/basic/showSmall/mobShouldSee(mob/M) - return FALSE - +//Verb for the associated toggle. +//When switched on, add the current mob to the list of mobs that need to see smallsprites and apply the ones already present immediately to the mob's hud. +//When switched off, remove from the list and remove smallsprites for the user's hud. /client/verb/toggle_others_giant() set name = "Toggle Others' Giant Sprite" set category = "Preferences" @@ -26,6 +26,7 @@ GLOBAL_LIST_EMPTY(see_toggle_smallsprite) if(L && L != mob && L.alternate_appearances && L.alternate_appearances["gscode_smallsprite"]) var/datum/atom_hud/alternate_appearance/AA = L.alternate_appearances["gscode_smallsprite"] AA.add_to_single_hud(mob, L) + to_chat(src, "Resize others view toggled ON.") else mob.see_resized_others = !mob.see_resized_others GLOB.see_toggle_smallsprite -= mob @@ -33,7 +34,13 @@ GLOBAL_LIST_EMPTY(see_toggle_smallsprite) if(L && L.alternate_appearances && L.alternate_appearances["gscode_smallsprite"]) var/datum/atom_hud/alternate_appearance/AA = L.alternate_appearances["gscode_smallsprite"] AA.remove_from_single_hud(mob, L) + to_chat(src, "Resize others view toggled OFF.") +//Call to regenerate the sprites and update huds. +//If present, remove the old sprite from the huds and from the mob +//If the size_multiplier is still higher than 1, check if the mob is in the list of smallsprite mobs and add it if not +// add a new sprite by generating it, then go through the list of mobs with smallsprites toggled on and it to their hud +//If the size_multiplier was not higher than one then remove the mob from the list of smallsprite mobs /mob/living/proc/regenerate_smallsprite() if(alternate_appearances && alternate_appearances["gscode_smallsprite"]) for(var/mob/M in GLOB.see_toggle_smallsprite) @@ -54,6 +61,8 @@ GLOBAL_LIST_EMPTY(see_toggle_smallsprite) GLOB.enabled_smallsprite -= src return FALSE +//Generate the image based on the mob's current icon and apply matrix transformations +// to adjust its position and angle /mob/living/proc/generate_smallsprite() var/image/I = image(icon=icon, icon_state=icon_state, loc=src, layer=layer, pixel_x=pixel_x, pixel_y=pixel_y) I.overlays += overlays @@ -64,6 +73,7 @@ GLOBAL_LIST_EMPTY(see_toggle_smallsprite) I.transform = ntransform return I +//Called periodically to regenerate the mob's smallsprite /mob/living/BiologicalLife(delta_time, times_fired) . = ..() regenerate_smallsprite() From 2a3c07db2eb6d3301a93ffbe81911135d2292e4b Mon Sep 17 00:00:00 2001 From: Alphas00 <154434082+Alphas00@users.noreply.github.com> Date: Tue, 28 Jan 2025 08:38:27 +0100 Subject: [PATCH 06/12] Arousal menu option & Preference subcategory --- GainStation13/code/modules/resize/height_limits.dm | 2 +- hyperstation/code/modules/arousal/arousalhud.dm | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/GainStation13/code/modules/resize/height_limits.dm b/GainStation13/code/modules/resize/height_limits.dm index db9bdba405..fc5b4860c1 100644 --- a/GainStation13/code/modules/resize/height_limits.dm +++ b/GainStation13/code/modules/resize/height_limits.dm @@ -17,7 +17,7 @@ GLOBAL_LIST_EMPTY(see_toggle_smallsprite) //When switched off, remove from the list and remove smallsprites for the user's hud. /client/verb/toggle_others_giant() set name = "Toggle Others' Giant Sprite" - set category = "Preferences" + set category = "Preferences.GS13" set desc = "Change display settings to and from displaying others' giant sprites." if(!mob.see_resized_others) mob.see_resized_others = !mob.see_resized_others diff --git a/hyperstation/code/modules/arousal/arousalhud.dm b/hyperstation/code/modules/arousal/arousalhud.dm index f4df481b63..b6ebec95c3 100644 --- a/hyperstation/code/modules/arousal/arousalhud.dm +++ b/hyperstation/code/modules/arousal/arousalhud.dm @@ -77,6 +77,7 @@ dat += {"
"}//Newline for the objects //bottom options + dat += "Toggle others' giant sprites" //GS13 Edit dat += "Refresh" dat += "Old Menu" dat += "Toggle Undergarments " @@ -281,6 +282,11 @@ H.underwear_toggle() return + if(href_list["toggle_giant"]) + if(H && H.client) + H.client.toggle_others_giant() + return + src.ui_interact(usr) From be783e52f5ea0609c2053089d8b44e2e78e85751 Mon Sep 17 00:00:00 2001 From: Alphas00 <154434082+Alphas00@users.noreply.github.com> Date: Tue, 28 Jan 2025 22:32:06 +0100 Subject: [PATCH 07/12] Update GainStation13/code/modules/resize/height_limits.dm Co-authored-by: sheepishgoat <100518708+sheepishgoat@users.noreply.github.com> --- GainStation13/code/modules/resize/height_limits.dm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/GainStation13/code/modules/resize/height_limits.dm b/GainStation13/code/modules/resize/height_limits.dm index fc5b4860c1..85f68cc852 100644 --- a/GainStation13/code/modules/resize/height_limits.dm +++ b/GainStation13/code/modules/resize/height_limits.dm @@ -36,11 +36,13 @@ GLOBAL_LIST_EMPTY(see_toggle_smallsprite) AA.remove_from_single_hud(mob, L) to_chat(src, "Resize others view toggled OFF.") -//Call to regenerate the sprites and update huds. -//If present, remove the old sprite from the huds and from the mob -//If the size_multiplier is still higher than 1, check if the mob is in the list of smallsprite mobs and add it if not -// add a new sprite by generating it, then go through the list of mobs with smallsprites toggled on and it to their hud -//If the size_multiplier was not higher than one then remove the mob from the list of smallsprite mobs +/** +* Call to regenerate the sprites and update huds. +* * If present, remove the old sprite from the huds and from the mob +* * If the size_multiplier is still higher than 1, check if the mob is in the list of smallsprite mobs and add it if not +* * add a new sprite by generating it, then go through the list of mobs with smallsprites toggled on and it to their hud +* * If the size_multiplier was not higher than one then remove the mob from the list of smallsprite mobs +*/ /mob/living/proc/regenerate_smallsprite() if(alternate_appearances && alternate_appearances["gscode_smallsprite"]) for(var/mob/M in GLOB.see_toggle_smallsprite) From ab0de5d92053bfcc699b4de2673a126b25535818 Mon Sep 17 00:00:00 2001 From: Alphas00 <154434082+Alphas00@users.noreply.github.com> Date: Tue, 28 Jan 2025 22:32:15 +0100 Subject: [PATCH 08/12] Update GainStation13/code/modules/resize/height_limits.dm Co-authored-by: sheepishgoat <100518708+sheepishgoat@users.noreply.github.com> --- GainStation13/code/modules/resize/height_limits.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GainStation13/code/modules/resize/height_limits.dm b/GainStation13/code/modules/resize/height_limits.dm index 85f68cc852..5675249da3 100644 --- a/GainStation13/code/modules/resize/height_limits.dm +++ b/GainStation13/code/modules/resize/height_limits.dm @@ -44,7 +44,7 @@ GLOBAL_LIST_EMPTY(see_toggle_smallsprite) * * If the size_multiplier was not higher than one then remove the mob from the list of smallsprite mobs */ /mob/living/proc/regenerate_smallsprite() - if(alternate_appearances && alternate_appearances["gscode_smallsprite"]) + if(length(alternate_appearances) && alternate_appearances["gscode_smallsprite"]) for(var/mob/M in GLOB.see_toggle_smallsprite) var/datum/atom_hud/alternate_appearance/AA = alternate_appearances["gscode_smallsprite"] AA.remove_from_single_hud(M, src) From e932583ba0c324e875e64cdab7eff4351b9898df Mon Sep 17 00:00:00 2001 From: Alphas00 <154434082+Alphas00@users.noreply.github.com> Date: Tue, 28 Jan 2025 22:32:32 +0100 Subject: [PATCH 09/12] Update GainStation13/code/modules/resize/height_limits.dm Co-authored-by: sheepishgoat <100518708+sheepishgoat@users.noreply.github.com> --- GainStation13/code/modules/resize/height_limits.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GainStation13/code/modules/resize/height_limits.dm b/GainStation13/code/modules/resize/height_limits.dm index 5675249da3..5c16b97ff2 100644 --- a/GainStation13/code/modules/resize/height_limits.dm +++ b/GainStation13/code/modules/resize/height_limits.dm @@ -6,8 +6,8 @@ GLOBAL_LIST_EMPTY(enabled_smallsprite) GLOBAL_LIST_EMPTY(see_toggle_smallsprite) -//var to know if one has the toggle activated or not /mob/ + ///var to know if one has the toggle activated or not var/see_resized_others = FALSE /datum/atom_hud/alternate_appearance/basic/showSmall From 2cf8c9e8e61f24c4380ca22036697d71f361806c Mon Sep 17 00:00:00 2001 From: Alphas00 <154434082+Alphas00@users.noreply.github.com> Date: Tue, 28 Jan 2025 22:35:11 +0100 Subject: [PATCH 10/12] Update GainStation13/code/modules/resize/height_limits.dm Co-authored-by: sheepishgoat <100518708+sheepishgoat@users.noreply.github.com> --- GainStation13/code/modules/resize/height_limits.dm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/GainStation13/code/modules/resize/height_limits.dm b/GainStation13/code/modules/resize/height_limits.dm index 5c16b97ff2..06cb902cfd 100644 --- a/GainStation13/code/modules/resize/height_limits.dm +++ b/GainStation13/code/modules/resize/height_limits.dm @@ -63,8 +63,7 @@ GLOBAL_LIST_EMPTY(see_toggle_smallsprite) GLOB.enabled_smallsprite -= src return FALSE -//Generate the image based on the mob's current icon and apply matrix transformations -// to adjust its position and angle +///Generate the image based on the mob's current icon and apply matrix transformations to adjust its position and angle /mob/living/proc/generate_smallsprite() var/image/I = image(icon=icon, icon_state=icon_state, loc=src, layer=layer, pixel_x=pixel_x, pixel_y=pixel_y) I.overlays += overlays From 557a3b3ef37fcbe1b79c7e59fa5d8b8df2e81e5c Mon Sep 17 00:00:00 2001 From: Alphas00 <154434082+Alphas00@users.noreply.github.com> Date: Tue, 28 Jan 2025 22:42:58 +0100 Subject: [PATCH 11/12] Update GainStation13/code/modules/resize/height_limits.dm Co-authored-by: sheepishgoat <100518708+sheepishgoat@users.noreply.github.com> --- GainStation13/code/modules/resize/height_limits.dm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/GainStation13/code/modules/resize/height_limits.dm b/GainStation13/code/modules/resize/height_limits.dm index 06cb902cfd..1f3670e4d3 100644 --- a/GainStation13/code/modules/resize/height_limits.dm +++ b/GainStation13/code/modules/resize/height_limits.dm @@ -19,8 +19,8 @@ GLOBAL_LIST_EMPTY(see_toggle_smallsprite) set name = "Toggle Others' Giant Sprite" set category = "Preferences.GS13" set desc = "Change display settings to and from displaying others' giant sprites." - if(!mob.see_resized_others) - mob.see_resized_others = !mob.see_resized_others + mob.see_resized_others = !mob.see_resized_others + if(mob.see_resized_others) GLOB.see_toggle_smallsprite += mob for(var/mob/living/L in GLOB.enabled_smallsprite) if(L && L != mob && L.alternate_appearances && L.alternate_appearances["gscode_smallsprite"]) @@ -28,7 +28,6 @@ GLOBAL_LIST_EMPTY(see_toggle_smallsprite) AA.add_to_single_hud(mob, L) to_chat(src, "Resize others view toggled ON.") else - mob.see_resized_others = !mob.see_resized_others GLOB.see_toggle_smallsprite -= mob for(var/mob/living/L in GLOB.enabled_smallsprite) if(L && L.alternate_appearances && L.alternate_appearances["gscode_smallsprite"]) From 3a69e2597c27487f89e41ba7c7454b7381ea4626 Mon Sep 17 00:00:00 2001 From: Alphas00 <154434082+Alphas00@users.noreply.github.com> Date: Tue, 28 Jan 2025 23:28:34 +0100 Subject: [PATCH 12/12] Variable names, QDEL remove from list, misc fixes --- .../code/modules/resize/height_limits.dm | 96 +++++++++++++------ 1 file changed, 65 insertions(+), 31 deletions(-) diff --git a/GainStation13/code/modules/resize/height_limits.dm b/GainStation13/code/modules/resize/height_limits.dm index 1f3670e4d3..b8fc50e8ac 100644 --- a/GainStation13/code/modules/resize/height_limits.dm +++ b/GainStation13/code/modules/resize/height_limits.dm @@ -19,21 +19,50 @@ GLOBAL_LIST_EMPTY(see_toggle_smallsprite) set name = "Toggle Others' Giant Sprite" set category = "Preferences.GS13" set desc = "Change display settings to and from displaying others' giant sprites." + var/list/remove_from_list = new() + mob.see_resized_others = !mob.see_resized_others + if(mob.see_resized_others) GLOB.see_toggle_smallsprite += mob - for(var/mob/living/L in GLOB.enabled_smallsprite) - if(L && L != mob && L.alternate_appearances && L.alternate_appearances["gscode_smallsprite"]) - var/datum/atom_hud/alternate_appearance/AA = L.alternate_appearances["gscode_smallsprite"] - AA.add_to_single_hud(mob, L) + for(var/mob/living/resize_mob in GLOB.enabled_smallsprite) + if(QDELETED(resize_mob)) + remove_from_list += resize_mob + continue + + if(resize_mob && resize_mob != mob && resize_mob.alternate_appearances && resize_mob.alternate_appearances["gscode_smallsprite"]) + var/datum/atom_hud/alternate_appearance/appearance = resize_mob.alternate_appearances["gscode_smallsprite"] + appearance.add_to_single_hud(mob, resize_mob) + + GLOB.enabled_smallsprite -= remove_from_list to_chat(src, "Resize others view toggled ON.") - else - GLOB.see_toggle_smallsprite -= mob - for(var/mob/living/L in GLOB.enabled_smallsprite) - if(L && L.alternate_appearances && L.alternate_appearances["gscode_smallsprite"]) - var/datum/atom_hud/alternate_appearance/AA = L.alternate_appearances["gscode_smallsprite"] - AA.remove_from_single_hud(mob, L) - to_chat(src, "Resize others view toggled OFF.") + return + + GLOB.see_toggle_smallsprite -= mob + for(var/mob/living/resize_mob in GLOB.enabled_smallsprite) + if(QDELETED(resize_mob)) + remove_from_list += resize_mob + continue + + if(resize_mob && resize_mob.alternate_appearances && resize_mob.alternate_appearances["gscode_smallsprite"]) + var/datum/atom_hud/alternate_appearance/appearance = resize_mob.alternate_appearances["gscode_smallsprite"] + appearance.remove_from_single_hud(mob, resize_mob) + + GLOB.enabled_smallsprite -= remove_from_list + to_chat(src, "Resize others view toggled OFF.") + +///Generate the image based on the mob's current icon and apply matrix transformations to adjust its position and angle +/mob/living/proc/create_smallsprite() + var/image/smallsprite = image(icon=icon, icon_state=icon_state, loc=src, layer=layer, pixel_x=pixel_x, pixel_y=pixel_y) + smallsprite.overlays += overlays + smallsprite.override = TRUE + + var/matrix/ntransform = matrix(lying, MATRIX_ROTATE) + if(lying != 0) + ntransform.Translate(0, -get_standard_pixel_y_offset(lying)) + + smallsprite.transform = ntransform + return smallsprite /** * Call to regenerate the sprites and update huds. @@ -43,37 +72,42 @@ GLOBAL_LIST_EMPTY(see_toggle_smallsprite) * * If the size_multiplier was not higher than one then remove the mob from the list of smallsprite mobs */ /mob/living/proc/regenerate_smallsprite() + var/list/remove_from_list = new() + if(length(alternate_appearances) && alternate_appearances["gscode_smallsprite"]) - for(var/mob/M in GLOB.see_toggle_smallsprite) - var/datum/atom_hud/alternate_appearance/AA = alternate_appearances["gscode_smallsprite"] - AA.remove_from_single_hud(M, src) + for(var/mob/viewer_mob in GLOB.see_toggle_smallsprite) + if(QDELETED(viewer_mob)) + remove_from_list += viewer_mob + continue + + var/datum/atom_hud/alternate_appearance/appearance = alternate_appearances["gscode_smallsprite"] + appearance.remove_from_single_hud(viewer_mob, src) remove_alt_appearance("gscode_smallsprite") + if(size_multiplier > 1) if(!GLOB.enabled_smallsprite[src]) GLOB.enabled_smallsprite += src - add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/showSmall, "gscode_smallsprite", generate_smallsprite(), FALSE) - for(var/mob/M in GLOB.see_toggle_smallsprite) - if(M != src) - var/datum/atom_hud/alternate_appearance/AA = alternate_appearances["gscode_smallsprite"] - AA.add_to_single_hud(M, src) + + add_alt_appearance(/datum/atom_hud/alternate_appearance/basic/showSmall, "gscode_smallsprite", create_smallsprite(), FALSE) + for(var/mob/viewer_mob in GLOB.see_toggle_smallsprite) + if(QDELETED(viewer_mob)) + remove_from_list += viewer_mob + continue + + if(viewer_mob != src) + var/datum/atom_hud/alternate_appearance/appearance = alternate_appearances["gscode_smallsprite"] + appearance.add_to_single_hud(viewer_mob, src) return TRUE + else if(GLOB.enabled_smallsprite[src]) GLOB.enabled_smallsprite -= src - return FALSE -///Generate the image based on the mob's current icon and apply matrix transformations to adjust its position and angle -/mob/living/proc/generate_smallsprite() - var/image/I = image(icon=icon, icon_state=icon_state, loc=src, layer=layer, pixel_x=pixel_x, pixel_y=pixel_y) - I.overlays += overlays - I.override = TRUE - var/matrix/ntransform = matrix(lying, MATRIX_ROTATE) - if(lying != 0) - ntransform.Translate(0, -get_standard_pixel_y_offset(lying)) - I.transform = ntransform - return I + GLOB.see_toggle_smallsprite -= remove_from_list + + return FALSE //Called periodically to regenerate the mob's smallsprite -/mob/living/BiologicalLife(delta_time, times_fired) +/mob/living/carbon/human/BiologicalLife(delta_time, times_fired) . = ..() regenerate_smallsprite()