Merge pull request #10811 from mwerezak/qdel

Fixes
This commit is contained in:
Zuhayr
2015-08-23 07:41:10 +09:30
6 changed files with 29 additions and 34 deletions
+11 -11
View File
@@ -20,10 +20,10 @@
/obj/machinery/cablelayer/attack_hand(mob/user as mob)
if(!cable&&!on)
user << "\The [src] don't work with no cable."
user << "<span class='warning'>\The [src] doesn't have any cable loaded.</span>"
return
on=!on
user.visible_message("\The [src] [!on?"dea":"a"]ctivated.", "[user] [!on?"dea":"a"]ctivated \the [src].")
user.visible_message("\The [user] [!on?"dea":"a"]ctivates \the [src].", "You switch [src] [on? "on" : "off"]")
return
/obj/machinery/cablelayer/attackby(var/obj/item/O as obj, var/mob/user as mob)
@@ -31,26 +31,27 @@
var/result = load_cable(O)
if(!result)
user << "Reel is full."
user << "<span class='warning'>\The [src]'s cable reel is full.</span>"
else
user << "[result] meters of cable successfully loaded."
user << "You load [result] lengths of cable into [src]."
return
if(istype(O, /obj/item/weapon/screwdriver))
if(istype(O, /obj/item/weapon/wirecutters))
if(cable && cable.amount)
var/m = round(input(usr,"Please specify the length of cable to cut","Cut cable",min(cable.amount,30)) as num, 1)
m = min(m, cable.amount)
m = min(m, 30)
if(m)
playsound(loc, 'sound/items/Wirecutter.ogg', 50, 1)
use_cable(m)
var/obj/item/stack/cable_coil/CC = new (get_turf(src))
CC.amount = m
else
usr << "There's no more cable on the reel."
usr << "<span class='warning'>There's no more cable on the reel.</span>"
/obj/machinery/cablelayer/examine(mob/user)
..()
user << "\The [src] has [cable.amount] meter\s."
user << "\The [src]'s cable reel has [cable.amount] length\s left."
/obj/machinery/cablelayer/proc/load_cable(var/obj/item/stack/cable_coil/CC)
if(istype(CC) && CC.amount)
@@ -70,12 +71,11 @@
/obj/machinery/cablelayer/proc/use_cable(amount)
if(!cable || cable.amount<1)
visible_message("Cable depleted, [src] deactivated.")
visible_message("A red light flashes on \the [src].")
return
/* if(cable.amount < amount)
visible_message("No enough cable to finish the task.")
return*/
cable.use(amount)
if(deleted(cable))
cable = null
return 1
/obj/machinery/cablelayer/proc/reset()
+1
View File
@@ -258,6 +258,7 @@
health = between(health, health + repairing.amount*DOOR_REPAIR_AMOUNT, maxhealth)
update_icon()
qdel(repairing)
repairing = null
return
if(repairing && istype(I, /obj/item/weapon/crowbar))
+3 -5
View File
@@ -184,11 +184,9 @@
if(!uses_charge)
amount -= used
if (amount <= 0)
spawn(0) //delete the empty stack once the current context yields
if (amount <= 0) //check again in case someone transferred stuff to us
if(usr)
usr.remove_from_mob(src)
qdel(src)
if(usr)
usr.remove_from_mob(src)
qdel(src) //should be safe to qdel immediately since if someone is still using this stack it will persist for a little while longer
return 1
else
if(get_amount() < used)
@@ -222,6 +222,7 @@
if(istype(W, /obj/item/weapon/grab))
var/obj/item/weapon/grab/G = W
src.MouseDrop_T(G.affecting, user) //act like they were dragged onto the closet
return 0
if(istype(W,/obj/item/tk_grab))
return 0
if(istype(W, /obj/item/weapon/weldingtool))
@@ -269,11 +270,9 @@
return
if(user.restrained() || user.stat || user.weakened || user.stunned || user.paralysis)
return
if((!( istype(O, /atom/movable) ) || O.anchored || get_dist(user, src) > 1 || get_dist(user, O) > 1 || user.contents.Find(src)))
if((!( istype(O, /atom/movable) ) || O.anchored || !Adjacent(user) || !Adjacent(O) || !user.Adjacent(O) || user.contents.Find(src)))
return
if(user.loc==null) // just in case someone manages to get a closet into the blue light dimension, as unlikely as that seems
return
if(!istype(user.loc, /turf)) // are you in a container/closet/pod/etc?
if(!isturf(user.loc)) // are you in a container/closet/pod/etc?
return
if(!src.opened)
return
@@ -87,6 +87,9 @@
/obj/item/weapon/gripper/no_use //Used when you want to hold and put items in other things, but not able to 'use' the item
/obj/item/weapon/gripper/no_use/attack_self(mob/user as mob)
return
/obj/item/weapon/gripper/no_use/loader //This is used to disallow building with metal.
name = "sheet loader"
desc = "A specialized loading device, designed to pick up and insert sheets of materials inside machines."
@@ -101,9 +104,6 @@
return wrapped.attack_self(user)
return ..()
/obj/item/weapon/gripper/no_use/attack_self(mob/user as mob)
return
/obj/item/weapon/gripper/verb/drop_item()
set name = "Drop Item"
@@ -130,6 +130,8 @@
force_holder = wrapped.force
wrapped.force = 0.0
wrapped.attack(M,user)
if(deleted(wrapped))
wrapped = null
return 1
return 0
+6 -11
View File
@@ -733,17 +733,13 @@
if (usr.stat != 0)
return
if (holdingitems && holdingitems.len == 0)
if (!holdingitems || holdingitems.len == 0)
return
for(var/obj/item/O in holdingitems)
O.loc = src.loc
holdingitems -= O
holdingitems = list()
/obj/machinery/reagentgrinder/proc/remove_object(var/obj/item/O)
holdingitems -= O
qdel(O)
holdingitems.Cut()
/obj/machinery/reagentgrinder/proc/grind()
@@ -766,10 +762,6 @@
// Process.
for (var/obj/item/O in holdingitems)
if(!O || !istype(O))
holdingitems -= null
continue
var/remaining_volume = beaker.reagents.maximum_volume - beaker.reagents.total_volume
if(remaining_volume <= 0)
break
@@ -780,13 +772,16 @@
var/amount_to_take = max(0,min(stack.amount,round(remaining_volume/REAGENTS_PER_SHEET)))
if(amount_to_take)
stack.use(amount_to_take)
if(deleted(stack))
holdingitems -= stack
beaker.reagents.add_reagent(sheet_reagents[stack.type], (amount_to_take*REAGENTS_PER_SHEET))
continue
if(O.reagents)
O.reagents.trans_to(beaker, min(O.reagents.total_volume, remaining_volume))
if(O.reagents.total_volume == 0)
remove_object(O)
holdingitems -= O
qdel(O)
if (beaker.reagents.total_volume >= beaker.reagents.maximum_volume)
break