Adds "Scan Gas" for ghosts (#17306)

This commit is contained in:
Ling
2023-01-07 01:18:01 +01:00
committed by GitHub
parent 9974595942
commit d4af44be85
18 changed files with 72 additions and 57 deletions

View File

@@ -1,7 +1,8 @@
#define SCAN_CHEM (1<<0)
#define SCAN_CHEM (1<<0)
#define SCAN_HEALTH (1<<1)
#define SCAN_NANITE (1<<2)
#define SCAN_WOUND (1<<3)
#define SCAN_NANITE (1<<2)
#define SCAN_WOUND (1<<3)
#define SCAN_GAS (1<<4)
/mob/dead/observer/DblClickOn(atom/A, params)
if(check_click_intercept(params, A))
@@ -56,7 +57,9 @@
if(SEND_SIGNAL(src, COMSIG_ATOM_ATTACK_GHOST, user) & COMPONENT_NO_ATTACK_HAND)
return TRUE
if(user.client)
if(IsAdminGhost(user))
if(user.scanmode & SCAN_GAS && atmosanalyzer_scan(user, src))
return TRUE
else if(IsAdminGhost(user))
attack_ai(user)
else if(user.client.prefs.inquisitive_ghost)
user.examinate(src)

View File

@@ -363,6 +363,9 @@
else
return null
/atom/proc/return_analyzable_air()
return null
///Return the air if we can analyze it
///Check if this atoms eye is still alive (probably)
/atom/proc/check_eye(mob/user)

View File

@@ -942,6 +942,9 @@
return cabin_air
return ..()
/obj/mecha/return_analyzable_air()
return cabin_air
/obj/mecha/proc/return_pressure()
var/datum/gas_mixture/t_air = return_air()
if(t_air)

View File

@@ -745,11 +745,15 @@ GENE SCANNER
amount += inaccurate
return DisplayTimeText(max(1,amount))
/proc/atmosanalyzer_scan(mixture, mob/living/user, atom/target = src)
/proc/atmosanalyzer_scan(mob/user, atom/target, silent=FALSE)
var/mixture = target.return_analyzable_air()
if(!mixture)
return FALSE
var/list/combined_msg = list()
var/icon = target
if(!isobserver(user))
user.visible_message("[user] has used the analyzer on [icon2html(icon, viewers(user))] [target].", span_notice("You use the analyzer on [icon2html(icon, user)] [target]."))
if(!silent && isliving(user))
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>")
combined_msg += span_boldnotice("Results of analysis of [icon2html(icon, user)] [target].")
var/list/airs = islist(mixture) ? mixture : list(mixture)
@@ -785,7 +789,7 @@ GENE SCANNER
combined_msg += span_boldnotice("Large amounts of free neutrons detected in the air indicate that a fusion reaction took place.")
combined_msg += span_notice("Instability of the last fusion reaction: [instability].")
to_chat(user, examine_block(combined_msg.Join("\n")))
return
return TRUE
//slime scanner

View File

@@ -133,9 +133,11 @@
else
return ..()
/obj/item/flamethrower/analyzer_act(mob/living/user, obj/item/I)
/obj/item/flamethrower/return_analyzable_air()
if(ptank)
ptank.analyzer_act(user, I)
return ptank.return_analyzable_air()
else
return null
/obj/item/flamethrower/attack_self(mob/user)

View File

@@ -112,9 +112,6 @@
qdel(src)
/obj/item/tank/analyzer_act(mob/living/user, obj/item/I)
atmosanalyzer_scan(air_contents, user, src)
/obj/item/tank/deconstruct(disassembled = TRUE)
if(!disassembled)
var/turf/T = get_turf(src)
@@ -214,6 +211,9 @@
/obj/item/tank/return_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)

View File

@@ -323,10 +323,8 @@
to_chat(M, "[src] is now skinned as '[choice].'")
/obj/analyzer_act(mob/living/user, obj/item/I)
var/turf/T = get_turf(src)
if(T)
if(atmosanalyzer_scan(T.return_air(), user, src))
return TRUE
if(atmosanalyzer_scan(user, src))
return TRUE
return ..()
/obj/proc/plunger_act(obj/item/plunger/P, mob/living/user, reinforced)

View File

@@ -35,4 +35,10 @@
if(tank)
return tank.air_contents
else
return loc.return_air()
return loc.return_air()
/obj/structure/closet/crate/critter/return_analyzable_air()
if(tank)
return tank.return_analyzable_air()
else
return null

View File

@@ -159,6 +159,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)

View File

@@ -232,7 +232,7 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
var/turf/T = get_turf(mob)
if(!isturf(T))
return
show_air_status_to(T, usr)
atmosanalyzer_scan(usr, T, TRUE)
SSblackbox.record_feedback("tally", "admin_verb", 1, "Air Status In Location") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/cmd_admin_robotize(mob/M in GLOB.mob_list)

View File

