diff --git a/code/ATMOSPHERICS/chiller.dm b/code/ATMOSPHERICS/chiller.dm new file mode 100644 index 00000000000..3aa8b0af271 --- /dev/null +++ b/code/ATMOSPHERICS/chiller.dm @@ -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 += "Installed
" + else + dat += "Removed
" + + + // 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]%

" + dat += {"Power Level: [cell ? round(cell.percent(),1) : 0]%

+ Set Temperature: + - + - + [temp]°C + + + +
"} + // END AUTOFIX + user.set_machine(src) + user << browse("Air Conditioner Control Panel[dat]", "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 diff --git a/code/ATMOSPHERICS/components/tvalve.dm b/code/ATMOSPHERICS/components/tvalve.dm index 83f592c315f..cb95959ea41 100644 --- a/code/ATMOSPHERICS/components/tvalve.dm +++ b/code/ATMOSPHERICS/components/tvalve.dm @@ -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) diff --git a/code/ATMOSPHERICS/components/unary/cold_sink.dm b/code/ATMOSPHERICS/components/unary/cold_sink.dm index ef1d5f60bea..b1fa6a21b47 100644 --- a/code/ATMOSPHERICS/components/unary/cold_sink.dm +++ b/code/ATMOSPHERICS/components/unary/cold_sink.dm @@ -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 diff --git a/code/ATMOSPHERICS/components/unary/thermal_plate.dm b/code/ATMOSPHERICS/components/unary/thermal_plate.dm index 23e27ad0564..daebcf1bd2e 100644 --- a/code/ATMOSPHERICS/components/unary/thermal_plate.dm +++ b/code/ATMOSPHERICS/components/unary/thermal_plate.dm @@ -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() diff --git a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm index b0470df9330..fa27ee44af4 100644 --- a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm +++ b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm @@ -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 diff --git a/code/ATMOSPHERICS/components/valve.dm b/code/ATMOSPHERICS/components/valve.dm index 09d0b64f866..d9471470759 100644 --- a/code/ATMOSPHERICS/components/valve.dm +++ b/code/ATMOSPHERICS/components/valve.dm @@ -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) diff --git a/code/ATMOSPHERICS/he_pipes.dm b/code/ATMOSPHERICS/he_pipes.dm index 3fe69c855d4..259b70b633f 100644 --- a/code/ATMOSPHERICS/he_pipes.dm +++ b/code/ATMOSPHERICS/he_pipes.dm @@ -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" \ No newline at end of file diff --git a/code/ATMOSPHERICS/pipes.dm b/code/ATMOSPHERICS/pipes.dm index 0b206866c58..754c82f5982 100644 --- a/code/ATMOSPHERICS/pipes.dm +++ b/code/ATMOSPHERICS/pipes.dm @@ -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)) diff --git a/code/ZAS/Airflow.dm b/code/ZAS/Airflow.dm index 894dc92c72b..87f4bda7ecf 100644 --- a/code/ZAS/Airflow.dm +++ b/code/ZAS/Airflow.dm @@ -52,12 +52,17 @@ mob/var/tmp/last_airflow_stun = 0 mob/proc/airflow_stun() if(stat == 2) return 0 - if(last_airflow_stun > world.time - vsc.airflow_stun_cooldown) return 0 + if(last_airflow_stun > world.time - zas_settings.Get(/datum/ZAS_Setting/airflow_stun_cooldown)) return 0 if(!(status_flags & CANSTUN) && !(status_flags & CANWEAKEN)) src << "\blue You stay upright as the air rushes past you." return 0 - if(weakened <= 0) src << "\red The sudden rush of air knocks you over!" - weakened = max(weakened,5) + + if(zas_settings.Get(/datum/ZAS_Setting/airflow_push)) + if(weakened <= 0) src << "\red The sudden rush of air knocks you over!" + weakened = max(weakened,5) + last_airflow_stun = world.time + return + src << "\blue You stay upright as the air rushes past you." last_airflow_stun = world.time mob/living/silicon/airflow_stun() @@ -67,27 +72,34 @@ mob/living/carbon/metroid/airflow_stun() return mob/living/carbon/human/airflow_stun() - if(last_airflow_stun > world.time - vsc.airflow_stun_cooldown) return 0 + if(last_airflow_stun > world.time - zas_settings.Get(/datum/ZAS_Setting/airflow_stun_cooldown)) return 0 if(buckled) return 0 if(shoes) if(shoes.flags & NOSLIP) return 0 if(!(status_flags & CANSTUN) && !(status_flags & CANWEAKEN)) src << "\blue You stay upright as the air rushes past you." return 0 - if(weakened <= 0) src << "\red The sudden rush of air knocks you over!" - weakened = max(weakened,rand(1,5)) + + if(zas_settings.Get(/datum/ZAS_Setting/airflow_push)) + if(weakened <= 0) src << "\red The sudden rush of air knocks you over!" + weakened = max(weakened,rand(1,5)) + last_airflow_stun = world.time + return + src << "\blue You stay upright as the air rushes past you." last_airflow_stun = world.time atom/movable/proc/check_airflow_movable(n) - - if(anchored && !ismob(src)) return 0 - - if(!istype(src,/obj/item) && n < vsc.airflow_dense_pressure) return 0 + if(!zas_settings.Get(/datum/ZAS_Setting/airflow_push)) + return 0 + if(anchored && !ismob(src)) + return 0 + if(!istype(src,/obj/item) && n < zas_settings.Get(/datum/ZAS_Setting/airflow_dense_pressure)) + return 0 return 1 mob/check_airflow_movable(n) - if(n < vsc.airflow_heavy_pressure) + if(n < zas_settings.Get(/datum/ZAS_Setting/airflow_heavy_pressure)) return 0 return 1 @@ -102,11 +114,11 @@ obj/item/check_airflow_movable(n) . = ..() switch(w_class) if(2) - if(n < vsc.airflow_lightest_pressure) return 0 + if(n < zas_settings.Get(/datum/ZAS_Setting/airflow_lightest_pressure)) return 0 if(3) - if(n < vsc.airflow_light_pressure) return 0 + if(n < zas_settings.Get(/datum/ZAS_Setting/airflow_light_pressure)) return 0 if(4,5) - if(n < vsc.airflow_medium_pressure) return 0 + if(n < zas_settings.Get(/datum/ZAS_Setting/airflow_medium_pressure)) return 0 //The main airflow code. Called by zone updates. //Zones A and B are air zones. n represents the amount of air moved. @@ -116,7 +128,7 @@ proc/Airflow(zone/A, zone/B) var/n = B.air.return_pressure() - A.air.return_pressure() //Don't go any further if n is lower than the lowest value needed for airflow. - if(abs(n) < vsc.airflow_lightest_pressure) return + if(abs(n) < zas_settings.Get(/datum/ZAS_Setting/airflow_lightest_pressure)) return //These turfs are the midway point between A and B, and will be the destination point for thrown objects. var/list/connection/connections_A = A.connections @@ -141,53 +153,52 @@ proc/Airflow(zone/A, zone/B) var/list/temporary_pplz = air_sucked air_sucked = air_repelled air_repelled = temporary_pplz + if(zas_settings.Get(/datum/ZAS_Setting/airflow_push)) // If enabled + for(var/atom/movable/M in air_sucked) + if(M.last_airflow > world.time - zas_settings.Get(/datum/ZAS_Setting/airflow_delay)) continue - for(var/atom/movable/M in air_sucked) + //Check for knocking people over + if(ismob(M) && n > zas_settings.Get(/datum/ZAS_Setting/airflow_stun_pressure)) + if(M:status_flags & GODMODE) continue + M:airflow_stun() - if(M.last_airflow > world.time - vsc.airflow_delay) continue + if(M.check_airflow_movable(n)) - //Check for knocking people over - if(ismob(M) && n > vsc.airflow_stun_pressure) - if(M:status_flags & GODMODE) continue - M:airflow_stun() + //Check for things that are in range of the midpoint turfs. + var/list/close_turfs = list() + for(var/turf/U in connected_turfs) + if(M in range(U)) close_turfs += U + if(!close_turfs.len) continue - if(M.check_airflow_movable(n)) + //If they're already being tossed, don't do it again. + if(!M.airflow_speed) - //Check for things that are in range of the midpoint turfs. - var/list/close_turfs = list() - for(var/turf/U in connected_turfs) - if(M in range(U)) close_turfs += U - if(!close_turfs.len) continue + M.airflow_dest = pick(close_turfs) //Pick a random midpoint to fly towards. - //If they're already being tossed, don't do it again. - if(!M.airflow_speed) + spawn M.GotoAirflowDest(abs(n)/5) - M.airflow_dest = pick(close_turfs) //Pick a random midpoint to fly towards. + //Do it again for the stuff in the other zone, making it fly away. + for(var/atom/movable/M in air_repelled) - spawn M.GotoAirflowDest(abs(n)/5) + if(M.last_airflow > world.time - zas_settings.Get(/datum/ZAS_Setting/airflow_delay)) continue - //Do it again for the stuff in the other zone, making it fly away. - for(var/atom/movable/M in air_repelled) + if(ismob(M) && abs(n) > zas_settings.Get(/datum/ZAS_Setting/airflow_medium_pressure)) + if(M:status_flags & GODMODE) continue + M:airflow_stun() - if(M.last_airflow > world.time - vsc.airflow_delay) continue + if(M.check_airflow_movable(abs(n))) - if(ismob(M) && abs(n) > vsc.airflow_medium_pressure) - if(M:status_flags & GODMODE) continue - M:airflow_stun() + var/list/close_turfs = list() + for(var/turf/U in connected_turfs) + if(M in range(U)) close_turfs += U + if(!close_turfs.len) continue - if(M.check_airflow_movable(abs(n))) + //If they're already being tossed, don't do it again. + if(!M.airflow_speed) - var/list/close_turfs = list() - for(var/turf/U in connected_turfs) - if(M in range(U)) close_turfs += U - if(!close_turfs.len) continue + M.airflow_dest = pick(close_turfs) //Pick a random midpoint to fly towards. - //If they're already being tossed, don't do it again. - if(!M.airflow_speed) - - M.airflow_dest = pick(close_turfs) //Pick a random midpoint to fly towards. - - spawn M.RepelAirflowDest(abs(n)/5) + spawn M.RepelAirflowDest(abs(n)/5) proc/AirflowSpace(zone/A) @@ -196,34 +207,34 @@ proc/AirflowSpace(zone/A) var/n = A.air.return_pressure() //Here, n is determined by only the pressure in the room. - if(n < vsc.airflow_lightest_pressure) return + if(n < zas_settings.Get(/datum/ZAS_Setting/airflow_lightest_pressure)) return var/list/connected_turfs = A.unsimulated_tiles //The midpoints are now all the space connections. var/list/pplz = A.movables() //We only need to worry about things in the zone, not things in space. - for(var/atom/movable/M in pplz) + if(zas_settings.Get(/datum/ZAS_Setting/airflow_push)) // If enabled + for(var/atom/movable/M in pplz) + if(M.last_airflow > world.time - zas_settings.Get(/datum/ZAS_Setting/airflow_delay)) continue - if(M.last_airflow > world.time - vsc.airflow_delay) continue + if(ismob(M) && n > zas_settings.Get(/datum/ZAS_Setting/airflow_stun_pressure)) + var/mob/O = M + if(O.status_flags & GODMODE) continue + O.airflow_stun() - if(ismob(M) && n > vsc.airflow_stun_pressure) - var/mob/O = M - if(O.status_flags & GODMODE) continue - O.airflow_stun() + if(M.check_airflow_movable(n)) - if(M.check_airflow_movable(n)) + var/list/close_turfs = list() + for(var/turf/U in connected_turfs) + if(M in range(U)) close_turfs += U + if(!close_turfs.len) continue - var/list/close_turfs = list() - for(var/turf/U in connected_turfs) - if(M in range(U)) close_turfs += U - if(!close_turfs.len) continue + //If they're already being tossed, don't do it again. + if(!M.airflow_speed) - //If they're already being tossed, don't do it again. - if(!M.airflow_speed) - - M.airflow_dest = pick(close_turfs) //Pick a random midpoint to fly towards. - spawn - if(M) M.GotoAirflowDest(n/10) - //Sometimes shit breaks, and M isn't there after the spawn. + M.airflow_dest = pick(close_turfs) //Pick a random midpoint to fly towards. + spawn + if(M) M.GotoAirflowDest(n/10) + //Sometimes shit breaks, and M isn't there after the spawn. /atom/movable/var/tmp/turf/airflow_dest @@ -232,9 +243,10 @@ proc/AirflowSpace(zone/A) /atom/movable/var/tmp/last_airflow = 0 /atom/movable/proc/GotoAirflowDest(n) + if(!zas_settings.Get(/datum/ZAS_Setting/airflow_push)) return // If not enabled, fuck it. if(!airflow_dest) return if(airflow_speed < 0) return - if(last_airflow > world.time - vsc.airflow_delay) return + if(last_airflow > world.time - zas_settings.Get(/datum/ZAS_Setting/airflow_delay)) return if(airflow_speed) airflow_speed = n/max(get_dist(src,airflow_dest),1) return @@ -268,7 +280,7 @@ proc/AirflowSpace(zone/A) while(airflow_speed > 0) if(airflow_speed <= 0) return airflow_speed = min(airflow_speed,15) - airflow_speed -= vsc.airflow_speed_decay + airflow_speed -= zas_settings.Get(/datum/ZAS_Setting/airflow_speed_decay) if(airflow_speed > 7) if(airflow_time++ >= airflow_speed - 7) if(od) @@ -288,7 +300,7 @@ proc/AirflowSpace(zone/A) return step_towards(src, src.airflow_dest) if(ismob(src) && src:client) - src:client:move_delay = world.time + vsc.airflow_mob_slowdown + src:client:move_delay = world.time + zas_settings.Get(/datum/ZAS_Setting/airflow_mob_slowdown) airflow_dest = null airflow_speed = 0 airflow_time = 0 @@ -297,9 +309,10 @@ proc/AirflowSpace(zone/A) /atom/movable/proc/RepelAirflowDest(n) + if(!zas_settings.Get(/datum/ZAS_Setting/airflow_push)) return // If not enabled, fuck it. if(!airflow_dest) return if(airflow_speed < 0) return - if(last_airflow > world.time - vsc.airflow_delay) return + if(last_airflow > world.time - zas_settings.Get(/datum/ZAS_Setting/airflow_delay)) return if(airflow_speed) airflow_speed = n/max(get_dist(src,airflow_dest),1) return @@ -333,7 +346,7 @@ proc/AirflowSpace(zone/A) while(airflow_speed > 0) if(airflow_speed <= 0) return airflow_speed = min(airflow_speed,15) - airflow_speed -= vsc.airflow_speed_decay + airflow_speed -= zas_settings.Get(/datum/ZAS_Setting/airflow_speed_decay) if(airflow_speed > 7) if(airflow_time++ >= airflow_speed - 7) sleep(1 * tick_multiplier) @@ -347,7 +360,7 @@ proc/AirflowSpace(zone/A) return step_towards(src, src.airflow_dest) if(ismob(src) && src:client) - src:client:move_delay = world.time + vsc.airflow_mob_slowdown + src:client:move_delay = world.time + zas_settings.Get(/datum/ZAS_Setting/airflow_mob_slowdown) airflow_dest = null airflow_speed = 0 airflow_time = 0 @@ -369,14 +382,14 @@ atom/movable/proc/airflow_hit(atom/A) mob/airflow_hit(atom/A) for(var/mob/M in hearers(src)) M.show_message("\red \The [src] slams into \a [A]!",1,"\red You hear a loud slam!",2) - playsound(src.loc, "smash.ogg", 25, 1, -1) + //playsound(src.loc, "smash.ogg", 25, 1, -1) weakened = max(weakened, (istype(A,/obj/item) ? A:w_class : rand(1,5))) //Heheheh . = ..() obj/airflow_hit(atom/A) for(var/mob/M in hearers(src)) M.show_message("\red \The [src] slams into \a [A]!",1,"\red You hear a loud slam!",2) - playsound(src.loc, "smash.ogg", 25, 1, -1) + //playsound(src.loc, "smash.ogg", 25, 1, -1) . = ..() obj/item/airflow_hit(atom/A) @@ -386,13 +399,13 @@ obj/item/airflow_hit(atom/A) mob/living/carbon/human/airflow_hit(atom/A) // for(var/mob/M in hearers(src)) // M.show_message("\red [src] slams into [A]!",1,"\red You hear a loud slam!",2) - playsound(src.loc, "punch", 25, 1, -1) + //playsound(src.loc, "punch", 25, 1, -1) loc:add_blood(src) if (src.wear_suit) src.wear_suit.add_blood(src) if (src.w_uniform) src.w_uniform.add_blood(src) - var/b_loss = airflow_speed * vsc.airflow_damage + var/b_loss = airflow_speed * zas_settings.Get(/datum/ZAS_Setting/airflow_damage) var/blocked = run_armor_check("head","melee") apply_damage(b_loss/3, BRUTE, "head", blocked, 0, "Airflow") @@ -403,17 +416,19 @@ mob/living/carbon/human/airflow_hit(atom/A) blocked = run_armor_check("groin","melee") apply_damage(b_loss/3, BRUTE, "groin", blocked, 0, "Airflow") - if(airflow_speed > 10) - paralysis += round(airflow_speed * vsc.airflow_stun) - stunned = max(stunned,paralysis + 3) - else - stunned += round(airflow_speed * vsc.airflow_stun/2) + if(zas_settings.Get(/datum/ZAS_Setting/airflow_push)) + if(airflow_speed > 10) + paralysis += round(airflow_speed * zas_settings.Get(/datum/ZAS_Setting/airflow_stun)) + stunned = max(stunned,paralysis + 3) + else + stunned += round(airflow_speed * zas_settings.Get(/datum/ZAS_Setting/airflow_stun)/2) + . = ..() zone/proc/movables() . = list() for(var/turf/T in contents) for(var/atom/A in T) - if(istype(A, /obj/effect) || istype(A, /mob/aiEye)) + if(istype(A, /obj/effect) || isobserver(A) || istype(A, /mob/camera)) continue . += A diff --git a/code/ZAS/Connection.dm b/code/ZAS/Connection.dm index b26217eeb6c..8a919d50435 100644 --- a/code/ZAS/Connection.dm +++ b/code/ZAS/Connection.dm @@ -104,7 +104,8 @@ Indirect connections will not merge the two zones after they reach equilibrium. //Disconnect zones while handling unusual conditions. // e.g. loss of a zone on a turf - DisconnectZones(zone_A, zone_B) + if(A && A.zone && B && B.zone) + DisconnectZones(A.zone, B.zone) //Finally, preform actual deletion. . = ..() @@ -399,4 +400,4 @@ Indirect connections will not merge the two zones after they reach equilibrium. #undef CONNECTION_DIRECT #undef CONNECTION_INDIRECT -#undef CONNECTION_CLOSED +#undef CONNECTION_CLOSED \ No newline at end of file diff --git a/code/ZAS/FEA_gas_mixture.dm b/code/ZAS/FEA_gas_mixture.dm index 8b7ab992c93..37c53c8feda 100644 --- a/code/ZAS/FEA_gas_mixture.dm +++ b/code/ZAS/FEA_gas_mixture.dm @@ -14,6 +14,15 @@ What are the archived variables for? #define QUANTIZE(variable) (round(variable,0.0001)) #define TRANSFER_FRACTION 5 //What fraction (1/#) of the air difference to try and transfer +#define TEMPERATURE_ICE_FORMATION 273.15 // 273 kelvin is the freezing point of water. +#define MIN_PRESSURE_ICE_FORMATION 10 // 10kPa should be okay + +#define GRAPHICS_PLASMA 1 +#define GRAPHICS_N2O 2 +#define GRAPHICS_REAGENTS 4 // Not used. Yet. +#define GRAPHICS_COLD 8 + + /datum/gas/sleeping_agent/specific_heat = 40 //These are used for the "Trace Gases" stuff, but is buggy. /datum/gas/oxygen_agent_b/specific_heat = 300 @@ -43,7 +52,7 @@ What are the archived variables for? //Size of the group this gas_mixture is representing. //=1 for singletons - var/graphic + var/graphics=0 var/list/datum/gas/trace_gases = list() //Seemed to be a good idea that was abandoned @@ -54,7 +63,7 @@ What are the archived variables for? var/tmp/temperature_archived - var/tmp/graphic_archived = 0 + var/tmp/graphics_archived = 0 var/tmp/fuel_burnt = 0 //FOR THE LOVE OF GOD PLEASE USE THIS PROC @@ -81,7 +90,7 @@ What are the archived variables for? update_values() return - //tg seems to like using these a lot +//tg seems to like using these a lot /datum/gas_mixture/proc/return_temperature() return temperature @@ -105,7 +114,7 @@ What are the archived variables for? var/heat_capacity = HEAT_CAPACITY_CALCULATION(oxygen,carbon_dioxide,nitrogen,toxins) - if(trace_gases.len) + if(trace_gases && trace_gases.len) //sanity check because somehow the tracegases gets nulled? for(var/datum/gas/trace_gas in trace_gases) heat_capacity += trace_gas.moles*trace_gas.specific_heat @@ -189,17 +198,30 @@ What are the archived variables for? //Inputs: None //Outputs: 1 if graphic changed, 0 if unchanged - graphic = 0 + graphics = 0 + + // If configured and cold, maek ice + if(zas_settings.Get(/datum/ZAS_Setting/ice_formation)) + if(temperature <= TEMPERATURE_ICE_FORMATION && return_pressure()>MIN_PRESSURE_ICE_FORMATION) + // If we're just forming, do a probability check. Otherwise, KEEP IT ON~ + // This ordering will hopefully keep it from sampling random noise every damn tick. + //if(was_icy || (!was_icy && prob(25))) + graphics |= GRAPHICS_COLD + if(toxins > MOLES_PLASMA_VISIBLE) - graphic = 1 - else if(length(trace_gases)) + graphics |= GRAPHICS_PLASMA + if(length(trace_gases)) var/datum/gas/sleeping_agent = locate(/datum/gas/sleeping_agent) in trace_gases if(sleeping_agent && (sleeping_agent.moles > 1)) - graphic = 2 - else - graphic = 0 + graphics |= GRAPHICS_N2O - return graphic != graphic_archived + /* + var/datum/gas/reagent = exact_locate(/datum/gas/reagent,trace_gases) + if(reagent && (reagent.moles > 0.1)) + graphics |= GRAPHICS_REAGENTS + */ + + return graphics != graphics_archived /datum/gas_mixture/proc/react(atom/dump_location) //Purpose: Calculating if it is possible for a fire to occur in the airmix @@ -298,7 +320,7 @@ What are the archived variables for? temperature_archived = temperature - graphic_archived = graphic + graphics_archived = graphics return 1 @@ -373,6 +395,10 @@ What are the archived variables for? //Inputs: How many moles to remove. //Outputs: Removed air. + // Fix a singuloth problem + if(group_multiplier==0) + return null + var/sum = total_moles() amount = min(amount,sum) //Can not take more air than tile has! if(amount <= 0) diff --git a/code/ZAS/Fire.dm b/code/ZAS/Fire.dm index d057bad4c3d..6909ccd213d 100644 --- a/code/ZAS/Fire.dm +++ b/code/ZAS/Fire.dm @@ -62,22 +62,34 @@ turf/simulated/hotspot_expose(exposed_temperature, exposed_volume, soh) . = 1 //get location and check if it is in a proper ZAS zone - var/turf/simulated/floor/S = loc - if(!S.zone) - del src + var/turf/simulated/S = loc if(!istype(S)) del src + if(!S.zone) + del src + var/datum/gas_mixture/air_contents = S.return_air() //get liquid fuels on the ground. var/obj/effect/decal/cleanable/liquid_fuel/liquid = locate() in S //and the volatile stuff from the air - //var/datum/gas/volatile_fuel/fuel = locate() in air_contents.trace_gases + var/datum/gas/volatile_fuel/fuel = locate() in air_contents.trace_gases + + //since the air is processed in fractions, we need to make sure not to have any minuscle residue or + //the amount of moles might get to low for some functions to catch them and thus result in wonky behaviour + if(air_contents.oxygen < 0.001) + air_contents.oxygen = 0 + if(air_contents.toxins < 0.001) + air_contents.toxins = 0 + if(fuel) + if(fuel.moles < 0.001) + air_contents.trace_gases.Remove(fuel) //check if there is something to combust - if(!air_contents.check_combustability(liquid)) - del src + if(!air_contents.check_recombustability(liquid)) + //del src + RemoveFire() //get a firelevel and set the icon firelevel = air_contents.calculate_firelevel(liquid) @@ -95,15 +107,19 @@ turf/simulated/hotspot_expose(exposed_temperature, exposed_volume, soh) //im not sure how to implement a version that works for every creature so for now monkeys are firesafe for(var/mob/living/carbon/human/M in loc) M.FireBurn(firelevel, air_contents.temperature, air_contents.return_pressure() ) //Burn the humans! - - - //spread! + for(var/atom/A in loc) + A.fire_act(air_contents, air_contents.temperature, air_contents.return_volume()) + //spread for(var/direction in cardinal) if(S.air_check_directions&direction) //Grab all valid bordering tiles var/turf/simulated/enemy_tile = get_step(S, direction) if(istype(enemy_tile)) + var/datum/gas_mixture/acs = enemy_tile.return_air() + var/obj/effect/decal/cleanable/liquid_fuel/liq = locate() in enemy_tile + if(!acs) continue + if(!acs.check_recombustability(liq)) continue //If extinguisher mist passed over the turf it's trying to spread to, don't spread and //reduce firelevel. if(enemy_tile.fire_protection > world.time-30) @@ -112,25 +128,25 @@ turf/simulated/hotspot_expose(exposed_temperature, exposed_volume, soh) //Spread the fire. if(!(locate(/obj/fire) in enemy_tile)) - if( prob( 50 + 50 * (firelevel/vsc.fire_firelevel_multiplier) ) && S.CanPass(null, enemy_tile, 0,0) && enemy_tile.CanPass(null, S, 0,0)) + if( prob( 50 + 50 * (firelevel/zas_settings.Get(/datum/ZAS_Setting/fire_firelevel_multiplier)) ) && S.CanPass(null, enemy_tile, 0,0) && enemy_tile.CanPass(null, S, 0,0)) new/obj/fire(enemy_tile,firelevel) //seperate part of the present gas //this is done to prevent the fire burning all gases in a single pass - var/datum/gas_mixture/flow = air_contents.remove_ratio(vsc.fire_consuption_rate) - + var/datum/gas_mixture/flow = air_contents.remove_ratio(zas_settings.Get(/datum/ZAS_Setting/fire_consumption_rate)) ///////////////////////////////// FLOW HAS BEEN CREATED /// DONT DELETE THE FIRE UNTIL IT IS MERGED BACK OR YOU WILL DELETE AIR /////////////////////////////////////////////// if(flow) - if(flow.check_combustability(liquid)) + + if(flow.check_recombustability(liquid)) //Ensure flow temperature is higher than minimum fire temperatures. //this creates some energy ex nihilo but is necessary to get a fire started //lets just pretend this energy comes from the ignition source and dont mention this again //flow.temperature = max(PLASMA_MINIMUM_BURN_TEMPERATURE+0.1,flow.temperature) //burn baby burn! - flow.zburn(liquid,1) + flow.zburn(liquid,1) //merge the air back S.assume_air(flow) @@ -158,6 +174,12 @@ turf/simulated/hotspot_expose(exposed_temperature, exposed_volume, soh) ..() +/obj/fire/proc/RemoveFire() + if (istype(loc, /turf/simulated)) + SetLuminosity(0) + loc = null + air_master.active_hotspots.Remove(src) + turf/simulated/var/fire_protection = 0 //Protects newly extinguished tiles from being overrun again. @@ -166,10 +188,10 @@ turf/simulated/apply_fire_protection() fire_protection = world.time -datum/gas_mixture/proc/zburn(obj/effect/decal/cleanable/liquid_fuel/liquid,force_burn) +datum/gas_mixture/proc/zburn(obj/effect/decal/cleanable/liquid_fuel/liquid, force_burn) var/value = 0 - if((temperature > PLASMA_MINIMUM_BURN_TEMPERATURE || force_burn) && check_combustability(liquid) ) + if((temperature > PLASMA_MINIMUM_BURN_TEMPERATURE || force_burn) && check_recombustability(liquid)) var/total_fuel = 0 var/datum/gas/volatile_fuel/fuel = locate() in trace_gases @@ -203,38 +225,63 @@ datum/gas_mixture/proc/zburn(obj/effect/decal/cleanable/liquid_fuel/liquid,force var/total_reactants = total_fuel + total_oxygen //determine the amount of reactants actually reacting - var/used_reactants_ratio = min( max(total_reactants * firelevel / vsc.fire_firelevel_multiplier, 0.2), total_reactants) / total_reactants + var/used_reactants_ratio = min( max(total_reactants * firelevel / zas_settings.Get(/datum/ZAS_Setting/fire_firelevel_multiplier), 0.2), total_reactants) / total_reactants //remove and add gasses as calculated oxygen -= min(oxygen, total_oxygen * used_reactants_ratio ) - toxins -= min(toxins, toxins * used_fuel_ratio * used_reactants_ratio ) + toxins -= min(toxins, (toxins * used_fuel_ratio * used_reactants_ratio ) * 3) + if(toxins < 0) + toxins = 0 carbon_dioxide += max(2 * total_fuel, 0) if(fuel) - fuel.moles -= fuel.moles * used_fuel_ratio * used_reactants_ratio + fuel.moles -= (fuel.moles * used_fuel_ratio * used_reactants_ratio) * 5 //Fuel burns 5 times as quick if(fuel.moles <= 0) del fuel if(liquid) - liquid.amount -= liquid.amount * used_fuel_ratio * used_reactants_ratio + liquid.amount -= (liquid.amount * used_fuel_ratio * used_reactants_ratio) * 5 // liquid fuel burns 5 times as quick + if(liquid.amount <= 0) del liquid //calculate the energy produced by the reaction and then set the new temperature of the mix - temperature = (starting_energy + vsc.fire_fuel_energy_release * total_fuel) / heat_capacity() + temperature = (starting_energy + zas_settings.Get(/datum/ZAS_Setting/fire_fuel_energy_release) * total_fuel) / heat_capacity() update_values() value = total_reactants * used_reactants_ratio return value +datum/gas_mixture/proc/check_recombustability(obj/effect/decal/cleanable/liquid_fuel/liquid) + //this is a copy proc to continue a fire after its been started. + + var/datum/gas/volatile_fuel/fuel = locate() in trace_gases + var/value = 0 + + if(oxygen && (toxins || fuel || liquid)) + if(liquid) + value = 1 + else if (toxins && !value) + value = 1 + else if(fuel && !value) + value = 1 + + return value + datum/gas_mixture/proc/check_combustability(obj/effect/decal/cleanable/liquid_fuel/liquid) //this check comes up very often and is thus centralized here to ease adding stuff var/datum/gas/volatile_fuel/fuel = locate() in trace_gases var/value = 0 - if(oxygen > 0.01 && (toxins > 0.01 || (fuel && fuel.moles > 0.01) || liquid)) - value = 1 + if(oxygen && (toxins || fuel || liquid)) + if(liquid) + value = 1 + else if (toxins >= 0.7 && !value) + value = 1 + else if(fuel && !value) + if(fuel.moles >= 1.4) + value = 1 return value @@ -245,7 +292,7 @@ datum/gas_mixture/proc/calculate_firelevel(obj/effect/decal/cleanable/liquid_fue var/total_fuel = 0 var/firelevel = 0 - if(check_combustability(liquid)) + if(check_recombustability(liquid)) total_fuel += toxins @@ -262,9 +309,9 @@ datum/gas_mixture/proc/calculate_firelevel(obj/effect/decal/cleanable/liquid_fue //slows down the burning when the concentration of the reactants is low var/dampening_multiplier = total_combustables / (total_combustables + nitrogen + carbon_dioxide) //calculates how close the mixture of the reactants is to the optimum - var/mix_multiplier = 1 / (1 + (5 * ((oxygen / total_combustables) ** 2))) + var/mix_multiplier = 1 / (1 + (5 * ((oxygen / total_combustables) ^2))) //toss everything together - firelevel = vsc.fire_firelevel_multiplier * mix_multiplier * dampening_multiplier + firelevel = zas_settings.Get(/datum/ZAS_Setting/fire_firelevel_multiplier) * mix_multiplier * dampening_multiplier return max( 0, firelevel) @@ -283,7 +330,7 @@ datum/gas_mixture/proc/calculate_firelevel(obj/effect/decal/cleanable/liquid_fue //determine the multiplier //minimize this for low-pressure enviroments - var/mx = 5 * firelevel/vsc.fire_firelevel_multiplier * min(pressure / ONE_ATMOSPHERE, 1) + var/mx = 5 * firelevel/zas_settings.Get(/datum/ZAS_Setting/fire_firelevel_multiplier) * min(pressure / ONE_ATMOSPHERE, 1) //Get heat transfer coefficients for clothing. //skytodo: kill anyone who breaks things then orders me to fix them diff --git a/code/ZAS/NewSettings.dm b/code/ZAS/NewSettings.dm new file mode 100644 index 00000000000..f3821367f48 --- /dev/null +++ b/code/ZAS/NewSettings.dm @@ -0,0 +1,517 @@ +/* +ZAS Settings System 2.0 + +Okay, so VariableSettings is a mess of spaghetticode and + is about as flexible as a grandmother covered in + starch. + +This is an attempt to fix that by using getters and + setters instead of stupidity. It's a little more difficult + to code with, but dammit, it's better than hackery. + +NOTE: plc was merged into the main settings. We can set up + visual groups later. + +HOW2GET: + zas_setting.Get(/datum/ZAS_Setting/herp) + +HOW2SET: + zas_setting.Set(/datum/ZAS_Setting/herp, "dsfargeg") +*/ + +var/global/ZAS_Settings/zas_settings = new + +#define ZAS_TYPE_UNDEFINED -1 +#define ZAS_TYPE_BOOLEAN 0 +#define ZAS_TYPE_NUMERIC 1 + +/** +* ZAS Setting Datum +* +* Stores a single setting. +* @author N3X15 +* @package SS13 +* @subpackage ZAS +*/ +/datum/ZAS_Setting/ + var/name="Clown" // Friendly name. + var/desc="Honk" + var/value=null + var/valtype=ZAS_TYPE_UNDEFINED + +/datum/ZAS_Setting/fire_consumption_rate + name = "Fire - Air Consumption Ratio" + desc = "Ratio of air removed and combusted per tick." + valtype=ZAS_TYPE_NUMERIC + value = 0.75 + +/datum/ZAS_Setting/fire_firelevel_multiplier + value = 25 + name = "Fire - Firelevel Constant" + desc = "Multiplied by the equation for firelevel, affects mainly the extingiushing of fires." + valtype=ZAS_TYPE_NUMERIC + +/datum/ZAS_Setting/fire_fuel_energy_release + value = 550000 + name = "Fire - Fuel energy release" + desc = "The energy in joule released when burning one mol of a burnable substance" + valtype=ZAS_TYPE_NUMERIC + +/datum/ZAS_Setting/airflow_lightest_pressure + value = 20 + name = "Airflow - Small Movement Threshold %" + desc = "Percent of 1 Atm. at which items with the small weight classes will move." + valtype=ZAS_TYPE_NUMERIC + +/datum/ZAS_Setting/airflow_light_pressure + value = 35 + name = "Airflow - Medium Movement Threshold %" + desc = "Percent of 1 Atm. at which items with the medium weight classes will move." + valtype=ZAS_TYPE_NUMERIC + +/datum/ZAS_Setting/airflow_medium_pressure + value = 50 + name = "Airflow - Heavy Movement Threshold %" + desc = "Percent of 1 Atm. at which items with the largest weight classes will move." + valtype=ZAS_TYPE_NUMERIC + +/datum/ZAS_Setting/airflow_heavy_pressure + value = 65 + name = "Airflow - Mob Movement Threshold %" + desc = "Percent of 1 Atm. at which mobs will move." + valtype=ZAS_TYPE_NUMERIC + +/datum/ZAS_Setting/airflow_dense_pressure + value = 85 + name = "Airflow - Dense Movement Threshold %" + desc = "Percent of 1 Atm. at which items with canisters and closets will move." + valtype=ZAS_TYPE_NUMERIC + +/datum/ZAS_Setting/airflow_stun_pressure + value = 60 + name = "Airflow - Mob Stunning Threshold %" + desc = "Percent of 1 Atm. at which mobs will be stunned by airflow." + valtype=ZAS_TYPE_NUMERIC + +/datum/ZAS_Setting/airflow_stun_cooldown + value = 60 + name = "Aiflow Stunning - Cooldown" + desc = "How long, in tenths of a second, to wait before stunning them again." + valtype=ZAS_TYPE_NUMERIC + +/datum/ZAS_Setting/airflow_stun + value = 1 + name = "Airflow Impact - Stunning" + desc = "How much a mob is stunned when hit by an object." + valtype=ZAS_TYPE_NUMERIC + +/datum/ZAS_Setting/airflow_damage + value = 2 + name = "Airflow Impact - Damage" + desc = "Damage from airflow impacts." + valtype=ZAS_TYPE_NUMERIC + +/datum/ZAS_Setting/airflow_speed_decay + value = 1.5 + name = "Airflow Speed Decay" + desc = "How rapidly the speed gained from airflow decays." + valtype=ZAS_TYPE_NUMERIC + +/datum/ZAS_Setting/airflow_delay + value = 30 + name = "Airflow Retrigger Delay" + desc = "Time in deciseconds before things can be moved by airflow again." + valtype=ZAS_TYPE_NUMERIC + +/datum/ZAS_Setting/airflow_mob_slowdown + value = 1 + name = "Airflow Slowdown" + desc = "Time in tenths of a second to add as a delay to each movement by a mob if they are fighting the pull of the airflow." + valtype=ZAS_TYPE_NUMERIC + +// N3X15 - Added back in so we can tweak performance. +/datum/ZAS_Setting/airflow_push + name="Airflow - Push" + value = 0 + desc="1=yes please rape my server, 0=no" + valtype=ZAS_TYPE_BOOLEAN + +/datum/ZAS_Setting/connection_insulation + value = 0.4 + name = "Connections - Insulation" + desc = "How insulative a connection is, in terms of heat transfer. 1 is perfectly insulative, and 0 is perfectly conductive." + valtype=ZAS_TYPE_NUMERIC + +/datum/ZAS_Setting/connection_temperature_delta + value = 10 + name = "Connections - Temperature Difference" + desc = "The smallest temperature difference which will cause heat to travel through doors." + valtype=ZAS_TYPE_NUMERIC + +// N3X15 - Ice is disabled by default, per Pomf's request. +/datum/ZAS_Setting/ice_formation + name="Airflow - Enable Ice Formation" + value = 0 + desc="1=yes, 0=no - Slippin' and slidin' when pressure > 10kPa and temperature < 273K" + valtype=ZAS_TYPE_BOOLEAN + +/datum/ZAS_Setting/space_isnt_cold + name="Airflow - Disable Cold Space" + value = 0 // Pomf requested + desc="1=yes, 0=no - Disables space behaving as being very fucking cold (0K)." + valtype=ZAS_TYPE_BOOLEAN + + +/////////////////////////////////////// +// PLASMA SHIT +/////////////////////////////////////// +// ALL CAPS BECAUSE PLASMA IS HARDCORE YO +// And I'm too lazy to fix the refs. + +/datum/ZAS_Setting/PLASMA_DMG + name = "Plasma Damage Amount" + desc = "Self Descriptive" + value = 3 + valtype=ZAS_TYPE_NUMERIC + +/datum/ZAS_Setting/CLOTH_CONTAMINATION + name = "Cloth Contamination" + desc = "If this is on, plasma does damage by getting into cloth." + value = 1 + valtype=ZAS_TYPE_BOOLEAN + +/datum/ZAS_Setting/PLASMAGUARD_ONLY + name = "PlasmaGuard Only" + desc = "If this is on, only biosuits and spacesuits protect against contamination and ill effects." + value = 0 + valtype=ZAS_TYPE_BOOLEAN + +/datum/ZAS_Setting/GENETIC_CORRUPTION + name = "Genetic Corruption Chance" + desc = "Chance of genetic corruption as well as toxic damage, X in 10,000." + value = 0 + valtype=ZAS_TYPE_BOOLEAN + +/datum/ZAS_Setting/SKIN_BURNS + name = "Skin Burns" + desc = "Plasma has an effect similar to mustard gas on the un-suited." + value = 0 + valtype=ZAS_TYPE_BOOLEAN + +/datum/ZAS_Setting/EYE_BURNS + name = "Eye Burns" + desc = "Plasma burns the eyes of anyone not wearing eye protection." + value = 1 + valtype=ZAS_TYPE_BOOLEAN + +/datum/ZAS_Setting/CONTAMINATION_LOSS + name = "Contamination Loss" + desc = "How much toxin damage is dealt from contaminated clothing" + value = 0.02 //Per tick? ASK ARYN + valtype=ZAS_TYPE_NUMERIC + +/datum/ZAS_Setting/PLASMA_HALLUCINATION + name = "Plasma Hallucination" + desc = "Does being in plasma cause you to hallucinate?" + value = 0 + valtype=ZAS_TYPE_BOOLEAN + +/datum/ZAS_Setting/N2O_HALLUCINATION + name = "N2O Hallucination" + desc = "Does being in sleeping gas cause you to hallucinate?" + value = 1 + valtype=ZAS_TYPE_BOOLEAN + +/** +* ZAS Settings +* +* Stores our settings for ZAS in an editable form. +* @author N3X15 +* @package SS13 +* @subpackage ZAS +*/ +/ZAS_Settings + // INTERNAL USE ONLY + var/list/datum/ZAS_Setting/settings = list() + +/ZAS_Settings/New() + .=..() + for(var/S in typesof(/datum/ZAS_Setting) - /datum/ZAS_Setting) + var/id=idfrompath("[S]") + //testing("Creating zas_settings\[[id]\] = new [S]") + src.settings[id]=new S + + + if(fexists("config/ZAS.txt") == 0) + Save() + Load() + +/ZAS_Settings/proc/Save() + var/F = file("config/ZAS.txt") + fdel(F) + for(var/id in src.settings) + var/datum/ZAS_Setting/setting = src.settings[id] + F << "# [setting.name]" + F << "# [setting.desc]" + F << "[id] [setting.value]" + F << "" + +/ZAS_Settings/proc/Load() + for(var/t in file2list("config/ZAS.txt")) + if(!t) continue + + t = trim(t) + if (length(t) == 0) + continue + else if (copytext(t, 1, 2) == "#") + continue + + var/pos = findtext(t, " ") + var/name = null + var/value = null + + if (pos) + name = copytext(t, 1, pos) + value = copytext(t, pos + 1) + else + name = t + + if (!name) + continue + + src.SetFromConfig(name,value) + +// INTERNAL USE ONLY +/ZAS_Settings/proc/idfrompath(var/str) + return replacetext(str,"/datum/ZAS_Setting/","") + +// INTERNAL USE ONLY +/ZAS_Settings/proc/ChangeSetting(var/user,var/id) + var/datum/ZAS_Setting/setting = src.settings[id] + var/displayedValue="" + switch(setting.valtype) + if(ZAS_TYPE_NUMERIC) + setting.value = input(user,"Enter a number:","Settings",setting.value) as num + displayedValue="\"[setting.value]\"" + /* + if(ZAS_TYPE_BITFLAG) + var/flag = input(user,"Toggle which bit?","Settings") in bitflags + flag = text2num(flag) + if(newvar & flag) + newvar &= ~flag + else + newvar |= flag + */ + if(ZAS_TYPE_BOOLEAN) + setting.value = !setting.value + displayedValue = (setting.value) ? "ON" : "OFF" + /* + if(ZAS_TYPE_STRING) + setting.value = input(user,"Enter text:","Settings",newvar) as message + */ + else + error("[id] has an invalid typeval.") + return + world << "\blue [key_name(user)] changed ZAS setting [setting.name] to [displayedValue]." + + ChangeSettingsDialog(user) + +/** +* Set the value of a setting. +* +* Recommended to use the actual type of the setting rather than the ID, since +* this will allow for the compiler to check the validity of id. Kinda. +* +* @param id Either the typepath of the desired setting, or the string ID of the setting. +* @param value The value that the setting should be set to. +*/ +/ZAS_Settings/proc/Set(var/id, var/value) + var/datum/ZAS_Setting/setting = src.settings[idfrompath(id)] + setting.value=value + +// INTERNAL USE ONLY +/ZAS_Settings/proc/SetFromConfig(var/id, var/value) + var/datum/ZAS_Setting/setting = src.settings[id] + switch(setting.valtype) + if(ZAS_TYPE_NUMERIC) + setting.value = text2num(value) + /* + if(ZAS_TYPE_BITFLAG) + var/flag = input(user,"Toggle which bit?","Settings") in bitflags + flag = text2num(flag) + if(newvar & flag) + newvar &= ~flag + else + newvar |= flag + */ + if(ZAS_TYPE_BOOLEAN) + setting.value = (value == "1") + /* + if(ZAS_TYPE_STRING) + setting.value = input(user,"Enter text:","Settings",newvar) as message + */ + +/** +* Get a setting. +* +* Recommended to use the actual type of the setting rather than the ID, since +* this will allow for the compiler to check the validity of id. Kinda. +* +* @param id Either the typepath of the desired setting, or the string ID of the setting. +* @returns Value of the desired setting +*/ +/ZAS_Settings/proc/Get(var/id) + if(ispath(id)) + id="[id]" + var/datum/ZAS_Setting/setting = src.settings[idfrompath(id)] + if(!setting || !istype(setting)) + world.log << "ZAS_SETTING DEBUG: [id] | [idfrompath(id)]" + return setting.value + +/ZAS_Settings/proc/ChangeSettingsDialog(mob/user) + var/dat = {" + + + ZAS Settings 2.0 + + + +

