diff --git a/code/game/machinery/poolcontroller.dm b/code/game/machinery/poolcontroller.dm index 6a865e923eb..f9898a3de00 100644 --- a/code/game/machinery/poolcontroller.dm +++ b/code/game/machinery/poolcontroller.dm @@ -8,30 +8,27 @@ var/temperature = "normal" //The temperature of the pool, starts off on normal, which has no effects. var/temperaturecolor = "" //used for nanoUI fancyness var/srange = 5 //The range of the search for pool turfs, change this for bigger or smaller pools. - var/linkedmist = list() //Used to keep track of created mist - var/misted = 0 //Used to check for mist. + var/list/linkedmist = list() //Used to keep track of created mist + /obj/machinery/poolcontroller/New() //This proc automatically happens on world start for(var/turf/simulated/floor/beach/water/W in range(srange,src)) //Search for /turf/simulated/floor/beach/water in the range of var/srange - src.linkedturfs += W //Add found pool turfs to the central list. + linkedturfs += W //Add found pool turfs to the central list. ..() //Changed to call parent as per MarkvA's recommendation /obj/machinery/poolcontroller/emag_act(user as mob) //Emag_act, this is called when it is hit with a cryptographic sequencer. if(!emagged) //If it is not already emagged, emag it. - user << "\red You disable \the [src]'s temperature safeguards." //Inform the mob of what emagging does. + user << "You disable \the [src]'s temperature safeguards." //Inform the mob of what emagging does. emagged = 1 //Set the emag var to true. /obj/machinery/poolcontroller/attackby(obj/item/P as obj, mob/user as mob, params) //Proc is called when a user hits the pool controller with something. - if(istype(P,/obj/item/device/multitool)) //If the mob hits the pool controller with a multitool, reset the emagged status if(emagged) //Check the emag status - user << "\red You re-enable \the [src]'s temperature safeguards." //Inform the user that they have just fixed the safeguards. + user << "You re-enable \the [src]'s temperature safeguards." //Inform the user that they have just fixed the safeguards. emagged = 0 //Set the emagged var to false. - return else - user << "\red Nothing happens." //If not emagged, don't do anything, and don't tell the user that it can be emagged. + user << "Nothing happens." //If not emagged, don't do anything, and don't tell the user that it can be emagged. - return //Return, nothing else needs to be done. else //If it's not a multitool, defer to /obj/machinery/attackby ..() @@ -51,18 +48,14 @@ continue if(isobserver(M)) continue + if(M.stat == DEAD) + continue //End sanity checks, go on switch(temperature) //Apply different effects based on what the temperature is set to. if("scalding") //Burn the mob. M.bodytemperature = min(500, M.bodytemperature + 35) //heat mob at 35k(elvin) per cycle M << "The water is searing hot!" - if("frigid") //Freeze the mob. - M.bodytemperature = max(80, M.bodytemperature - 35) //cool mob at -35k per cycle - M << "The water is freezing!" - - if("normal") //Normal temp does nothing, because it's just room temperature water. - if("warm") //Gently warm the mob. M.bodytemperature = min(330, M.bodytemperature + 10) //Heats up mobs to just over normal, not enough to burn if(prob(50)) //inform the mob of warm water half the time @@ -73,22 +66,30 @@ if(prob(50)) //inform the mob of cold water half the time M << "The water is chilly." //Inform the mob it's chilly water. + if("frigid") //Freeze the mob. + M.bodytemperature = max(80, M.bodytemperature - 35) //cool mob at -35k per cycle + M << "The water is freezing!" + + if(ishuman(M)) //Make sure they are human before typecasting. var/mob/living/carbon/human/drownee = M //Typecast them as human. - if(drownee.stat == DEAD) //Check stat, if they are dead, ignore them. - continue - if(drownee && drownee.lying && !drownee.internal && !(drownee.species.flags & NO_BREATHE) && !(drownee.species.name == "Skrell" || drownee.species.name =="Neara") && !(NO_BREATH in drownee.mutations)) - //Establish that there is a mob, the mob is lying down, has no internals, species does breathe, is not a skrell/neara, and does not have NO_BREATHE - if(drownee.stat != CONSCIOUS) //Mob is in critical. + if(drownee && drownee.lying) //Mob lying down + if(drownee.internal) + continue //Has internals, no drowning + if((drownee.species.flags & NO_BREATHE) || (NO_BREATHE in drownee.mutations)) + continue //doesn't breathe, no drowning + if(drownee.get_species() == "Skrell" || drownee.get_species() == "Neara") + continue //fish things don't drown + + if(drownee.stat) //Mob is in critical. drownee.adjustOxyLoss(9) //Kill em quickly. add_logs(drownee, src, "drowned") drownee.visible_message("\The [drownee] appears to be drowning!","You're quickly drowning!") //inform them that they are fucked. else - if(!drownee.internal) //double check they have no internals, just in case. - drownee.adjustOxyLoss(5) //5 oxyloss per cycle. - add_logs(drownee, src, "drowned") - if(prob(35)) //35% chance to tell them what is going on. They should probably figure it out before then. - drownee.visible_message("\The [drownee] flails, almost like they are drowning!","You're lacking air!") //*gasp* *gasp* *gasp* *gasp* *gasp* + drownee.adjustOxyLoss(5) //5 oxyloss per cycle. + add_logs(drownee, src, "drowned") + if(prob(35)) //35% chance to tell them what is going on. They should probably figure it out before then. + drownee.visible_message("\The [drownee] flails, almost like they are drowning!","You're lacking air!") //*gasp* *gasp* *gasp* *gasp* *gasp* for(var/obj/effect/decal/cleanable/decal in W) animate(decal, alpha = 10, time = 20) @@ -96,23 +97,23 @@ qdel(decal) /obj/machinery/poolcontroller/proc/miston() //Spawn /obj/effect/mist (from the shower) on all linked pool tiles + if(linkedmist.len) + return + for(var/turf/simulated/floor/beach/water/W in linkedturfs) var/M = new /obj/effect/mist(W) - if(misted) - return linkedmist += M - misted = 1 //var just to keep track of when the mist on proc has been called. - /obj/machinery/poolcontroller/proc/mistoff() //Delete all /obj/effect/mist from all linked pool tiles. for(var/obj/effect/mist/M in linkedmist) qdel(M) - misted = 0 //no mist left, turn off the tracking var + linkedmist.Cut() + /obj/machinery/poolcontroller/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) var/data[0] - data["currentTemp"] = capitalize(src.temperature) + data["currentTemp"] = temperature data["emagged"] = emagged data["TempColor"] = temperaturecolor @@ -122,33 +123,36 @@ ui.set_initial_data(data) ui.open() + + /obj/machinery/poolcontroller/Topic(href, href_list) - if(..()) return 1 + if(..()) + return 1 switch(href_list["temp"]) if("Scalding") - if(!src.emagged) + if(!emagged) return 0 - src.temperature = "scalding" - src.temperaturecolor = "#FF0000" + temperature = "scalding" + temperaturecolor = "#FF0000" miston() if("Frigid") - if(!src.emagged) + if(!emagged) return 0 - src.temperature = "frigid" - src.temperaturecolor = "#00CCCC" + temperature = "frigid" + temperaturecolor = "#00CCCC" mistoff() if("Warm") - src.temperature = "warm" - src.temperaturecolor = "#990000" + temperature = "warm" + temperaturecolor = "#990000" mistoff() if("Cool") - src.temperature = "cool" - src.temperaturecolor = "#009999" + temperature = "cool" + temperaturecolor = "#009999" mistoff() if("Normal") - src.temperature = "normal" - src.temperaturecolor = "" + temperature = "normal" + temperaturecolor = "" mistoff() return 1 \ No newline at end of file diff --git a/nano/js/nano_base_helpers.js b/nano/js/nano_base_helpers.js index 40c6b6077e5..28a41518010 100644 --- a/nano/js/nano_base_helpers.js +++ b/nano/js/nano_base_helpers.js @@ -102,6 +102,10 @@ NanoBaseHelpers = function () parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); return parts.join("."); }, + // Capitalize the first letter of a string. From http://stackoverflow.com/questions/1026069/capitalize-the-first-letter-of-string-in-javascript + capitalizeFirstLetter: function(string) { + return string.charAt(0).toUpperCase() + string.slice(1); + }, // Display a bar. Used to show health, capacity, etc. displayBar: function(value, rangeMin, rangeMax, styleClass, showText) { diff --git a/nano/templates/poolcontroller.tmpl b/nano/templates/poolcontroller.tmpl index 246542107a2..7f24546e4b2 100644 --- a/nano/templates/poolcontroller.tmpl +++ b/nano/templates/poolcontroller.tmpl @@ -7,39 +7,49 @@ Used In File(s): \code\game\machinery\poolcontroller.dm Current Temperature:
- {{:data.currentTemp}} + {{:helper.capitalizeFirstLetter(data.currentTemp)}}
+
+
+ Saftey Status: +
{{if data.emagged}} - WARNING: SAFE MODE OVERRIDE + WARNING: OVERRIDDEN {{else}} - Safeties Nominal + Nominal {{/if}}
+
Temperature Selection:
+ {{if data.emagged}}
- {{:helper.link('Scalding', 'circle-arrow-n', { 'temp' : 'Scalding' })}} + {{:helper.link('Scalding', 'circle-arrow-n', { 'temp' : 'Scalding' }, data.currentTemp == "scalding" ? 'selected' : null)}}
{{/if}} +
- {{:helper.link('Warm', 'circle-arrow-n', { 'temp' : 'Warm' })}} + {{:helper.link('Warm', 'circle-arrow-n', { 'temp' : 'Warm' }, data.currentTemp == "warm" ? 'selected' : null)}}
+
- {{:helper.link('Normal', 'circle-arrow-e', { 'temp' : 'Normal' })}} + {{:helper.link('Normal', 'circle-arrow-e', { 'temp' : 'Normal' }, data.currentTemp == "normal" ? 'selected' : null)}}
+
- {{:helper.link('Cool', 'circle-arrow-s', { 'temp' : 'Cool' })}} + {{:helper.link('Cool', 'circle-arrow-s', { 'temp' : 'Cool' }, data.currentTemp == "cool" ? 'selected' : null)}}
+ {{if data.emagged}}
- {{:helper.link('Frigid', 'circle-arrow-s', { 'temp' : 'Frigid' })}} + {{:helper.link('Frigid', 'circle-arrow-s', { 'temp' : 'Frigid' }, data.currentTemp == "frigid" ? 'selected' : null)}}
{{/if}}
\ No newline at end of file