mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Merge pull request #8311 from PsiOmegaDelta/AllTheNano
Turret NanoUI interfaces
This commit is contained in:
@@ -124,7 +124,7 @@
|
||||
Topic(src, list("src"= "\ref[src]", "breaker"="1"), 1) // 1 meaning no window (consistency!)
|
||||
|
||||
/obj/machinery/turretid/AICtrlClick() //turns off/on Turrets
|
||||
Topic(src, list("src"= "\ref[src]", "operation"="toggleon"), 1) // 1 meaning no window (consistency!)
|
||||
Topic(src, list("src"= "\ref[src]", "command"="enable", "value"="[!enabled]"), 1) // 1 meaning no window (consistency!)
|
||||
|
||||
/atom/proc/AIAltClick(var/atom/A)
|
||||
AltClick(A)
|
||||
@@ -139,7 +139,7 @@
|
||||
return
|
||||
|
||||
/obj/machinery/turretid/AIAltClick() //toggles lethal on turrets
|
||||
Topic(src, list("src"= "\ref[src]", "operation"="togglelethal"), 1) // 1 meaning no window (consistency!)
|
||||
Topic(src, list("src"= "\ref[src]", "command"="lethal", "value"="[!lethal]"), 1) // 1 meaning no window (consistency!)
|
||||
|
||||
/atom/proc/AIMiddleClick()
|
||||
return
|
||||
|
||||
@@ -42,25 +42,19 @@
|
||||
shot_delay = 30
|
||||
iconholder = 1
|
||||
|
||||
/obj/machinery/porta_turret/tag/interact(mob/user)
|
||||
var/dat
|
||||
/obj/machinery/porta_turret/tag/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
var/data[0]
|
||||
data["access"] = !isLocked(user)
|
||||
data["locked"] = locked
|
||||
data["enabled"] = enabled
|
||||
data["is_lethal"] = 0
|
||||
|
||||
if(istype(user,/mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(lasercolor == "b" && istype(H.wear_suit, /obj/item/clothing/suit/redtag))
|
||||
return
|
||||
if(lasercolor == "r" && istype(H.wear_suit, /obj/item/clothing/suit/bluetag))
|
||||
return
|
||||
dat += text({"
|
||||
<TT><B>Automatic Portable Turret Installation</B></TT><BR><BR>
|
||||
Status: []<BR>"},
|
||||
|
||||
"<A href='?src=\ref[src];power=1'>[on ? "On" : "Off"]</A>" )
|
||||
|
||||
|
||||
user << browse("<HEAD><TITLE>Automatic Portable Turret Installation</TITLE></HEAD>[dat]", "window=autosec")
|
||||
onclose(user, "autosec")
|
||||
return
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "turret_control.tmpl", "Turret Controls", 500, 300)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
|
||||
/obj/machinery/porta_turret/tag/update_icon()
|
||||
if(!anchored)
|
||||
@@ -70,7 +64,7 @@
|
||||
icon_state = "[lasercolor]destroyed_target_prism"
|
||||
else
|
||||
if(powered())
|
||||
if(on)
|
||||
if(enabled)
|
||||
if(iconholder)
|
||||
//lasers have a orange icon
|
||||
icon_state = "[lasercolor]orange_target_prism"
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
var/attacked = 0 //if set to 1, the turret gets pissed off and shoots at people nearby (unless they have sec access!)
|
||||
|
||||
var/on = 1 //determines if the turret is on
|
||||
var/enabled = 1 //determines if the turret is on
|
||||
var/lethal = 0 //whether in lethal or stun mode
|
||||
var/disabled = 0
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
icon_state = "destroyed_target_prism"
|
||||
else
|
||||
if(powered())
|
||||
if(on)
|
||||
if(enabled)
|
||||
if(iconholder)
|
||||
//lasers have a orange icon
|
||||
icon_state = "orange_target_prism"
|
||||
@@ -149,109 +149,98 @@
|
||||
del(cover) // qdel
|
||||
..()
|
||||
|
||||
/obj/machinery/porta_turret/proc/can_use(mob/user)
|
||||
if(ailock && issilicon(user))
|
||||
/obj/machinery/porta_turret/proc/isLocked(mob/user)
|
||||
if(ailock && user.isSilicon())
|
||||
user << "<span class='notice'>There seems to be a firewall preventing you from accessing this device.</span>"
|
||||
return 0
|
||||
return 1
|
||||
|
||||
if (get_dist(src, user) > 1 && !issilicon(user))
|
||||
user << "<span class='notice'>You are too far away.</span>"
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=turretid")
|
||||
return 0
|
||||
|
||||
if(locked && !issilicon(user))
|
||||
if(locked && !user.isSilicon())
|
||||
user << "<span class='notice'>Access denied.</span>"
|
||||
return 0
|
||||
return 1
|
||||
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/machinery/porta_turret/attack_ai(mob/user)
|
||||
return attack_hand(user)
|
||||
if(isLocked(user))
|
||||
return
|
||||
|
||||
ui_interact(user)
|
||||
|
||||
/obj/machinery/porta_turret/attack_hand(mob/user)
|
||||
if(..())
|
||||
return 1
|
||||
if(!can_use(user))
|
||||
return 1
|
||||
interact(user)
|
||||
if(isLocked(user))
|
||||
return
|
||||
|
||||
/obj/machinery/porta_turret/interact(mob/user)
|
||||
var/dat = text({"
|
||||
<TT><B>Automatic Portable Turret Installation</B></TT><BR><BR>
|
||||
Status: []<BR>
|
||||
Behaviour controls are [locked ? "locked" : "unlocked"]"},
|
||||
"<A href='?src=\ref[src];power=1'>[on ? "On" : "Off"]</A>" )
|
||||
ui_interact(user)
|
||||
|
||||
if(!locked || issilicon(user))
|
||||
dat += text({"<BR><BR>
|
||||
Lethal Mode: []<BR>
|
||||
Neutralize All Non-Synthetics: []<BR>"},
|
||||
/obj/machinery/porta_turret/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
var/data[0]
|
||||
data["access"] = !isLocked(user)
|
||||
data["locked"] = locked
|
||||
data["enabled"] = enabled
|
||||
data["is_lethal"] = 1
|
||||
data["lethal"] = lethal
|
||||
|
||||
"<A href='?src=\ref[src];operation=togglelethal'>[lethal ? "Enabled" : "Disabled"]</A>",
|
||||
"<A href='?src=\ref[src];operation=toggleai'>[check_synth ? "Yes" : "No"]</A>")
|
||||
if(!check_synth)
|
||||
dat += text({"Check for Weapon Authorization: []<BR>
|
||||
Check Security Records: []<BR>
|
||||
Check Arrest Status: []<BR>
|
||||
Neutralize All Non-Authorized Personnel: []<BR>
|
||||
Neutralize All Unidentified Life Signs: []<BR>"},
|
||||
if(data["access"])
|
||||
var/settings[0]
|
||||
settings[++settings.len] = list("category" = "Neutralize All Non-Synthetics", "setting" = "check_synth", "value" = check_synth)
|
||||
settings[++settings.len] = list("category" = "Check Weapon Authorization", "setting" = "check_weapons", "value" = check_weapons)
|
||||
settings[++settings.len] = list("category" = "Check Security Records", "setting" = "check_records", "value" = check_records)
|
||||
settings[++settings.len] = list("category" = "Check Arrest Status", "setting" = "check_arrest", "value" = check_arrest)
|
||||
settings[++settings.len] = list("category" = "Check Access Authorization", "setting" = "check_access", "value" = check_access)
|
||||
settings[++settings.len] = list("category" = "Check misc. Lifeforms", "setting" = "check_anomalies", "value" = check_anomalies)
|
||||
data["settings"] = settings
|
||||
|
||||
"<A href='?src=\ref[src];operation=authweapon'>[check_weapons ? "Yes" : "No"]</A>",
|
||||
"<A href='?src=\ref[src];operation=checkrecords'>[check_records ? "Yes" : "No"]</A>",
|
||||
"<A href='?src=\ref[src];operation=checkarrest'>[check_arrest ? "Yes" : "No"]</A>",
|
||||
"<A href='?src=\ref[src];operation=checkaccess'>[check_access ? "Yes" : "No"]</A>",
|
||||
"<A href='?src=\ref[src];operation=checkxenos'>[check_anomalies ? "Yes" : "No"]</A>" )
|
||||
else
|
||||
dat += "<div class='notice icon'>Swipe ID card to unlock interface</div>"
|
||||
|
||||
user << browse("<HEAD><TITLE>Automatic Portable Turret Installation</TITLE></HEAD>[dat]", "window=autosec")
|
||||
onclose(user, "autosec")
|
||||
return
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "turret_control.tmpl", "Turret Controls", 500, 300)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
|
||||
/obj/machinery/porta_turret/proc/HasController()
|
||||
var/area/A = get_area(src)
|
||||
return A && A.turret_controls.len > 0
|
||||
|
||||
/obj/machinery/porta_turret/Topic(href, href_list)
|
||||
/obj/machinery/porta_turret/CanUseTopic(var/mob/user)
|
||||
if(HasController())
|
||||
user << "<span class='notice'>Turrets can only be controlled using the assigned turret controller.</span>"
|
||||
return STATUS_CLOSE
|
||||
|
||||
if(isLocked(user))
|
||||
return STATUS_CLOSE
|
||||
|
||||
if(!anchored)
|
||||
usr << "<span class='notice'>\The [src] has to be secured first!</span>"
|
||||
return STATUS_CLOSE
|
||||
|
||||
return STATUS_INTERACTIVE
|
||||
|
||||
|
||||
/obj/machinery/porta_turret/Topic(href, href_list, var/nowindow = 0)
|
||||
if(..())
|
||||
return 1
|
||||
if(!can_use(usr))
|
||||
|
||||
if(href_list["command"] && href_list["value"])
|
||||
var/value = text2num(href_list["value"])
|
||||
if(href_list["command"] == "enable")
|
||||
enabled = value
|
||||
else if(href_list["command"] == "lethal")
|
||||
lethal = value
|
||||
else if(href_list["command"] == "check_synth")
|
||||
check_synth = value
|
||||
else if(href_list["command"] == "check_weapons")
|
||||
check_weapons = value
|
||||
else if(href_list["command"] == "check_records")
|
||||
check_records = value
|
||||
else if(href_list["command"] == "check_arrest")
|
||||
check_arrest = value
|
||||
else if(href_list["command"] == "check_access")
|
||||
check_access = value
|
||||
else if(href_list["command"] == "check_anomalies")
|
||||
check_anomalies = value
|
||||
|
||||
return 1
|
||||
|
||||
if(HasController())
|
||||
usr << "<span class='notice'>Turrets can only be controlled using the assigned turret controller.</span>"
|
||||
return
|
||||
|
||||
usr.set_machine(src)
|
||||
if(href_list["power"])
|
||||
if(anchored) //you can't turn a turret on/off if it's not anchored/secured
|
||||
on = !on //toggle on/off
|
||||
else
|
||||
usr << "<span class='notice'>It has to be secured first!</span>"
|
||||
|
||||
attack_hand(usr)
|
||||
return
|
||||
|
||||
switch(href_list["operation"]) //toggles customizable behavioural protocols
|
||||
if("togglelethal")
|
||||
if(!controllock)
|
||||
lethal = !lethal
|
||||
if("toggleai")
|
||||
check_synth = !check_synth
|
||||
if("authweapon")
|
||||
check_weapons = !check_weapons
|
||||
if("checkrecords")
|
||||
check_records = !check_records
|
||||
if("checkarrests")
|
||||
check_arrest = !check_arrest
|
||||
if("checkaccess")
|
||||
check_access = !check_access
|
||||
if("checkxenos")
|
||||
check_anomalies = !check_anomalies
|
||||
attack_hand(usr)
|
||||
|
||||
|
||||
/obj/machinery/porta_turret/power_change()
|
||||
if(powered())
|
||||
stat &= ~NOPOWER
|
||||
@@ -291,12 +280,12 @@
|
||||
emagged = 1
|
||||
iconholder = 1
|
||||
controllock = 1
|
||||
on = 0 //turns off the turret temporarily
|
||||
enabled = 0 //turns off the turret temporarily
|
||||
sleep(60) //6 seconds for the traitor to gtfo of the area before the turret decides to ruin his shit
|
||||
on = 1 //turns it back on. The cover popUp() popDown() are automatically called in process(), no need to define it here
|
||||
enabled = 1 //turns it back on. The cover popUp() popDown() are automatically called in process(), no need to define it here
|
||||
|
||||
else if((istype(I, /obj/item/weapon/wrench)))
|
||||
if(on || raised)
|
||||
if(enabled || raised)
|
||||
user << "<span class='warning'>You cannot unsecure an active turret!</span>"
|
||||
return
|
||||
if(wrenching)
|
||||
@@ -363,7 +352,7 @@
|
||||
if(Proj.damage_type == HALLOSS)
|
||||
return
|
||||
|
||||
if(on)
|
||||
if(enabled)
|
||||
if(!attacked && !emagged)
|
||||
attacked = 1
|
||||
spawn()
|
||||
@@ -376,7 +365,7 @@
|
||||
take_damage(Proj.damage)
|
||||
|
||||
/obj/machinery/porta_turret/emp_act(severity)
|
||||
if(on)
|
||||
if(enabled)
|
||||
//if the turret is on, the EMP no matter how severe disables the turret for a while
|
||||
//and scrambles its settings, with a slight chance of having an emag effect
|
||||
check_arrest = prob(50)
|
||||
@@ -387,10 +376,10 @@
|
||||
if(prob(5))
|
||||
emagged = 1
|
||||
|
||||
on=0
|
||||
enabled=0
|
||||
sleep(rand(60,600))
|
||||
if(!on)
|
||||
on=1
|
||||
if(!enabled)
|
||||
enabled=1
|
||||
|
||||
..()
|
||||
|
||||
@@ -437,7 +426,7 @@
|
||||
popDown()
|
||||
return
|
||||
|
||||
if(!on)
|
||||
if(!enabled)
|
||||
//if the turret is off, make it pop down
|
||||
popDown()
|
||||
return
|
||||
@@ -615,7 +604,7 @@
|
||||
A.process()
|
||||
|
||||
/datum/turret_checks
|
||||
var/on
|
||||
var/enabled
|
||||
var/lethal
|
||||
var/check_synth
|
||||
var/check_access
|
||||
@@ -628,7 +617,7 @@
|
||||
/obj/machinery/porta_turret/proc/setState(var/datum/turret_checks/TC)
|
||||
if(controllock)
|
||||
return
|
||||
src.on = TC.on
|
||||
src.enabled = TC.enabled
|
||||
src.lethal = TC.lethal
|
||||
src.iconholder = TC.lethal
|
||||
|
||||
@@ -804,7 +793,7 @@
|
||||
Turret.name = finish_name
|
||||
Turret.installation = installation
|
||||
Turret.gun_charge = gun_charge
|
||||
Turret.on = 0
|
||||
Turret.enabled = 0
|
||||
Turret.setup()
|
||||
|
||||
// Turret.cover=new/obj/machinery/porta_turret_cover(loc)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
var/enabled = 0
|
||||
var/lethal = 0
|
||||
var/locked = 1
|
||||
var/control_area //can be area name, path or nothing.
|
||||
var/area/control_area //can be area name, path or nothing.
|
||||
|
||||
var/check_arrest = 1 //checks if the perp is set to arrest
|
||||
var/check_records = 1 //checks if a security record exists at all
|
||||
@@ -24,7 +24,7 @@
|
||||
var/check_access = 1 //if this is active, the turret shoots everything that does not meet the access requirements
|
||||
var/check_anomalies = 1 //checks if it can shoot at unidentified lifeforms (ie xenos)
|
||||
var/check_synth = 0 //if active, will shoot at anything not an AI or cyborg
|
||||
var/ailock = 0 // AI cannot use this
|
||||
var/ailock = 0 //Silicons cannot use this
|
||||
|
||||
req_access = list(access_ai_upload)
|
||||
|
||||
@@ -47,159 +47,127 @@
|
||||
/obj/machinery/turretid/initialize()
|
||||
if(!control_area)
|
||||
var/area/CA = get_area(src)
|
||||
if(CA.master && CA.master != CA)
|
||||
control_area = CA.master
|
||||
else
|
||||
control_area = CA
|
||||
control_area = CA.master
|
||||
else if(istext(control_area))
|
||||
for(var/area/A in world)
|
||||
if(A.name && A.name==control_area)
|
||||
control_area = A
|
||||
control_area = A.master
|
||||
break
|
||||
power_change() //Checks power and initial settings
|
||||
//don't have to check if control_area is path, since get_area_all_atoms can take path.
|
||||
|
||||
if(control_area)
|
||||
var/area/A = control_area
|
||||
if(A && istype(A))
|
||||
if(istype(A))
|
||||
A.turret_controls += src
|
||||
else
|
||||
control_area = null
|
||||
|
||||
power_change() //Checks power and initial settings
|
||||
return
|
||||
|
||||
/obj/machinery/turretid/proc/can_use(mob/user)
|
||||
if(ailock && issilicon(user))
|
||||
/obj/machinery/turretid/proc/isLocked(mob/user)
|
||||
if(ailock && user.isSilicon())
|
||||
user << "<span class='notice'>There seems to be a firewall preventing you from accessing this device.</span>"
|
||||
return 0
|
||||
return 1
|
||||
|
||||
if (get_dist(src, user) > 0 && !issilicon(user))
|
||||
user << "<span class='notice'>You are too far away.</span>"
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=turretid")
|
||||
return 0
|
||||
|
||||
if(locked && !issilicon(user))
|
||||
if(locked && !user.isSilicon())
|
||||
user << "<span class='notice'>Access denied.</span>"
|
||||
return 0
|
||||
return 1
|
||||
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/machinery/turretid/CanUseTopic(mob/user)
|
||||
if(isLocked(user))
|
||||
return STATUS_CLOSE
|
||||
|
||||
return STATUS_INTERACTIVE
|
||||
|
||||
/obj/machinery/turretid/attackby(obj/item/weapon/W, mob/user)
|
||||
if(stat & BROKEN) return
|
||||
if (istype(user, /mob/living/silicon))
|
||||
return src.attack_hand(user)
|
||||
if(stat & BROKEN)
|
||||
return
|
||||
|
||||
if (istype(W, /obj/item/weapon/card/emag) && !emagged)
|
||||
if(!emagged && istype(W, /obj/item/weapon/card/emag))
|
||||
user << "<span class='danger'>You short out the turret controls' access analysis module.</span>"
|
||||
emagged = 1
|
||||
locked = 0
|
||||
if(user.machine==src)
|
||||
src.attack_hand(user)
|
||||
|
||||
ailock = 0
|
||||
return
|
||||
|
||||
else if( get_dist(src, user) == 0 ) // trying to unlock the interface
|
||||
if (src.allowed(usr))
|
||||
if(istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda))
|
||||
if(src.allowed(usr))
|
||||
if(emagged)
|
||||
user << "<span class='notice'>The turret control is unresponsive.</span>"
|
||||
return
|
||||
|
||||
locked = !locked
|
||||
user << "<span class='notice'>You [ locked ? "lock" : "unlock"] the panel.</span>"
|
||||
if (locked)
|
||||
if (user.machine==src)
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=turretid")
|
||||
else
|
||||
if (user.machine==src)
|
||||
src.attack_hand(user)
|
||||
else
|
||||
user << "<span class='warning'>Access denied.</span>"
|
||||
locked = !locked
|
||||
user << "<span class='notice'>You [ locked ? "lock" : "unlock"] the panel.</span>"
|
||||
return
|
||||
return ..()
|
||||
|
||||
/obj/machinery/turretid/attack_ai(mob/user as mob)
|
||||
return attack_hand(user)
|
||||
if(isLocked(user))
|
||||
return
|
||||
|
||||
ui_interact(user)
|
||||
|
||||
/obj/machinery/turretid/attack_hand(mob/user as mob)
|
||||
if(!can_use(user))
|
||||
if(isLocked(user))
|
||||
return
|
||||
|
||||
user.set_machine(src)
|
||||
var/loc = src.loc
|
||||
if (istype(loc, /turf))
|
||||
var/turf/T = loc
|
||||
loc = T.loc
|
||||
if (!istype(loc, /area))
|
||||
return
|
||||
var/area/area = loc
|
||||
var/dat = text({"Status: []<BR>
|
||||
Behaviour controls are [locked ? "locked" : "unlocked"]"},
|
||||
"<A href='?src=\ref[src];operation=toggleon'>[enabled ? "On" : "Off"]</A>" )
|
||||
ui_interact(user)
|
||||
|
||||
if(!locked || issilicon(user))
|
||||
dat += text({"<BR><BR>
|
||||
Lethal Mode: []<BR>
|
||||
Neutralize All Non-Synthetics: []<BR>"},
|
||||
/obj/machinery/turretid/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
var/data[0]
|
||||
data["access"] = !isLocked(user)
|
||||
data["locked"] = locked
|
||||
data["enabled"] = enabled
|
||||
data["is_lethal"] = 1
|
||||
data["lethal"] = lethal
|
||||
|
||||
"<A href='?src=\ref[src];operation=togglelethal'>[lethal ? "Enabled" : "Disabled"]</A>",
|
||||
"<A href='?src=\ref[src];operation=toggleai'>[check_synth ? "Yes" : "No"]</A>")
|
||||
if(!check_synth)
|
||||
dat += text({"Check for Weapon Authorization: []<BR>
|
||||
Check Security Records: []<BR>
|
||||
Check Arrest Status: []<BR>
|
||||
Neutralize All Non-Authorized Personnel: []<BR>
|
||||
Neutralize All Unidentified Life Signs: []<BR>"},
|
||||
if(data["access"])
|
||||
var/settings[0]
|
||||
settings[++settings.len] = list("category" = "Neutralize All Non-Synthetics", "setting" = "check_synth", "value" = check_synth)
|
||||
settings[++settings.len] = list("category" = "Check Weapon Authorization", "setting" = "check_weapons", "value" = check_weapons)
|
||||
settings[++settings.len] = list("category" = "Check Security Records", "setting" = "check_records", "value" = check_records)
|
||||
settings[++settings.len] = list("category" = "Check Arrest Status", "setting" = "check_arrest", "value" = check_arrest)
|
||||
settings[++settings.len] = list("category" = "Check Access Authorization", "setting" = "check_access", "value" = check_access)
|
||||
settings[++settings.len] = list("category" = "Check misc. Lifeforms", "setting" = "check_anomalies", "value" = check_anomalies)
|
||||
data["settings"] = settings
|
||||
|
||||
"<A href='?src=\ref[src];operation=authweapon'>[check_weapons ? "Yes" : "No"]</A>",
|
||||
"<A href='?src=\ref[src];operation=checkrecords'>[check_records ? "Yes" : "No"]</A>",
|
||||
"<A href='?src=\ref[src];operation=checkarrest'>[check_arrest ? "Yes" : "No"]</A>",
|
||||
"<A href='?src=\ref[src];operation=checkaccess'>[check_access ? "Yes" : "No"]</A>",
|
||||
"<A href='?src=\ref[src];operation=checkxenos'>[check_anomalies ? "Yes" : "No"]</A>" )
|
||||
else
|
||||
dat += "<div class='notice icon'>Swipe ID card to unlock interface</div>"
|
||||
|
||||
//user << browse(t, "window=turretid")
|
||||
//onclose(user, "turretid")
|
||||
var/datum/browser/popup = new(user, "turretid", "Turret Control Panel ([area.name])", 500, 500)
|
||||
popup.set_content(dat)
|
||||
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
|
||||
popup.open()
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "turret_control.tmpl", "Turret Controls", 500, 300)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
|
||||
/obj/machinery/turretid/Topic(href, href_list, var/nowindow = 0)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
if(!can_use(usr))
|
||||
if(href_list["command"] && href_list["value"])
|
||||
var/value = text2num(href_list["value"])
|
||||
if(href_list["command"] == "enable")
|
||||
enabled = value
|
||||
else if(href_list["command"] == "lethal")
|
||||
lethal = value
|
||||
else if(href_list["command"] == "check_synth")
|
||||
check_synth = value
|
||||
else if(href_list["command"] == "check_weapons")
|
||||
check_weapons = value
|
||||
else if(href_list["command"] == "check_records")
|
||||
check_records = value
|
||||
else if(href_list["command"] == "check_arrest")
|
||||
check_arrest = value
|
||||
else if(href_list["command"] == "check_access")
|
||||
check_access = value
|
||||
else if(href_list["command"] == "check_anomalies")
|
||||
check_anomalies = value
|
||||
|
||||
updateTurrets()
|
||||
return 1
|
||||
|
||||
switch(href_list["operation"]) //toggles customizable behavioural protocols
|
||||
if("toggleon")
|
||||
enabled = !enabled
|
||||
if("togglelethal")
|
||||
lethal = !lethal
|
||||
if("toggleai")
|
||||
check_synth = !check_synth
|
||||
if("authweapon")
|
||||
check_weapons = !check_weapons
|
||||
if("checkrecords")
|
||||
check_records = !check_records
|
||||
if("checkarrest")
|
||||
check_arrest = !check_arrest
|
||||
if("checkaccess")
|
||||
check_access = !check_access
|
||||
if("checkxenos")
|
||||
check_anomalies = !check_anomalies
|
||||
|
||||
src.updateTurrets()
|
||||
|
||||
if(!nowindow)
|
||||
attack_hand(usr)
|
||||
|
||||
/obj/machinery/turretid/updateDialog()
|
||||
if (stat & (BROKEN|MAINT))
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/machinery/turretid/proc/updateTurrets()
|
||||
var/datum/turret_checks/TC = new
|
||||
TC.on = enabled
|
||||
TC.enabled = enabled
|
||||
TC.lethal = lethal
|
||||
TC.check_synth = check_synth
|
||||
TC.check_access = check_access
|
||||
@@ -209,10 +177,12 @@
|
||||
TC.check_anomalies = check_anomalies
|
||||
TC.ailock = ailock
|
||||
|
||||
if(control_area)
|
||||
for (var/obj/machinery/porta_turret/aTurret in get_area_all_atoms(control_area))
|
||||
aTurret.setState(TC)
|
||||
src.update_icon()
|
||||
if(istype(control_area))
|
||||
for(var/area/sub_area in control_area.related)
|
||||
for (var/obj/machinery/porta_turret/aTurret in sub_area)
|
||||
aTurret.setState(TC)
|
||||
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/turretid/power_change()
|
||||
..()
|
||||
|
||||
@@ -146,10 +146,10 @@ nanoui is used to open and update nano browser uis
|
||||
var/new_status = host.CanUseTopic(user, list(), custom_state)
|
||||
if(master_ui)
|
||||
new_status = min(new_status, master_ui.status)
|
||||
|
||||
set_status(new_status, push_update)
|
||||
if(new_status == STATUS_CLOSE)
|
||||
close()
|
||||
else
|
||||
set_status(new_status, push_update)
|
||||
|
||||
/**
|
||||
* Set the ui to auto update (every master_controller tick)
|
||||
@@ -396,6 +396,9 @@ nanoui is used to open and update nano browser uis
|
||||
if (width && height)
|
||||
window_size = "size=[width]x[height];"
|
||||
update_status(0)
|
||||
if(status == STATUS_CLOSE)
|
||||
return
|
||||
|
||||
user << browse(get_html(), "window=[window_id];[window_size][window_options]")
|
||||
winset(user, "mapwindow.map", "focus=true") // return keyboard focus to map
|
||||
on_close_winset()
|
||||
|
||||
Reference in New Issue
Block a user