@@ -1,25 +1,10 @@
/proc/show_air_status_to(turf/target, mob/user)
var/datum/gas_mixture/env = target.return_air()
var/burning = FALSE
if(isopenturf(target))
var/turf/open/T = target
if(T.active_hotspot)
burning = TRUE
var/list/lines = list(span_adminnotice("[AREACOORD(target)]: [env.return_temperature()] K ([env.return_temperature() - T0C] C), [env.return_pressure()] kPa[(burning)?(", <font color='red'>burning</font>"):(null)]"))
for(var/id in env.get_gases())
var/moles = env.get_moles(id)
if (abs(moles) >= 0.00001)
lines += "[GLOB.meta_gas_info[id][META_GAS_NAME]]: [moles] mol"
to_chat(usr, lines.Join("\n"))
/client/proc/air_status(turf/target)
set category = "Misc.Server Debug"
set name = "Display Air Status"
if(!isturf(target))
return
show_air_status_to(target, usr)
atmosanalyzer_scan(usr, target, TRUE)
SSblackbox.record_feedback("tally", "admin_verb", 1, "Show Air Status") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/fix_next_move()

View File

@@ -57,9 +57,6 @@
return TRUE
/obj/item/onetankbomb/analyzer_act(mob/living/user, obj/item/I)
bombtank.analyzer_act(user, I)
/obj/item/onetankbomb/attack_self(mob/user) //pressing the bomb accesses its assembly
bombassembly.attack_self(user, TRUE)
add_fingerprint(user)
@@ -198,3 +195,9 @@
return
T.assume_air(removed)
air_update_turf()
/obj/item/onetankbomb/return_analyzable_air()
if(bombtank)
return bombtank.return_analyzable_air()
else
return null

View File

@@ -84,6 +84,9 @@
RETURN_TYPE(/datum/gas_mixture)
return air
/turf/open/return_analyzable_air()
return return_air()
/turf/temperature_expose()
if(temperature > heat_capacity)
to_be_destroyed = TRUE

View File

@@ -158,5 +158,5 @@
// Tool acts
/obj/machinery/atmospherics/components/analyzer_act(mob/living/user, obj/item/I)
atmosanalyzer_scan(airs, user, src)
/obj/machinery/atmospherics/components/return_analyzable_air()
return airs

View File

@@ -57,6 +57,10 @@
if(parent)
return parent.air
/obj/machinery/atmospherics/pipe/return_analyzable_air()
if(parent)
return parent.air
/obj/machinery/atmospherics/pipe/remove_air(amount)
if(parent)
return parent.air.remove(amount)
@@ -69,9 +73,6 @@
else
return ..()
/obj/machinery/atmospherics/pipe/analyzer_act(mob/living/user, obj/item/I)
atmosanalyzer_scan(parent.air, user, src)
/obj/machinery/atmospherics/pipe/examine(mob/dead/observer/user)
if(istype(user))
analyzer_act(user, src)

View File

@@ -51,6 +51,9 @@
/obj/machinery/portable_atmospherics/return_air()
return air_contents
/obj/machinery/portable_atmospherics/return_analyzable_air()
return air_contents
/obj/machinery/portable_atmospherics/proc/connect(obj/machinery/atmospherics/components/unary/portables_connector/new_port)
//Make sure not already connected to something else
if(connected_port || !new_port || new_port.connected_device)
@@ -150,9 +153,6 @@
else
return ..()
/obj/machinery/portable_atmospherics/analyzer_act(mob/living/user, obj/item/I)
atmosanalyzer_scan(air_contents, user, src)
/obj/machinery/portable_atmospherics/attacked_by(obj/item/I, mob/user)
if(I.force < 10 && !(stat & BROKEN))
take_damage(0)

View File

@@ -65,7 +65,6 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER)
add_verb(src, list(
/mob/dead/observer/proc/dead_tele,
/mob/dead/observer/proc/open_spawners_menu,
/mob/dead/observer/proc/view_gas,
/mob/dead/observer/proc/tray_view,
/mob/dead/observer/proc/possess_mouse_verb))
@@ -425,14 +424,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
usr.forceMove(pick(L))
update_parallax_contents()
/mob/dead/observer/proc/view_gas()
set category = "Ghost"
set name = "View Gases"
set desc= "View the atmospheric conditions in a location"
var/turf/loc = get_turf(src)
show_air_status_to(loc, usr)
/mob/dead/observer/verb/follow()
set category = "Ghost"
set name = "Orbit" // "Haunt"
@@ -769,6 +760,14 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
scanmode ^= SCAN_WOUND
to_chat(src, span_notice("Wound scan [scanmode & SCAN_WOUND ? "enabled" : "disabled"]."))
/mob/dead/observer/verb/toggle_gas_scan()
set name = "Toggle Gas Scan"
set desc = "Toggles whether you analyze gas contents on click"
set category = "Ghost"
scanmode ^= SCAN_GAS
to_chat(src, span_notice("Gas scan [scanmode & SCAN_GAS ? "enabled" : "disabled"]."))
/mob/dead/observer/verb/restore_ghost_appearance()
set name = "Restore Ghost Character"
set desc = "Sets your deadchat name and ghost appearance to your \

View File

@@ -251,9 +251,11 @@
to_chat(user, "<span class='warning'>You set the [src] mode to [mode] production.</span>")
/obj/machinery/power/rad_collector/analyzer_act(mob/living/user, obj/item/I)
/obj/machinery/power/rad_collector/return_analyzable_air()
if(loaded_tank)
loaded_tank.analyzer_act(user, I)
return loaded_tank.return_analyzable_air()
else
return null
/obj/machinery/power/rad_collector/examine(mob/user)
. = ..()