Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Atmos update #1223

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions code/__DEFINES/atmospherics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -352,3 +352,6 @@ GLOBAL_LIST_INIT(pipe_paint_colors, list(
"violet" = rgb(64,0,128),
"yellow" = rgb(255,198,0)
))

#define AIR_REF_PLANETARY_TURF (1<<0) //SIMULATION_DIFFUSE 0b1
#define AIR_REF_OPEN_TURF (1<<1) //SIMULATION_ALL 0b10
2 changes: 2 additions & 0 deletions code/__SANDCODE/DEFINES/chat.dm
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/// Adds a generic box around whatever message you're sending in chat. Really makes things stand out.
#define examine_block(str) ("<div class='examine_block'>" + str + "</div>")

#define MESSAGE_TYPE_INFO "info"
4 changes: 4 additions & 0 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1590,3 +1590,7 @@
else
//We inline a MAPTEXT() here, because there's no good way to statically add to a string like this
active_hud.screentip_text.maptext = "<span class='context' style='text-align: center; color: [user.client.prefs.screentip_color]'>[name][extra_context]</span>"

///Return the air if we can analyze it
/atom/proc/return_analyzable_air()
return null
2 changes: 1 addition & 1 deletion code/game/gamemodes/clown_ops/clown_weapons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
..()
slipper.signal_enabled = active

/obj/item/shield/energy/bananium/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback)
/obj/item/shield/energy/bananium/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback, quickstart = TRUE)
if(active)
if(iscarbon(thrower))
var/mob/living/carbon/C = thrower
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
playsound(src, drop_sound, YEET_SOUND_VOLUME, ignore_walls = FALSE)
return hit_atom.hitby(src, 0, itempush, throwingdatum=throwingdatum)

/obj/item/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback, force, messy_throw = TRUE)
/obj/item/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback, force, messy_throw = TRUE, quickstart = TRUE)
thrownby = WEAKREF(thrower)
callback = CALLBACK(src, PROC_REF(after_throw), callback, (spin && messy_throw)) //replace their callback with our own
. = ..(target, range, speed, thrower, spin, diagonals_first, callback, force)
Expand Down Expand Up @@ -1077,7 +1077,7 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
dropped(M)
return ..()

/obj/item/throw_at(atom/target, range, speed, mob/thrower, spin=TRUE, diagonals_first = FALSE, var/datum/callback/callback)
/obj/item/throw_at(atom/target, range, speed, mob/thrower, spin=TRUE, diagonals_first = FALSE, var/datum/callback/callback, quickstart = TRUE)
if (HAS_TRAIT(src, TRAIT_NODROP))
return
return ..()
Expand Down
46 changes: 24 additions & 22 deletions code/game/objects/items/devices/scanners.dm
Original file line number Diff line number Diff line change
Expand Up @@ -725,16 +725,21 @@ GENETICS SCANNER
amount += inaccurate
return DisplayTimeText(max(1,amount))

/proc/atmosanalyzer_scan(mixture, mob/living/user, atom/target = src, visible = TRUE)
/proc/atmosanalyzer_scan(mixture, mob/living/user, atom/target = src, silent = FALSE)
mixture = target.return_analyzable_air()
if(!mixture)
return FALSE

var/icon = target
if(visible)
user.visible_message("[user] has used the analyzer on [icon2html(icon, viewers(user))] [target].", "<span class='notice'>You use the analyzer on [icon2html(icon, user)] [target].</span>")
var/results = "<span class='boldnotice'>Results of analysis of [icon2html(icon, user)] [target].</span>"
var/render_list = list()
if(!silent && isliving(user))
user.visible_message("<span class='notice'>[user] uses the analyzer on [icon2html(icon, viewers(user))] [target].</span>", "<span class='notice'>You use the analyzer on [icon2html(icon, user)] [target].</span>")
render_list += "<span class='boldnotice'>Results of analysis of [icon2html(icon, user)] [target].</span>"

var/list/airs = islist(mixture) ? mixture : list(mixture)
for(var/g in airs)
if(airs.len > 1) //not a unary gas mixture
results += "\n<span class='boldnotice'>Node [airs.Find(g)]</span>"
render_list += "<span class='boldnotice'>Node [airs.Find(g)]</span>"
var/datum/gas_mixture/air_contents = g

var/total_moles = air_contents.total_moles()
Expand All @@ -744,30 +749,27 @@ GENETICS SCANNER
var/cached_scan_results = air_contents.analyzer_results

