Storage z-fighting bugfix (#20518)

Fixes this shit from happening.

<img width="256" alt="dreamseeker_siriznpX2I"
src="https://github.com/user-attachments/assets/ed7c1daa-79bb-4030-9667-547d7756d350"
/>
This commit is contained in:
Wowzewow (Wezzy)
2025-02-27 13:33:46 +00:00
committed by GitHub
parent cde18f64c0
commit fda25beae4
10 changed files with 103 additions and 47 deletions
@@ -17,7 +17,7 @@
w_class = WEIGHT_CLASS_BULKY
slot_flags = SLOT_BACK
max_w_class = WEIGHT_CLASS_NORMAL
max_storage_space = 28
max_storage_space = DEFAULT_BACKPACK_STORAGE
var/species_restricted = list("exclude",BODYTYPE_VAURCA_BREEDER,BODYTYPE_VAURCA_WARFORM)
drop_sound = 'sound/items/drop/backpack.ogg'
pickup_sound = 'sound/items/pickup/backpack.ogg'
@@ -7,7 +7,7 @@
force = 2
storage_slots = 7
max_w_class = WEIGHT_CLASS_NORMAL
max_storage_space = 28
max_storage_space = DEFAULT_BACKPACK_STORAGE
slot_flags = SLOT_BELT
attack_verb = list("whipped", "lashed", "disciplined")
drop_sound = 'sound/items/drop/toolbelt.ogg'
@@ -251,7 +251,7 @@
name = "tactical medical belt"
desc = "A sturdy black webbing belt with attached pouches. This one is designed for medical professionals who expect to enter conflict zones on the daily. It has increased storage and utility."
storage_slots = 9
max_storage_space = 28
max_storage_space = DEFAULT_BACKPACK_STORAGE
can_hold = list(
/obj/item/device/breath_analyzer,
/obj/item/device/healthanalyzer,
@@ -414,7 +414,7 @@
item_state = "swatbelt"
storage_slots = 9
max_w_class = WEIGHT_CLASS_NORMAL
max_storage_space = 28
max_storage_space = DEFAULT_BACKPACK_STORAGE
/obj/item/storage/belt/military
name = "military belt"
@@ -587,7 +587,7 @@
item_state = "security"
storage_slots = 9
max_w_class = WEIGHT_CLASS_BULKY
max_storage_space = 28
max_storage_space = DEFAULT_BACKPACK_STORAGE
can_hold = list(
/obj/item/grenade,
@@ -643,7 +643,7 @@
name = "component pouch"
desc = "A dorky fannypack for keeping small items in. Also stores magickal components!"
starts_with = list(/obj/item/toy/snappop/syndi = 3, /obj/item/reagent_containers/glass/beaker/vial/random/toxin = 2, /obj/item/storage/pill_bottle/dice = 1)
max_storage_space = 14
max_storage_space = DEFAULT_BOX_STORAGE
/obj/item/storage/belt/shumaila_buckle
name = "hammer buckle belt"
@@ -152,7 +152,7 @@
desc = "A faithful box that will remain with you, no matter where you go, and probably save you."
icon_state = "redbox"
illustration = "survival"
max_storage_space = 14
max_storage_space = DEFAULT_BOX_STORAGE
can_hold = list(
/obj/item/clothing/mask,
/obj/item/tank/emergency_oxygen,
@@ -200,7 +200,7 @@
name = "box of sterile gloves"
desc = "Contains sterile gloves."
illustration = "latex"
max_storage_space = 14
max_storage_space = DEFAULT_BOX_STORAGE
starts_with = list(/obj/item/clothing/gloves/latex = 2,
/obj/item/clothing/gloves/latex/nitrile = 2,
/obj/item/clothing/gloves/latex/nitrile/unathi = 1,
@@ -800,7 +800,7 @@
icon_state = "portafreezer"
item_state = "medicalpack"
max_w_class = WEIGHT_CLASS_NORMAL
max_storage_space = 21
max_storage_space = DEFAULT_LARGEBOX_STORAGE
use_to_pickup = FALSE // for picking up broken bulbs, not that most people will try
chewable = FALSE
@@ -9,7 +9,7 @@
contained_sprite = TRUE
w_class = WEIGHT_CLASS_BULKY
max_w_class = WEIGHT_CLASS_NORMAL
max_storage_space = 14 //The sum of the w_classes of all the items in this storage item.
max_storage_space = DEFAULT_BOX_STORAGE //The sum of the w_classes of all the items in this storage item.
req_access = list(ACCESS_ARMORY)
var/locked = 1
var/broken = 0
@@ -395,20 +395,21 @@
/obj/item/storage/proc/space_orient_objs(list/obj/item/display_contents, defer_overlays = FALSE)
var/baseline_max_storage_space = 16 //should be equal to default backpack capacity
// Don't touch these numbers. This works on literal pixel measurements. Unless you want to fix this shit.
var/baseline_max_storage_space = DEFAULT_BACKPACK_STORAGE //should be equal to default backpack capacity
var/storage_cap_width = 2 //length of sprite for start and end of the box representing total storage space
var/stored_cap_width = 4 //length of sprite for start and end of the box representing the stored item
var/storage_width = min( round( 224 * max_storage_space/baseline_max_storage_space ,1) ,284) //length of sprite for the box representing total storage space
var/storage_width = min(round(DEFAULT_BACKPACK_STORAGE*8*max_storage_space/baseline_max_storage_space ,1) , DEFAULT_BACKPACK_STORAGE*10) //length of sprite for the box representing total storage space
storage_start.ClearOverlays()
var/matrix/M = matrix()
M.Scale((storage_width-storage_cap_width*2+3)/32,1)
M.Scale((storage_width-storage_cap_width*2+11)/32,1)
storage_continue.transform = M
storage_start.screen_loc = "4:16,2:16"
storage_continue.screen_loc = "4:[storage_cap_width+(storage_width-storage_cap_width*2)/2+2],2:16"
storage_end.screen_loc = "4:[19+storage_width-storage_cap_width],2:16"
storage_continue.screen_loc = "4:[round(storage_cap_width+(storage_width-storage_cap_width*2)/2+6)],2:16"
storage_end.screen_loc = "4:[27+storage_width-storage_cap_width],2:16"
var/startpoint = 0
var/endpoint = 1
@@ -419,34 +420,35 @@
for(var/obj/item/O in contents)
startpoint = endpoint + 1
endpoint += storage_width * O.get_storage_cost()/max_storage_space
endpoint = startpoint + storage_width * O.get_storage_cost()/max_storage_space
var/atom/movable/screen/storage/background/stored_start = new /atom/movable/screen/storage/background(null, O, "stored_start")
var/atom/movable/screen/storage/background/stored_continue = new /atom/movable/screen/storage/background(null, O, "stored_continue")
var/atom/movable/screen/storage/background/stored_end = new /atom/movable/screen/storage/background(null, O, "stored_end")
var/matrix/M_start = matrix()
M_start.Translate(startpoint, 0)
stored_start.transform = M_start
var/atom/movable/screen/storage/background/stored_continue = new /atom/movable/screen/storage/background(null, O, "stored_continue")
var/matrix/M_continue = matrix()
var/matrix/M_end = matrix()
M_start.Translate(startpoint,0)
M_continue.Scale((endpoint-startpoint-stored_cap_width*2)/32,1)
M_continue.Translate(startpoint+stored_cap_width+(endpoint-startpoint-stored_cap_width*2)/2 - 16,0)
M_end.Translate(endpoint-stored_cap_width,0)
stored_start.transform = M_start
stored_continue.transform = M_continue
var/atom/movable/screen/storage/background/stored_end = new /atom/movable/screen/storage/background(null, O, "stored_end")
var/matrix/M_end = matrix()
M_end.Translate(endpoint-stored_cap_width, 0)
stored_end.transform = M_end
storage_screens += list(stored_start, stored_continue, stored_end)
storage_start.add_vis_contents(list(stored_start, stored_continue, stored_end))
O.screen_loc = "4:[round((startpoint+endpoint)/2)+2],2:16"
O.screen_loc = "4:[round((startpoint+endpoint)/2)],2:16"
O.maptext = ""
O.hud_layerise()
if (!defer_overlays)
storage_start.UpdateOverlays()
closer.screen_loc = "4:[storage_width+19],2:16"
closer.screen_loc = "4:[storage_width+27],2:16"
return
/datum/numbered_display
@@ -964,22 +966,7 @@
return depth
/obj/item/proc/get_storage_cost()
if (storage_cost)
return storage_cost
else
if(w_class == WEIGHT_CLASS_TINY)
return 1
if(w_class == WEIGHT_CLASS_SMALL)
return 2
if(w_class == WEIGHT_CLASS_NORMAL)
return 4
if(w_class == WEIGHT_CLASS_BULKY)
return 8
if(w_class == WEIGHT_CLASS_HUGE)
return 16
else
return 1000
//return 2**(w_class-1) //1,2,4,8,16,...
//If you want to prevent stuff above a certain w_class from being stored, use max_w_class
return BASE_STORAGE_COST(w_class)
#undef STORAGE_SPACE_CAP
@@ -13,7 +13,7 @@
throw_range = 7
w_class = WEIGHT_CLASS_BULKY
max_w_class = WEIGHT_CLASS_NORMAL
max_storage_space = 14 //enough to hold all starting contents
max_storage_space = DEFAULT_BOX_STORAGE //enough to hold all starting contents
origin_tech = list(TECH_COMBAT = 1)
attack_verb = list("robusted")
use_sound = 'sound/items/storage/toolbox.ogg'
+1 -1
View File
@@ -297,7 +297,7 @@
contained_sprite = TRUE
w_class = WEIGHT_CLASS_NORMAL
display_contents_with_number = TRUE
max_storage_space = 28
max_storage_space = DEFAULT_BACKPACK_STORAGE
force_column_number = 3 // we want 4 slots to appear, so 3 columns + 1 free (to insert stuff)
storage_slots = 14
can_hold = list(/obj/item/inflatable)