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
+4
View File
@@ -38,6 +38,7 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
var/smoke_amt = 0 //cropped at 10
var/critfailchance = 0
var/centcomm_cancast = 1 //Whether or not the spell should be allowed on z2
/obj/effect/proc_holder/spell/proc/cast_check(skipcharge = 0,mob/user = usr) //checks if the spell can be cast based on its settings; skipcharge is used when an additional cast_check is called inside the spell
@@ -45,6 +46,9 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin
usr << "\red You shouldn't have this spell! Something's wrong."
return 0
if(usr.z == 2 && !centcomm_cancast) //Certain spells are not allowed on the centcomm zlevel
return 0
if(!skipcharge)
switch(charge_type)
if("recharge")
+1 -1
View File
@@ -9,7 +9,7 @@
invocation_type = "none"
range = -1
include_user = 1
centcomm_cancast = 0 //Prevent people from getting to centcomm
var phaseshift = 0
var/jaunt_duration = 50 //in deciseconds
+6 -2
View File
@@ -105,6 +105,8 @@
inner_tele_radius = 0
outer_tele_radius = 6
centcomm_cancast = 0 //prevent people from getting to centcomm
/obj/effect/proc_holder/spell/targeted/area_teleport/teleport
name = "Teleport"
desc = "This spell teleports you to a type of area of your selection."
@@ -250,6 +252,7 @@
invocation_type = "none"
range = 0
summon_type = list("/turf/simulated/floor/engine/cult")
centcomm_cancast = 0 //Stop crashing the server by spawning turfs on transit tiles
/obj/effect/proc_holder/spell/aoe_turf/conjure/wall
name = "Leser Construction"
@@ -262,6 +265,7 @@
invocation_type = "none"
range = 0
summon_type = list("/turf/simulated/wall/cult")
centcomm_cancast = 0 //Stop crashing the server by spawning turfs on transit tiles
/obj/effect/proc_holder/spell/aoe_turf/conjure/wall/reinforced
name = "Greater Construction"
@@ -273,6 +277,7 @@
invocation = "none"
invocation_type = "none"
range = 0
centcomm_cancast = 0 //Stop crashing the server by spawning turfs on transit tiles
summon_type = list("/turf/simulated/wall/r_wall")
@@ -304,8 +309,6 @@
summon_lifespan = 50
/obj/effect/proc_holder/spell/targeted/ethereal_jaunt/shift
name = "Phase Shift"
desc = "This spell allows you to pass through walls"
@@ -319,3 +322,4 @@
include_user = 1
phaseshift = 1
jaunt_duration = 50 //in deciseconds
centcomm_cancast = 0 //Stop people from getting to centcomm
-14
View File
@@ -360,10 +360,6 @@ datum/objective/steal
for(var/obj/item/I in all_items) //Check for plasma tanks
if(istype(I, steal_target))
found_amount += (target_name=="28 moles of plasma (full tank)" ? (I:air_contents:toxins) : (I:amount))
for(var/obj/item/smallDelivery/J in all_items) //Check to see plasma tank is wrapped
if(istype(J.wrapped, steal_target))
found_amount += (target_name=="28 moles of plasma (full tank)" ? (J.wrapped:air_contents:toxins) : (J.wrapped:amount))
return found_amount>=target_amount
if("50 coins (in bag)")
@@ -381,21 +377,11 @@ datum/objective/steal
for(var/mob/living/silicon/ai/M in C)
if(istype(M, /mob/living/silicon/ai) && M.stat != 2) //See if any AI's are alive inside that card.
return 1
for(var/obj/item/smallDelivery/D in all_items) //Check for AI card desguised as packages
for(var/mob/living/silicon/ai/N in D.wrapped)
if(istype(N, /mob/living/silicon/ai) && N.stat != 2) //No idea why I have to check the type of a mob that I JUST created but ok.
return 1
else
for(var/obj/I in all_items) //Check for items
if(istype(I, steal_target))
return 1
for(var/obj/item/smallDelivery/J in all_items) //Check for items desguised as packages
if(istype(J.wrapped, steal_target))
return 1
return 0
@@ -19,6 +19,9 @@ PHOTOGRAPHS
user << "\blue You need more paper!"
return
else
if(istype(W, /obj/item/smallDelivery) || istype(W, /obj/item/weapon/gift)) //No gift wrapping gifts!
return
src.amount -= a_used
user.drop_item()
var/obj/item/weapon/gift/G = new /obj/item/weapon/gift( src.loc )
+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