mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-27 05:57:24 +01:00
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:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user