Verb Toggle

This commit is contained in:
Alphas00
2025-01-26 23:35:27 +01:00
parent 2070a6e5c7
commit 695db655d5
2 changed files with 32 additions and 31 deletions
@@ -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()
@@ -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