Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closets now dense themselves based on pixel offset when being reclosed #5780

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions code/game/objects/structures/crates_lockers/closets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
layer = BELOW_OBJ_LAYER
var/icon_closed = "closed"
var/icon_opened = "open"
var/opened = 0
var/opened = FALSE
var/welded = 0
var/wall_mounted = 0 //never solid (You can always pass over it)
health = 100
Expand Down Expand Up @@ -59,16 +59,16 @@

/obj/structure/closet/proc/can_open()
if(src.welded)
return 0
return 1
return FALSE
return TRUE

/obj/structure/closet/proc/can_close()
for(var/obj/structure/closet/closet in get_turf(src))
if(closet != src && !closet.wall_mounted)
return 0
return FALSE
for(var/mob/living/carbon/xenomorph/xeno in get_turf(src))
return 0
return 1
return FALSE
return TRUE

/obj/structure/closet/proc/dump_contents()

Expand All @@ -87,25 +87,25 @@

/obj/structure/closet/proc/open()
if(opened)
return 0
return FALSE

if(!can_open())
return 0
return FALSE

dump_contents()

UnregisterSignal(src, COMSIG_CLOSET_FLASHBANGED)
opened = 1
opened = TRUE
update_icon()
playsound(src.loc, open_sound, 15, 1)
density = FALSE
return 1
return TRUE

/obj/structure/closet/proc/close()
if(!src.opened)
return 0
return FALSE
if(!src.can_close())
return 0
return FALSE

var/stored_units = 0
if(store_items)
Expand All @@ -114,12 +114,13 @@
stored_units = store_mobs(stored_units)
RegisterSignal(src, COMSIG_CLOSET_FLASHBANGED, PROC_REF(flashbang))

opened = 0
opened = FALSE
update_icon()

playsound(src.loc, close_sound, 15, 1)
density = TRUE
return 1
if(pixel_y < 10 || pixel_x < 10) // If it's offsetted to a point where it would confuse players, don't make dense
density = TRUE
Comment on lines +121 to +122
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of the || here, it's setting the closet's density to TRUE if pixel_y OR pixel_x is less than 10, which is the case more often than not (unless it's shifted into a corner or something). You probably want && instead:

Suggested change
if(pixel_y < 10 || pixel_x < 10) // If it's offsetted to a point where it would confuse players, don't make dense
density = TRUE
if(pixel_y < 10 && pixel_x < 10) // If it's offsetted to a point where it would confuse players, don't make dense
density = TRUE

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intended for edge cases, any pixel offset past a certain point communicates to players that it is passable. This wouldn't work if you put it 10 pixels back against a wall and don't adjust X or want to adjust it to be next to something under 10 pixels away for aesthetic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

open to adjusting pixel amounts though as I am unsure of the point where most people consider it "passable"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay! What I meant was that it currently only makes the closet passable if both variables are greater than ten, since that's the 'fail' state of the check:

dreamseeker_UoRn6gMNi8.mp4

(The closet is mapedited to have pixel_y = 25, density = 0)


For comparison of how both versions handle different pixel_x and pixel_y values:

pixel_y < 10 || pixel_x < 10 pixel_y < 10 && pixel_X < 10
Both variables < 10 density = TRUE density = TRUE
One variable >= 10 density = TRUE density = FALSE
Both variables >= 10 density = FALSE density = FALSE

return TRUE

/obj/structure/closet/proc/store_items(stored_units)
for(var/obj/item/I in src.loc)
Expand Down Expand Up @@ -214,7 +215,7 @@
src.MouseDrop_T(G.grabbed_thing, user) //act like they were dragged onto the closet
return
if(W.flags_item & ITEM_ABSTRACT)
return 0
return FALSE
if(material == MATERIAL_METAL)
if(iswelder(W))
if(!HAS_TRAIT(W, TRAIT_TOOL_BLOWTORCH))
Expand Down
Loading