diff --git a/code/modules/supermatter/supermatter.dm b/code/modules/supermatter/supermatter.dm index 6cdf0c3e91..5af46388bd 100644 --- a/code/modules/supermatter/supermatter.dm +++ b/code/modules/supermatter/supermatter.dm @@ -121,10 +121,15 @@ if(luminosity != lum) SetLuminosity(lum) -/obj/machinery/power/supermatter/proc/announce_warning() +/obj/machinery/power/supermatter/proc/get_integrity() var/integrity = damage / explosion_point integrity = round(100 - integrity * 100) integrity = integrity < 0 ? 0 : integrity + return integrity + + +/obj/machinery/power/supermatter/proc/announce_warning() + var/integrity = get_integrity() var/alert_msg = " Integrity at [integrity]%" if(damage > emergency_point) @@ -260,11 +265,11 @@ if(Adjacent(user)) return attack_hand(user) else - user << "You attempt to interface with the control circuits but find they are not connected to your network. Maybe in a future firmware update." + ui_interact(user) return /obj/machinery/power/supermatter/attack_ai(mob/user as mob) - user << "You attempt to interface with the control circuits but find they are not connected to your network. Maybe in a future firmware update." + ui_interact(user) /obj/machinery/power/supermatter/attack_hand(mob/user as mob) user.visible_message("\The [user] reaches out and touches \the [src], inducing a resonance... \his body starts to glow and bursts into flames before flashing into ash.",\ @@ -273,6 +278,31 @@ Consume(user) +// This is purely informational UI that may be accessed by AIs or robots +/obj/machinery/power/supermatter/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) + var/data[0] + + data["integrity_percentage"] = round(get_integrity()) + var/datum/gas_mixture/env = null + if(!istype(src.loc, /turf/space)) + env = src.loc.return_air() + + if(!env) + data["ambient_temp"] = 0 + data["ambient_pressure"] = 0 + else + data["ambient_temp"] = round(env.temperature) + data["ambient_pressure"] = round(env.return_pressure()) + data["detonating"] = grav_pulling + + ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) + if (!ui) + ui = new(user, src, ui_key, "supermatter_crystal.tmpl", "Supermatter Crystal", 500, 300) + ui.set_initial_data(data) + ui.open() + ui.set_auto_update(1) + + /* /obj/machinery/power/supermatter/proc/transfer_energy() for(var/obj/machinery/power/rad_collector/R in rad_collectors) diff --git a/nano/templates/supermatter_crystal.tmpl b/nano/templates/supermatter_crystal.tmpl new file mode 100644 index 0000000000..294de181ef --- /dev/null +++ b/nano/templates/supermatter_crystal.tmpl @@ -0,0 +1,16 @@ +{{if data.detonating}} +
+

CRYSTAL DELAMINATING

+

Evacuate area immediately

+
+
+{{else}} +

Crystal Integrity

+ {{:helper.displayBar(data.integrity_percentage, 0, 100, (data.integrity_percentage >= 90) ? 'good' : (data.integrity_percentage >= 25) ? 'average' : 'bad')}}
+ {{:data.integrity_percentage}} % +

Environment

+ Temperature: + {{:helper.displayBar(data.ambient_temp, 0, 10000, (data.ambient_temp >= 5000) ? 'bad' : (data.ambient_temp >= 4000) ? 'average' : 'good')}}
+ {{:data.ambient_temp}} K
+ Pressure: {{:data.ambient_pressure}} kPa +{{/if}} \ No newline at end of file