Robot Control/supermatter NanoUI

This commit is contained in:
Markolie
2015-07-28 23:06:01 +02:00
parent 8ac25a71e5
commit 398bd40dfe
4 changed files with 350 additions and 113 deletions
+45 -11
View File
@@ -217,26 +217,60 @@
qdel(src)
return(gain)
/obj/machinery/power/supermatter_shard/attack_robot(mob/user as mob)
/obj/machinery/power/supermatter/attack_robot(mob/user as mob)
if(Adjacent(user))
return attack_hand(user)
else
user << "<span class='warning'>You attempt to interface with the control circuits but find they are not connected to your network. Maybe in a future firmware update.</span>"
ui_interact(user)
return
/obj/machinery/power/supermatter_shard/attack_ai(mob/user as mob)
user << "<span class='warning'>You attempt to interface with the control circuits but find they are not connected to your network. Maybe in a future firmware update.</span>"
ui_interact(user)
/obj/machinery/power/supermatter_shard/attack_ghost(mob/user as mob)
ui_interact(user)
/obj/machinery/power/supermatter_shard/attack_hand(mob/living/user as mob)
if(!istype(user))
return
user.visible_message("<span class='danger'>\The [user] reaches out and touches \the [src], inducing a resonance... \his body starts to glow and bursts into flames before flashing into ash.</span>",\
"<span class='userdanger'>You reach out and touch \the [src]. Everything starts burning and all you can hear is ringing. Your last thought is \"That was not a wise decision.\"</span>",\
"<span class='italics'>You hear an unearthly noise as a wave of heat washes over you.</span>")
playsound(get_turf(src), 'sound/effects/supermatter.ogg', 50, 1)
/obj/machinery/power/supermatter_shard/attack_hand(mob/user as mob)
user.visible_message("<span class=\"warning\">\The [user] reaches out and touches \the [src], inducing a resonance... \his body starts to glow and bursts into flames before flashing into ash.</span>",\
"<span class=\"danger\">You reach out and touch \the [src]. Everything starts burning and all you can hear is ringing. Your last thought is \"That was not a wise decision.\"</span>",\
"<span class=\"warning\">You hear an uneartly ringing, then what sounds like a shrilling kettle as you are washed with a wave of heat.</span>")
playsound(get_turf(src), 'sound/effects/supermatter.ogg', 50, 1)
Consume(user)
/obj/machinery/power/supermatter_shard/proc/get_integrity()
var/integrity = damage / explosion_point
integrity = round(100 - integrity * 100)
integrity = integrity < 0 ? 0 : integrity
return integrity
// This is purely informational UI that may be accessed by AIs or robots
/obj/machinery/power/supermatter_shard/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())
if(damage > explosion_point)
data["detonating"] = 1
else
data["detonating"] = 0
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_shard/proc/transfer_energy()
for(var/obj/machinery/power/rad_collector/R in rad_collectors)