Make lockers use forceMove()

This commit is contained in:
Markolie
2015-09-01 18:49:19 +02:00
parent b683cfa0c5
commit 8d7bd64a00
11 changed files with 31 additions and 299 deletions
@@ -21,7 +21,7 @@
if(!opened) // if closed, any item at the crate's loc is put in the contents
for(var/obj/item/I in src.loc)
if(I.density || I.anchored || I == src) continue
I.loc = src
I.forceMove(src)
// Fix for #383 - C4 deleting fridges with corpses
/obj/structure/closet/Destroy()
@@ -49,13 +49,13 @@
/obj/structure/closet/proc/dump_contents()
//Cham Projector Exception
for(var/obj/effect/dummy/chameleon/AD in src)
AD.loc = src.loc
AD.forceMove(loc)
for(var/obj/I in src)
I.loc = src.loc
I.forceMove(loc)
for(var/mob/M in src)
M.loc = src.loc
M.forceMove(loc)
if(M.client)
M.client.eye = M.client.mob
M.client.perspective = MOB_PERSPECTIVE
@@ -90,14 +90,14 @@
for(var/obj/effect/dummy/chameleon/AD in src.loc)
if(itemcount >= storage_capacity)
break
AD.loc = src
AD.forceMove(src)
itemcount++
for(var/obj/item/I in src.loc)
if(itemcount >= storage_capacity)
break
if(!I.anchored)
I.loc = src
I.forceMove(src)
itemcount++
for(var/mob/M in src.loc)
@@ -112,7 +112,7 @@
M.client.perspective = EYE_PERSPECTIVE
M.client.eye = src
M.loc = src
M.forceMove(src)
itemcount++
src.icon_state = src.icon_closed
@@ -134,19 +134,19 @@
switch(severity)
if(1)
for(var/atom/movable/A as mob|obj in src)//pulls everything out of the locker and hits it with an explosion
A.loc = src.loc
A.forceMove(src.loc)
A.ex_act(severity++)
qdel(src)
if(2)
if(prob(50))
for (var/atom/movable/A as mob|obj in src)
A.loc = src.loc
A.forceMove(loc)
A.ex_act(severity++)
qdel(src)
if(3)
if(prob(5))
for(var/atom/movable/A as mob|obj in src)
A.loc = src.loc
A.forceMove(loc)
A.ex_act(severity++)
qdel(src)
@@ -156,7 +156,7 @@
health -= Proj.damage
if(health <= 0)
for(var/atom/movable/A as mob|obj in src)
A.loc = src.loc
A.forceMove(loc)
qdel(src)
return
@@ -165,14 +165,14 @@
user.do_attack_animation(src)
visible_message("\red [user] destroys the [src]. ")
for(var/atom/movable/A as mob|obj in src)
A.loc = src.loc
A.forceMove(loc)
qdel(src)
// this should probably use dump_contents()
/obj/structure/closet/blob_act()
if(prob(75))
for(var/atom/movable/A as mob|obj in src)
A.loc = src.loc
A.forceMove(loc)
qdel(src)
/obj/structure/closet/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
@@ -261,7 +261,7 @@
if(!usr.drop_item())
return
if(W)
W.loc = src.loc
W.forceMove(loc)
else if(istype(W, /obj/item/stack/packageWrap))
return
else if(istype(W, /obj/item/weapon/weldingtool))
@@ -144,7 +144,7 @@
attack_tk(mob/user as mob)
if(localopened && fireaxe)
fireaxe.loc = loc
fireaxe.forceMove(loc)
user << "\blue You telekinetically remove the fire axe."
fireaxe = null
update_icon()
@@ -63,7 +63,7 @@
if (istype(W, /obj/item/weapon/grab))
src.MouseDrop_T(W:affecting, user) //act like they were dragged onto the closet
user.drop_item()
if (W) W.loc = src.loc
if (W) W.forceMove(loc)
else if(istype(W, /obj/item/weapon/card/id))
if(src.broken)
user << "\red It appears to be broken."
@@ -76,7 +76,7 @@
return
user.drop_item()
if(W)
W.loc = src.loc
W.forceMove(loc)
else if((istype(W, /obj/item/weapon/card/emag)||istype(W, /obj/item/weapon/melee/energy/blade)) && !broken)
emag_act(user)
else if(istype(W,/obj/item/stack/packageWrap) || istype(W,/obj/item/weapon/weldingtool))
@@ -45,7 +45,7 @@
playsound(src.loc, 'sound/machines/click.ogg', 15, 1, -3)
for(var/obj/O in src)
O.loc = get_turf(src)
O.forceMove(loc)
icon_state = icon_opened
src.opened = 1
@@ -71,7 +71,7 @@
var/obj/structure/stool/bed/B = O
if(B.buckled_mob)
continue
O.loc = src
O.forceMove(src)
itemcount++
icon_state = icon_closed
@@ -151,7 +151,7 @@
user << "<span class='notice'>\The [W] is stuck to your hand, you cannot put it in \the [src]!</span>"
return
if(W)
W.loc = src.loc
W.forceMove(loc)
else if(istype(W, /obj/item/stack/packageWrap))
return
else if(istype(W, /obj/item/stack/cable_coil))
@@ -167,7 +167,7 @@
if(rigged)
user << "<span class='notice'>You attach [W] to [src].</span>"
user.drop_item()
W.loc = src
W.forceMove(src)
return
else if(istype(W, /obj/item/weapon/wirecutters))
if(rigged)
@@ -201,7 +201,7 @@
if(manifest)
user << "<span class='notice'>You tear the manifest off of the crate.</span>"
playsound(src.loc, 'sound/items/poster_ripped.ogg', 75, 1)
manifest.loc = loc
manifest.forceMove(loc)
if(ishuman(user))
user.put_in_hands(manifest)
manifest = null
@@ -282,7 +282,7 @@
if(manifest)
user << "<span class='notice'>You tear the manifest off of the crate.</span>"
playsound(src.loc, 'sound/items/poster_ripped.ogg', 75, 1)
manifest.loc = loc
manifest.forceMove(loc)
if(ishuman(user))
user.put_in_hands(manifest)
manifest = null
@@ -503,12 +503,12 @@
continue
if(!S.anchored)
found = 1
S.loc = src
S.forceMove(src)
break
if(!found)
for(var/obj/machinery/M in src.loc)
if(!M.anchored)
M.loc = src
M.forceMove(src)
break
return
@@ -531,12 +531,12 @@
continue
if(!S.anchored)
found = 1
S.loc = src
S.forceMove(src)
break
if(!found)
for(var/obj/machinery/M in src.loc)
if(!M.anchored)
M.loc = src
M.forceMove(src)
break
return
@@ -20,7 +20,7 @@
if(manifest)
user << "<span class='notice'>You tear the manifest off of the crate.</span>"
playsound(src.loc, 'sound/items/poster_ripped.ogg', 75, 1)
manifest.loc = loc
manifest.forceMove(loc)
if(ishuman(user))
user.put_in_hands(manifest)
manifest = null
@@ -33,13 +33,13 @@
/obj/structure/largecrate/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/weapon/crowbar))
if(manifest)
manifest.loc = loc
manifest.forceMove(loc)
manifest = null
update_icon()
new /obj/item/stack/sheet/wood(src)
var/turf/T = get_turf(src)
for(var/obj/O in contents)
O.loc = T
O.forceMove(T)
user.visible_message("<span class='notice'>[user] pries \the [src] open.</span>", \
"<span class='notice'>You pry open \the [src].</span>", \
"<span class='notice'>You hear splitting wood.</span>")
@@ -0,0 +1,50 @@
//added by cael from old bs12
//not sure if there's an immediate place for secure wall lockers, but i'm sure the players will think of something
/obj/structure/closet/walllocker
desc = "A wall mounted storage locker."
name = "Wall Locker"
icon = 'icons/obj/walllocker.dmi'
icon_state = "wall-locker"
density = 0
anchored = 1
icon_closed = "wall-locker"
icon_opened = "wall-lockeropen"
//spawns endless (3 sets) amounts of breathmask, emergency oxy tank and crowbar
/obj/structure/closet/walllocker/emerglocker
name = "emergency locker"
desc = "A wall mounted locker with emergency supplies"
var/list/spawnitems = list(/obj/item/weapon/tank/emergency_oxygen,/obj/item/clothing/mask/breath,/obj/item/weapon/crowbar)
var/amount = 3 // spawns each items X times.
icon_state = "emerg"
/obj/structure/closet/walllocker/emerglocker/attack_hand(mob/user as mob)
if (istype(user, /mob/living/silicon/ai)) //Added by Strumpetplaya - AI shouldn't be able to
return //activate emergency lockers. This fixes that. (Does this make sense, the AI can't call attack_hand, can it? --Mloc)
if(!amount)
usr << "<spawn class='notice'>It's empty.."
return
if(amount)
usr << "<spawn class='notice'>You take out some items from \the [src]."
for(var/path in spawnitems)
new path(src.loc)
amount--
return
/obj/structure/closet/walllocker/emerglocker/north
pixel_y = 32
dir = SOUTH
/obj/structure/closet/walllocker/emerglocker/south
pixel_y = -32
dir = NORTH
/obj/structure/closet/walllocker/emerglocker/west
pixel_x = -32
dir = WEST
/obj/structure/closet/walllocker/emerglocker/east
pixel_x = 32
dir = EAST