if(total_moles > 0)
results += "\n<span class='notice'>Moles: [round(total_moles, 0.01)] mol</span>"
results += "\n<span class='notice'>Volume: [volume] L</span>"
results += "\n<span class='notice'>Pressure: [round(pressure,0.01)] kPa</span>"
//WS Start -- Atmos Analyzer Reformat (Issue #419)
render_list += "<span class='notice'>Moles: [round(total_moles, 0.01)] mol</span>\
\n<span class='notice'>Volume: [volume] L</span>\
\n<span class='notice'>Pressure: [round(pressure,0.01)] kPa</span>\
\n<span class='notice'>Temperature: [round(temperature - T0C,0.01)] &deg;C ([round(temperature, 0.01)] K)</span>"
//WS End

for(var/id in air_contents.get_gases())
if(air_contents.get_moles(id) >= 0.005)
var/gas_concentration = air_contents.get_moles(id)/total_moles
results += "\n<span class='notice'>[GLOB.gas_data.names[id]]: [round(gas_concentration*100, 0.01)] % ([round(air_contents.get_moles(id), 0.01)] mol)</span>"
results += "\n<span class='notice'>Temperature: [round(temperature - T0C,0.01)] &deg;C ([round(temperature, 0.01)] K)</span>"
var/gas_concentration = air_contents.get_moles(id)/total_moles
render_list += "<span class='notice'>[GLOB.gas_data.names[id]]: [round(gas_concentration*100, 0.01)] % ([round(air_contents.get_moles(id), 0.01)] mol)</span>" //WS Edit -- Atmos Analyzer Reformat (Issue #419)

else
if(airs.len > 1)
results += "\n<span class='notice'>This node is empty!</span>"
else
results += "\n<span class='notice'>[target] is empty!</span>"
render_list += airs.len > 1 ? "<span class='notice'>This node is empty!</span>" : "<span class='notice'>[target] is empty!</span>"

if(cached_scan_results && cached_scan_results["fusion"]) //notify the user if a fusion reaction was detected
var/instability = round(cached_scan_results["fusion"], 0.01)
var/tier = instability2text(instability)
results += "\n<span class='boldnotice'>Large amounts of free neutrons detected in the air indicate that a fusion reaction took place.</span>"
results += "\n<span class='notice'>Instability of the last fusion reaction: [instability]\n This indicates it was [tier]</span>"
render_list += "<span class='boldnotice'>Large amounts of free neutrons detected in the air indicate that a fusion reaction took place.</span>\
\n<span class='notice'>Instability of the last fusion reaction: [round(cached_scan_results["fusion"], 0.01)].</span>"

to_chat(user, examine_block(results))
return
// we let the join apply newlines so we do need handholding
to_chat(user, examine_block(jointext(render_list, "\n")), type = MESSAGE_TYPE_INFO)
return TRUE

/obj/item/analyzer/proc/scan_turf(mob/user, turf/location)

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/handcuffs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@
gender = NEUTER
var/knockdown = 0

/obj/item/restraints/legcuffs/bola/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback)
/obj/item/restraints/legcuffs/bola/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback, quickstart = TRUE)
if(!..())
return
playsound(src.loc,'sound/weapons/bolathrow.ogg', 75, 1)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/stunbaton.dm
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@
throw_hit_chance = 99 //Have you prayed today?
custom_materials = list(/datum/material/iron = 10000, /datum/material/glass = 4000, /datum/material/silver = 10000, /datum/material/gold = 2000)

/obj/item/melee/baton/boomerang/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback, force)
/obj/item/melee/baton/boomerang/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback, force, quickstart = TRUE)
if(turned_on)
if(ishuman(thrower))
var/mob/living/carbon/human/H = thrower
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/tanks/tanks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@
/obj/item/tank/return_air()
return air_contents

// /obj/item/tank/return_analyzable_air()
// return air_contents
/obj/item/tank/return_analyzable_air()
return air_contents

/obj/item/tank/assume_air(datum/gas_mixture/giver)
air_contents.merge(giver)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/objs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
/obj/proc/setAnchored(anchorvalue)
set_anchored(anchorvalue)

/obj/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback, force, messy_throw = TRUE)
/obj/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback, force, messy_throw = TRUE, quickstart = TRUE)
. = ..()
if(obj_flags & FROZEN)
visible_message("<span class='danger'>[src] shatters into a million pieces!</span>")
Expand Down
6 changes: 3 additions & 3 deletions code/game/objects/structures/crates_lockers/crates/critter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
if(manifest)
. += "manifest"