ZAS Configuration

+

Save Settings | Load Settings

+

Please note that changing these settings can and probably will result in death, destruction and mayhem. Change at your own risk.

+
"} + for(var/id in src.settings) + var/datum/ZAS_Setting/s = src.settings[id] + + // AUTOFIXED BY fix_string_idiocy.py + // C:\Users\Rob\Documents\Projects\vgstation13\code\ZAS\NewSettings.dm:393: dat += "
[s.name] = [s.value] \[Change\]
" + dat += {"
[s.name] = [s.value] \[Change\]
+
[s.desc]
"} + // END AUTOFIX + dat += "
" + user << browse(dat,"window=settings") + +/ZAS_Settings/Topic(href,href_list) + if("changevar" in href_list) + ChangeSetting(usr,href_list["changevar"]) + if("save" in href_list) + var/sure = input(usr,"Are you sure? This will overwrite your ZAS configuration!","Overwrite ZAS.txt?", "No") in list("Yes","No") + if(sure=="Yes") + Save() + message_admins("[key_name(usr)] saved ZAS settings to disk.") + if("load" in href_list) + var/sure = input(usr,"Are you sure?","Reload ZAS.txt?", "No") in list("Yes","No") + if(sure=="Yes") + Load() + message_admins("[key_name(usr)] reloaded ZAS settings from disk.") + +/ZAS_Settings/proc/SetDefault(var/mob/user) + var/list/setting_choices = list("Plasma - Standard", "Plasma - Low Hazard", "Plasma - High Hazard", "Plasma - Oh Shit!", "ZAS - Normal", "ZAS - Forgiving", "ZAS - Dangerous", "ZAS - Hellish") + var/def = input(user, "Which of these presets should be used?") as null|anything in setting_choices + if(!def) + return + switch(def) + if("Plasma - Standard") + Set("CLOTH_CONTAMINATION", 1) //If this is on, plasma does damage by getting into cloth. + Set("PLASMAGUARD_ONLY", 0) + Set("GENETIC_CORRUPTION", 0) //Chance of genetic corruption as well as toxic damage, X in 1000. + Set("SKIN_BURNS", 0) //Plasma has an effect similar to mustard gas on the un-suited. + Set("EYE_BURNS", 1) //Plasma burns the eyes of anyone not wearing eye protection. + Set("PLASMA_HALLUCINATION", 0) + Set("CONTAMINATION_LOSS", 0.02) + + if("Plasma - Low Hazard") + Set("CLOTH_CONTAMINATION", 0) //If this is on, plasma does damage by getting into cloth. + Set("PLASMAGUARD_ONLY", 0) + Set("GENETIC_CORRUPTION", 0) //Chance of genetic corruption as well as toxic damage, X in 1000 + Set("SKIN_BURNS", 0) //Plasma has an effect similar to mustard gas on the un-suited. + Set("EYE_BURNS", 1) //Plasma burns the eyes of anyone not wearing eye protection. + Set("PLASMA_HALLUCINATION", 0) + Set("CONTAMINATION_LOSS", 0.01) + + if("Plasma - High Hazard") + Set("CLOTH_CONTAMINATION", 1) //If this is on, plasma does damage by getting into cloth. + Set("PLASMAGUARD_ONLY", 0) + Set("GENETIC_CORRUPTION", 0) //Chance of genetic corruption as well as toxic damage, X in 1000. + Set("SKIN_BURNS", 1) //Plasma has an effect similar to mustard gas on the un-suited. + Set("EYE_BURNS", 1) //Plasma burns the eyes of anyone not wearing eye protection. + Set("PLASMA_HALLUCINATION", 1) + Set("CONTAMINATION_LOSS", 0.05) + + if("Plasma - Oh Shit!") + Set("CLOTH_CONTAMINATION", 1) //If this is on, plasma does damage by getting into cloth. + Set("PLASMAGUARD_ONLY", 1) + Set("GENETIC_CORRUPTION", 5) //Chance of genetic corruption as well as toxic damage, X in 1000. + Set("SKIN_BURNS", 1) //Plasma has an effect similar to mustard gas on the un-suited. + Set("EYE_BURNS", 1) //Plasma burns the eyes of anyone not wearing eye protection. + Set("PLASMA_HALLUCINATION", 1) + Set("CONTAMINATION_LOSS", 0.075) + + if("ZAS - Normal") + Set("airflow_push", 0) + Set("airflow_lightest_pressure", 20) + Set("airflow_light_pressure", 35) + Set("airflow_medium_pressure", 50) + Set("airflow_heavy_pressure", 65) + Set("airflow_dense_pressure", 85) + Set("airflow_stun_pressure", 60) + Set("airflow_stun_cooldown", 60) + Set("airflow_stun", 1) + Set("airflow_damage", 2) + Set("airflow_speed_decay", 1.5) + Set("airflow_delay", 30) + Set("airflow_mob_slowdown", 1) + + if("ZAS - Forgiving") + Set("airflow_push", 0) + Set("airflow_lightest_pressure", 45) + Set("airflow_light_pressure", 60) + Set("airflow_medium_pressure", 120) + Set("airflow_heavy_pressure", 110) + Set("airflow_dense_pressure", 200) + Set("airflow_stun_pressure", 150) + Set("airflow_stun_cooldown", 90) + Set("airflow_stun", 0.15) + Set("airflow_damage", 0.15) + Set("airflow_speed_decay", 1.5) + Set("airflow_delay", 50) + Set("airflow_mob_slowdown", 0) + + if("ZAS - Dangerous") + Set("airflow_push", 1) + Set("airflow_lightest_pressure", 15) + Set("airflow_light_pressure", 30) + Set("airflow_medium_pressure", 45) + Set("airflow_heavy_pressure", 55) + Set("airflow_dense_pressure", 70) + Set("airflow_stun_pressure", 50) + Set("airflow_stun_cooldown", 50) + Set("airflow_stun", 2) + Set("airflow_damage", 3) + Set("airflow_speed_decay", 1.2) + Set("airflow_delay", 25) + Set("airflow_mob_slowdown", 2) + + if("ZAS - Hellish") + Set("airflow_push", 1) + Set("airflow_lightest_pressure", 20) + Set("airflow_light_pressure", 30) + Set("airflow_medium_pressure", 40) + Set("airflow_heavy_pressure", 50) + Set("airflow_dense_pressure", 60) + Set("airflow_stun_pressure", 40) + Set("airflow_stun_cooldown", 40) + Set("airflow_stun", 3) + Set("airflow_damage", 4) + Set("airflow_speed_decay", 1) + Set("airflow_delay", 20) + Set("airflow_mob_slowdown", 3) + world << "\blue [key_name(usr)] loaded ZAS preset [def]" \ No newline at end of file diff --git a/code/ZAS/Plasma.dm b/code/ZAS/Plasma.dm index 9f0e95f6617..5936f3843b0 100644 --- a/code/ZAS/Plasma.dm +++ b/code/ZAS/Plasma.dm @@ -1,43 +1,5 @@ var/image/contamination_overlay = image('icons/effects/contamination.dmi') -/pl_control - var/PLASMA_DMG = 3 - var/PLASMA_DMG_NAME = "Plasma Damage Amount" - var/PLASMA_DMG_DESC = "Self Descriptive" - - var/CLOTH_CONTAMINATION = 1 - var/CLOTH_CONTAMINATION_NAME = "Cloth Contamination" - var/CLOTH_CONTAMINATION_DESC = "If this is on, plasma does damage by getting into cloth." - - var/PLASMAGUARD_ONLY = 0 - var/PLASMAGUARD_ONLY_NAME = "\"PlasmaGuard Only\"" - var/PLASMAGUARD_ONLY_DESC = "If this is on, only biosuits and spacesuits protect against contamination and ill effects." - - var/GENETIC_CORRUPTION = 0 - var/GENETIC_CORRUPTION_NAME = "Genetic Corruption Chance" - var/GENETIC_CORRUPTION_DESC = "Chance of genetic corruption as well as toxic damage, X in 10,000." - - var/SKIN_BURNS = 0 - var/SKIN_BURNS_DESC = "Plasma has an effect similar to mustard gas on the un-suited." - var/SKIN_BURNS_NAME = "Skin Burns" - - var/EYE_BURNS = 1 - var/EYE_BURNS_NAME = "Eye Burns" - var/EYE_BURNS_DESC = "Plasma burns the eyes of anyone not wearing eye protection." - - var/CONTAMINATION_LOSS = 0.02 - var/CONTAMINATION_LOSS_NAME = "Contamination Loss" - var/CONTAMINATION_LOSS_DESC = "How much toxin damage is dealt from contaminated clothing" //Per tick? ASK ARYN - - var/PLASMA_HALLUCINATION = 0 - var/PLASMA_HALLUCINATION_NAME = "Plasma Hallucination" - var/PLASMA_HALLUCINATION_DESC = "Does being in plasma cause you to hallucinate?" - - var/N2O_HALLUCINATION = 1 - var/N2O_HALLUCINATION_NAME = "N2O Hallucination" - var/N2O_HALLUCINATION_DESC = "Does being in sleeping gas cause you to hallucinate?" - - obj/var/contaminated = 0 @@ -78,21 +40,21 @@ obj/var/contaminated = 0 //Handles all the bad things plasma can do. //Contamination - if(vsc.plc.CLOTH_CONTAMINATION) contaminate() + if(zas_settings.Get(/datum/ZAS_Setting/CLOTH_CONTAMINATION)) contaminate() //Anything else requires them to not be dead. if(stat >= 2) return //Burn skin if exposed. - if(vsc.plc.SKIN_BURNS) + if(zas_settings.Get(/datum/ZAS_Setting/SKIN_BURNS)) if(!pl_head_protected() || !pl_suit_protected()) burn_skin(0.75) if(prob(20)) src << "\red Your skin burns!" updatehealth() //Burn eyes if exposed. - if(vsc.plc.EYE_BURNS) + if(zas_settings.Get(/datum/ZAS_Setting/EYE_BURNS)) if(!head) if(!wear_mask) burn_eyes() @@ -108,8 +70,8 @@ obj/var/contaminated = 0 burn_eyes() //Genetic Corruption - if(vsc.plc.GENETIC_CORRUPTION) - if(rand(1,10000) < vsc.plc.GENETIC_CORRUPTION) + if(zas_settings.Get(/datum/ZAS_Setting/GENETIC_CORRUPTION)) + if(rand(1,10000) < zas_settings.Get(/datum/ZAS_Setting/GENETIC_CORRUPTION)) randmutb(src) src << "\red High levels of toxins cause you to spontaneously mutate." domutcheck(src,null) @@ -128,7 +90,7 @@ obj/var/contaminated = 0 /mob/living/carbon/human/proc/pl_head_protected() //Checks if the head is adequately sealed. if(head) - if(vsc.plc.PLASMAGUARD_ONLY) + if(zas_settings.Get(/datum/ZAS_Setting/PLASMAGUARD_ONLY)) if(head.flags & PLASMAGUARD) return 1 else if(head.flags & HEADCOVERSEYES) @@ -138,7 +100,7 @@ obj/var/contaminated = 0 /mob/living/carbon/human/proc/pl_suit_protected() //Checks if the suit is adequately sealed. if(wear_suit) - if(vsc.plc.PLASMAGUARD_ONLY) + if(zas_settings.Get(/datum/ZAS_Setting/PLASMAGUARD_ONLY)) if(wear_suit.flags & PLASMAGUARD) return 1 else if(wear_suit.flags_inv & HIDEJUMPSUIT) return 1 @@ -154,7 +116,7 @@ obj/var/contaminated = 0 turf/Entered(obj/item/I) . = ..() //Items that are in plasma, but not on a mob, can still be contaminated. - if(istype(I) && vsc.plc.CLOTH_CONTAMINATION) + if(istype(I) && zas_settings.Get(/datum/ZAS_Setting/CLOTH_CONTAMINATION)) var/datum/gas_mixture/env = return_air(1) if(!env) return diff --git a/code/ZAS/Variable Settings.dm b/code/ZAS/Variable Settings.dm index 743eadd3178..09501ffc78a 100644 --- a/code/ZAS/Variable Settings.dm +++ b/code/ZAS/Variable Settings.dm @@ -1,68 +1,75 @@ var/global/vs_control/vsc = new -/vs_control - var/fire_consuption_rate = 0.25 - var/fire_consuption_rate_NAME = "Fire - Air Consumption Ratio" - var/fire_consuption_rate_DESC = "Ratio of air removed and combusted per tick." +// Whoever made this fucking thing: I hate you so much. +vs_control/var + // N3X15 - Added back in so we can tweak performance. + airflow_push = 0 + airflow_push_NAME="Airflow - Push shit around" + airflow_push_DESC="1=yes please rape my server, 0=no" + airflow_push_METHOD="Toggle" // See ChangeSettings(). I'd rather not let people break this. - var/fire_firelevel_multiplier = 25 - var/fire_firelevel_multiplier_NAME = "Fire - Firelevel Constant" - var/fire_firelevel_multiplier_DESC = "Multiplied by the equation for firelevel, affects mainly the extingiushing of fires." + fire_consuption_rate = 0.75 + fire_consuption_rate_NAME = "Fire - Air Consumption Ratio" + fire_consuption_rate_DESC = "Ratio of air removed and combusted per tick." - var/fire_fuel_energy_release = 397000 - var/fire_fuel_energy_release_NAME = "Fire - Fuel energy release" - var/fire_fuel_energy_release_DESC = "The energy in joule released when burning one mol of a burnable substance" + fire_firelevel_multiplier = 25 + fire_firelevel_multiplier_NAME = "Fire - Firelevel Constant" + fire_firelevel_multiplier_DESC = "Multiplied by the equation for firelevel, affects mainly the extingiushing of fires." + + fire_fuel_energy_release = 550000 + fire_fuel_energy_release_NAME = "Fire - Fuel energy release" + fire_fuel_energy_release_DESC = "The energy in joule released when burning one mol of a burnable substance" - var/airflow_lightest_pressure = 20 - var/airflow_lightest_pressure_NAME = "Airflow - Small Movement Threshold %" - var/airflow_lightest_pressure_DESC = "Percent of 1 Atm. at which items with the small weight classes will move." + airflow_lightest_pressure = 20 + airflow_lightest_pressure_NAME = "Airflow - Small Movement Threshold %" + airflow_lightest_pressure_DESC = "Percent of 1 Atm. at which items with the small weight classes will move." - var/airflow_light_pressure = 35 - var/airflow_light_pressure_NAME = "Airflow - Medium Movement Threshold %" - var/airflow_light_pressure_DESC = "Percent of 1 Atm. at which items with the medium weight classes will move." + airflow_light_pressure = 35 + airflow_light_pressure_NAME = "Airflow - Medium Movement Threshold %" + airflow_light_pressure_DESC = "Percent of 1 Atm. at which items with the medium weight classes will move." - var/airflow_medium_pressure = 50 - var/airflow_medium_pressure_NAME = "Airflow - Heavy Movement Threshold %" - var/airflow_medium_pressure_DESC = "Percent of 1 Atm. at which items with the largest weight classes will move." + airflow_medium_pressure = 50 + airflow_medium_pressure_NAME = "Airflow - Heavy Movement Threshold %" + airflow_medium_pressure_DESC = "Percent of 1 Atm. at which items with the largest weight classes will move." - var/airflow_heavy_pressure = 65 - var/airflow_heavy_pressure_NAME = "Airflow - Mob Movement Threshold %" - var/airflow_heavy_pressure_DESC = "Percent of 1 Atm. at which mobs will move." + airflow_heavy_pressure = 65 + airflow_heavy_pressure_NAME = "Airflow - Mob Movement Threshold %" + airflow_heavy_pressure_DESC = "Percent of 1 Atm. at which mobs will move." - var/airflow_dense_pressure = 85 - var/airflow_dense_pressure_NAME = "Airflow - Dense Movement Threshold %" - var/airflow_dense_pressure_DESC = "Percent of 1 Atm. at which items with canisters and closets will move." + airflow_dense_pressure = 85 + airflow_dense_pressure_NAME = "Airflow - Dense Movement Threshold %" + airflow_dense_pressure_DESC = "Percent of 1 Atm. at which items with canisters and closets will move." - var/airflow_stun_pressure = 60 - var/airflow_stun_pressure_NAME = "Airflow - Mob Stunning Threshold %" - var/airflow_stun_pressure_DESC = "Percent of 1 Atm. at which mobs will be stunned by airflow." + airflow_stun_pressure = 60 + airflow_stun_pressure_NAME = "Airflow - Mob Stunning Threshold %" + airflow_stun_pressure_DESC = "Percent of 1 Atm. at which mobs will be stunned by airflow." - var/airflow_stun_cooldown = 60 - var/airflow_stun_cooldown_NAME = "Aiflow Stunning - Cooldown" - var/airflow_stun_cooldown_DESC = "How long, in tenths of a second, to wait before stunning them again." + airflow_stun_cooldown = 60 + airflow_stun_cooldown_NAME = "Aiflow Stunning - Cooldown" + airflow_stun_cooldown_DESC = "How long, in tenths of a second, to wait before stunning them again." - var/airflow_stun = 1 - var/airflow_stun_NAME = "Airflow Impact - Stunning" - var/airflow_stun_DESC = "How much a mob is stunned when hit by an object." + airflow_stun = 1 + airflow_stun_NAME = "Airflow Impact - Stunning" + airflow_stun_DESC = "How much a mob is stunned when hit by an object." - var/airflow_damage = 2 - var/airflow_damage_NAME = "Airflow Impact - Damage" - var/airflow_damage_DESC = "Damage from airflow impacts." + airflow_damage = 2 + airflow_damage_NAME = "Airflow Impact - Damage" + airflow_damage_DESC = "Damage from airflow impacts." - var/airflow_speed_decay = 1.5 - var/airflow_speed_decay_NAME = "Airflow Speed Decay" - var/airflow_speed_decay_DESC = "How rapidly the speed gained from airflow decays." + airflow_speed_decay = 1.5 + airflow_speed_decay_NAME = "Airflow Speed Decay" + airflow_speed_decay_DESC = "How rapidly the speed gained from airflow decays." - var/airflow_delay = 30 - var/airflow_delay_NAME = "Airflow Retrigger Delay" - var/airflow_delay_DESC = "Time in deciseconds before things can be moved by airflow again." + airflow_delay = 30 + airflow_delay_NAME = "Airflow Retrigger Delay" + airflow_delay_DESC = "Time in deciseconds before things can be moved by airflow again." - var/airflow_mob_slowdown = 1 - var/airflow_mob_slowdown_NAME = "Airflow Slowdown" - var/airflow_mob_slowdown_DESC = "Time in tenths of a second to add as a delay to each movement by a mob if they are fighting the pull of the airflow." + airflow_mob_slowdown = 1 + airflow_mob_slowdown_NAME = "Airflow Slowdown" + airflow_mob_slowdown_DESC = "Time in tenths of a second to add as a delay to each movement by a mob if they are fighting the pull of the airflow." - var/connection_insulation = 1 + var/connection_insulation = 0.4 var/connection_insulation_NAME = "Connections - Insulation" var/connection_insulation_DESC = "How insulative a connection is, in terms of heat transfer. 1 is perfectly insulative, and 0 is perfectly conductive." @@ -70,263 +77,264 @@ var/global/vs_control/vsc = new var/connection_temperature_delta_NAME = "Connections - Temperature Difference" var/connection_temperature_delta_DESC = "The smallest temperature difference which will cause heat to travel through doors." +vs_control + var + list/settings = list() + list/bitflags = list("1","2","4","8","16","32","64","128","256","512","1024") // Oh jesus why. Learn to shift bits, you idiots. + pl_control/plc = new() -/vs_control/var/list/settings = list() -/vs_control/var/list/bitflags = list("1","2","4","8","16","32","64","128","256","512","1024") -/vs_control/var/pl_control/plc = new() + New() + . = ..() + settings = vars.Copy() -/vs_control/New() - . = ..() - settings = vars.Copy() - - var/datum/D = new() //Ensure only unique vars are put through by making a datum and removing all common vars. - for(var/V in D.vars) - settings -= V - - for(var/V in settings) - if(findtextEx(V,"_RANDOM") || findtextEx(V,"_DESC") || findtextEx(V,"_METHOD")) + var/datum/D = new() //Ensure only unique vars are put through by making a datum and removing all common vars. + for(var/V in D.vars) settings -= V - settings -= "settings" - settings -= "bitflags" - settings -= "plc" + for(var/V in settings) + if(findtextEx(V,"_RANDOM") || findtextEx(V,"_DESC") || findtextEx(V,"_METHOD")) + settings -= V -/vs_control/proc/ChangeSettingsDialog(mob/user,list/L) - //var/which = input(user,"Choose a setting:") in L - var/dat = "" - for(var/ch in L) - if(findtextEx(ch,"_RANDOM") || findtextEx(ch,"_DESC") || findtextEx(ch,"_METHOD") || findtextEx(ch,"_NAME")) continue + settings -= "settings" + settings -= "bitflags" + settings -= "plc" + + proc/ChangeSettingsDialog(mob/user,list/L) + //var/which = input(user,"Choose a setting:") in L + var/dat = "" + for(var/ch in L) + if(findtextEx(ch,"_RANDOM") || findtextEx(ch,"_DESC") || findtextEx(ch,"_METHOD") || findtextEx(ch,"_NAME")) continue + var/vw + var/vw_desc = "No Description." + var/vw_name = ch + if(ch in plc.settings) + vw = plc.vars[ch] + if("[ch]_DESC" in plc.vars) vw_desc = plc.vars["[ch]_DESC"] + if("[ch]_NAME" in plc.vars) vw_name = plc.vars["[ch]_NAME"] + else + vw = vars[ch] + if("[ch]_DESC" in vars) vw_desc = vars["[ch]_DESC"] + if("[ch]_NAME" in vars) vw_name = vars["[ch]_NAME"] + dat += "[vw_name] = [vw] \[Change\]
" + dat += "[vw_desc]

