Atmos changes

This commit is contained in:
ZomgPonies
2013-10-15 16:27:30 -04:00
parent ad09347a0e
commit cc496f88ce
8 changed files with 213 additions and 21 deletions
+70 -1
View File
@@ -1,6 +1,73 @@
/*
* False Walls
*/
// Minimum pressure difference to fail building falsewalls.
// Also affects admin alerts.
#define FALSEDOOR_MAX_PRESSURE_DIFF 25.0
/**
* Gets the highest and lowest pressures from the tiles in cardinal directions
* around us, then checks the difference.
*/
/proc/getOPressureDifferential(var/turf/loc)
var/minp=16777216;
var/maxp=0;
for(var/dir in cardinal)
var/turf/T=get_turf(get_step(loc,dir))
var/cp=0
if(T && istype(T,/turf/simulated) && T.zone)
var/datum/gas_mixture/environment = T.return_air()
cp = environment.return_pressure()
else
if(istype(T,/turf/simulated))
continue
if(cp<minp)minp=cp
if(cp>maxp)maxp=cp
return abs(minp-maxp)
// Checks pressure here vs. around us.
/proc/performFalseWallPressureCheck(var/turf/loc)
var/turf/simulated/lT=loc
if(!istype(lT) || !lT.zone)
return 0
var/datum/gas_mixture/myenv=lT.return_air()
var/pressure=myenv.return_pressure()
for(var/dir in cardinal)
var/turf/simulated/T=get_turf(get_step(loc,dir))
if(T && istype(T) && T.zone)
var/datum/gas_mixture/environment = T.return_air()
var/pdiff = abs(pressure - environment.return_pressure())
if(pdiff > FALSEDOOR_MAX_PRESSURE_DIFF)
return pdiff
return 0
/proc/performWallPressureCheck(var/turf/loc)
var/pdiff = getOPressureDifferential(loc)
if(pdiff > FALSEDOOR_MAX_PRESSURE_DIFF)
return pdiff
return 0
/client/proc/pdiff()
set name = "Get PDiff"
set category = "Debug"
if(!mob || !holder)
return
var/turf/T = mob.loc
if (!( istype(T, /turf) ))
return
var/pdiff = getOPressureDifferential(T)
var/fwpcheck=performFalseWallPressureCheck(T)
var/wpcheck=performWallPressureCheck(T)
src << "Pressure Differential (cardinals): [pdiff]"
src << "FWPCheck: [fwpcheck]"
src << "WPCheck: [wpcheck]"
/obj/structure/falsewall
name = "wall"
desc = "A huge chunk of metal used to seperate rooms."
@@ -52,6 +119,7 @@
icon_state = "[mineral][junction]"
return
/obj/structure/falsewall/attack_hand(mob/user as mob)
if(opening)
return
@@ -175,6 +243,7 @@
..()
/obj/structure/falserwall/attack_hand(mob/user as mob)
if(opening)
return
@@ -231,7 +300,7 @@
if(istype(W, /obj/item/weapon/screwdriver))
var/turf/T = get_turf(src)
user.visible_message("[user] tightens some bolts on the r wall.", "You tighten the bolts on the wall.")
T.ChangeTurf(/turf/simulated/wall) //Intentionally makes a regular wall instead of an r-wall (no cheap r-walls for you).
T.ChangeTurf(/turf/simulated/wall/r_wall) //Why not make rwall?
del(src)
if( istype(W, /obj/item/weapon/weldingtool) )
+34 -13
View File
@@ -70,10 +70,17 @@
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=performWallPressureCheck(src.loc)
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]!")
log_admin("Attempted false wall made by [user.real_name] (user.ckey) at [loc] had a pressure difference of [pdiff]!")
return
else
if(S.amount < 2) return ..()
user << "\blue Now adding plating..."
@@ -91,10 +98,17 @@
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=performWallPressureCheck(src.loc)
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]!")
log_admin("Attempted false rwall made by [user.real_name] ([user.ckey]) at [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 +138,18 @@
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=performWallPressureCheck(src.loc)
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]!")
log_admin("Attempted false [M] wall made by [user.real_name] ([user.ckey]) at [loc] had a pressure difference of [pdiff]!")
return
else
if(S.amount < 2) return ..()
user << "\blue Now adding plating..."
+47 -4
View File
@@ -19,6 +19,10 @@
health -= Proj.damage
..()
if(health <= 0)
var/pdiff=performWallPressureCheck(src.loc)
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)]!")
log_admin("Window destroyed by ([Proj.firer.ckey]) via \an [Proj]! pdiff = [pdiff] at [loc]!")
new /obj/item/weapon/shard(loc)
new /obj/item/stack/rods(loc)
del(src)
@@ -79,8 +83,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,14 +97,27 @@
anchored = 0
update_nearby_icons()
step(src, get_dir(AM, src))
var/pdiff=performWallPressureCheck(src.loc)
if(pdiff>0)
if(M)
message_admins("Window with pdiff [pdiff] at [formatJumpTo(loc)] deanchored by [M.real_name] ([formatPlayerPanel(M,M.ckey)])!")
log_admin("Window with pdiff [pdiff] at [loc] deanchored by [M.real_name] ([M.ckey])!")
else
message_admins("Window with pdiff [pdiff] at [formatJumpTo(loc)] deanchored by [AM]!")
log_admin("Window with pdiff [pdiff] at [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=performWallPressureCheck(src.loc)
if(pdiff>0)
if(M)
message_admins("Window with pdiff [pdiff] at [formatJumpTo(loc)] destroyed by [M.real_name] ([formatPlayerPanel(M,M.ckey)])!")
log_admin("Window with pdiff [pdiff] at [loc] destroyed by [M.real_name] ([M.ckey])!")
else
message_admins("Window with pdiff [pdiff] at [formatJumpTo(loc)] destroyed by [AM]!")
log_admin("Window with pdiff [pdiff] at [loc] destroyed by [AM]!")
/obj/structure/window/attack_tk(mob/user as mob)
user.visible_message("<span class='notice'>Something knocks on [src].</span>")
playsound(loc, 'sound/effects/Glasshit.ogg', 50, 1)
/obj/structure/window/attack_hand(mob/user as mob)
if(HULK in user.mutations)
@@ -107,6 +126,10 @@
new /obj/item/weapon/shard(loc)
if(reinf) new /obj/item/stack/rods(loc)
del(src)
var/pdiff=performWallPressureCheck(src.loc)
if(pdiff>0)
message_admins("Window destroyed by hulk [user.real_name] ([formatPlayerPanel(user,user.ckey)]) with pdiff [pdiff] at [formatJumpTo(loc)]!")
log_admin("Window destroyed by hulk [user.real_name] ([user.ckey]) with pdiff [pdiff] at [loc]!")
else if (usr.a_intent == "hurt")
playsound(src.loc, 'sound/effects/glassknock.ogg', 80, 1)
usr.visible_message("\red [usr.name] bangs against the [src.name]!", \
@@ -131,6 +154,9 @@
new /obj/item/weapon/shard(loc)
if(reinf) new /obj/item/stack/rods(loc)
del(src)
var/pdiff=performWallPressureCheck(src.loc)
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)
@@ -188,11 +214,21 @@
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=performWallPressureCheck(src.loc)
if(pdiff>0)
message_admins("Window with pdiff [pdiff] deanchored by [user.real_name] ([formatPlayerPanel(user,user.ckey)]) at [formatJumpTo(loc)]!")
log_admin("Window with pdiff [pdiff] deanchored by [user.real_name] ([user.ckey]) at [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=performWallPressureCheck(src.loc)
if(pdiff>0)
message_admins("Window with pdiff [pdiff] deanchored by [user.real_name] ([formatPlayerPanel(user,user.ckey)]) at [formatJumpTo(loc)]!")
log_admin("Window with pdiff [pdiff] deanchored by [user.real_name] ([user.ckey]) at [loc]!")
else if(istype(W, /obj/item/weapon/crowbar) && reinf && state <= 1)
state = 1 - state
playsound(loc, 'sound/items/Crowbar.ogg', 75, 1)
@@ -204,6 +240,10 @@
anchored = 0
update_nearby_icons()
step(src, get_dir(user, src))
var/pdiff=performWallPressureCheck(src.loc)
if(pdiff>0)
message_admins("Window with pdiff [pdiff] deanchored by [user.real_name] ([formatPlayerPanel(user,user.ckey)]) at [formatJumpTo(loc)]!")
log_admin("Window with pdiff [pdiff] deanchored by [user.real_name] ([user.ckey]) at [loc]!")
else
playsound(loc, 'sound/effects/Glasshit.ogg', 75, 1)
..()
@@ -225,6 +265,9 @@
else
new /obj/item/weapon/shard(loc)
if(reinf) new /obj/item/stack/rods(loc)
var/pdiff=performWallPressureCheck(src.loc)
if(pdiff>0)
message_admins("Window with pdiff [pdiff] broken at [formatJumpTo(loc)]!")
del(src)
return
@@ -307,7 +350,7 @@
update_nearby_tiles()
playsound(src, "shatter", 70, 1)
update_nearby_icons()
loc = null //garbage collect
..()
/obj/structure/window/Move()