Of Helper Procs & Dumbs

Makes a mob/proc/can_use_hand(), which determines whether or not a mob can use a given hand.

Redefined in human.dm to check a hand's status and usability.
This commit is contained in:
skull132
2016-03-25 20:33:10 +02:00
parent 4bce434a56
commit 17938853d5
9 changed files with 32 additions and 59 deletions
+2 -8
View File
@@ -84,14 +84,8 @@
/mob/living/carbon/attack_hand(mob/M as mob)
if(!istype(M, /mob/living/carbon)) return
if (ishuman(M))
var/mob/living/carbon/human/H = M
var/obj/item/organ/external/temp = H.organs_by_name["r_hand"]
if (H.hand)
temp = H.organs_by_name["l_hand"]
if(temp && !temp.is_usable())
H << "\red You can't use your [temp.name]"
return
if (!M.can_use_hand())
return
for(var/datum/disease/D in viruses)
+13 -15
View File
@@ -1420,15 +1420,6 @@
if(!..() || l_hand)
return 0
var/obj/item/organ/external/temp = organs_by_name["l_hand"]
if (temp && !temp.is_usable())
src << "<span class='notice'>You try to move your [temp.name], but cannot!"
return 0
if (!temp)
src << "<span class='notice'>You try to use your hand, but realize it is no longer attached!"
return 0
W.forceMove(src)
l_hand = W
W.equipped(src,slot_l_hand)
@@ -1440,7 +1431,19 @@
if(!..() || r_hand)
return 0
var/obj/item/organ/external/temp = organs_by_name["r_hand"]
W.forceMove(src)
r_hand = W
W.equipped(src,slot_r_hand)
W.add_fingerprint(src)
update_inv_r_hand()
return 1
/mob/living/carbon/human/can_use_hand(var/selected_hand = hand)
var/hand_to_check = "l_hand"
if (!selected_hand)
hand_to_check = "r_hand"
var/obj/item/organ/external/temp = organs_by_name[hand_to_check]
if (temp && !temp.is_usable())
src << "<span class='notice'>You try to move your [temp.name], but cannot!"
return 0
@@ -1449,9 +1452,4 @@
src << "<span class='notice'>You try to use your hand, but realize it is no longer attached!"
return 0
W.forceMove(src)
r_hand = W
W.equipped(src,slot_r_hand)
W.add_fingerprint(src)
update_inv_r_hand()
return 1
@@ -7,13 +7,8 @@
/mob/living/carbon/human/attack_hand(mob/living/carbon/M as mob)
var/mob/living/carbon/human/H = M
if(istype(H))
var/obj/item/organ/external/temp = H.organs_by_name["r_hand"]
if(H.hand)
temp = H.organs_by_name["l_hand"]
if(!temp || !temp.is_usable())
H << "\red You can't use your hand."
return
if(!M.can_use_hand())
return
..()
+4
View File
@@ -1110,3 +1110,7 @@ mob/proc/yank_out_object()
feedback_add_details("admin_verb", "UNWIND")
return
//Helper proc for figuring out if the active hand (or given hand) is usable.
/mob/proc/can_use_hand()
return 1
+2 -8
View File
@@ -22,14 +22,8 @@
return
/obj/item/weapon/paper_bin/attack_hand(mob/user as mob)
if(ishuman(user))
var/mob/living/carbon/human/H = user
var/obj/item/organ/external/temp = H.organs_by_name["r_hand"]
if (H.hand)
temp = H.organs_by_name["l_hand"]
if(temp && !temp.is_usable())
user << "<span class='notice'>You try to move your [temp.name], but cannot!"
return
if(!user.can_use_hand())
return
var/response = ""
if(!papers.len > 0)
response = alert(user, "Do you take regular paper, or Carbon copy paper?", "Paper type request", "Regular", "Carbon-Copy", "Cancel")