Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
realforest2001 committed Jul 19, 2023
1 parent 9de94b5 commit e0e8714
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions code/modules/cm_preds/yaut_bracers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@
else
embedded_id.forceMove(src)

/// Handles all the locking and unlocking of bracers.
/// Verb to let Yautja attempt the unlocking.
/obj/item/clothing/gloves/yautja/hunter/verb/toggle_lock()
set name = "Toggle Bracer Lock"
set desc = "Toggle the lock on your bracers, allowing them to be removed."
Expand All @@ -1080,25 +1080,27 @@

attempt_toggle_lock(usr, FALSE)

/// Handles all the locking and unlocking of bracers.
/obj/item/clothing/gloves/yautja/proc/attempt_toggle_lock(mob/user, force_lock)
if(!user)
return FALSE

var/obj/item/grab/G = user.get_active_hand()
if(istype(G))
var/mob/living/carbon/human/victim = G.grabbed_thing
var/obj/item/grab/held_mob = user.get_active_hand()
if(istype(held_mob))
var/mob/living/carbon/human/victim = held_mob.grabbed_thing
var/obj/item/clothing/gloves/yautja/hunter/bracer = victim.gloves
if(isspeciesyautja(victim) && !(victim.stat == DEAD))
to_chat(user, SPAN_WARNING("You cannot unlock the bracer of a living hunter!"))
return FALSE

if(istype(bracer))
if(alert("Are you sure you want to unlock this [victim.species]'s bracer?", "Unlock Bracers", "Yes", "No") == "Yes")
if(user.get_active_hand() == G && victim && victim.gloves == bracer)
if(user.get_active_hand() == held_mob && victim && victim.gloves == bracer)
log_interact(user, victim, "[key_name(user)] unlocked the [bracer.name] of [key_name(victim)].")
user.visible_message(SPAN_WARNING("[user] presses a few buttons on [victim]'s wrist bracer."),SPAN_DANGER("You unlock the bracer."))
bracer.toggle_lock_internal(victim)
return TRUE
return FALSE
else
to_chat(user, SPAN_WARNING("<b>This [victim.species] does not have a bracer attached.</b>"))
return FALSE
Expand All @@ -1107,6 +1109,7 @@
toggle_lock_internal(user)
return TRUE

/// The actual unlock/lock function.
/obj/item/clothing/gloves/yautja/proc/toggle_lock_internal(mob/user, force_lock)
if(((flags_item & NODROP) || (flags_inventory & CANTSTRIP)) && !force_lock)
flags_item &= ~NODROP
Expand All @@ -1115,11 +1118,13 @@
to_chat(user, SPAN_WARNING("The bracer beeps pleasantly, releasing it's grip on your forearm."))
else
to_chat(user, SPAN_WARNING("With an angry blare the bracer releases your forearm."))
return TRUE
else
flags_item |= NODROP
flags_inventory |= CANTSTRIP
if(isyautja(user))
to_chat(user, SPAN_WARNING("The bracer clamps securely around your forearm and beeps in a comfortable, familiar way."))
else
to_chat(user, SPAN_WARNING("The bracer clamps painfully around your forearm and beeps angrily. It won't come off!"))
return TRUE
return TRUE
return FALSE//Technically should never reach this.

Check failure on line 1130 in code/modules/cm_preds/yaut_bracers.dm

View workflow job for this annotation

GitHub Actions / Run Linters

possible unreachable code here

0 comments on commit e0e8714

Please sign in to comment.