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

Locker qol and a little cleanup. #76

Merged
merged 6 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
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
34 changes: 14 additions & 20 deletions code/game/objects/structures/crates_lockers/closets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
dump_contents()
return ..()

//USE THIS TO FILL IT, NOT INITIALIZE OR NEW
///USE THIS TO FILL IT, NOT INITIALIZE OR NEW
/obj/structure/closet/proc/PopulateContents()
return

Expand Down Expand Up @@ -230,8 +230,7 @@
return TRUE
return user.transferItemToLoc(I, drop_location())

var/obj/item/card/id/ID = user.get_idcard()
if(istype(ID))
if(user.get_idcard())
if(!togglelock(user, TRUE))
toggle(user)

Expand Down Expand Up @@ -301,20 +300,19 @@
. = ..()
if(.)
return
return toggle(user)

/obj/structure/closet/verb/verb_toggleopen()
set src in oview(1)
set category = "Object"
set name = "Toggle Open"
if(user.get_idcard() && locked)
togglelock(user, TRUE)
else
toggle(user)

if(!usr.canmove || usr.stat || usr.restrained())
/obj/structure/closet/attack_hand_alternate(mob/user)
. = ..()
if(.)
return

if(ishuman(usr))
src.toggle(usr)
else
balloon_alert(usr, "Can't do this")
if(opened)
toggle(user)
else if(user.get_idcard())
togglelock(user, TRUE)

/obj/structure/closet/update_icon_state()//Putting the welded stuff in updateicon() so it's easy to overwrite for special cases (Fridges, cabinets, and whatnot)
. = ..()
Expand Down Expand Up @@ -370,10 +368,6 @@
welded = FALSE
update_icon()

/obj/structure/closet/AltClick(mob/user)
. = ..()
return togglelock(user)

/obj/structure/closet/proc/togglelock(mob/living/user, silent)
if(!CHECK_BITFIELD(closet_flags, CLOSET_IS_SECURE))
return FALSE
Expand All @@ -396,7 +390,7 @@
return FALSE

locked = !locked
balloon_alert_to_viewers("[locked ? null : "un"]locked")
balloon_alert_to_viewers("[locked ? "" : "un"]locked")
update_icon()
return TRUE

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,17 @@
locked = TRUE
broken = FALSE
closet_flags = CLOSET_IS_SECURE
var/large = 1
max_integrity = 100
icon_closed = "secure"
var/icon_locked = "secure1"
icon_opened = "secureopen"
var/icon_locked = "secure1"
var/icon_broken = "securebroken"
var/icon_off = "secureoff"
max_integrity = 100
var/slotlocked = 0


/obj/structure/closet/secure_closet/close()
if(..())
if(broken)
icon_state = src.icon_off
icon_state = icon_off
return 1
else
return 0
Expand All @@ -29,27 +26,17 @@
for(var/obj/O in src)
O.emp_act(severity)
if(!broken)
if(prob(50/severity))
src.locked = !src.locked
src.update_icon()
if(prob(20/severity) && !opened)
if(prob(50 / severity))
locked = !locked
update_icon()
if(prob(20 / severity) && !opened)
if(!locked)
open()
else
req_access = list()
req_access += pick(ALL_ACCESS)
return ..()


/obj/structure/closet/secure_closet/verb/verb_togglelock()
set src in oview(1) // One square distance
set category = "Object"
set name = "Toggle Lock"

if(usr.incapacitated())
return
togglelock(usr)

/obj/structure/closet/secure_closet/update_icon_state()
. = ..()
if(opened)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@
new /obj/item/clothing/head/powdered_wig (src)
new /obj/item/storage/briefcase(src)


/obj/structure/closet/secure_closet/wall
name = "wall locker"
req_access = list(ACCESS_MARINE_BRIG)
Expand All @@ -329,10 +328,6 @@
icon_broken = "wall-lockerbroken"
icon_off = "wall-lockeroff"

//too small to put a man in
large = FALSE


/obj/structure/closet/secure_closet/wall/update_icon_state()
. = ..()
if(broken)
Expand Down
2 changes: 0 additions & 2 deletions code/game/objects/structures/crates_lockers/walllocker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
anchored = TRUE
mob_storage_capacity = 0
wall_mounted = TRUE
large = FALSE
storage_capacity = 20

/obj/structure/closet/secure_closet/walllocker/Initialize(mapload, ndir)
Expand Down Expand Up @@ -158,7 +157,6 @@
anchored = TRUE
mob_storage_capacity = 0
wall_mounted = TRUE
large = FALSE
storage_capacity = 20

/obj/structure/closet/secure_closet/personal/walllocker/Initialize(mapload, ndir)
Expand Down
Loading