Add method to track people breaking shit that would cause explosive decompression.

This commit is contained in:
Rob Nelson
2013-08-22 01:37:10 -07:00
parent 109e0aafbb
commit 62e81a71de
6 changed files with 146 additions and 14 deletions

View File

@@ -1,6 +1,21 @@
/*
* False Walls
*/
#define FALSEDOOR_MAX_PRESSURE_DIFF 100.0
/proc/performFalseWallPressureCheck(var/turf/loc,var/mob/user)
var/datum/gas_mixture/myenv=loc.return_air()
var/pressure=myenv.return_pressure()
for(var/dir in cardinal)
var/turf/T=get_turf(get_step(loc,dir))
var/datum/gas_mixture/environment = T.return_air()
var/pdiff = abs(pressure - environment.return_pressure())
if(pdiff > FALSEDOOR_MAX_PRESSURE_DIFF)
return pdiff
return 1
/obj/structure/falsewall
name = "wall"
desc = "A huge chunk of metal used to seperate rooms."

View File

@@ -70,10 +70,16 @@
if(/obj/item/stack/sheet/metal, /obj/item/stack/sheet/metal/cyborg)
if(!anchored)
if(S.amount < 2) return
S.use(2)
user << "\blue You create a false wall! Push on it to open or close the passage."
new /obj/structure/falsewall (src.loc)
del(src)
var/pdiff=performFalseWallPressureCheck(src.loc,user)
if(!pdiff)
S.use(2)
user << "\blue You create a false wall! Push on it to open or close the passage."
new /obj/structure/falsewall (src.loc)
del(src)
else
user << "\red There is too much air moving through the gap! The door wouldn't stay closed if you built it."
message_admins("Attempted false wall made by [user.real_name] ([formatPlayerPanel(user,user.ckey)]) at [formatJumpTo(loc)] had a pressure difference of [pdiff]!")
return
else
if(S.amount < 2) return ..()
user << "\blue Now adding plating..."
@@ -91,10 +97,16 @@
if(/obj/item/stack/sheet/plasteel)
if(!anchored)
if(S.amount < 2) return
S.use(2)
user << "\blue You create a false wall! Push on it to open or close the passage."
new /obj/structure/falserwall (src.loc)
del(src)
var/pdiff=performFalseWallPressureCheck(src.loc,user)
if(!pdiff)
S.use(2)
user << "\blue You create a false wall! Push on it to open or close the passage."
new /obj/structure/falserwall (src.loc)
del(src)
else
user << "\red There is too much air moving through the gap! The door wouldn't stay closed if you built it."
message_admins("Attempted false rwall made by [user.real_name] ([formatPlayerPanel(user,user.ckey)]) at [formatJumpTo(loc)] had a pressure difference of [pdiff]!")
return
else
if (src.icon_state == "reinforced") //I cant believe someone would actually write this line of code...
if(S.amount < 1) return ..()
@@ -124,11 +136,17 @@
var/M = S.sheettype
if(!anchored)
if(S.amount < 2) return
S.use(2)
user << "\blue You create a false wall! Push on it to open or close the passage."
var/F = text2path("/obj/structure/falsewall/[M]")
new F (src.loc)
del(src)
var/pdiff=performFalseWallPressureCheck(src.loc,user)
if(!pdiff)
S.use(2)
user << "\blue You create a false wall! Push on it to open or close the passage."
var/F = text2path("/obj/structure/falsewall/[M]")
new F (src.loc)
del(src)
else
user << "\red There is too much air moving through the gap! The door wouldn't stay closed if you built it."
message_admins("Attempted false [M] wall made by [user.real_name] ([formatPlayerPanel(user,user.ckey)]) at [formatJumpTo(loc)] had a pressure difference of [pdiff]!")
return
else
if(S.amount < 2) return ..()
user << "\blue Now adding plating..."

View File

