making shit compile

This commit is contained in:
duncathan
2015-12-27 22:03:13 -06:00
parent 108719015d
commit b18cb5fca8
49 changed files with 323 additions and 482 deletions
@@ -1,9 +1,10 @@
#define FILTER_NOTHING -1
#define FILTER_PLASMA 0
#define FILTER_OXYGEN 1
#define FILTER_NITROGEN 2
#define FILTER_CARBONDIOXIDE 3
#define FILTER_NITROUSOXIDE 4
//very cleverly using the gas index defines so as to simplify a bunch of logic
#define FILTER_PLASMA GAS_PL
#define FILTER_OXYGEN GAS_O2
#define FILTER_NITROGEN GAS_N2
#define FILTER_CARBONDIOXIDE GAS_CO2
#define FILTER_NITROUSOXIDE GAS_N2O
/obj/machinery/atmospherics/components/trinary/filter
icon_state = "filter_off"
@@ -108,39 +109,14 @@ Filter types:
var/datum/gas_mixture/filtered_out = new
filtered_out.temperature = removed.temperature
switch(filter_type)
if(FILTER_PLASMA)
filtered_out.toxins = removed.toxins
removed.toxins = 0
if(removed.trace_gases.len>0)
for(var/datum/gas/trace_gas in removed.trace_gases)
if(istype(trace_gas, /datum/gas/oxygen_agent_b))
removed.trace_gases -= trace_gas
filtered_out.trace_gases += trace_gas
if(FILTER_OXYGEN)
filtered_out.oxygen = removed.oxygen
removed.oxygen = 0
if(FILTER_NITROGEN)
filtered_out.nitrogen = removed.nitrogen
removed.nitrogen = 0
if(FILTER_CARBONDIOXIDE)
filtered_out.carbon_dioxide = removed.carbon_dioxide
removed.carbon_dioxide = 0
if(FILTER_NITROUSOXIDE)
if(removed.trace_gases.len>0)
for(var/datum/gas/trace_gas in removed.trace_gases)
if(istype(trace_gas, /datum/gas/sleeping_agent))
removed.trace_gases -= trace_gas
filtered_out.trace_gases += trace_gas
else
filtered_out = null
if(filter_type > 0)
filtered_out.gases[filter_type][MOLES] = removed.gases[filter_type][MOLES]
removed.gases[filter_type][MOLES] = 0
if(filter_type == FILTER_PLASMA)
filtered_out.gases[GAS_AGENT_B][MOLES] = removed.gases[GAS_AGENT_B][MOLES]
removed.gases[GAS_AGENT_B][MOLES] = 0
else
filtered_out = null
air2.merge(filtered_out)
air3.merge(removed)
@@ -269,7 +269,7 @@
if(occupant.bodytemperature < T0C)
occupant.sleeping = max(5 / efficiency, (1 / occupant.bodytemperature) * 2000 / efficiency)
occupant.Paralyse(max(5 / efficiency, (1 / occupant.bodytemperature) * 3000 / efficiency))
if(air_contents.oxygen > 2)
if(air_contents.gases[GAS_O2][MOLES] > 2)
if(occupant.getOxyLoss()) occupant.adjustOxyLoss(-1)
else
occupant.adjustOxyLoss(-1)
@@ -46,7 +46,7 @@
var/added_oxygen = oxygen_content - total_moles
air_contents.temperature = (current_heat_capacity*air_contents.temperature + 20*added_oxygen*T0C)/(current_heat_capacity+20*added_oxygen)
air_contents.oxygen += added_oxygen
air_contents.gases[GAS_O2][MOLES] += added_oxygen
update_parents()
@@ -6,58 +6,35 @@
desc = "A large vessel containing pressurized gas."
var/volume = 10000 //in liters, 1 meters by 1 meters by 2 meters
density = 1
var/gas_type = 0
/obj/machinery/atmospherics/components/unary/tank/New()
..()
var/datum/gas_mixture/air_contents = AIR1
air_contents.volume = volume
air_contents.temperature = T20C
if(gas_type)
air_contents.gases[gas_type][MOLES] = AIR_CONTENTS
name = "[name] ([air_contents.gases[gas_type][GAS_NAME]])"
/obj/machinery/atmospherics/components/unary/tank/carbon_dioxide
name = "pressure tank (Carbon Dioxide)"
/obj/machinery/atmospherics/components/unary/tank/carbon_dioxide/New()
..()
var/datum/gas_mixture/air_contents = AIR1
air_contents.carbon_dioxide = AIR_CONTENTS
gas_type = GAS_CO2
/obj/machinery/atmospherics/components/unary/tank/toxins
icon_state = "orange"
name = "pressure tank (Plasma)"
/obj/machinery/atmospherics/components/unary/tank/toxins/New()
..()
var/datum/gas_mixture/air_contents = AIR1
air_contents.toxins = AIR_CONTENTS
gas_type = GAS_PL
/obj/machinery/atmospherics/components/unary/tank/oxygen_agent_b
icon_state = "orange_2"
name = "pressure tank (Oxygen + Plasma)"
/obj/machinery/atmospherics/components/unary/tank/oxygen_agent_b/New()
..()
var/datum/gas_mixture/air_contents = AIR1
var/datum/gas/oxygen_agent_b/trace_gas = new
trace_gas.moles = AIR_CONTENTS
air_contents.trace_gases += trace_gas
gas_type = GAS_AGENT_B
/obj/machinery/atmospherics/components/unary/tank/oxygen
icon_state = "blue"
name = "pressure tank (Oxygen)"
/obj/machinery/atmospherics/components/unary/tank/oxygen/New()
..()
var/datum/gas_mixture/air_contents = AIR1
air_contents.oxygen = AIR_CONTENTS
gas_type = GAS_O2
/obj/machinery/atmospherics/components/unary/tank/nitrogen
icon_state = "red"
name = "pressure tank (Nitrogen)"
/obj/machinery/atmospherics/components/unary/tank/nitrogen/New()
..()
var/datum/gas_mixture/air_contents = AIR1
air_contents.nitrogen = AIR_CONTENTS
gas_type = GAS_N2
/obj/machinery/atmospherics/components/unary/tank/air
icon_state = "grey"
@@ -66,5 +43,5 @@
/obj/machinery/atmospherics/components/unary/tank/air/New()
..()
var/datum/gas_mixture/air_contents = AIR1
air_contents.oxygen = AIR_CONTENTS * 0.2
air_contents.nitrogen = AIR_CONTENTS * 0.8
air_contents.gases[GAS_O2][MOLES] = AIR_CONTENTS * 0.2
air_contents.gases[GAS_N2][MOLES] = AIR_CONTENTS * 0.8
@@ -162,14 +162,21 @@
/obj/machinery/atmospherics/components/unary/vent_scrubber/proc/scrub(var/turf/simulated/tile)
if (!tile || !istype(tile))
if (!istype(tile))
return 0
var/datum/gas_mixture/environment = tile.return_air()
var/datum/gas_mixture/air_contents = AIR1
if(scrubbing & SCRUBBING)
if((environment.toxins>0) || (environment.carbon_dioxide>0) || (environment.trace_gases.len>0))
var/should_we_scrub = FALSE
for(var/gas in environment.gases)
if(gas[GAS_INDEX] <= 2)
continue
if(gas[MOLES])
should_we_scrub = TRUE
break
if(should_we_scrub)
var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles()
//Take a gas sample
@@ -181,21 +188,17 @@
var/datum/gas_mixture/filtered_out = new
filtered_out.temperature = removed.temperature
if(scrub_Toxins)
filtered_out.toxins = removed.toxins
removed.toxins = 0
filtered_out.gases[GAS_PL][MOLES] = removed.gases[GAS_PL][MOLES]
removed.gases[GAS_PL][MOLES] = 0
if(scrub_CO2)
filtered_out.carbon_dioxide = removed.carbon_dioxide
removed.carbon_dioxide = 0
if(removed.trace_gases.len>0)
for(var/datum/gas/trace_gas in removed.trace_gases)
if(istype(trace_gas, /datum/gas/oxygen_agent_b))
removed.trace_gases -= trace_gas
filtered_out.trace_gases += trace_gas
else if(istype(trace_gas, /datum/gas/sleeping_agent) && scrub_N2O)
removed.trace_gases -= trace_gas
filtered_out.trace_gases += trace_gas
filtered_out.gases[GAS_CO2][MOLES] = removed.gases[GAS_CO2][MOLES]
removed.gases[GAS_CO2][MOLES] = 0
if(TRUE) //no var for scrubbing agent b but I wanted the indentation to line up
filtered_out.gases[GAS_AGENT_B][MOLES] = removed.gases[GAS_AGENT_B][MOLES]
removed.gases[GAS_AGENT_B][MOLES] = 0
if(scrub_N2O)
filtered_out.gases[GAS_N2O][MOLES] = removed.gases[GAS_N2O][MOLES]
removed.gases[GAS_AGENT_B][MOLES] = 0
//Remix the resulting gases
air_contents.merge(filtered_out)