Removes unnecessary and cruft procs from mob/inventory.dm

This commit is contained in:
mwerezak
2015-03-30 05:25:43 -04:00
parent e6d19faeba
commit 1b4e13aabc
24 changed files with 70 additions and 235 deletions

View File

@@ -379,7 +379,8 @@
if(!usr.stat && isturf(usr.loc) && !usr.restrained()) if(!usr.stat && isturf(usr.loc) && !usr.restrained())
usr:toggle_throw_mode() usr:toggle_throw_mode()
if("drop") if("drop")
usr.drop_item_v() if(usr.client)
usr.client.drop_item()
if("module") if("module")
if(isrobot(usr)) if(isrobot(usr))
@@ -429,7 +430,7 @@
if("Allow Walking") if("Allow Walking")
if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes. if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes.
return return
if(!istype(usr.equipped(),/obj/item/weapon/gun)) if(!istype(usr.get_active_hand(),/obj/item/weapon/gun))
usr << "You need your gun in your active hand to do that!" usr << "You need your gun in your active hand to do that!"
return return
usr.client.AllowTargetMove() usr.client.AllowTargetMove()
@@ -438,7 +439,7 @@
if("Disallow Walking") if("Disallow Walking")
if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes. if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes.
return return
if(!istype(usr.equipped(),/obj/item/weapon/gun)) if(!istype(usr.get_active_hand(),/obj/item/weapon/gun))
usr << "You need your gun in your active hand to do that!" usr << "You need your gun in your active hand to do that!"
return return
usr.client.AllowTargetMove() usr.client.AllowTargetMove()
@@ -447,7 +448,7 @@
if("Allow Running") if("Allow Running")
if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes. if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes.
return return
if(!istype(usr.equipped(),/obj/item/weapon/gun)) if(!istype(usr.get_active_hand(),/obj/item/weapon/gun))
usr << "You need your gun in your active hand to do that!" usr << "You need your gun in your active hand to do that!"
return return
usr.client.AllowTargetRun() usr.client.AllowTargetRun()
@@ -456,7 +457,7 @@
if("Disallow Running") if("Disallow Running")
if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes. if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes.
return return
if(!istype(usr.equipped(),/obj/item/weapon/gun)) if(!istype(usr.get_active_hand(),/obj/item/weapon/gun))
usr << "You need your gun in your active hand to do that!" usr << "You need your gun in your active hand to do that!"
return return
usr.client.AllowTargetRun() usr.client.AllowTargetRun()
@@ -465,7 +466,7 @@
if("Allow Item Use") if("Allow Item Use")
if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes. if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes.
return return
if(!istype(usr.equipped(),/obj/item/weapon/gun)) if(!istype(usr.get_active_hand(),/obj/item/weapon/gun))
usr << "You need your gun in your active hand to do that!" usr << "You need your gun in your active hand to do that!"
return return
usr.client.AllowTargetClick() usr.client.AllowTargetClick()
@@ -475,7 +476,7 @@
if("Disallow Item Use") if("Disallow Item Use")
if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes. if(gun_click_time > world.time - 30) //give them 3 seconds between mode changes.
return return
if(!istype(usr.equipped(),/obj/item/weapon/gun)) if(!istype(usr.get_active_hand(),/obj/item/weapon/gun))
usr << "You need your gun in your active hand to do that!" usr << "You need your gun in your active hand to do that!"
return return
usr.client.AllowTargetClick() usr.client.AllowTargetClick()

View File

@@ -151,9 +151,9 @@
// spawn (100) // spawn (100)
// if (rev_mob.r_store) // if (rev_mob.r_store)
// rev_mob.equip_if_possible(new /obj/item/weapon/paper/communist_manifesto(rev_mob), rev_mob.slot_l_store) // rev_mob.equip_to_slot_or_del(new /obj/item/weapon/paper/communist_manifesto(rev_mob), rev_mob.slot_l_store)
// if (rev_mob.l_store) // if (rev_mob.l_store)
// rev_mob.equip_if_possible(new /obj/item/weapon/paper/communist_manifesto(rev_mob), rev_mob.slot_r_store) // rev_mob.equip_to_slot_or_del(new /obj/item/weapon/paper/communist_manifesto(rev_mob), rev_mob.slot_r_store)
/datum/game_mode/rp_revolution/check_win() /datum/game_mode/rp_revolution/check_win()