/obj/structure/closet/crate/critter/return_air()
/obj/structure/closet/crate/critter/return_analyzable_air()
if(tank)
return tank.air_contents
return tank.return_analyzable_air()
else
return loc.return_air()
return null
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@
/obj/structure/transit_tube_pod/return_air()
return air_contents

/obj/structure/transit_tube_pod/return_analyzable_air()
return air_contents

/obj/structure/transit_tube_pod/assume_air(datum/gas_mixture/giver)
return air_contents.merge(giver)

Expand Down
1 change: 0 additions & 1 deletion code/game/world.dm
Original file line number Diff line number Diff line change
Expand Up @@ -398,4 +398,3 @@ GLOBAL_LIST(topic_status_cache)
var/init_result = call_ext(library, "init")("block")
if (init_result != "0")
CRASH("Error initializing byond-tracy: [init_result]")

6 changes: 6 additions & 0 deletions code/modules/assembly/bomb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,9 @@
return
T.assume_air(air_contents)
air_update_turf()

/obj/item/onetankbomb/return_analyzable_air()
if(bombtank)
return bombtank.return_analyzable_air()
else
return null
26 changes: 19 additions & 7 deletions code/modules/atmospherics/environmental/LINDA_fire.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@


/turf/open/hotspot_expose(exposed_temperature, exposed_volume, soh)
if(!air)
//If the air doesn't exist we just return false
var/list/air_gases = air?.get_gases()
if(!air_gases)
return

if (air.get_oxidation_power(exposed_temperature) < 0.5 || air.get_moles(GAS_HYPERNOB) > 5)
Expand All @@ -35,9 +37,11 @@
icon = 'icons/effects/fire.dmi'
icon_state = "1"
layer = GASFIRE_LAYER
blend_mode = BLEND_ADD
// light_system = MOVABLE_LIGHT
light_range = LIGHT_RANGE_FIRE
light_power = 1
light_color = LIGHT_COLOR_FIRE
blend_mode = BLEND_ADD

var/volume = 125
var/temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST
Expand All @@ -55,22 +59,30 @@
setDir(pick(GLOB.cardinals))
air_update_turf()

var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = PROC_REF(on_entered),
)
AddElement(/datum/element/connect_loc, loc_connections)

/obj/effect/hotspot/proc/perform_exposure()
var/turf/open/location = loc
if(!istype(location) || !(location.air))
return

location.active_hotspot = src

bypassing = volume > CELL_VOLUME*0.95
bypassing = volume > CELL_VOLUME*0.95 || location.air.return_temperature() >= FUSION_TEMPERATURE_THRESHOLD

if(bypassing)
if(temperature > location.air.return_temperature())
location.air.set_temperature(temperature) //now actually starts fires like intended
volume = location.air.reaction_results["fire"]*FIRE_GROWTH_RATE
temperature = location.air.return_temperature()
else
var/datum/gas_mixture/affected = location.air.remove_ratio(volume/location.air.return_volume())
if(affected) //in case volume is 0
affected.set_temperature(temperature)
if(temperature > affected.return_temperature())
affected.set_temperature(temperature) //don't set the temperature lower than what it was
affected.react(src)
temperature = affected.return_temperature()
volume = affected.reaction_results["fire"]*FIRE_GROWTH_RATE
Expand Down Expand Up @@ -131,7 +143,7 @@
add_overlay(fusion_overlay)
add_overlay(rainbow_overlay)

set_light(l_color = rgb(LERP(250,heat_r,greyscale_fire),LERP(160,heat_g,greyscale_fire),LERP(25,heat_b,greyscale_fire)))
set_light_color(rgb(LERP(250, heat_r, greyscale_fire), LERP(160, heat_g, greyscale_fire), LERP(25, heat_b, greyscale_fire)))

heat_r /= 255
heat_g /= 255
Expand Down Expand Up @@ -210,8 +222,8 @@
T.to_be_destroyed = FALSE
T.max_fire_temperature_sustained = 0

/obj/effect/hotspot/Crossed(atom/movable/AM, oldLoc)
..()
/obj/effect/hotspot/proc/on_entered(datum/source, atom/movable/AM, oldLoc)
SIGNAL_HANDLER
if(isliving(AM))
var/mob/living/L = AM
L.fire_act(temperature, volume)
Expand Down
Loading
Loading