" + user << browse(dat,"window=settings") + Topic(href,href_list) + if("changevar" in href_list) + ChangeSetting(usr,href_list["changevar"]) + proc/ChangeSetting(mob/user,ch) var/vw - var/vw_desc = "No Description." - var/vw_name = ch + var/how = "Text" + var/display_description = ch if(ch in plc.settings) vw = plc.vars[ch] - if("[ch]_DESC" in plc.vars) vw_desc = plc.vars["[ch]_DESC"] - if("[ch]_NAME" in plc.vars) vw_name = plc.vars["[ch]_NAME"] + if("[ch]_NAME" in plc.vars) + display_description = plc.vars["[ch]_NAME"] + if("[ch]_METHOD" in plc.vars) + how = plc.vars["[ch]_METHOD"] + else + if(isnum(vw)) + how = "Numeric" + else + how = "Text" else vw = vars[ch] - if("[ch]_DESC" in vars) vw_desc = vars["[ch]_DESC"] - if("[ch]_NAME" in vars) vw_name = vars["[ch]_NAME"] - dat += "[vw_name] = [vw] \[Change\]
" - dat += "[vw_desc]

" - user << browse(dat,"window=settings") - -/vs_control/Topic(href,href_list) - if("changevar" in href_list) - ChangeSetting(usr,href_list["changevar"]) - -/vs_control/proc/ChangeSetting(mob/user,ch) - var/vw - var/how = "Text" - var/display_description = ch - if(ch in plc.settings) - vw = plc.vars[ch] - if("[ch]_NAME" in plc.vars) - display_description = plc.vars["[ch]_NAME"] - if("[ch]_METHOD" in plc.vars) - how = plc.vars["[ch]_METHOD"] + if("[ch]_NAME" in vars) + display_description = vars["[ch]_NAME"] + if("[ch]_METHOD" in vars) + how = vars["[ch]_METHOD"] + else + if(isnum(vw)) + how = "Numeric" + else + how = "Text" + var/newvar = vw + switch(how) + if("Numeric") + newvar = input(user,"Enter a number:","Settings",newvar) as num + if("Bit Flag") + var/flag = input(user,"Toggle which bit?","Settings") in bitflags + flag = text2num(flag) + if(newvar & flag) + newvar &= ~flag + else + newvar |= flag + if("Toggle") + newvar = !newvar + if("Text") + newvar = input(user,"Enter a string:","Settings",newvar) as text + if("Long Text") + newvar = input(user,"Enter text:","Settings",newvar) as message + vw = newvar + if(ch in plc.settings) + plc.vars[ch] = vw else - if(isnum(vw)) - how = "Numeric" - else - how = "Text" - else - vw = vars[ch] - if("[ch]_NAME" in vars) - display_description = vars["[ch]_NAME"] - if("[ch]_METHOD" in vars) - how = vars["[ch]_METHOD"] + vars[ch] = vw + if(how == "Toggle") + newvar = (newvar?"ON":"OFF") + world << "\blue [key_name(user)] changed the setting [display_description] to [newvar]." + if(ch in plc.settings) + ChangeSettingsDialog(user,plc.settings) else - if(isnum(vw)) - how = "Numeric" - else - how = "Text" - var/newvar = vw - switch(how) - if("Numeric") - newvar = input(user,"Enter a number:","Settings",newvar) as num - if("Bit Flag") - var/flag = input(user,"Toggle which bit?","Settings") in bitflags - flag = text2num(flag) - if(newvar & flag) - newvar &= ~flag - else - newvar |= flag - if("Toggle") - newvar = !newvar - if("Text") - newvar = input(user,"Enter a string:","Settings",newvar) as text - if("Long Text") - newvar = input(user,"Enter text:","Settings",newvar) as message - vw = newvar - if(ch in plc.settings) - plc.vars[ch] = vw - else - vars[ch] = vw - if(how == "Toggle") - newvar = (newvar?"ON":"OFF") - world << "\blue [key_name(user)] changed the setting [display_description] to [newvar]." - if(ch in plc.settings) - ChangeSettingsDialog(user,plc.settings) - else - ChangeSettingsDialog(user,settings) + ChangeSettingsDialog(user,settings) + proc/RandomizeWithProbability() + for(var/V in settings) + var/newvalue + if("[V]_RANDOM" in vars) + if(isnum(vars["[V]_RANDOM"])) + newvalue = prob(vars["[V]_RANDOM"]) + else if(istext(vars["[V]_RANDOM"])) + newvalue = roll(vars["[V]_RANDOM"]) + else + newvalue = vars[V] + V = newvalue -/vs_control/proc/RandomizeWithProbability() - for(var/V in settings) + proc/ChangePlasma() + for(var/V in plc.settings) + plc.Randomize(V) + + proc/SetDefault(var/mob/user) + var/list/setting_choices = list("Plasma - Standard", "Plasma - Low Hazard", "Plasma - High Hazard", "Plasma - Oh Shit!",\ + "ZAS - Normal", "ZAS - Forgiving", "ZAS - Dangerous", "ZAS - Hellish") + var/def = input(user, "Which of these presets should be used?") as null|anything in setting_choices + if(!def) + return + switch(def) + if("Plasma - Standard") + plc.CLOTH_CONTAMINATION = 1 //If this is on, plasma does damage by getting into cloth. + plc.PLASMAGUARD_ONLY = 0 + plc.GENETIC_CORRUPTION = 0 //Chance of genetic corruption as well as toxic damage, X in 1000. + plc.SKIN_BURNS = 0 //Plasma has an effect similar to mustard gas on the un-suited. + plc.EYE_BURNS = 1 //Plasma burns the eyes of anyone not wearing eye protection. + plc.PLASMA_HALLUCINATION = 0 + plc.CONTAMINATION_LOSS = 0.02 + + if("Plasma - Low Hazard") + plc.CLOTH_CONTAMINATION = 0 //If this is on, plasma does damage by getting into cloth. + plc.PLASMAGUARD_ONLY = 0 + plc.GENETIC_CORRUPTION = 0 //Chance of genetic corruption as well as toxic damage, X in 1000 + plc.SKIN_BURNS = 0 //Plasma has an effect similar to mustard gas on the un-suited. + plc.EYE_BURNS = 1 //Plasma burns the eyes of anyone not wearing eye protection. + plc.PLASMA_HALLUCINATION = 0 + plc.CONTAMINATION_LOSS = 0.01 + + if("Plasma - High Hazard") + plc.CLOTH_CONTAMINATION = 1 //If this is on, plasma does damage by getting into cloth. + plc.PLASMAGUARD_ONLY = 0 + plc.GENETIC_CORRUPTION = 0 //Chance of genetic corruption as well as toxic damage, X in 1000. + plc.SKIN_BURNS = 1 //Plasma has an effect similar to mustard gas on the un-suited. + plc.EYE_BURNS = 1 //Plasma burns the eyes of anyone not wearing eye protection. + plc.PLASMA_HALLUCINATION = 1 + plc.CONTAMINATION_LOSS = 0.05 + + if("Plasma - Oh Shit!") + plc.CLOTH_CONTAMINATION = 1 //If this is on, plasma does damage by getting into cloth. + plc.PLASMAGUARD_ONLY = 1 + plc.GENETIC_CORRUPTION = 5 //Chance of genetic corruption as well as toxic damage, X in 1000. + plc.SKIN_BURNS = 1 //Plasma has an effect similar to mustard gas on the un-suited. + plc.EYE_BURNS = 1 //Plasma burns the eyes of anyone not wearing eye protection. + plc.PLASMA_HALLUCINATION = 1 + plc.CONTAMINATION_LOSS = 0.075 + + if("ZAS - Normal") + airflow_push=0 + airflow_lightest_pressure = 20 + airflow_light_pressure = 35 + airflow_medium_pressure = 50 + airflow_heavy_pressure = 65 + airflow_dense_pressure = 85 + airflow_stun_pressure = 60 + airflow_stun_cooldown = 60 + airflow_stun = 1 + airflow_damage = 2 + airflow_speed_decay = 1.5 + airflow_delay = 30 + airflow_mob_slowdown = 1 + + if("ZAS - Forgiving") + airflow_push=0 + airflow_lightest_pressure = 45 + airflow_light_pressure = 60 + airflow_medium_pressure = 120 + airflow_heavy_pressure = 110 + airflow_dense_pressure = 200 + airflow_stun_pressure = 150 + airflow_stun_cooldown = 90 + airflow_stun = 0.15 + airflow_damage = 0.15 + airflow_speed_decay = 1.5 + airflow_delay = 50 + airflow_mob_slowdown = 0 + + if("ZAS - Dangerous") + airflow_push=1 + airflow_lightest_pressure = 15 + airflow_light_pressure = 30 + airflow_medium_pressure = 45 + airflow_heavy_pressure = 55 + airflow_dense_pressure = 70 + airflow_stun_pressure = 50 + airflow_stun_cooldown = 50 + airflow_stun = 2 + airflow_damage = 3 + airflow_speed_decay = 1.2 + airflow_delay = 25 + airflow_mob_slowdown = 2 + + if("ZAS - Hellish") + airflow_push=1 + airflow_lightest_pressure = 20 + airflow_light_pressure = 30 + airflow_medium_pressure = 40 + airflow_heavy_pressure = 50 + airflow_dense_pressure = 60 + airflow_stun_pressure = 40 + airflow_stun_cooldown = 40 + airflow_stun = 3 + airflow_damage = 4 + airflow_speed_decay = 1 + airflow_delay = 20 + airflow_mob_slowdown = 3 + + + world << "\blue [key_name(user)] changed the global plasma/ZAS settings to \"[def]\"" + +pl_control + var/list/settings = list() + New() + . = ..() + settings = vars.Copy() + + var/datum/D = new() //Ensure only unique vars are put through by making a datum and removing all common vars. + for(var/V in D.vars) + settings -= V + + for(var/V in settings) + if(findtextEx(V,"_RANDOM") || findtextEx(V,"_DESC")) + settings -= V + + settings -= "settings" + proc/Randomize(V) var/newvalue if("[V]_RANDOM" in vars) if(isnum(vars["[V]_RANDOM"])) newvalue = prob(vars["[V]_RANDOM"]) else if(istext(vars["[V]_RANDOM"])) - newvalue = roll(vars["[V]_RANDOM"]) + var/txt = vars["[V]_RANDOM"] + if(findtextEx(txt,"PROB")) + txt = text2list(txt,"/") + txt[1] = replacetext(txt[1],"PROB","") + var/p = text2num(txt[1]) + var/r = txt[2] + if(prob(p)) + newvalue = roll(r) + else + newvalue = vars[V] + else if(findtextEx(txt,"PICK")) + txt = replacetext(txt,"PICK","") + txt = text2list(txt,",") + newvalue = pick(txt) + else + newvalue = roll(txt) else newvalue = vars[V] - V = newvalue - -/vs_control/proc/ChangePlasma() - for(var/V in plc.settings) - plc.Randomize(V) - -/vs_control/proc/SetDefault(var/mob/user) - var/list/setting_choices = list("Plasma - Standard", "Plasma - Low Hazard", "Plasma - High Hazard", "Plasma - Oh Shit!",\ - "ZAS - Normal", "ZAS - Forgiving", "ZAS - Dangerous", "ZAS - Hellish") - var/def = input(user, "Which of these presets should be used?") as null|anything in setting_choices - if(!def) - return - switch(def) - if("Plasma - Standard") - plc.CLOTH_CONTAMINATION = 1 //If this is on, plasma does damage by getting into cloth. - plc.PLASMAGUARD_ONLY = 0 - plc.GENETIC_CORRUPTION = 0 //Chance of genetic corruption as well as toxic damage, X in 1000. - plc.SKIN_BURNS = 0 //Plasma has an effect similar to mustard gas on the un-suited. - plc.EYE_BURNS = 1 //Plasma burns the eyes of anyone not wearing eye protection. - plc.PLASMA_HALLUCINATION = 0 - plc.CONTAMINATION_LOSS = 0.02 - - if("Plasma - Low Hazard") - plc.CLOTH_CONTAMINATION = 0 //If this is on, plasma does damage by getting into cloth. - plc.PLASMAGUARD_ONLY = 0 - plc.GENETIC_CORRUPTION = 0 //Chance of genetic corruption as well as toxic damage, X in 1000 - plc.SKIN_BURNS = 0 //Plasma has an effect similar to mustard gas on the un-suited. - plc.EYE_BURNS = 1 //Plasma burns the eyes of anyone not wearing eye protection. - plc.PLASMA_HALLUCINATION = 0 - plc.CONTAMINATION_LOSS = 0.01 - - if("Plasma - High Hazard") - plc.CLOTH_CONTAMINATION = 1 //If this is on, plasma does damage by getting into cloth. - plc.PLASMAGUARD_ONLY = 0 - plc.GENETIC_CORRUPTION = 0 //Chance of genetic corruption as well as toxic damage, X in 1000. - plc.SKIN_BURNS = 1 //Plasma has an effect similar to mustard gas on the un-suited. - plc.EYE_BURNS = 1 //Plasma burns the eyes of anyone not wearing eye protection. - plc.PLASMA_HALLUCINATION = 1 - plc.CONTAMINATION_LOSS = 0.05 - - if("Plasma - Oh Shit!") - plc.CLOTH_CONTAMINATION = 1 //If this is on, plasma does damage by getting into cloth. - plc.PLASMAGUARD_ONLY = 1 - plc.GENETIC_CORRUPTION = 5 //Chance of genetic corruption as well as toxic damage, X in 1000. - plc.SKIN_BURNS = 1 //Plasma has an effect similar to mustard gas on the un-suited. - plc.EYE_BURNS = 1 //Plasma burns the eyes of anyone not wearing eye protection. - plc.PLASMA_HALLUCINATION = 1 - plc.CONTAMINATION_LOSS = 0.075 - - if("ZAS - Normal") - airflow_lightest_pressure = 20 - airflow_light_pressure = 35 - airflow_medium_pressure = 50 - airflow_heavy_pressure = 65 - airflow_dense_pressure = 85 - airflow_stun_pressure = 60 - airflow_stun_cooldown = 60 - airflow_stun = 1 - airflow_damage = 2 - airflow_speed_decay = 1.5 - airflow_delay = 30 - airflow_mob_slowdown = 1 - - if("ZAS - Forgiving") - airflow_lightest_pressure = 45 - airflow_light_pressure = 60 - airflow_medium_pressure = 120 - airflow_heavy_pressure = 110 - airflow_dense_pressure = 200 - airflow_stun_pressure = 150 - airflow_stun_cooldown = 90 - airflow_stun = 0.15 - airflow_damage = 0.15 - airflow_speed_decay = 1.5 - airflow_delay = 50 - airflow_mob_slowdown = 0 - - if("ZAS - Dangerous") - airflow_lightest_pressure = 15 - airflow_light_pressure = 30 - airflow_medium_pressure = 45 - airflow_heavy_pressure = 55 - airflow_dense_pressure = 70 - airflow_stun_pressure = 50 - airflow_stun_cooldown = 50 - airflow_stun = 2 - airflow_damage = 3 - airflow_speed_decay = 1.2 - airflow_delay = 25 - airflow_mob_slowdown = 2 - - if("ZAS - Hellish") - airflow_lightest_pressure = 20 - airflow_light_pressure = 30 - airflow_medium_pressure = 40 - airflow_heavy_pressure = 50 - airflow_dense_pressure = 60 - airflow_stun_pressure = 40 - airflow_stun_cooldown = 40 - airflow_stun = 3 - airflow_damage = 4 - airflow_speed_decay = 1 - airflow_delay = 20 - airflow_mob_slowdown = 3 - - - world << "\blue [key_name(user)] changed the global plasma/ZAS settings to \"[def]\"" - -/pl_control/var/list/settings = list() - -/pl_control/New() - . = ..() - settings = vars.Copy() - - var/datum/D = new() //Ensure only unique vars are put through by making a datum and removing all common vars. - for(var/V in D.vars) - settings -= V - - for(var/V in settings) - if(findtextEx(V,"_RANDOM") || findtextEx(V,"_DESC")) - settings -= V - - settings -= "settings" - -/pl_control/proc/Randomize(V) - var/newvalue - if("[V]_RANDOM" in vars) - if(isnum(vars["[V]_RANDOM"])) - newvalue = prob(vars["[V]_RANDOM"]) - else if(istext(vars["[V]_RANDOM"])) - var/txt = vars["[V]_RANDOM"] - if(findtextEx(txt,"PROB")) - txt = text2list(txt,"/") - txt[1] = replacetext(txt[1],"PROB","") - var/p = text2num(txt[1]) - var/r = txt[2] - if(prob(p)) - newvalue = roll(r) - else - newvalue = vars[V] - else if(findtextEx(txt,"PICK")) - txt = replacetext(txt,"PICK","") - txt = text2list(txt,",") - newvalue = pick(txt) - else - newvalue = roll(txt) - else - newvalue = vars[V] - vars[V] = newvalue + vars[V] = newvalue diff --git a/code/ZAS/ZAS_Turfs.dm b/code/ZAS/ZAS_Turfs.dm index 04af9a05283..e7f5f4402f8 100644 --- a/code/ZAS/ZAS_Turfs.dm +++ b/code/ZAS/ZAS_Turfs.dm @@ -20,6 +20,15 @@ return GM +// For new turfs +/turf/proc/copy_air_from(var/turf/T) + oxygen = T.oxygen + carbon_dioxide = T.carbon_dioxide + nitrogen = T.nitrogen + toxins = T.toxins + + temperature = T.temperature + /turf/remove_air(amount as num) var/datum/gas_mixture/GM = new @@ -36,14 +45,11 @@ return GM /turf/simulated/var/current_graphic = null - /turf/simulated/var/tmp/datum/gas_mixture/air - /turf/simulated/var/tmp/processing = 1 - /turf/simulated/var/tmp/air_check_directions = 0 //Do not modify this, just add turf to air_master.tiles_to_update - /turf/simulated/var/tmp/obj/fire/active_hotspot +/turf/simulated/var/tmp/was_icy=0 /turf/simulated/proc/update_visuals() overlays = null @@ -51,12 +57,47 @@ var/siding_icon_state = return_siding_icon_state() if(siding_icon_state) overlays += image('icons/turf/floors.dmi',siding_icon_state) + + // ONLY USED IF ZAS_SETTINGS SAYS SO. var/datum/gas_mixture/model = return_air() - switch(model.graphic) - if(1) - overlays.Add(plmaster) //TODO: Make invisible plasma an option - if(2) - overlays.Add(slmaster) + if(model.graphics & GRAPHICS_COLD) + if(!was_icy) + wet=3 // Custom ice + was_icy=1 + var/o="" + //if(is_plating()) + // o="snowfloor_s" + //else + if(is_plasteel_floor()) + o="snowfloor" + if(o!="") + overlays += image('icons/turf/overlays.dmi',o) + else + if(was_icy) + wet=0 + was_icy=0 + if(prob(10)) + wet = 1 + if(wet_overlay) + overlays -= wet_overlay + wet_overlay = null + wet_overlay = image('icons/effects/water.dmi',src,"wet_floor") + overlays += wet_overlay + + spawn(800) + if (!istype(src)) return + if(wet >= 2) return + wet = 0 + if(wet_overlay) + overlays -= wet_overlay + wet_overlay = null + if(model.graphics & GRAPHICS_PLASMA) + overlays.Add(plmaster) + if(model.graphics & GRAPHICS_N2O) + overlays.Add(slmaster) + //if(model.graphics & GRAPHICS_REAGENTS) + // overlays.Add(slmaster/*rlmaster*/) + /turf/simulated/New() ..() @@ -92,6 +133,12 @@ air_master.tiles_to_update.Add(tile) ..() +/turf/simulated/copy_air_from(var/turf/T) + //if(istype(T,/turf/simulated)) + // var/turf/simulated/ST=T + // air=ST.air + air=T.return_air() + /turf/simulated/assume_air(datum/gas_mixture/giver) if(!giver) return 0 if(zone) @@ -113,6 +160,8 @@ if(zone) var/datum/gas_mixture/removed = null removed = zone.air.remove(amount) + if(zone.air.check_tile_graphic()) + update_visuals(zone.air) return removed else if(air) var/datum/gas_mixture/removed = null @@ -162,6 +211,8 @@ air_master.connections_to_check |= C if(zone && !zone.rebuild) + if(zone.air.check_tile_graphic()) + update_visuals(zone.air) for(var/direction in cardinal) var/turf/T = get_step(src,direction) if(!istype(T)) diff --git a/code/ZAS/ZAS_Zones.dm b/code/ZAS/ZAS_Zones.dm index 860f57cd370..c538a6c7c2a 100644 --- a/code/ZAS/ZAS_Zones.dm +++ b/code/ZAS/ZAS_Zones.dm @@ -170,7 +170,7 @@ var/list/CounterDoorDirections = list(SOUTH,EAST) //Which directions doors turfs if(unsimulated_tiles.len) var/moved_air = ShareSpace(air,unsimulated_tiles) - if(moved_air > vsc.airflow_lightest_pressure) + if(moved_air > zas_settings.Get(/datum/ZAS_Setting/airflow_lightest_pressure)) AirflowSpace(src) else unsimulated_tiles = null @@ -178,24 +178,28 @@ var/list/CounterDoorDirections = list(SOUTH,EAST) //Which directions doors turfs //Check the graphic. progress = "problem with: modifying turf graphics" - air.graphic = 0 + air.graphics = 0 if(air.toxins > MOLES_PLASMA_VISIBLE) - air.graphic = 1 - else if(air.trace_gases.len) + air.graphics |= GRAPHICS_PLASMA + if(air.trace_gases.len) var/datum/gas/sleeping_agent = locate(/datum/gas/sleeping_agent) in air.trace_gases if(sleeping_agent && (sleeping_agent.moles > 1)) - air.graphic = 2 + air.graphics |= GRAPHICS_N2O + // If configured and cold, maek ice + if(zas_settings.Get(/datum/ZAS_Setting/ice_formation)) + if(air.temperature <= TEMPERATURE_ICE_FORMATION && air.return_pressure()>MIN_PRESSURE_ICE_FORMATION) + air.graphics |= GRAPHICS_COLD progress = "problem with an inbuilt byond function: some conditional checks" //Only run through the individual turfs if there's reason to. - if(air.graphic != air.graphic_archived || air.temperature > PLASMA_FLASHPOINT) + if(air.graphics != air.graphics_archived || air.temperature > PLASMA_FLASHPOINT) progress = "problem with: turf/simulated/update_visuals()" for(var/turf/simulated/S in contents) //Update overlays. - if(air.graphic != air.graphic_archived) + if(air.graphics != air.graphics_archived) if(S.HasDoor(1)) S.update_visuals() else @@ -212,7 +216,7 @@ var/list/CounterDoorDirections = list(SOUTH,EAST) //Which directions doors turfs progress = "problem with: calculating air graphic" //Archive graphic so we can know if it's different. - air.graphic_archived = air.graphic + air.graphics_archived = air.graphics progress = "problem with: calculating air temp" @@ -252,7 +256,7 @@ var/list/CounterDoorDirections = list(SOUTH,EAST) //Which directions doors turfs //Ensure we're not doing pointless calculations on equilibrium zones. var/moles_delta = abs(air.total_moles() - Z.air.total_moles()) if(moles_delta > 0.1 || abs(air.temperature - Z.air.temperature) > 0.1) - if(abs(Z.air.return_pressure() - air.return_pressure()) > vsc.airflow_lightest_pressure) + if(abs(Z.air.return_pressure() - air.return_pressure()) > zas_settings.Get(/datum/ZAS_Setting/airflow_lightest_pressure)) Airflow(src,Z) var/unsimulated_boost = 0 if(unsimulated_tiles) @@ -267,7 +271,7 @@ var/list/CounterDoorDirections = list(SOUTH,EAST) //Which directions doors turfs if(Z.last_update > last_update) continue if(air && Z.air) - if( abs(air.temperature - Z.air.temperature) > vsc.connection_temperature_delta ) + if( abs(air.temperature - Z.air.temperature) > zas_settings.Get(/datum/ZAS_Setting/connection_temperature_delta) ) ShareHeat(air, Z.air, closed_connection_zones[Z]) progress = "all components completed successfully, the problem is not here" @@ -412,7 +416,10 @@ proc/ShareSpace(datum/gas_mixture/A, list/unsimulated_tiles, dbg_output) A.carbon_dioxide = max(0, (A.carbon_dioxide - co2_avg) * (1 - ratio) + co2_avg ) A.toxins = max(0, (A.toxins - plasma_avg) * (1 - ratio) + plasma_avg ) - A.temperature = max(TCMB, (A.temperature - temp_avg) * (1 - ratio) + temp_avg ) + // EXPERIMENTAL: Disable space being cold + // N3X: Made this togglable for Pomf. Comment recovered from older code. + if(!zas_settings.Get(/datum/ZAS_Setting/space_isnt_cold)) + A.temperature = max(TCMB, (A.temperature - temp_avg) * (1 - ratio) + temp_avg ) for(var/datum/gas/G in A.trace_gases) var/G_avg = (G.moles * size) / (size + share_size) @@ -442,7 +449,7 @@ proc/ShareHeat(datum/gas_mixture/A, datum/gas_mixture/B, connecting_tiles) //WOOT WOOT TOUCH THIS AND YOU ARE A RETARD //We need to adjust it to account for the insulation settings. - ratio *= 1 - vsc.connection_insulation + ratio *= 1 - zas_settings.Get(/datum/ZAS_Setting/connection_insulation) A.temperature = max(0, (A.temperature - temp_avg) * (1- (ratio / max(1,A.group_multiplier)) ) + temp_avg ) B.temperature = max(0, (B.temperature - temp_avg) * (1- (ratio / max(1,B.group_multiplier)) ) + temp_avg ) diff --git a/icons/obj/atmospherics/cold_sink.dmi b/icons/obj/atmospherics/cold_sink.dmi index 09f9be43514..e36d5ceb96c 100644 Binary files a/icons/obj/atmospherics/cold_sink.dmi and b/icons/obj/atmospherics/cold_sink.dmi differ diff --git a/icons/obj/atmospherics/red_pipe.dmi b/icons/obj/atmospherics/red_pipe.dmi index ff9d9e8a59a..7276674e25d 100644 Binary files a/icons/obj/atmospherics/red_pipe.dmi and b/icons/obj/atmospherics/red_pipe.dmi differ diff --git a/icons/obj/atmospherics/vent_scrubber.dmi b/icons/obj/atmospherics/vent_scrubber.dmi index 83536121c49..b828539004a 100644 Binary files a/icons/obj/atmospherics/vent_scrubber.dmi and b/icons/obj/atmospherics/vent_scrubber.dmi differ diff --git a/icons/obj/pipes/heat.dmi b/icons/obj/pipes/heat.dmi index 6d1ed47e7ef..8561b016807 100644 Binary files a/icons/obj/pipes/heat.dmi and b/icons/obj/pipes/heat.dmi differ diff --git a/icons/obj/pipes/junction.dmi b/icons/obj/pipes/junction.dmi index 70286bde155..0424ceecb81 100644 Binary files a/icons/obj/pipes/junction.dmi and b/icons/obj/pipes/junction.dmi differ