Skip to content

Commit

Permalink
Adds the ability to construct and deconstruct locker locks (OracleSta…
Browse files Browse the repository at this point in the history
  • Loading branch information
Citinited authored and FlattestGuitar committed Jul 31, 2018
1 parent 745210d commit da1b4a7
Show file tree
Hide file tree
Showing 9 changed files with 242 additions and 106 deletions.
254 changes: 171 additions & 83 deletions code/game/objects/structures/crates_lockers/closets.dm

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
return 1
return 0

/obj/structure/closet/body_bag/handle_lock_addition()
return

/obj/structure/closet/body_bag/handle_lock_removal()
return

/obj/structure/closet/body_bag/MouseDrop(over_object, src_location, over_location)
..()
if(over_object == usr && Adjacent(usr) && (in_range(src, usr) || usr.contents.Find(src)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
L.do_alert_animation(L)
playsound(loc, 'sound/machines/chime.ogg', 50, FALSE, -5)

/obj/structure/closet/cardboard/handle_lock_addition() //Whoever heard of a lockable cardboard box anyway
return

/obj/structure/closet/cardboard/handle_lock_removal()
return

/mob/living/proc/do_alert_animation(atom/A)
var/image/I = image('goon/icons/obj/closet.dmi', A, "cardboard_special", A.layer+1)
flick_overlay_view(I, A, 8)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@
material_drop = /obj/item/stack/sheet/mineral/wood
material_drop_amount = 5

/obj/structure/closet/coffin/handle_lock_addition()
return

/obj/structure/closet/coffin/handle_lock_removal()
return

/obj/structure/closet/wardrobe/red
name = "security wardrobe"
icon_door = "red"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@

return ..()

/obj/structure/closet/secure_closet/genpop/handle_lock_addition() //If lock construction is successful we don't care what access the electronics had, so we override it
if(..())
req_access = list(ACCESS_BRIG)
lockerelectronics.accesses = req_access

/obj/structure/closet/secure_closet/genpop/proc/handle_prisoner_id(mob/user)
var/obj/item/card/id/prisoner/prisoner_id = null
for(prisoner_id in user.held_items)
Expand Down Expand Up @@ -84,7 +89,7 @@
return ..()

/obj/structure/closet/secure_closet/genpop/close(mob/living/user)
if(registered_id != null)
if(registered_id != null && !QDELETED(lockerelectronics))
locked = TRUE
return ..()

Expand All @@ -96,7 +101,7 @@
handle_prisoner_id(user)
return

if(!broken && opened && !locked && allowed(user) && !registered_id) //Genpop setup
if(!broken && opened && !locked && allowed(user) && !registered_id && !QDELETED(lockerelectronics)) //Genpop setup

registered_id = new /obj/item/card/id/prisoner/(src.contents)
if(handle_edit_sentence(user))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@
req_access = list(ACCESS_ALL_PERSONAL_LOCKERS)
var/registered_name = null

/obj/structure/closet/secure_closet/personal/examine(mob/user)
..()
if(registered_name)
to_chat(user, "<span class='notice'>The display reads, \"Owned by [registered_name]\".</span>")

/obj/structure/closet/secure_closet/personal/check_access(obj/item/card/id/I)
. = ..()
if(!I || !istype(I))
return
if(registered_name == I.registered_name)
return TRUE

/obj/structure/closet/secure_closet/personal/PopulateContents()
..()
if(prob(40))
Expand All @@ -20,36 +32,36 @@
name = "patient's closet"

/obj/structure/closet/secure_closet/personal/patient/PopulateContents()
new /obj/item/clothing/under/color/white( src )
new /obj/item/clothing/shoes/sneakers/white( src )
new /obj/item/clothing/under/color/white(src)
new /obj/item/clothing/shoes/sneakers/white(src)

/obj/structure/closet/secure_closet/personal/cabinet
icon_state = "cabinet"
resistance_flags = FLAMMABLE
max_integrity = 70

/obj/structure/closet/secure_closet/personal/cabinet/PopulateContents()
new /obj/item/storage/backpack/satchel/leather/withwallet( src )
new /obj/item/storage/backpack/satchel/leather/withwallet(src)
new /obj/item/device/instrument/piano_synth(src)
new /obj/item/device/radio/headset( src )
new /obj/item/device/radio/headset(src)

/obj/structure/closet/secure_closet/personal/attackby(obj/item/W, mob/user, params)
var/obj/item/card/id/I = W.GetID()
if(istype(I))
if(broken)
to_chat(user, "<span class='danger'>It appears to be broken.</span>")
return
if(!I || !I.registered_name)
return
if(allowed(user) || !registered_name || (istype(I) && (registered_name == I.registered_name)))
//they can open all lockers, or nobody owns this, or they own this locker
locked = !locked
update_icon()

if(!registered_name)
registered_name = I.registered_name
desc = "Owned by [I.registered_name]."
else
to_chat(user, "<span class='danger'>Access Denied.</span>")
else
if(!I || !istype(I))
return ..()
if(!can_lock(user, FALSE)) //Can't do anything if there isn't a lock!
return
if(I.registered_name && !registered_name)
to_chat(user, "<span class='notice'>You claim [src].</span>")
registered_name = I.registered_name
else
..()

/obj/structure/closet/secure_closet/personal/handle_lock_addition() //If lock construction is successful we don't care what access the electronics had, so we override it
if(..())
req_access = list(ACCESS_ALL_PERSONAL_LOCKERS)
lockerelectronics.accesses = req_access

/obj/structure/closet/secure_closet/personal/handle_lock_removal()
if(..())
registered_name = null
6 changes: 6 additions & 0 deletions code/game/objects/structures/crates_lockers/crates.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
manifest = null
update_icon()

/obj/structure/closet/crate/handle_lock_addition()
return

/obj/structure/closet/crate/handle_lock_removal()
return

/obj/structure/closet/crate/proc/tear_manifest(mob/user)
to_chat(user, "<span class='notice'>You tear the manifest off of [src].</span>")
playsound(src, 'sound/items/poster_ripped.ogg', 75, 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,13 @@ Difficulty: Very Hard
/obj/structure/closet/stasis/ex_act()
return


/obj/structure/closet/stasis/handle_lock_addition()
return

/obj/structure/closet/stasis/handle_lock_removal()
return

/obj/effect/proc_holder/spell/targeted/exit_possession
name = "Exit Possession"
desc = "Exits the body you are possessing"
Expand Down
Binary file modified goon/icons/obj/closet.dmi
Binary file not shown.

0 comments on commit da1b4a7

Please sign in to comment.