View File

@@ -38,7 +38,7 @@
if (beaker) if (beaker)
return 1 return 1
else else
user.before_take_item(O) user.remove_from_mob(O)
O.loc = src O.loc = src
beaker = O beaker = O
src.verbs += /obj/machinery/juicer/verb/detach src.verbs += /obj/machinery/juicer/verb/detach
@@ -48,7 +48,7 @@
if (!is_type_in_list(O, allowed_items)) if (!is_type_in_list(O, allowed_items))
user << "It looks as not containing any juice." user << "It looks as not containing any juice."
return 1 return 1
user.before_take_item(O) user.remove_from_mob(O)
O.loc = src O.loc = src
src.updateUsrDialog() src.updateUsrDialog()
return 0 return 0

View File

@@ -112,7 +112,7 @@
"\blue [user] has added one of [O] to \the [src].", \ "\blue [user] has added one of [O] to \the [src].", \
"\blue You add one of [O] to \the [src].") "\blue You add one of [O] to \the [src].")
else else
// user.before_take_item(O) //This just causes problems so far as I can tell. -Pete // user.remove_from_mob(O) //This just causes problems so far as I can tell. -Pete
user.drop_item() user.drop_item()
O.loc = src O.loc = src
user.visible_message( \ user.visible_message( \

View File

@@ -169,7 +169,7 @@
user << "<span class='notice'>\The [src] is full.</span>" user << "<span class='notice'>\The [src] is full.</span>"
return 1 return 1
else else
user.before_take_item(O) user.remove_from_mob(O)
O.loc = src O.loc = src
if(item_quants[O.name]) if(item_quants[O.name])
item_quants[O.name]++ item_quants[O.name]++

View File

@@ -110,7 +110,7 @@
B.loc = get_turf(src) B.loc = get_turf(src)
user << "<span class='notice'>You armed the robot frame.</span>" user << "<span class='notice'>You armed the robot frame.</span>"
if (user.get_inactive_hand()==src) if (user.get_inactive_hand()==src)
user.before_take_item(src) user.remove_from_mob(src)
user.put_in_inactive_hand(B) user.put_in_inactive_hand(B)
del(src) del(src)
else else

View File

@@ -177,7 +177,7 @@
spawn(0) //delete the empty stack once the current context yields spawn(0) //delete the empty stack once the current context yields
if (amount <= 0) //check again in case someone transferred stuff to us if (amount <= 0) //check again in case someone transferred stuff to us
if(usr) if(usr)
usr.before_take_item(src) usr.remove_from_mob(src)
del(src) del(src)
return 1 return 1

View File

@@ -103,7 +103,7 @@
if ((!F.status)||(F.ptank)) return if ((!F.status)||(F.ptank)) return
src.master = F src.master = F
F.ptank = src F.ptank = src
user.before_take_item(src) user.remove_from_mob(src)
src.loc = F src.loc = F
return return

View File

@@ -17,7 +17,7 @@
return return
if(istype(O, /obj/item/weapon/extinguisher)) if(istype(O, /obj/item/weapon/extinguisher))
if(!has_extinguisher && opened) if(!has_extinguisher && opened)
user.drop_item(O) user.remove_from_mob(O)
contents += O contents += O
has_extinguisher = O has_extinguisher = O
user << "<span class='notice'>You place [O] in [src].</span>" user << "<span class='notice'>You place [O] in [src].</span>"

View File

@@ -26,7 +26,7 @@
if(istype(W, /obj/item/target)) if(istype(W, /obj/item/target))
density = 0 density = 0
W.density = 1 W.density = 1
user.drop_item(src) user.remove_from_mob(W)
W.loc = loc W.loc = loc
W.layer = 3.1 W.layer = 3.1
pinned_target = W pinned_target = W

View File

@@ -456,7 +456,7 @@ turf/simulated/floor/proc/update_icon()
if(istype(C,/obj/item/weapon/light/bulb)) //only for light tiles if(istype(C,/obj/item/weapon/light/bulb)) //only for light tiles
if(is_light_floor()) if(is_light_floor())
if(get_lightfloor_state()) if(get_lightfloor_state())
user.drop_item(C) user.remove_from_mob(C)
del(C) del(C)
set_lightfloor_state(0) //fixing it by bashing it with a light bulb, fun eh? set_lightfloor_state(0) //fixing it by bashing it with a light bulb, fun eh?
update_icon() update_icon()

View File

@@ -736,19 +736,19 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
M.equip_syndicate_commando() M.equip_syndicate_commando()
if("nanotrasen representative") if("nanotrasen representative")
M.equip_if_possible(new /obj/item/clothing/under/rank/centcom(M), slot_w_uniform) M.equip_to_slot_or_del(new /obj/item/clothing/under/rank/centcom(M), slot_w_uniform)
M.equip_if_possible(new /obj/item/clothing/shoes/laceup(M), slot_shoes) M.equip_to_slot_or_del(new /obj/item/clothing/shoes/laceup(M), slot_shoes)
M.equip_if_possible(new /obj/item/clothing/gloves/white(M), slot_gloves) M.equip_to_slot_or_del(new /obj/item/clothing/gloves/white(M), slot_gloves)
M.equip_if_possible(new /obj/item/device/radio/headset/heads/hop(M), slot_l_ear) M.equip_to_slot_or_del(new /obj/item/device/radio/headset/heads/hop(M), slot_l_ear)
var/obj/item/device/pda/heads/pda = new(M) var/obj/item/device/pda/heads/pda = new(M)
pda.owner = M.real_name pda.owner = M.real_name
pda.ownjob = "NanoTrasen Navy Representative" pda.ownjob = "NanoTrasen Navy Representative"
pda.name = "PDA-[M.real_name] ([pda.ownjob])" pda.name = "PDA-[M.real_name] ([pda.ownjob])"
M.equip_if_possible(pda, slot_r_store) M.equip_to_slot_or_del(pda, slot_r_store)
M.equip_if_possible(new /obj/item/clothing/glasses/sunglasses(M), slot_l_store) M.equip_to_slot_or_del(new /obj/item/clothing/glasses/sunglasses(M), slot_l_store)
M.equip_if_possible(new /obj/item/weapon/clipboard(M), slot_belt) M.equip_to_slot_or_del(new /obj/item/weapon/clipboard(M), slot_belt)
var/obj/item/weapon/card/id/W = new(M) var/obj/item/weapon/card/id/W = new(M)
W.name = "[M.real_name]'s ID Card" W.name = "[M.real_name]'s ID Card"
@@ -758,23 +758,23 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
W.access += list("VIP Guest","Custodian","Thunderdome Overseer","Intel Officer","Medical Officer","Death Commando","Research Officer") W.access += list("VIP Guest","Custodian","Thunderdome Overseer","Intel Officer","Medical Officer","Death Commando","Research Officer")
W.assignment = "NanoTrasen Navy Representative" W.assignment = "NanoTrasen Navy Representative"
W.registered_name = M.real_name W.registered_name = M.real_name
M.equip_if_possible(W, slot_wear_id) M.equip_to_slot_or_del(W, slot_wear_id)
if("nanotrasen officer") if("nanotrasen officer")
M.equip_if_possible(new /obj/item/clothing/under/rank/centcom_officer(M), slot_w_uniform) M.equip_to_slot_or_del(new /obj/item/clothing/under/rank/centcom_officer(M), slot_w_uniform)
M.equip_if_possible(new /obj/item/clothing/shoes/laceup(M), slot_shoes) M.equip_to_slot_or_del(new /obj/item/clothing/shoes/laceup(M), slot_shoes)
M.equip_if_possible(new /obj/item/clothing/gloves/white(M), slot_gloves) M.equip_to_slot_or_del(new /obj/item/clothing/gloves/white(M), slot_gloves)
M.equip_if_possible(new /obj/item/device/radio/headset/heads/captain(M), slot_l_ear) M.equip_to_slot_or_del(new /obj/item/device/radio/headset/heads/captain(M), slot_l_ear)
M.equip_if_possible(new /obj/item/clothing/head/beret/centcom/officer(M), slot_head) M.equip_to_slot_or_del(new /obj/item/clothing/head/beret/centcom/officer(M), slot_head)
var/obj/item/device/pda/heads/pda = new(M) var/obj/item/device/pda/heads/pda = new(M)
pda.owner = M.real_name pda.owner = M.real_name
pda.ownjob = "NanoTrasen Navy Officer" pda.ownjob = "NanoTrasen Navy Officer"
pda.name = "PDA-[M.real_name] ([pda.ownjob])" pda.name = "PDA-[M.real_name] ([pda.ownjob])"
M.equip_if_possible(pda, slot_r_store) M.equip_to_slot_or_del(pda, slot_r_store)
M.equip_if_possible(new /obj/item/clothing/glasses/sunglasses(M), slot_l_store) M.equip_to_slot_or_del(new /obj/item/clothing/glasses/sunglasses(M), slot_l_store)
M.equip_if_possible(new /obj/item/weapon/gun/energy(M), slot_belt) M.equip_to_slot_or_del(new /obj/item/weapon/gun/energy(M), slot_belt)
var/obj/item/weapon/card/id/centcom/W = new(M) var/obj/item/weapon/card/id/centcom/W = new(M)
W.name = "[M.real_name]'s ID Card" W.name = "[M.real_name]'s ID Card"
@@ -782,24 +782,24 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
W.access += get_all_centcom_access() W.access += get_all_centcom_access()
W.assignment = "NanoTrasen Navy Officer" W.assignment = "NanoTrasen Navy Officer"
W.registered_name = M.real_name W.registered_name = M.real_name
M.equip_if_possible(W, slot_wear_id) M.equip_to_slot_or_del(W, slot_wear_id)
if("nanotrasen captain") if("nanotrasen captain")
M.equip_if_possible(new /obj/item/clothing/under/rank/centcom_captain(M), slot_w_uniform) M.equip_to_slot_or_del(new /obj/item/clothing/under/rank/centcom_captain(M), slot_w_uniform)
M.equip_if_possible(new /obj/item/clothing/shoes/laceup(M), slot_shoes) M.equip_to_slot_or_del(new /obj/item/clothing/shoes/laceup(M), slot_shoes)
M.equip_if_possible(new /obj/item/clothing/gloves/white(M), slot_gloves) M.equip_to_slot_or_del(new /obj/item/clothing/gloves/white(M), slot_gloves)
M.equip_if_possible(new /obj/item/device/radio/headset/heads/captain(M), slot_l_ear) M.equip_to_slot_or_del(new /obj/item/device/radio/headset/heads/captain(M), slot_l_ear)
M.equip_if_possible(new /obj/item/clothing/head/beret/centcom/captain(M), slot_head) M.equip_to_slot_or_del(new /obj/item/clothing/head/beret/centcom/captain(M), slot_head)
var/obj/item/device/pda/heads/pda = new(M) var/obj/item/device/pda/heads/pda = new(M)
pda.owner = M.real_name pda.owner = M.real_name
pda.ownjob = "NanoTrasen Navy Captain" pda.ownjob = "NanoTrasen Navy Captain"
pda.name = "PDA-[M.real_name] ([pda.ownjob])" pda.name = "PDA-[M.real_name] ([pda.ownjob])"
M.equip_if_possible(pda, slot_r_store) M.equip_to_slot_or_del(pda, slot_r_store)
M.equip_if_possible(new /obj/item/clothing/glasses/sunglasses(M), slot_l_store) M.equip_to_slot_or_del(new /obj/item/clothing/glasses/sunglasses(M), slot_l_store)
M.equip_if_possible(new /obj/item/weapon/gun/energy(M), slot_belt) M.equip_to_slot_or_del(new /obj/item/weapon/gun/energy(M), slot_belt)
var/obj/item/weapon/card/id/centcom/W = new(M) var/obj/item/weapon/card/id/centcom/W = new(M)
W.name = "[M.real_name]'s ID Card" W.name = "[M.real_name]'s ID Card"
@@ -807,7 +807,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
W.access += get_all_centcom_access() W.access += get_all_centcom_access()
W.assignment = "NanoTrasen Navy Captain" W.assignment = "NanoTrasen Navy Captain"
W.registered_name = M.real_name W.registered_name = M.real_name
M.equip_if_possible(W, slot_wear_id) M.equip_to_slot_or_del(W, slot_wear_id)
if("emergency response team") if("emergency response team")
M.equip_to_slot_or_del(new /obj/item/clothing/under/rank/centcom_officer(M), slot_w_uniform) M.equip_to_slot_or_del(new /obj/item/clothing/under/rank/centcom_officer(M), slot_w_uniform)

View File

@@ -60,7 +60,7 @@
//replace old ID //replace old ID
del(C) del(C)
ok = M.equip_if_possible(I, slot_wear_id, 0) //if 1, last argument deletes on fail ok = M.equip_to_slot_if_possible(I, slot_wear_id, 0) //if 1, last argument deletes on fail
break break
else if(istype(Item,/obj/item/weapon/storage/belt)) else if(istype(Item,/obj/item/weapon/storage/belt))
if(M.ckey == "jakksergal" && M.real_name == "Nashi Ra'hal" && M.mind.role_alt_title && M.mind.role_alt_title != "Nurse" && M.mind.role_alt_title != "Chemist") if(M.ckey == "jakksergal" && M.real_name == "Nashi Ra'hal" && M.mind.role_alt_title && M.mind.role_alt_title != "Nurse" && M.mind.role_alt_title != "Chemist")
@@ -72,13 +72,13 @@
for(var/obj/item/weapon/storage/belt/B in M) for(var/obj/item/weapon/storage/belt/B in M)
del(B) del(B)
M.belt=null M.belt=null
ok = M.equip_if_possible(I, slot_belt, 0) ok = M.equip_to_slot_if_possible(I, slot_belt, 0)
break break
if(istype(M.belt,/obj/item/device/pda)) if(istype(M.belt,/obj/item/device/pda))
for(var/obj/item/device/pda/Pda in M) for(var/obj/item/device/pda/Pda in M)
M.belt=null M.belt=null
M.equip_if_possible(Pda, slot_l_store, 0) M.equip_to_slot_if_possible(Pda, slot_l_store, 0)
ok = M.equip_if_possible(I, slot_belt, 0) ok = M.equip_to_slot_if_possible(I, slot_belt, 0)
else if(istype(M.back,/obj/item/weapon/storage) && M.back:contents.len < M.back:storage_slots) // Try to place it in something on the mob's back else if(istype(M.back,/obj/item/weapon/storage) && M.back:contents.len < M.back:storage_slots) // Try to place it in something on the mob's back
Item.loc = M.back Item.loc = M.back
ok = 1 ok = 1

View File

@@ -36,7 +36,7 @@
if(beaker) if(beaker)
user << "\red The biogenerator is already loaded." user << "\red The biogenerator is already loaded."
else else
user.before_take_item(O) user.remove_from_mob(O)
O.loc = src O.loc = src
beaker = O beaker = O
updateUsrDialog() updateUsrDialog()
@@ -68,7 +68,7 @@
if(i >= 10) if(i >= 10)
user << "\red The biogenerator is full! Activate it." user << "\red The biogenerator is full! Activate it."
else else
user.before_take_item(O) user.remove_from_mob(O)
O.loc = src O.loc = src
user << "\blue You put [O.name] in [src.name]" user << "\blue You put [O.name] in [src.name]"
update_icon() update_icon()

View File

@@ -633,7 +633,7 @@
if(!seed) if(!seed)
var/obj/item/seeds/S = O var/obj/item/seeds/S = O
user.drop_item(O) user.remove_from_mob(O)
if(!S.seed) if(!S.seed)
user << "The packet seems to be empty. You throw it away." user << "The packet seems to be empty. You throw it away."
@@ -691,7 +691,7 @@
else if ( istype(O, /obj/item/weapon/plantspray) ) else if ( istype(O, /obj/item/weapon/plantspray) )
var/obj/item/weapon/plantspray/spray = O var/obj/item/weapon/plantspray/spray = O
user.drop_item(O) user.remove_from_mob(O)
toxins += spray.toxicity toxins += spray.toxicity
pestlevel -= spray.pest_kill_str pestlevel -= spray.pest_kill_str
weedlevel -= spray.weed_kill_str weedlevel -= spray.weed_kill_str

View File

@@ -88,7 +88,7 @@
if(S.seed && S.seed.immutable > 0) if(S.seed && S.seed.immutable > 0)
user << "That seed is not compatible with our genetics technology." user << "That seed is not compatible with our genetics technology."
else else
user.drop_item(W) user.remove_from_mob(W)
W.loc = src W.loc = src
seed = W seed = W
user << "You load [W] into [src]." user << "You load [W] into [src]."
@@ -120,7 +120,7 @@
user << "That disk does not have any gene data loaded." user << "That disk does not have any gene data loaded."
return return
user.drop_item(W) user.remove_from_mob(W)
W.loc = src W.loc = src
loaded_disk = W loaded_disk = W
user << "You load [W] into [src]." user << "You load [W] into [src]."

View File

@@ -143,13 +143,6 @@ var/list/slot_equipment_priority = list( \
W.dropped() W.dropped()
return 0 return 0
/mob/proc/drop_item_v() //this is dumb.
if(stat == CONSCIOUS && isturf(loc))
return drop_item()
return 0
// Removes an item from inventory and places it in the target atom // Removes an item from inventory and places it in the target atom
/mob/proc/drop_from_inventory(var/obj/item/W, var/atom/Target = null) /mob/proc/drop_from_inventory(var/obj/item/W, var/atom/Target = null)
if(W) if(W)
@@ -166,64 +159,17 @@ var/list/slot_equipment_priority = list( \
//Drops the item in our left hand //Drops the item in our left hand
/mob/proc/drop_l_hand(var/atom/Target) /mob/proc/drop_l_hand(var/atom/Target)
if(l_hand) return drop_from_inventory(l_hand, Target)
if(client) client.screen -= l_hand
l_hand.layer = initial(l_hand.layer)
if(Target) l_hand.loc = Target.loc
else l_hand.loc = loc
var/turf/T = get_turf(loc)
if(isturf(T))
T.Entered(l_hand)
l_hand.dropped(src)
l_hand = null
update_inv_l_hand()
return 1
return 0
//Drops the item in our right hand //Drops the item in our right hand
/mob/proc/drop_r_hand(var/atom/Target) /mob/proc/drop_r_hand(var/atom/Target)
if(r_hand) return drop_from_inventory(r_hand, Target)
if(client) client.screen -= r_hand
r_hand.layer = initial(r_hand.layer)
if(Target) r_hand.loc = Target.loc
else r_hand.loc = loc
var/turf/T = get_turf(Target)
if(istype(T))
T.Entered(r_hand)
r_hand.dropped(src)
r_hand = null
update_inv_r_hand()
return 1
return 0
//Drops the item in our active hand. //Drops the item in our active hand.
/mob/proc/drop_item(var/atom/Target) /mob/proc/drop_item(var/atom/Target)
if(hand) return drop_l_hand(Target) if(hand) return drop_l_hand(Target)
else return drop_r_hand(Target) else return drop_r_hand(Target)
//TODO: phase out this proc
/mob/proc/before_take_item(var/obj/item/W) //TODO: what is this?
W.loc = null
W.layer = initial(W.layer)
u_equip(W)
update_icons()
return
//Removes the object from any slots the mob might have, calling the appropriate icon update proc. //Removes the object from any slots the mob might have, calling the appropriate icon update proc.
//Does nothing else. //Does nothing else.
//DO NOT CALL THIS PROC DIRECTLY. It is meant to be called only by other inventory procs. //DO NOT CALL THIS PROC DIRECTLY. It is meant to be called only by other inventory procs.
@@ -244,34 +190,18 @@ var/list/slot_equipment_priority = list( \
update_inv_wear_mask(0) update_inv_wear_mask(0)
return return
//This differs from remove_from_mob() in that it checks canremove first.
/mob/proc/unEquip(obj/item/I, force = 0) //Force overrides NODROP for things like wizarditis and admin undress. /mob/proc/unEquip(obj/item/I, force = 0) //Force overrides NODROP for things like wizarditis and admin undress.
if(!I) //If there's nothing to drop, the drop is automatically successful. If(unEquip) should generally be used to check for NODROP. if(!I) //If there's nothing to drop, the drop is automatically successful.
return 1 return 1
/*if((I.flags & NODROP) && !force)
return 0*/
if(!I.canremove && !force) if(!I.canremove && !force)
return 0 return 0
if(I == r_hand) remove_from_mob(I)
r_hand = null
update_inv_r_hand()
else if(I == l_hand)
l_hand = null
update_inv_l_hand()
if(I)
if(client)
client.screen -= I
I.loc = loc
I.dropped(src)
if(I)
I.layer = initial(I.layer)
return 1 return 1
//Attemps to remove an object on a mob. Will not move it to another area or such, just removes from the mob. //Attemps to remove an object on a mob. Will not move it to another area or such, just removes from the mob.
//It does call u_equip() though. So it can drop items to the floor but only if src is human.
/mob/proc/remove_from_mob(var/obj/O) /mob/proc/remove_from_mob(var/obj/O)
src.u_equip(O) src.u_equip(O)
if (src.client) if (src.client)
@@ -306,99 +236,3 @@ var/list/slot_equipment_priority = list( \
//if(hasvar(src,"r_hand")) if(src:r_hand) items += src:r_hand //if(hasvar(src,"r_hand")) if(src:r_hand) items += src:r_hand
return items return items
/** BS12's proc to get the item in the active hand. Couldn't find the /tg/ equivalent. **/
/mob/proc/equipped()
return get_active_hand() //TODO: get rid of this proc
/mob/living/carbon/human/proc/equip_if_possible(obj/item/W, slot, del_on_fail = 1) // since byond doesn't seem to have pointers, this seems like the best way to do this :/
//warning: icky code
var/equipped = 0
switch(slot)
if(slot_back)
if(!src.back)
src.back = W
equipped = 1
if(slot_wear_mask)
if(!src.wear_mask)
src.wear_mask = W
equipped = 1
if(slot_handcuffed)
if(!src.handcuffed)
src.handcuffed = W
equipped = 1
if(slot_l_hand)
if(!src.l_hand)
src.l_hand = W
equipped = 1
if(slot_r_hand)
if(!src.r_hand)
src.r_hand = W
equipped = 1
if(slot_belt)
if(!src.belt && src.w_uniform)
src.belt = W
equipped = 1
if(slot_wear_id)
if(!src.wear_id && src.w_uniform)
src.wear_id = W
equipped = 1
if(slot_l_ear)
if(!src.l_ear)
src.l_ear = W
equipped = 1
if(slot_r_ear)
if(!src.r_ear)
src.r_ear = W
equipped = 1
if(slot_glasses)
if(!src.glasses)
src.glasses = W
equipped = 1
if(slot_gloves)
if(!src.gloves)
src.gloves = W
equipped = 1
if(slot_head)
if(!src.head)
src.head = W
equipped = 1
if(slot_shoes)
if(!src.shoes)
src.shoes = W
equipped = 1
if(slot_wear_suit)
if(!src.wear_suit)
src.wear_suit = W
equipped = 1
if(slot_w_uniform)
if(!src.w_uniform)
src.w_uniform = W
equipped = 1
if(slot_l_store)
if(!src.l_store && src.w_uniform)
src.l_store = W
equipped = 1
if(slot_r_store)
if(!src.r_store && src.w_uniform)
src.r_store = W
equipped = 1
if(slot_s_store)
if(!src.s_store && src.wear_suit)
src.s_store = W
equipped = 1
if(slot_in_backpack)
if (src.back && istype(src.back, /obj/item/weapon/storage/backpack))
var/obj/item/weapon/storage/backpack/B = src.back
if(B.contents.len < B.storage_slots && W.w_class <= B.max_w_class)
W.loc = B
equipped = 1
if(equipped)
W.layer = 20
if(src.back && W.loc != src.back)
W.loc = src
else
if (del_on_fail)
del(W)
return equipped

View File

@@ -235,7 +235,7 @@
src << "\red It becomes hard to see for some reason." src << "\red It becomes hard to see for some reason."
eye_blurry = 10 eye_blurry = 10
if(getBrainLoss() >= 35) if(getBrainLoss() >= 35)
if(7 <= rn && rn <= 9) if(hand && equipped()) if(7 <= rn && rn <= 9) if(get_active_hand())
src << "\red Your hand won't respond properly, you drop what you're holding." src << "\red Your hand won't respond properly, you drop what you're holding."
drop_item() drop_item()
if(getBrainLoss() >= 50) if(getBrainLoss() >= 50)

View File

@@ -49,8 +49,8 @@
Stun(2) Stun(2)
//Being hit while using a deadman switch //Being hit while using a deadman switch
if(istype(equipped(),/obj/item/device/assembly/signaler)) if(istype(get_active_hand(),/obj/item/device/assembly/signaler))
var/obj/item/device/assembly/signaler/signaler = equipped() var/obj/item/device/assembly/signaler/signaler = get_active_hand()
if(signaler.deadman && prob(80)) if(signaler.deadman && prob(80))
src.visible_message("\red [src] triggers their deadman's switch!") src.visible_message("\red [src] triggers their deadman's switch!")
signaler.signal() signaler.signal()

View File

@@ -96,8 +96,8 @@
/client/verb/drop_item() /client/verb/drop_item()
set hidden = 1 set hidden = 1
if(!isrobot(mob)) if(!isrobot(mob) && mob.stat == CONSCIOUS && isturf(mob.loc))
mob.drop_item_v() return mob.drop_item()
return return

View File

@@ -45,7 +45,7 @@
src.state = STATE_DEFAULT src.state = STATE_DEFAULT
if("login") if("login")
var/mob/M = usr var/mob/M = usr
var/obj/item/weapon/card/id/I = M.equipped() var/obj/item/weapon/card/id/I = M.get_active_hand()
if (I && istype(I)) if (I && istype(I))
if(src.check_access(I)) if(src.check_access(I))
authenticated = 1 authenticated = 1

View File

@@ -67,7 +67,7 @@
for(var/obj/item/O in src.contents) for(var/obj/item/O in src.contents)
total_stored += O.w_class total_stored += O.w_class
if(total_stored + W.w_class <= max_combined_w_class) if(total_stored + W.w_class <= max_combined_w_class)
user.drop_item(W) user.remove_from_mob(W)
W.loc = src W.loc = src
user << "You shove [W] into the hopper." user << "You shove [W] into the hopper."
else else

View File

@@ -80,7 +80,7 @@
var/mob/living/M = loc var/mob/living/M = loc
if(M == T) return if(M == T) return
if(!istype(M)) return if(!istype(M)) return
if(src != M.equipped()) if(src != M.get_active_hand())
stop_aim() stop_aim()
return return

View File

@@ -925,7 +925,7 @@
user << "Cannot refine into a reagent." user << "Cannot refine into a reagent."
return 1 return 1
user.before_take_item(O) user.remove_from_mob(O)
O.loc = src O.loc = src
holdingitems += O holdingitems += O
src.updateUsrDialog() src.updateUsrDialog()