Updated ZAS and Atmo

This commit is contained in:
ZomgPonies
2013-10-12 14:41:43 -04:00
parent 771de60525
commit 37e732d8db
22 changed files with 1529 additions and 571 deletions
+184
View File
@@ -0,0 +1,184 @@
// A freezer and a space heater had a baby.
/obj/machinery/space_heater/air_conditioner
anchored = 0
density = 1
icon = 'icons/obj/atmos.dmi'
icon_state = "aircond0"
name = "air conditioner"
desc = "If you can't take the heat, use one of these."
set_temperature = 20 // in celcius, add T0C for kelvin
var/cooling_power = 40000
flags = FPRINT
/obj/machinery/space_heater/air_conditioner/New()
..()
cell = new(src)
cell.charge = 1000
cell.maxcharge = 1000
update_icon()
return
/obj/machinery/space_heater/air_conditioner/update_icon()
overlays.Cut()
icon_state = "aircond[on]"
if(open)
overlays += "sheater-open"
return
/obj/machinery/space_heater/air_conditioner/examine()
set src in oview(12)
if (!( usr ))
return
usr << "This is \icon[src] \an [src.name]."
usr << src.desc
usr << "The air conditioner is [on ? "on" : "off"] and the hatch is [open ? "open" : "closed"]."
if(open)
usr << "The power cell is [cell ? "installed" : "missing"]."
else
usr << "The charge meter reads [cell ? round(cell.percent(),1) : 0]%"
return
/obj/machinery/space_heater/air_conditioner/emp_act(severity)
if(stat & (BROKEN|NOPOWER))
..(severity)
return
if(cell)
cell.emp_act(severity)
..(severity)
/obj/machinery/space_heater/air_conditioner/attackby(obj/item/I, mob/user)
if(istype(I, /obj/item/weapon/cell))
if(open)
if(cell)
user << "There is already a power cell inside."
return
else
// insert cell
var/obj/item/weapon/cell/C = usr.get_active_hand()
if(istype(C))
user.drop_item()
cell = C
C.loc = src
C.add_fingerprint(usr)
user.visible_message("\blue [user] inserts a power cell into [src].", "\blue You insert the power cell into [src].")
else
user << "The hatch must be open to insert a power cell."
return
else if(istype(I, /obj/item/weapon/screwdriver))
open = !open
user.visible_message("\blue [user] [open ? "opens" : "closes"] the hatch on the [src].", "\blue You [open ? "open" : "close"] the hatch on the [src].")
update_icon()
if(!open && user.machine == src)
user << browse(null, "window=aircond")
user.unset_machine()
else
..()
return
/obj/machinery/space_heater/air_conditioner/attack_hand(mob/user as mob)
src.add_fingerprint(user)
interact(user)
/obj/machinery/space_heater/air_conditioner/interact(mob/user as mob)
if(open)
var/temp = set_temperature
var/dat
dat = "Power cell: "
if(cell)
dat += "<A href='byond://?src=\ref[src];op=cellremove'>Installed</A><BR>"
else
dat += "<A href='byond://?src=\ref[src];op=cellinstall'>Removed</A><BR>"
// AUTOFIXED BY fix_string_idiocy.py
// C:\Users\Rob\Documents\Projects\vgstation13\code\ATMOSPHERICS\chiller.dm:95: dat += "Power Level: [cell ? round(cell.percent(),1) : 0]%<BR><BR>"
dat += {"Power Level: [cell ? round(cell.percent(),1) : 0]%<BR><BR>
Set Temperature:
<A href='?src=\ref[src];op=temp;val=-5'>-</A>
<A href='?src=\ref[src];op=temp;val=-1'>-</A>
[temp]&deg;C
<A href='?src=\ref[src];op=temp;val=1'>+</A>
<A href='?src=\ref[src];op=temp;val=5'>+</A><BR>"}
// END AUTOFIX
user.set_machine(src)
user << browse("<HEAD><TITLE>Air Conditioner Control Panel</TITLE></HEAD><TT>[dat]</TT>", "window=aircond")
onclose(user, "aircond")
else
on = !on
user.visible_message("\blue [user] switches [on ? "on" : "off"] the [src].","\blue You switch [on ? "on" : "off"] the [src].")
update_icon()
return
/obj/machinery/space_heater/air_conditioner/Topic(href, href_list)
if (usr.stat)
return
if ((in_range(src, usr) && istype(src.loc, /turf)) || (istype(usr, /mob/living/silicon)))
usr.set_machine(src)
switch(href_list["op"])
if("temp")
var/value = text2num(href_list["val"])
// limit to 15c and 20c(room temp)
set_temperature = dd_range(15, 25, set_temperature + value)
if("cellremove")
if(open && cell && !usr.get_active_hand())
cell.updateicon()
usr.put_in_hands(cell)
cell.add_fingerprint(usr)
cell = null
usr.visible_message("\blue [usr] removes the power cell from \the [src].", "\blue You remove the power cell from \the [src].")
if("cellinstall")
if(open && !cell)
var/obj/item/weapon/cell/C = usr.get_active_hand()
if(istype(C))
usr.drop_item()
cell = C
C.loc = src
C.add_fingerprint(usr)
usr.visible_message("\blue [usr] inserts a power cell into \the [src].", "\blue You insert the power cell into \the [src].")
src.updateDialog()
else
usr << browse(null, "window=aircond")
usr.unset_machine()
return
/obj/machinery/space_heater/air_conditioner/proc/chill()
var/turf/simulated/L = loc
if(istype(L))
var/datum/gas_mixture/env = L.return_air()
var/transfer_moles = 0.25 * env.total_moles()
var/datum/gas_mixture/removed = env.remove(transfer_moles)
if(removed)
if(removed.temperature > (set_temperature + T0C))
var/air_heat_capacity = removed.heat_capacity()
var/combined_heat_capacity = cooling_power + air_heat_capacity
//var/old_temperature = removed.temperature
if(combined_heat_capacity > 0)
var/combined_energy = set_temperature*cooling_power + air_heat_capacity*removed.temperature
removed.temperature = combined_energy/combined_heat_capacity
env.merge(removed)
return 1
env.merge(removed)
return 0
/obj/machinery/space_heater/air_conditioner/process()
if(on)
if(cell && cell.charge > 0)
if(chill())
cell.use(cooling_power/20000)
else
on = 0
update_icon()
return
+2
View File
@@ -268,6 +268,7 @@ obj/machinery/atmospherics/tvalve
icon = 'icons/obj/atmospherics/digital_valve.dmi'
attack_ai(mob/user as mob)
src.add_hiddenprint(user)
return src.attack_hand(user)
attack_hand(mob/user as mob)
@@ -387,6 +388,7 @@ obj/machinery/atmospherics/tvalve/mirrored
icon = 'icons/obj/atmospherics/digital_valve.dmi'
attack_ai(mob/user as mob)
src.add_hiddenprint(user)
return src.attack_hand(user)
attack_hand(mob/user as mob)
@@ -1,6 +1,6 @@
/obj/machinery/atmospherics/unary/cold_sink
icon = 'icons/obj/atmospherics/cold_sink.dmi'
icon_state = "intact_off"
icon_state = "on_cool"
density = 1
use_power = 1
@@ -6,17 +6,18 @@
//Transfers heat between a pipe system and environment, based on which has a greater thermal energy concentration
icon = 'icons/obj/atmospherics/cold_sink.dmi'
icon_state = "intact_off"
icon_state = "off"
level = 1
name = "Thermal Transfer Plate"
desc = "Transfers heat to and from an area"
update_icon()
if(node)
icon_state = "intact_off"
else
icon_state = "exposed"
return
var/prefix=""
//var/suffix="_idle" // Also available: _heat, _cool
if(level == 1 && istype(loc, /turf/simulated))
prefix="h"
icon_state = "[prefix]off"
process()
..()
@@ -59,6 +60,37 @@
return 1
hide(var/i) //to make the little pipe section invisible, the icon changes.
var/prefix=""
//var/suffix="_idle" // Also available: _heat, _cool
if(i == 1 && istype(loc, /turf/simulated))
prefix="h"
icon_state = "[prefix]off"
return
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
if (!istype(W, /obj/item/weapon/wrench))
return ..()
var/turf/T = src.loc
if (level==1 && isturf(T) && T.intact)
user << "\red You must remove the plating first."
return 1
var/datum/gas_mixture/int_air = return_air()
var/datum/gas_mixture/env_air = loc.return_air()
if ((int_air.return_pressure()-env_air.return_pressure()) > 2*ONE_ATMOSPHERE)
user << "\red You cannot unwrench this [src], it too exerted due to internal pressure."
add_fingerprint(user)
return 1
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "\blue You begin to unfasten \the [src]..."
if (do_after(user, 40))
user.visible_message( \
"[user] unfastens \the [src].", \
"\blue You have unfastened \the [src].", \
"You hear ratchet.")
new /obj/item/pipe(loc, make_from=src)
del(src)
proc/radiate()
var/internal_transfer_moles = 0.25 * air_contents.total_moles()
@@ -40,13 +40,19 @@
..()
update_icon()
var/hidden=""
if(level == 1 && istype(loc, /turf/simulated))
hidden="h"
var/suffix=""
if(scrub_O2)
suffix="1"
if(node && on && !(stat & (NOPOWER|BROKEN)))
if(scrubbing)
icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]on"
icon_state = "[hidden]on[suffix]"
else
icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]in"
icon_state = "[hidden]in"
else
icon_state = "[level == 1 && istype(loc, /turf/simulated) ? "h" : "" ]off"
icon_state = "[hidden]off"
return
proc
@@ -106,7 +112,12 @@
var/datum/gas_mixture/environment = loc.return_air()
if(scrubbing)
if((environment.toxins>0) || (environment.carbon_dioxide>0) || (environment.trace_gases.len>0))
// Are we scrubbing gasses that are present?
if(\
(scrub_Toxins && environment.toxins > 0) ||\
(scrub_CO2 && environment.carbon_dioxide > 0) ||\
(scrub_N2O && environment.trace_gases.len > 0) ||\
(scrub_O2 && environment.oxygen > 0))
var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles()
//Take a gas sample
@@ -117,12 +128,15 @@
//Filter it
var/datum/gas_mixture/filtered_out = new
filtered_out.temperature = removed.temperature
if(scrub_Toxins)
filtered_out.toxins = removed.toxins
removed.toxins = 0
if(scrub_CO2)
filtered_out.carbon_dioxide = removed.carbon_dioxide
removed.carbon_dioxide = 0
if(scrub_O2)
filtered_out.oxygen = removed.oxygen
removed.oxygen = 0
@@ -184,7 +198,7 @@
on = !on
if(signal.data["panic_siphon"]) //must be before if("scrubbing" thing
panic = text2num(signal.data["panic_siphon"] != null)
panic = text2num(signal.data["panic_siphon"]) // We send 0 for false in the alarm.
if(panic)
on = 1
scrubbing = 0
+3 -2
View File
@@ -266,6 +266,7 @@ obj/machinery/atmospherics/valve
icon = 'icons/obj/atmospherics/digital_valve.dmi'
attack_ai(mob/user as mob)
src.add_hiddenprint(user)
return src.attack_hand(user)
attack_hand(mob/user as mob)
@@ -314,8 +315,8 @@ obj/machinery/atmospherics/valve
attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
if (!istype(W, /obj/item/weapon/wrench))
return ..()
if (istype(src, /obj/machinery/atmospherics/valve/digital))
user << "\red You cannot unwrench this [src], it's too complicated."
if (istype(src,/obj/machinery/atmospherics/valve/digital) && src:frequency)
user << "\red You cannot unwrench this [src], it's digitally connected to another device."
return 1
var/turf/T = src.loc
if (level==1 && isturf(T) && T.intact)
+85 -77
View File
@@ -1,5 +1,5 @@
obj/machinery/atmospherics/pipe/simple/heat_exchanging
/obj/machinery/atmospherics/pipe/simple/heat_exchanging
icon = 'icons/obj/pipes/heat.dmi'
icon_state = "intact"
level = 2
@@ -9,55 +9,59 @@ obj/machinery/atmospherics/pipe/simple/heat_exchanging
thermal_conductivity = OPEN_HEAT_TRANSFER_COEFFICIENT
// BubbleWrap
New()
..()
initialize_directions_he = initialize_directions // The auto-detection from /pipe is good enough for a simple HE pipe
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/New()
..()
initialize_directions_he = initialize_directions // The auto-detection from /pipe is good enough for a simple HE pipe
// BubbleWrap END
initialize()
normalize_dir()
var/node1_dir
var/node2_dir
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/initialize()
normalize_dir()
var/node1_dir
var/node2_dir
for(var/direction in cardinal)
if(direction&initialize_directions_he)
if (!node1_dir)
node1_dir = direction
else if (!node2_dir)
node2_dir = direction
for(var/direction in cardinal)
if(direction&initialize_directions_he)
if (!node1_dir)
node1_dir = direction
else if (!node2_dir)
node2_dir = direction
for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,node1_dir))
if(target.initialize_directions_he & get_dir(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,node2_dir))
if(target.initialize_directions_he & get_dir(target,src))
node2 = target
break
update_icon()
return
for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,node1_dir))
if(target.initialize_directions_he & get_dir(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,node2_dir))
if(target.initialize_directions_he & get_dir(target,src))
node2 = target
break
update_icon()
return
process()
if(!parent)
..()
else
var/environment_temperature = 0
if(istype(loc, /turf/simulated/))
if(loc:blocks_air)
environment_temperature = loc:temperature
else
var/datum/gas_mixture/environment = loc.return_air()
environment_temperature = environment.temperature
else
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/process()
if(!parent)
..()
else
var/environment_temperature = 0
if(istype(loc, /turf/simulated/))
if(loc:blocks_air)
environment_temperature = loc:temperature
var/datum/gas_mixture/pipe_air = return_air()
if(abs(environment_temperature-pipe_air.temperature) > minimum_temperature_difference)
parent.temperature_interact(loc, volume, thermal_conductivity)
else
var/datum/gas_mixture/environment = loc.return_air()
environment_temperature = environment.temperature
else
environment_temperature = loc:temperature
var/datum/gas_mixture/pipe_air = return_air()
if(abs(environment_temperature-pipe_air.temperature) > minimum_temperature_difference)
parent.temperature_interact(loc, volume, thermal_conductivity)
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/hidden
level=1
icon_state="intact-f"
obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction
/////////////////////////////////
// JUNCTION
/////////////////////////////////
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction
icon = 'icons/obj/pipes/junction.dmi'
icon_state = "intact"
level = 2
@@ -65,42 +69,46 @@ obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction
thermal_conductivity = WALL_HEAT_TRANSFER_COEFFICIENT
// BubbleWrap
New()
.. ()
switch ( dir )
if ( SOUTH )
initialize_directions = NORTH
initialize_directions_he = SOUTH
if ( NORTH )
initialize_directions = SOUTH
initialize_directions_he = NORTH
if ( EAST )
initialize_directions = WEST
initialize_directions_he = EAST
if ( WEST )
initialize_directions = EAST
initialize_directions_he = WEST
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/New()
.. ()
switch ( dir )
if ( SOUTH )
initialize_directions = NORTH
initialize_directions_he = SOUTH
if ( NORTH )
initialize_directions = SOUTH
initialize_directions_he = NORTH
if ( EAST )
initialize_directions = WEST
initialize_directions_he = EAST
if ( WEST )
initialize_directions = EAST
initialize_directions_he = WEST
// BubbleWrap END
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/update_icon()
if(node1&&node2)
icon_state = "intact[invisibility ? "-f" : "" ]"
else
var/have_node1 = node1?1:0
var/have_node2 = node2?1:0
icon_state = "exposed[have_node1][have_node2]"
if(!node1&&!node2)
del(src)
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/initialize()
for(var/obj/machinery/atmospherics/target in get_step(src,initialize_directions))
if(target.initialize_directions & get_dir(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,initialize_directions_he))
if(target.initialize_directions_he & get_dir(target,src))
node2 = target
break
update_icon()
if(node1&&node2)
icon_state = "intact"
else
var/have_node1 = node1?1:0
var/have_node2 = node2?1:0
icon_state = "exposed[have_node1][have_node2]"
if(!node1&&!node2)
del(src)
return
initialize()
for(var/obj/machinery/atmospherics/target in get_step(src,initialize_directions))
if(target.initialize_directions & get_dir(target,src))
node1 = target
break
for(var/obj/machinery/atmospherics/pipe/simple/heat_exchanging/target in get_step(src,initialize_directions_he))
if(target.initialize_directions_he & get_dir(target,src))
node2 = target
break
update_icon()
return
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction/hidden
level=1
icon_state="intact-f"
+85 -2
View File
@@ -247,7 +247,6 @@ obj/machinery/atmospherics/pipe
node2 = null
update_icon()
return null
simple/scrubbers
@@ -315,9 +314,23 @@ obj/machinery/atmospherics/pipe
level = 1
icon_state = "intact-y-f"
simple/filtering
name="Pipe"
_color="green"
icon_state = ""
simple/filtering/visible
level = 2
icon_state = "intact-g"
simple/filtering/hidden
level = 1
icon_state = "intact-g-f"
simple/insulated
name = "Insulated pipe"
icon = 'icons/obj/atmospherics/red_pipe.dmi'
icon_state = "intact"
@@ -329,6 +342,10 @@ obj/machinery/atmospherics/pipe
level = 2
hidden
level=1
icon_state="intact-f"
tank
icon = 'icons/obj/atmospherics/pipe_tank.dmi'
@@ -792,6 +809,22 @@ obj/machinery/atmospherics/pipe
_color="yellow"
icon_state = ""
manifold/filtering
name="Air filtering pipe"
_color="green"
icon_state = ""
manifold/insulated
//thermal_conductivity = 0
name="Insulated pipe"
icon = 'icons/obj/atmospherics/red_pipe.dmi'
icon_state = "manifold"
//minimum_temperature_difference = 10000
//maximum_pressure = 1000*ONE_ATMOSPHERE
//fatigue_pressure = 900*ONE_ATMOSPHERE
alert_pressure = 900*ONE_ATMOSPHERE
level = 2
manifold/scrubbers/visible
level = 2
icon_state = "manifold-r"
@@ -824,6 +857,14 @@ obj/machinery/atmospherics/pipe
level = 1
icon_state = "manifold-f"
manifold/insulated/visible
level = 2
icon_state = "manifold"
manifold/insulated/hidden
level = 1
icon_state = "manifold-f"
manifold/yellow/visible
level = 2
icon_state = "manifold-y"
@@ -832,6 +873,15 @@ obj/machinery/atmospherics/pipe
level = 1
icon_state = "manifold-y-f"
manifold/filtering/visible
level = 2
icon_state = "manifold-g"
manifold/filtering/hidden
level = 1
icon_state = "manifold-g-f"
manifold4w
icon = 'icons/obj/atmospherics/pipe_manifold.dmi'
icon_state = "manifold4w-f"
@@ -998,6 +1048,16 @@ obj/machinery/atmospherics/pipe
_color="gray"
icon_state = ""
manifold4w/insulated
name="Insulated pipe"
_color=""
//minimum_temperature_difference = 10000
//maximum_pressure = 1000*ONE_ATMOSPHERE
//fatigue_pressure = 900*ONE_ATMOSPHERE
alert_pressure = 900*ONE_ATMOSPHERE
level = 2
icon_state = "manifold4w"
manifold4w/scrubbers/visible
level = 2
icon_state = "manifold4w-r"
@@ -1030,6 +1090,10 @@ obj/machinery/atmospherics/pipe
level = 1
icon_state = "manifold4w-f"
manifold4w/insulated/hidden
level = 1
icon_state = "manifold4w-f"
cap
name = "pipe endcap"
desc = "An endcap for pipes"
@@ -1118,7 +1182,26 @@ obj/machinery/atmospherics/pipe/attackby(var/obj/item/weapon/W as obj, var/mob/u
if (istype(src, /obj/machinery/atmospherics/pipe/vent))
return ..()
if(istype(W,/obj/item/device/pipe_painter))
// ===== Handle paints =====
if(istype(W, /obj/item/weapon/reagent_containers/glass/paint/red))
src._color = "red"
user << "\red You paint the pipe red."
update_icon()
return 1
if(istype(W, /obj/item/weapon/reagent_containers/glass/paint/blue))
src._color = "blue"
user << "\red You paint the pipe blue."
update_icon()
return 1
if(istype(W, /obj/item/weapon/reagent_containers/glass/paint/green))
src._color = "green"
user << "\red You paint the pipe green."
update_icon()
return 1
if(istype(W, /obj/item/weapon/reagent_containers/glass/paint/yellow))
src._color = "yellow"
user << "\red You paint the pipe yellow."
update_icon()
return 1
if (!istype(W, /obj/item/weapon/wrench))