Mob inventory cleanup

Replaces three item removal procs with one
Adds a proc to delete an item on the mob
This commit is contained in:
Kelenius
2016-03-24 01:23:08 +03:00
parent 463eb3a4b6
commit df5a0d7941
152 changed files with 296 additions and 423 deletions

View File

@@ -49,7 +49,7 @@
/obj/item/weapon/reagent_containers/food/drinks/bottle/proc/smash(var/newloc, atom/against = null)
if(ismob(loc))
var/mob/M = loc
M.drop_from_inventory(src)
M.removeItem(src)
//Creates a shattering noise and replaces the bottle with a broken_bottle
var/obj/item/weapon/broken_bottle/B = new /obj/item/weapon/broken_bottle(newloc)
@@ -110,10 +110,9 @@
/obj/item/weapon/reagent_containers/food/drinks/bottle/proc/insert_rag(obj/item/weapon/reagent_containers/glass/rag/R, mob/user)
if(!isGlass || rag) return
if(user.unEquip(R))
if(user.removeItem(R, src))
user << "<span class='notice'>You stuff [R] into [src].</span>"
rag = R
rag.forceMove(src)
flags &= ~OPENCONTAINER
update_icon()

View File

@@ -19,7 +19,7 @@
if(!usr) return
if(!reagents.total_volume)
M.visible_message("<span class='notice'>[M] finishes eating \the [src].</span>","<span class='notice'>You finish eating \the [src].</span>")
usr.drop_from_inventory(src) //so icons update :[
usr.removeItem(src) //so icons update :[
if(trash)
if(ispath(trash,/obj/item))
@@ -36,8 +36,7 @@
/obj/item/weapon/reagent_containers/food/snacks/attack(mob/M as mob, mob/user as mob, def_zone)
if(!reagents.total_volume)
user << "<span class='danger'>None of [src] left!</span>"
user.drop_from_inventory(src)
qdel(src)
user.deleteItem(src)
return 0
if(istype(M, /mob/living/carbon))
@@ -164,10 +163,8 @@
return
user << "\red You slip [W] inside [src]."
user.remove_from_mob(W)
W.dropped(user)
user.removeItem(W, src)
add_fingerprint(user)
contents += W
return
if (has_edge(W))
@@ -490,8 +487,7 @@
return
user << "You crack \the [src] into \the [O]."
reagents.trans_to(O, reagents.total_volume)
user.drop_from_inventory(src)
qdel(src)
user.deleteItem(src)
/obj/item/weapon/reagent_containers/food/snacks/egg/throw_impact(atom/hit_atom)
..()
@@ -1626,7 +1622,7 @@
H.name = H.real_name
if(ismob(loc))
var/mob/M = loc
M.unEquip(src)
M.removeItem(src)
qdel(src)
return 1

View File

@@ -226,8 +226,7 @@
user << "You add [D] to [src]."
qdel(D)
user.put_in_hands(new /obj/item/weapon/bucket_sensor)
user.drop_from_inventory(src)
qdel(src)
user.deleteItem(src)
return
else if(istype(D, /obj/item/weapon/mop))
if(reagents.total_volume < 1)

View File

@@ -31,7 +31,7 @@
return
M << "<span class='notice'>You swallow \the [src].</span>"
M.drop_from_inventory(src) //icon update
M.removeItem(src) //icon update
if(reagents.total_volume)
reagents.trans_to_mob(M, reagents.total_volume, CHEM_INGEST)
qdel(src)
@@ -53,7 +53,7 @@
if(!do_mob(user, M))
return
user.drop_from_inventory(src) //icon update
user.removeItem(src) //icon update
user.visible_message("<span class='warning'>[user] forces [M] to swallow \the [src].</span>")
var/contained = reagentlist()

View File

@@ -243,8 +243,7 @@
if (target != user && H.getarmor(target_zone, "melee") > 5 && prob(50))
for(var/mob/O in viewers(world.view, user))
O.show_message(text("\red <B>[user] tries to stab [target] in \the [hit_area] with [src.name], but the attack is deflected by armor!</B>"), 1)
user.remove_from_mob(src)
qdel(src)
user.deleteItem(src)
user.attack_log += "\[[time_stamp()]\]<font color='red'> Attacked [target.name] ([target.ckey]) with \the [src] (INTENT: HARM).</font>"
target.attack_log += "\[[time_stamp()]\]<font color='orange'> Attacked by [user.name] ([user.ckey]) with [src.name] (INTENT: HARM).</font>"