From 0f1d8a1e3b4ea60a916343dd6fcc42ab659c40cb Mon Sep 17 00:00:00 2001 From: Wildkins Date: Wed, 18 Feb 2026 23:30:08 -0500 Subject: [PATCH] Lag War Day 3: 100,000 SendMaps Under The Profile (#21874) after ragebaiting all of coderbus with our 10 second sendmap ticks, i have slapped together this bandaid fix which should help decrease server load from all you nerds with 72,000 body markings i know what you are --- code/modules/mob/inventory.dm | 7 ++++--- code/modules/mob/living/carbon/human/human.dm | 6 +++--- .../mob/living/carbon/human/species/species.dm | 1 + code/modules/mob/living/living.dm | 16 ++++++++-------- html/changelogs/johnwildkins-lagbilion.yml | 13 +++++++++++++ 5 files changed, 29 insertions(+), 14 deletions(-) create mode 100644 html/changelogs/johnwildkins-lagbilion.yml diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index ca85d213ac5..1401a939e94 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -239,7 +239,7 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( // Removes an item from inventory and places it in the target atom. // If canremove or other conditions need to be checked then use unEquip instead. -/mob/proc/drop_from_inventory(var/obj/item/W, var/atom/target) +/mob/proc/drop_from_inventory(var/obj/item/W, var/atom/target, update_icons = TRUE, force = FALSE) if(W) remove_from_mob(W) if(!(W && W.loc)) @@ -247,7 +247,8 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( if(target) W.forceMove(target) W.do_drop_animation(src) - update_icon() + if(update_icons) + update_icon() return TRUE return FALSE @@ -527,7 +528,7 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( /mob/proc/delete_inventory(var/include_carried = FALSE) for(var/obj/item/I as anything in get_equipped_items(include_carried ? INCLUDE_POCKETS|INCLUDE_HELD : 0)) - drop_from_inventory(I) + drop_from_inventory(I, null, FALSE) qdel(I) /mob/proc/get_covering_equipped_items(var/body_parts) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index d4c378544e8..272a8f177f7 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1892,10 +1892,10 @@ playsound(src.loc, SFX_FRACTURE, 50, 1, -2) current_limb.undislocate() -/mob/living/carbon/human/drop_from_inventory(var/obj/item/W, var/atom/target = null) - if(W in organs) +/mob/living/carbon/human/drop_from_inventory(obj/item/W, atom/target, update_icons = TRUE, force = FALSE) + if(!force && (W in organs)) return - ..() + return ..() /mob/living/carbon/human/reset_view(atom/A, update_hud = 1) ..() diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm index 203de09a486..2ebebe1c853 100644 --- a/code/modules/mob/living/carbon/human/species/species.dm +++ b/code/modules/mob/living/carbon/human/species/species.dm @@ -540,6 +540,7 @@ /datum/species/proc/create_organs(var/mob/living/carbon/human/H) //Handles creation of mob organs. for(var/obj/item/organ/organ in H.contents) if((organ in H.organs) || (organ in H.internal_organs)) + H.drop_from_inventory(organ, null, FALSE, TRUE) qdel(organ) if(H.organs) H.organs.Cut() diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 343acb1d994..8918aacb97b 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -19,11 +19,16 @@ if(.) visible_message("\The [src] points to \the [pointing_at].") -/mob/living/drop_from_inventory(var/obj/item/item, var/atom/target) - . = ..(item, target) - if(item && item.GetID()) +/mob/living/drop_from_inventory(var/obj/item/item, var/atom/target, update_icons = TRUE, force = FALSE) + . = ..() + if(item?.GetID()) BITSET(hud_updateflag, ID_HUD) //If we drop our ID, update ID HUD +/mob/living/carbon/drop_from_inventory(obj/item/W, atom/target, update_icons = TRUE, force = FALSE) + if(!force && (W in internal_organs)) + return + return ..() + /*one proc, four uses swapping: if it's 1, the mobs are trying to switch, if 0, non-passive is pushing passive default behaviour is: @@ -818,11 +823,6 @@ default behaviour is: layer = UNDERDOOR underdoor = 1 -/mob/living/carbon/drop_from_inventory(var/obj/item/W, var/atom/target = null) - if(W in internal_organs) - return - ..() - /mob/living/touch_map_edge() //check for nuke disks diff --git a/html/changelogs/johnwildkins-lagbilion.yml b/html/changelogs/johnwildkins-lagbilion.yml new file mode 100644 index 00000000000..ed1db00b25e --- /dev/null +++ b/html/changelogs/johnwildkins-lagbilion.yml @@ -0,0 +1,13 @@ +# Your name. +author: JohnWildkins + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - refactor: "Reduce lag by ensuring refreshing char select preview doesn't cause 50 trillion icon update operations (estimated)."