@@ -19,6 +19,9 @@
health -= Proj.damage
..()
if(health <= 0)
var/pdiff=performFalseWallPressureCheck(src.loc,Proj.firer)
if(pdiff>0)
message_admins("Window destroyed by [Proj.firer.real_name] ([formatPlayerPanel(Proj.firer,Proj.firer.ckey)]) via \an [Proj]! pdiff = [pdiff] at [formatJumpTo(loc)]!")
new /obj/item/weapon/shard(loc)
new /obj/item/stack/rods(loc)
del(src)
@@ -79,8 +82,10 @@
..()
visible_message("<span class='danger'>[src] was hit by [AM].</span>")
var/tforce = 0
var/mob/M=null
if(ismob(AM))
tforce = 40
M=AM
else if(isobj(AM))
var/obj/item/I = AM
tforce = I.throwforce
@@ -91,10 +96,22 @@
anchored = 0
update_nearby_icons()
step(src, get_dir(AM, src))
var/pdiff=performFalseWallPressureCheck(src.loc,M)
if(pdiff>0)
if(M)
message_admins("Window with pdiff [pdiff] at [formatJumpTo(loc)] deanchored by [M.real_name] ([formatPlayerPanel(M,M.ckey)])!")
else
message_admins("Window with pdiff [pdiff] at [formatJumpTo(loc)] deanchored by [AM]!")
if(health <= 0)
new /obj/item/weapon/shard(loc)
if(reinf) new /obj/item/stack/rods(loc)
del(src)
var/pdiff=performFalseWallPressureCheck(src.loc,M)
if(pdiff>0)
if(M)
message_admins("Window with pdiff [pdiff] at [formatJumpTo(loc)] destroyed by [M.real_name] ([formatPlayerPanel(M,M.ckey)])!")
else
message_admins("Window with pdiff [pdiff] at [formatJumpTo(loc)] destroyed by [AM]!")
/obj/structure/window/attack_hand(mob/user as mob)
@@ -104,6 +121,9 @@
new /obj/item/weapon/shard(loc)
if(reinf) new /obj/item/stack/rods(loc)
del(src)
var/pdiff=performFalseWallPressureCheck(src.loc,user)
if(pdiff>0)
message_admins("Window destroyed by hulk [user.real_name] ([formatPlayerPanel(user,user.ckey)]) with pdiff [pdiff] at [formatJumpTo(loc)]!")
else if (usr.a_intent == "hurt")
playsound(src.loc, 'glassknock.ogg', 80, 1)
usr.visible_message("\red [usr.name] bangs against the [src.name]!", \
@@ -128,6 +148,9 @@
new /obj/item/weapon/shard(loc)
if(reinf) new /obj/item/stack/rods(loc)
del(src)
var/pdiff=performFalseWallPressureCheck(src.loc,user)
if(pdiff>0)
message_admins("Window destroyed by [user.real_name] ([formatPlayerPanel(user,user.ckey)]) with pdiff [pdiff] at [formatJumpTo(loc)]!")
else //for nicer text~
user.visible_message("<span class='danger'>[user] smashes into [src]!</span>")
playsound(loc, 'sound/effects/Glasshit.ogg', 100, 1)
@@ -185,11 +208,19 @@
update_nearby_icons()
playsound(loc, 'sound/items/Screwdriver.ogg', 75, 1)
user << (anchored ? "<span class='notice'>You have fastened the frame to the floor.</span>" : "<span class='notice'>You have unfastened the frame from the floor.</span>")
if(!anchored)
var/pdiff=performFalseWallPressureCheck(src.loc,user)
if(pdiff>0)
message_admins("Window with pdiff [pdiff] deanchored by [user.real_name] ([formatPlayerPanel(user,user.ckey)]) at [formatJumpTo(loc)]!")
else if(!reinf)
anchored = !anchored
update_nearby_icons()
playsound(loc, 'sound/items/Screwdriver.ogg', 75, 1)
user << (anchored ? "<span class='notice'>You have fastened the window to the floor.</span>" : "<span class='notice'>You have unfastened the window.</span>")
if(!anchored)
var/pdiff=performFalseWallPressureCheck(src.loc,user)
if(pdiff>0)
message_admins("Window with pdiff [pdiff] deanchored by [user.real_name] ([formatPlayerPanel(user,user.ckey)]) at [formatJumpTo(loc)]!")
else if(istype(W, /obj/item/weapon/crowbar) && reinf && state <= 1)
state = 1 - state
playsound(loc, 'sound/items/Crowbar.ogg', 75, 1)
@@ -201,6 +232,9 @@
anchored = 0
update_nearby_icons()
step(src, get_dir(user, src))
var/pdiff=performFalseWallPressureCheck(src.loc,user)
if(pdiff>0)
message_admins("Window with pdiff [pdiff] deanchored by [user.real_name] ([formatPlayerPanel(user,user.ckey)]) at [formatJumpTo(loc)]!")
else
playsound(loc, 'sound/effects/Glasshit.ogg', 75, 1)
..()
@@ -222,6 +256,9 @@
else
new /obj/item/weapon/shard(loc)
if(reinf) new /obj/item/stack/rods(loc)
var/pdiff=performFalseWallPressureCheck(src.loc,null)
if(pdiff>0)
message_admins("Window with pdiff [pdiff] broken at [formatJumpTo(loc)]!")
del(src)
return

View File

@@ -1,3 +1,19 @@
/proc/performWallPressureCheck(var/turf/loc,var/mob/user)
var/minp=16777216;
var/maxp=0;
for(var/dir in cardinal)
var/turf/T=get_turf(get_step(loc,dir))
var/datum/gas_mixture/environment = T.return_air()
var/cp = environment.return_pressure()
if(cp<minp)minp=cp
if(cp>maxp)maxp=cp
var/pdiff = abs(minp-maxp)
if(pdiff > FALSEDOOR_MAX_PRESSURE_DIFF)
return pdiff
return 1
/turf/simulated/wall
name = "wall"
desc = "A huge chunk of metal used to seperate rooms."
@@ -164,6 +180,10 @@
else if(!is_sharp(W) && W.force >= 10 || W.force >= 20)
user << "<span class='notice'>\The [src] crumbles away under the force of your [W.name].</span>"
src.dismantle_wall(1)
var/pdiff=performWallPressureCheck(src.loc,user)
if(pdiff)
message_admins("[user.real_name] ([formatPlayerPanel(user,user.ckey)]) broke a rotting wall with a pdiff of [pdiff] at [formatJumpTo(loc)]!")
return
//THERMITE related stuff. Calls src.thermitemelt() which handles melting simulated walls and the relevant effects
@@ -203,6 +223,9 @@
if( user.loc == T && user.get_active_hand() == WT )
user << "<span class='notice'>You remove the outer plating.</span>"
var/pdiff=performWallPressureCheck(src.loc,user)
if(pdiff)
message_admins("[user.real_name] ([formatPlayerPanel(user,user.ckey)]) dismanted a wall with a pdiff of [pdiff] at [formatJumpTo(loc)]!")
dismantle_wall()
else
user << "<span class='notice'>You need more welding fuel to complete this task.</span>"
@@ -221,6 +244,9 @@
if( user.loc == T && user.get_active_hand() == W )
user << "<span class='notice'>You remove the outer plating.</span>"
dismantle_wall()
var/pdiff=performWallPressureCheck(src.loc,user)
if(pdiff)
message_admins("[user.real_name] ([formatPlayerPanel(user,user.ckey)]) dismantled with a pdiff of [pdiff] at [formatJumpTo(loc)]!")
for(var/mob/O in viewers(user, 5))
O.show_message("<span class='warning'>The wall was sliced apart by [user]!</span>", 1, "<span class='warning'>You hear metal being sliced apart.</span>", 2)
return
@@ -238,6 +264,9 @@
if( user.loc == T && user.get_active_hand() == W )
user << "<span class='notice'>Your drill tears though the last of the reinforced plating.</span>"
dismantle_wall()
var/pdiff=performWallPressureCheck(src.loc,user)
if(pdiff)
message_admins("[user.real_name] ([formatPlayerPanel(user,user.ckey)]) drilled a wall with a pdiff of [pdiff] at [formatJumpTo(loc)]!")
for(var/mob/O in viewers(user, 5))
O.show_message("<span class='warning'>The wall was drilled through by [user]!</span>", 1, "<span class='warning'>You hear the grinding of metal.</span>", 2)
return
@@ -259,6 +288,9 @@
playsound(src.loc, "sparks", 50, 1)
playsound(src.loc, 'sound/weapons/blade1.ogg', 50, 1)
dismantle_wall(1)
var/pdiff=performWallPressureCheck(src.loc,user)
if(pdiff)
message_admins("[user.real_name] ([formatPlayerPanel(user,user.ckey)]) sliced up a wall with a pdiff of [pdiff] at [formatJumpTo(loc)]!")
for(var/mob/O in viewers(user, 5))
O.show_message("<span class='warning'>The wall was sliced apart by [user]!</span>", 1, "<span class='warning'>You hear metal being sliced apart and sparks flying.</span>", 2)
return
@@ -340,12 +372,17 @@
var/turf/simulated/floor/F = ChangeTurf(/turf/simulated/floor/plating)
if(!F)
if(O)
message_admins("[user.real_name] ([formatPlayerPanel(user,user.ckey)]) thermited a wall into space at [formatJumpTo(loc)]!")
del(O)
user << "<span class='warning'>The thermite melts through the wall.</span>"
F.burn_tile()
F.icon_state = "wall_thermite"
user << "<span class='warning'>The thermite melts through the wall.</span>"
var/pdiff=performWallPressureCheck(src.loc,user)
if(pdiff)
message_admins("[user.real_name] ([formatPlayerPanel(user,user.ckey)]) thermited a wall with a pdiff of [pdiff] at [formatJumpTo(loc)]!")
spawn(100)
if(O) del(O)
// F.sd_LumReset() //TODO: ~Carn

View File

@@ -90,6 +90,9 @@
..()
/turf/simulated/wall/mineral/plasma/proc/PlasmaBurn(temperature)
var/pdiff=performWallPressureCheck(src.loc,null)
if(pdiff>0)
message_admins("Plasma wall with pdiff [pdiff] at [formatJumpTo(loc)] just caught fire!")
spawn(2)
new /obj/structure/girder(src)
src.ChangeTurf(/turf/simulated/floor)

View File

@@ -1096,3 +1096,25 @@ proc/move_alien_ship()
else
alien_ship_location = 1
return
proc/formatJumpTo(var/location,var/where="")
var/turf/loc
if(istype(location,/turf/))
loc = location
else
loc = get_turf(location)
if(where=="")
where=formatLocation(loc)
return "<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[loc.x];Y=[loc.y];Z=[loc.z]'>[where]</a>"
proc/formatLocation(var/location)
var/turf/loc
if(istype(location,/turf/))
loc = location
else
loc = get_turf(location)
var/area/A = get_area(location)
return "[A.name] - [loc.x],[loc.y],[loc.z]"
proc/formatPlayerPanel(var/mob/U,var/text="PP")
return "<A HREF='?_src_=holder;adminplayeropts=\ref[U]'>[text]</A>"