Mob inventory cleanup

This commit is contained in:
Kelenius
2016-03-15 16:39:40 +03:00
parent 5104957ff8
commit afbc235b96
59 changed files with 432 additions and 390 deletions
+8 -13
View File
@@ -73,13 +73,10 @@
/obj/item/equipped()
..()
var/mob/M = loc
var/mob/living/M = loc
if(!istype(M))
return
if(M.l_hand)
M.l_hand.update_held_icon()
if(M.r_hand)
M.r_hand.update_held_icon()
M.update_held_icons()
/obj/item/Destroy()
if(ismob(loc))
@@ -95,8 +92,8 @@
//Checks if the item is being held by a mob, and if so, updates the held icons
/obj/item/proc/update_held_icon()
if(ismob(src.loc))
var/mob/M = src.loc
if(isliving(src.loc))
var/mob/living/M = src.loc
if(M.l_hand == src)
M.update_inv_l_hand()
else if(M.r_hand == src)
@@ -157,7 +154,7 @@
size = "huge"
return ..(user, distance, "", "It is a [size] item.")
/obj/item/attack_hand(mob/user as mob)
/obj/item/attack_hand(mob/living/user as mob)
if (!user) return
if (hasorgans(user))
var/mob/living/carbon/human/H = user
@@ -396,17 +393,15 @@ var/list/global/slot_flags_enumeration = list(
if((!istype(usr, /mob/living/carbon)) || (istype(usr, /mob/living/carbon/brain)))//Is humanoid, and is not a brain
usr << "<span class='warning'>You can't pick things up!</span>"
return
var/mob/living/carbon/C = usr
if( usr.stat || usr.restrained() )//Is not asleep/dead and is not restrained
usr << "<span class='warning'>You can't pick things up!</span>"
return
if(src.anchored) //Object isn't anchored
usr << "<span class='warning'>You can't pick that up!</span>"
return
if(!usr.hand && usr.r_hand) //Right hand is not full
usr << "<span class='warning'>Your right hand is full.</span>"
return
if(usr.hand && usr.l_hand) //Left hand is not full
usr << "<span class='warning'>Your left hand is full.</span>"
if(C.get_active_hand()) //Hand is not full
usr << "<span class='warning'>Your hand is full.</span>"
return
if(!istype(src.loc, /turf)) //Object is on a turf
usr << "<span class='warning'>You can't pick that up!</span>"
@@ -12,7 +12,7 @@
var/code = 2
/obj/item/device/radio/electropack/attack_hand(mob/user as mob)
/obj/item/device/radio/electropack/attack_hand(mob/living/user as mob)
if(src == user.back)
user << "<span class='notice'>You need help taking this off!</span>"
return
+1 -1
View File
@@ -209,7 +209,7 @@
amount = 5
max_amount = 5
/obj/item/stack/medical/splint/attack(mob/living/carbon/M as mob, mob/user as mob)
/obj/item/stack/medical/splint/attack(mob/living/carbon/M as mob, mob/living/user as mob)
if(..())
return 1
+1 -14
View File
@@ -160,20 +160,7 @@
P.icon_state = "paper_words"
if(istype(usr,/mob/living/carbon))
// place the item in the usr's hand if possible
if(!usr.r_hand)
P.loc = usr
usr.r_hand = P
P.layer = 20
else if(!usr.l_hand)
P.loc = usr
usr.l_hand = P
P.layer = 20
if (ismob(src.loc))
var/mob/M = src.loc
M.update_inv_l_hand()
M.update_inv_r_hand()
usr.put_in_hands(src)
/obj/item/weapon/autopsy_scanner/attack(mob/living/carbon/human/M as mob, mob/living/carbon/user as mob)
if(!istype(M))
@@ -445,39 +445,36 @@ CIGARETTE PACKETS ARE IN FANCY.DM
/obj/item/weapon/flame/lighter/attack_self(mob/living/user)
if(!base_state)
base_state = icon_state
if(user.r_hand == src || user.l_hand == src)
if(!lit)
lit = 1
icon_state = "[base_state]on"
item_state = "[base_state]on"
if(istype(src, /obj/item/weapon/flame/lighter/zippo) )
user.visible_message("<span class='rose'>Without even breaking stride, [user] flips open and lights [src] in one smooth movement.</span>")
else
if(prob(95))
user.visible_message("<span class='notice'>After a few attempts, [user] manages to light the [src].</span>")
else
user << "<span class='warning'>You burn yourself while lighting the lighter.</span>"
if (user.l_hand == src)
user.apply_damage(2,BURN,"l_hand")
else
user.apply_damage(2,BURN,"r_hand")
user.visible_message("<span class='notice'>After a few attempts, [user] manages to light the [src], they however burn their finger in the process.</span>")
set_light(2)
processing_objects.Add(src)
if(!lit)
lit = 1
icon_state = "[base_state]on"
item_state = "[base_state]on"
if(istype(src, /obj/item/weapon/flame/lighter/zippo) )
user.visible_message("<span class='rose'>Without even breaking stride, [user] flips open and lights [src] in one smooth movement.</span>")
else
lit = 0
icon_state = "[base_state]"
item_state = "[base_state]"
if(istype(src, /obj/item/weapon/flame/lighter/zippo) )
user.visible_message("<span class='rose'>You hear a quiet click, as [user] shuts off [src] without even looking at what they're doing.</span>")
if(prob(95))
user.visible_message("<span class='notice'>After a few attempts, [user] manages to light the [src].</span>")
else
user.visible_message("<span class='notice'>[user] quietly shuts off the [src].</span>")
user << "<span class='warning'>You burn yourself while lighting the lighter.</span>"
if (user.get_left_hand() == src)
user.apply_damage(2,BURN,"l_hand")
else
user.apply_damage(2,BURN,"r_hand")
user.visible_message("<span class='notice'>After a few attempts, [user] manages to light the [src], they however burn their finger in the process.</span>")
set_light(0)
processing_objects.Remove(src)
set_light(2)
processing_objects.Add(src)
else
return ..()
lit = 0
icon_state = "[base_state]"
item_state = "[base_state]"
if(istype(src, /obj/item/weapon/flame/lighter/zippo) )
user.visible_message("<span class='rose'>You hear a quiet click, as [user] shuts off [src] without even looking at what they're doing.</span>")
else
user.visible_message("<span class='notice'>[user] quietly shuts off the [src].</span>")
set_light(0)
processing_objects.Remove(src)
return
+2 -4
View File
@@ -77,7 +77,5 @@
icon_state = "purplecomb"
item_state = "purplecomb"
/obj/item/weapon/haircomb/attack_self(mob/user)
if(user.r_hand == src || user.l_hand == src)
user.visible_message(text("<span class='notice'>[] uses [] to comb their hair with incredible style and sophistication. What a [].</span>", user, src, user.gender == FEMALE ? "lady" : "guy"))
return
/obj/item/weapon/haircomb/attack_self(mob/living/user)
user.visible_message(text("<span class='notice'>[] uses [] to comb their hair with incredible style and sophistication. What a [].</span>", user, src, user.gender == FEMALE ? "lady" : "guy"))
@@ -39,8 +39,8 @@
return null
var/turf/location = loc
if(istype(location, /mob/))
var/mob/M = location
if(M.l_hand == src || M.r_hand == src)
var/mob/living/M = location
if(M.item_is_in_hands(src))
location = M.loc
if(isturf(location)) //start a fire if possible
location.hotspot_expose(700, 2)
@@ -125,12 +125,12 @@
icon_state = "wrap_paper"
var/amount = 20.0
/obj/item/weapon/wrapping_paper/attackby(obj/item/weapon/W as obj, mob/user as mob)
/obj/item/weapon/wrapping_paper/attackby(obj/item/weapon/W as obj, mob/living/user as mob)
..()
if (!( locate(/obj/structure/table, src.loc) ))
user << "<span class='warning'>You MUST put the paper on a table!</span>"
if (W.w_class < 4)
if ((istype(user.l_hand, /obj/item/weapon/wirecutters) || istype(user.r_hand, /obj/item/weapon/wirecutters)))
if (user.get_type_in_hands(/obj/item/weapon/wirecutters))
var/a_used = 2 ** (src.w_class - 1)
if (src.amount < a_used)
user << "<span class='warning'>You need more paper!</span>"
@@ -24,8 +24,8 @@
return
attack_hand(mob/user as mob)
if ((src.case && (user.l_hand == src || user.r_hand == src)))
attack_hand(mob/living/user as mob)
if ((src.case && user.item_is_in_hands(src)))
user.put_in_active_hand(case)
src.case.add_fingerprint(user)
@@ -29,7 +29,7 @@
/obj/item/weapon/material/twohanded/update_held_icon()
var/mob/living/M = loc
if(istype(M) && !issmall(M) && ((M.r_hand == src && !M.l_hand) || (M.l_hand == src && !M.r_hand)))
if(istype(M) && !issmall(M) && M.item_is_in_hands(src) && !M.hands_are_full())
wielded = 1
force = force_wielded
name = "[base_name] (wielded)"
@@ -214,7 +214,7 @@
spawn(1) if(src) qdel(src)
/obj/item/weapon/melee/energy/blade/process()
if(!creator || loc != creator || (creator.l_hand != src && creator.r_hand != src))
if(!creator || loc != creator || !creator.item_is_in_hands(src))
// Tidy up a bit.
if(istype(loc,/mob/living))
var/mob/living/carbon/human/host = loc
@@ -59,7 +59,7 @@
spawn(1) if(src) del(src)
/obj/item/weapon/mop_deploy/process()
if(!creator || loc != creator || (creator.l_hand != src && creator.r_hand != src))
if(!creator || loc != creator || !creator.item_is_in_hands(src))
// Tidy up a bit.
if(istype(loc,/mob/living))
var/mob/living/carbon/human/host = loc
@@ -21,7 +21,7 @@
var/linked
/obj/item/weapon/storage/laundry_basket/attack_hand(mob/user as mob)
/obj/item/weapon/storage/laundry_basket/attack_hand(mob/living/user as mob)
if(ishuman(user))
var/mob/living/carbon/human/H = user
var/obj/item/organ/external/temp = H.get_organ("r_hand")
+4 -4
View File
@@ -173,7 +173,7 @@
user << text("\icon[] [] contains []/[] units of fuel!", src, src.name, get_fuel(),src.max_fuel )
/obj/item/weapon/weldingtool/attackby(obj/item/W as obj, mob/user as mob)
/obj/item/weapon/weldingtool/attackby(obj/item/W as obj, mob/living/user as mob)
if(istype(W,/obj/item/weapon/screwdriver))
if(welding)
user << "<span class='danger'>Stop welding first!</span>"
@@ -222,9 +222,9 @@
//I'm not sure what this does. I assume it has to do with starting fires...
//...but it doesnt check to see if the welder is on or not.
var/turf/location = src.loc
if(istype(location, /mob/))
var/mob/M = location
if(M.l_hand == src || M.r_hand == src)
if(istype(location, /mob/living))
var/mob/living/M = location
if(M.item_is_in_hands(src))
location = get_turf(M)
if (istype(location, /turf))
location.hotspot_expose(700, 5)
+5 -4
View File
@@ -93,11 +93,12 @@
// check for TK users
if (istype(usr, /mob/living/carbon/human))
if(istype(usr.l_hand, /obj/item/tk_grab) || istype(usr.r_hand, /obj/item/tk_grab/))
if(!(usr in nearby))
if(usr.client && usr.machine==src)
var/mob/living/carbon/human/H = usr
if(H.get_type_in_hands(/obj/item/tk_grab))
if(!(H in nearby))
if(H.client && H.machine==src)
is_in_use = 1
src.attack_hand(usr)
src.attack_hand(H)
in_use = is_in_use
/obj/proc/updateDialog()
+1 -1
View File
@@ -28,7 +28,7 @@
update_icon()
/obj/structure/extinguisher_cabinet/attack_hand(mob/user)
/obj/structure/extinguisher_cabinet/attack_hand(mob/living/user)
if(isrobot(user))
return
if (ishuman(user))
+3 -3
View File
@@ -107,7 +107,7 @@
if(!isliving(usr))
return
var/mob/living/user = usr
if(href_list["take"])
switch(href_list["take"])
if("garbage")
@@ -213,10 +213,10 @@
..()
/obj/structure/bed/chair/janicart/relaymove(mob/user, direction)
/obj/structure/bed/chair/janicart/relaymove(mob/living/user, direction)
if(user.stat || user.stunned || user.weakened || user.paralysis)
unbuckle_mob()
if(istype(user.l_hand, /obj/item/key) || istype(user.r_hand, /obj/item/key))
if(user.get_type_in_hands(/obj/item/key))
step(src, direction)
update_mob()
else
+7 -8
View File
@@ -64,15 +64,14 @@
return
var/obj/item/P = locate(href_list["write"])
if((P && P.loc == src)) //ifthe paper's on the board
if(istype(usr.r_hand, /obj/item/weapon/pen)) //and you're holding a pen
add_fingerprint(usr)
P.attackby(usr.r_hand, usr) //then do ittttt
else
if(istype(usr.l_hand, /obj/item/weapon/pen)) //check other hand for pen
add_fingerprint(usr)
P.attackby(usr.l_hand, usr)
var/mob/living/M = usr
if(istype(M))
var/obj/item/weapon/pen/E = M.get_type_in_hands(/obj/item/weapon/pen)
if(E)
add_fingerprint(M)
P.attackby(E, usr)
else
usr << "<span class='notice'>You'll need something to write with!</span>"
M << "<span class='notice'>You'll need something to write with!</span>"
if(href_list["read"])
var/obj/item/weapon/paper/P = locate(href_list["read"])
if((P && P.loc == src))
+1 -1
View File
@@ -90,7 +90,7 @@ FLOOR SAFES
var/mob/living/carbon/human/user = usr
var/canhear = 0
if(istype(user.l_hand, /obj/item/clothing/accessory/stethoscope) || istype(user.r_hand, /obj/item/clothing/accessory/stethoscope))
if(user.get_type_in_hands(/obj/item/clothing/accessory/stethoscope))
canhear = 1
if(href_list["open"])
+1 -1
View File
@@ -358,7 +358,7 @@
if (ishuman(user))
var/mob/living/carbon/human/H = user
var/obj/item/organ/external/temp = H.organs_by_name["r_hand"]
if (user.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!</span>"