Resisting out of lockers

- Being inside a wrapped locker no longer delete you when you resist out of it. Fixes Issue 596
- Resisting out of a locker now takes longer then 5 seconds

Certain spells can no longer be cast on z2
- 'walk through wall' spells are disabled to prevent people from getting to centcomm
- 'construct turf' spells are disabled because turfs in transit space crash the server

get_contents()
- Now recursively runs through a mobs contents for items and should actually find everything.
- Now take package wrapped items into account.

check_for_contents() now simply calls get_contents() to generate a list instead of using copy/pasted code from get_contents().

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4064 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
johnsonmt88@gmail.com
2012-07-14 01:00:22 +00:00
parent 7694de3cad
commit 8432f2aabe
9 changed files with 87 additions and 48 deletions
+42 -17
View File
@@ -153,26 +153,51 @@
/mob/proc/get_contents()
/mob/living/get_contents()
/mob/verb/getthecontents()
for(var/obj/O in src.get_contents())
world << "[O]"
//Recursive function to find everything a mob is holding.
/mob/living/get_contents(var/obj/item/weapon/storage/Storage = null)
var/list/L = list()
L += src.contents
for(var/obj/item/weapon/storage/S in src.contents)
L += S.return_inv()
for(var/obj/item/weapon/gift/G in src.contents)
L += G.gift
if (istype(G.gift, /obj/item/weapon/storage))
L += G.gift:return_inv()
return L
if(Storage) //If it called itself
L += Storage.return_inv()
//Leave this commented out, it will cause storage items to exponentially add duplicate to the list
//for(var/obj/item/weapon/storage/S in Storage.return_inv()) //Check for storage items
// L += get_contents(S)
for(var/obj/item/weapon/gift/G in Storage.return_inv()) //Check for gift-wrapped items
L += G.gift
if(istype(G.gift, /obj/item/weapon/storage))
L += get_contents(G.gift)
for(var/obj/item/smallDelivery/D in Storage.return_inv()) //Check for package wrapped items
L += D.wrapped
if(istype(D.wrapped, /obj/item/weapon/storage)) //this should never happen
L += get_contents(D.wrapped)
return L
else
L += src.contents
for(var/obj/item/weapon/storage/S in src.contents) //Check for storage items
L += get_contents(S)
for(var/obj/item/weapon/gift/G in src.contents) //Check for gift-wrapped items
L += G.gift
if(istype(G.gift, /obj/item/weapon/storage))
L += get_contents(G.gift)
for(var/obj/item/smallDelivery/D in src.contents) //Check for package wrapped items
L += D.wrapped
if(istype(D.wrapped, /obj/item/weapon/storage)) //this should never happen
L += get_contents(D.wrapped)
return L
/mob/living/proc/check_contents_for(A)
var/list/L = list()
L += src.contents
for(var/obj/item/weapon/storage/S in src.contents)
L += S.return_inv()
for(var/obj/item/weapon/gift/G in src.contents)
L += G.gift
if (istype(G.gift, /obj/item/weapon/storage))
L += G.gift:return_inv()
var/list/L = src.get_contents()
for(var/obj/B in L)
if(B.type == A)
+16 -4
View File
@@ -578,7 +578,7 @@
//unbuckling yourself
if( L.buckled && (L.last_special <= world.time) )
if(L.buckled && (L.last_special <= world.time) )
if( L.handcuffed )
L.next_move = world.time + 100
L.last_special = world.time + 100
@@ -598,6 +598,8 @@
//Breaking out of a locker?
else if( src.loc && (istype(src.loc, /obj/structure/closet)) )
var/breakout_time = 2 //2 minutes by default
var/obj/structure/closet/C = L.loc
if(C.opened)
return //Door's open... wait, why are you in it's contents then?
@@ -608,16 +610,20 @@
else
if(!C.welded)
return //closed but not welded...
// else Meh, lets just keep it at 2 minutes for now
// breakout_time++ //Harder to get out of welded lockers than locked lockers
//okay, so the closet is either welded or locked... resist!!!
usr.next_move = world.time + 100
L.last_special = world.time + 100
L << "\red You lean on the back of \the [C] and start pushing the door open. (this will take about 2 minutes)"
L << "\red You lean on the back of \the [C] and start pushing the door open. (this will take about [breakout_time] minutes)"
for(var/mob/O in viewers(usr.loc))
O.show_message("\red <B>The [L.loc] begins to shake violently!</B>", 1)
spawn(0)
if(do_after(usr, 50))
if(!C || !L || L.loc != C || C.opened) //User, closet destroyed OR user no longer in closet OR closet opened
if(do_after(usr,(breakout_time*60*10))) //minutes * 60seconds * 10deciseconds
if(!C || !L || L.stat != CONSCIOUS || L.loc != C || C.opened) //closet/user destroyed OR user dead/unconcious OR user no longer in closet OR closet opened
return
//Perform the same set of checks as above for weld and lock status to determine if there is even still a point in 'resisting'...
@@ -643,12 +649,18 @@
usr << "\red You successfully break out!"
for(var/mob/O in viewers(L.loc))
O.show_message("\red <B>\the [usr] successfully broke out of \the [SC]!</B>", 1)
if(istype(SC.loc, /obj/structure/bigDelivery)) //Do this to prevent contents from being opened into nullspace (read: bluespace)
var/obj/structure/bigDelivery/BD = SC.loc
BD.attack_hand(usr)
SC.open()
else
C.welded = 0
usr << "\red You successfully break out!"
for(var/mob/O in viewers(L.loc))
O.show_message("\red <B>\the [usr] successfully broke out of \the [C]!</B>", 1)
if(istype(C.loc, /obj/structure/bigDelivery)) //nullspace ect.. read the comment above
var/obj/structure/bigDelivery/BD = C.loc
BD.attack_hand(usr)
C.open()
//breaking out of handcuffs
+2 -2
View File
@@ -496,8 +496,8 @@
var/mob/living/carbon/human/H = AM
if(FAT in H.mutations) // is a human and fat?
has_fat_guy = 1 // set flag on holder
if(istype(AM, /obj/effect/bigDelivery) && !hasmob)
var/obj/effect/bigDelivery/T = AM
if(istype(AM, /obj/structure/bigDelivery) && !hasmob)
var/obj/structure/bigDelivery/T = AM
src.destinationTag = T.sortTag
if(istype(AM, /obj/item/smallDelivery) && !hasmob)
var/obj/item/smallDelivery/T = AM
+13 -8
View File
@@ -1,4 +1,4 @@
/obj/effect/bigDelivery //Why is this an effect? 0.o --SkyMarshal
/obj/structure/bigDelivery
desc = "A big wrapped package."
name = "large parcel"
icon = 'storage.dmi'
@@ -81,7 +81,9 @@
afterattack(var/obj/target as obj, mob/user as mob)
if(!(istype(target, /obj))) //this really shouldn't be necessary (but it is). -Pete
return
if(istype(target, /obj/structure/table) || istype(target, /obj/structure/rack) || istype(target,/obj/item/smallDelivery))
if(istype(target, /obj/structure/table) || istype(target, /obj/structure/rack) \
|| istype(target, /obj/item/smallDelivery) || istype(target,/obj/structure/bigDelivery) \
|| istype(target, /obj/item/weapon/gift))
return
if(target.anchored)
return
@@ -99,11 +101,14 @@
user.client.screen -= O
P.wrapped = O
O.loc = P
P.add_fingerprint(usr)
O.add_fingerprint(usr)
src.add_fingerprint(usr)
src.amount -= 1
else if (istype(target, /obj/structure/closet/crate))
var/obj/structure/closet/crate/O = target
if (src.amount > 3 && !O.opened)
var/obj/effect/bigDelivery/P = new /obj/effect/bigDelivery(get_turf(O.loc))
var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc))
P.icon_state = "deliverycrate"
P.wrapped = O
O.loc = P
@@ -113,7 +118,7 @@
else if (istype (target, /obj/structure/closet))
var/obj/structure/closet/O = target
if (src.amount > 3 && !O.opened)
var/obj/effect/bigDelivery/P = new /obj/effect/bigDelivery(get_turf(O.loc))
var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc))
P.wrapped = O
O.welded = 1
O.loc = P
@@ -190,9 +195,9 @@
user << "/blue You can only tag properly wrapped delivery packages!"
*/
attack(target as obj, mob/user as mob)
if (istype(target, /obj/effect/bigDelivery))
if (istype(target, /obj/structure/bigDelivery))
user << "\blue *TAGGED*"
var/obj/effect/bigDelivery/O = target
var/obj/structure/bigDelivery/O = target
O.sortTag = src.currTag
else if (istype(target, /obj/item/smallDelivery))
user << "\blue *TAGGED*"
@@ -238,7 +243,7 @@
var/deliveryCheck = 0
var/obj/structure/disposalholder/H = new() // virtual holder object which actually
// travels through the pipes.
for(var/obj/effect/bigDelivery/O in src)
for(var/obj/structure/bigDelivery/O in src)
deliveryCheck = 1
if(O.sortTag == 0)
O.sortTag = 1
@@ -300,4 +305,4 @@
return
else
user << "You need more welding fuel to complete this task."
return
return