diff --git a/code/game/machinery/computer/Operating.dm b/code/game/machinery/computer/Operating.dm
index c8efe319db..122e89dd93 100644
--- a/code/game/machinery/computer/Operating.dm
+++ b/code/game/machinery/computer/Operating.dm
@@ -43,69 +43,39 @@
table.computer = src
break
-/obj/machinery/computer/operating/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.not_incapacitated_state)
- ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
+/obj/machinery/computer/operating/ui_state(mob/user)
+ return GLOB.not_incapacitated_state
+
+/obj/machinery/computer/operating/ui_interact(mob/user, datum/tgui/ui)
+ ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
- ui = new(user, src, ui_key, "OperatingComputer", name, 350, 470, master_ui, state)
+ ui = new(user, src, "OperatingComputer", name)
ui.open()
/obj/machinery/computer/operating/ui_data(mob/user)
var/list/data = list()
- data["table"] = table
+ var/list/surgeries = list()
+ for(var/X in advanced_surgeries)
+ var/datum/surgery/S = X
+ var/list/surgery = list()
+ surgery["name"] = initial(S.name)
+ surgery["desc"] = initial(S.desc)
+ surgeries += list(surgery)
+ data["surgeries"] = surgeries
+ data["patient"] = null
if(table)
- var/list/surgeries = list()
- for(var/X in advanced_surgeries)
- var/datum/surgery/S = X
- var/list/surgery = list()
- surgery["name"] = initial(S.name)
- surgery["desc"] = initial(S.desc)
- surgeries += list(surgery)
- data["surgeries"] = surgeries
- if(table.check_patient())
+ data["table"] = table
+ if(!table.check_eligible_patient())
+ return data
+ data["patient"] = list()
+ patient = table.patient
+ else
+ if(sbed)
+ data["table"] = sbed
+ if(!ishuman(sbed.occupant) && !ismonkey(sbed.occupant))
+ return data
data["patient"] = list()
- patient = table.patient
- switch(patient.stat)
- if(CONSCIOUS)
- data["patient"]["stat"] = "Conscious"
- data["patient"]["statstate"] = "good"
- if(SOFT_CRIT)
- data["patient"]["stat"] = "Conscious"
- data["patient"]["statstate"] = "average"
- if(UNCONSCIOUS)
- data["patient"]["stat"] = "Unconscious"
- data["patient"]["statstate"] = "average"
- if(DEAD)
- data["patient"]["stat"] = "Dead"
- data["patient"]["statstate"] = "bad"
- data["patient"]["health"] = patient.health
- data["patient"]["blood_type"] = patient.dna.blood_type
- data["patient"]["maxHealth"] = patient.maxHealth
- data["patient"]["minHealth"] = HEALTH_THRESHOLD_DEAD
- data["patient"]["bruteLoss"] = patient.getBruteLoss()
- data["patient"]["fireLoss"] = patient.getFireLoss()
- data["patient"]["toxLoss"] = patient.getToxLoss()
- data["patient"]["oxyLoss"] = patient.getOxyLoss()
- if(patient.surgeries.len)
- data["procedures"] = list()
- for(var/datum/surgery/procedure in patient.surgeries)
- var/datum/surgery_step/surgery_step = procedure.get_surgery_step()
- var/chems_needed = surgery_step.get_chem_list()
- var/alternative_step
- var/alt_chems_needed = ""
- if(surgery_step.repeatable)
- var/datum/surgery_step/next_step = procedure.get_surgery_next_step()
- if(next_step)
- alternative_step = capitalize(next_step.name)
- alt_chems_needed = next_step.get_chem_list()
- else
- alternative_step = "Finish operation"
- data["procedures"] += list(list(
- "name" = capitalize(procedure.name),
- "next_step" = capitalize(surgery_step.name),
- "chems_needed" = chems_needed,
- "alternative_step" = alternative_step,
- "alt_chems_needed" = alt_chems_needed
- ))
+ patient = sbed.occupant
else
data["patient"] = null
return data
@@ -153,6 +123,8 @@
))
return data
+
+
/obj/machinery/computer/operating/ui_act(action, params)
if(..())
return
diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm
index 2b3416e1c8..5c8173adae 100644
--- a/code/game/machinery/computer/camera.dm
+++ b/code/game/machinery/computer/camera.dm
@@ -5,8 +5,6 @@
icon_keyboard = "security_key"
circuit = /obj/item/circuitboard/computer/security
light_color = LIGHT_COLOR_RED
- ui_x = 870
- ui_y = 708
var/list/network = list("ss13")
var/obj/machinery/camera/active_camera
@@ -55,11 +53,9 @@
network -= i
network += "[idnum][i]"
-/obj/machinery/computer/security/ui_interact(\
- mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
- datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
+/obj/machinery/computer/security/ui_interact(mob/user, datum/tgui/ui)
// Update UI
- ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
+ ui = SStgui.try_update_ui(user, src, ui)
// Show static if can't use the camera
if(!active_camera?.can_use())
show_camera_static()
@@ -76,10 +72,11 @@
use_power(active_power_usage)
// Register map objects
user.client.register_map_obj(cam_screen)
- user.client.register_map_obj(cam_plane_master)
+ for(var/plane in cam_plane_masters)
+ user.client.register_map_obj(plane)
user.client.register_map_obj(cam_background)
// Open UI
- ui = new(user, src, ui_key, "CameraConsole", name, ui_x, ui_y, master_ui, state)
+ ui = new(user, src, "CameraConsole", name)
ui.open()
/obj/machinery/computer/security/ui_data()
diff --git a/code/game/machinery/computer/crew.dm b/code/game/machinery/computer/crew.dm
index cd8b5c1c59..19da4f75d8 100644
--- a/code/game/machinery/computer/crew.dm
+++ b/code/game/machinery/computer/crew.dm
@@ -76,11 +76,10 @@ GLOBAL_DATUM_INIT(crewmonitor, /datum/crewmonitor, new)
/datum/crewmonitor/Destroy()
return ..()
-/datum/crewmonitor/ui_interact(mob/user, ui_key = "crew", datum/tgui/ui = null, force_open = FALSE, \
- datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
- ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
+/datum/crewmonitor/ui_interact(mob/user, datum/tgui/ui)
+ ui = SStgui.try_update_ui(user, src, ui)
if (!ui)
- ui = new(user, src, ui_key, "CrewConsole", "crew monitor", 800, 600 , master_ui, state)
+ ui = new(user, src, "CrewConsole")
ui.open()
/datum/crewmonitor/proc/show(mob/M, source)
diff --git a/code/game/machinery/computer/dna_console.dm b/code/game/machinery/computer/dna_console.dm
index 2dce50aa88..286c106788 100644
--- a/code/game/machinery/computer/dna_console.dm
+++ b/code/game/machinery/computer/dna_console.dm
@@ -220,9 +220,7 @@
/obj/machinery/computer/scan_consolenew/examine(mob/user)
. = ..()
-/obj/machinery/computer/scan_consolenew/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
- . = ..()
-
+/obj/machinery/computer/scan_consolenew/ui_interact(mob/user, datum/tgui/ui)
// Most of ui_interact is spent setting variables for passing to the tgui
// interface.
// We can also do some general state processing here too as it's a good
@@ -264,10 +262,9 @@
time_to_pulse = round((rad_pulse_timer - world.time)/10)
// Attempt to update tgui ui, open and update if needed.
- ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
-
+ ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
- ui = new(user, src, ui_key, "DnaConsole", name, 539, 710, master_ui, state)
+ ui = new(user, src, "DnaConsole")
ui.open()
/obj/machinery/computer/scan_consolenew/ui_data(mob/user)
diff --git a/code/game/machinery/computer/launchpad_control.dm b/code/game/machinery/computer/launchpad_control.dm
index fdbe2f1060..b2f7ae73a1 100644
--- a/code/game/machinery/computer/launchpad_control.dm
+++ b/code/game/machinery/computer/launchpad_control.dm
@@ -53,10 +53,10 @@
var/obj/machinery/launchpad/pad = launchpads[number]
return pad
-/obj/machinery/computer/launchpad/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
- ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
+/obj/machinery/computer/launchpad/ui_interact(mob/user, datum/tgui/ui)
+ ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
- ui = new(user, src, ui_key, "LaunchpadConsole", name, ui_x, ui_y, master_ui, state)
+ ui = new(user, src, "LaunchpadConsole", name)
ui.open()
/obj/machinery/computer/launchpad/ui_data(mob/user)
@@ -128,4 +128,4 @@
if("pull")
teleport(usr, current_pad, FALSE)
. = TRUE
- . = TRUE
\ No newline at end of file
+ . = TRUE
diff --git a/code/game/machinery/computer/prisoner/gulag_teleporter.dm b/code/game/machinery/computer/prisoner/gulag_teleporter.dm
index dd925fbe3b..13727b585b 100644
--- a/code/game/machinery/computer/prisoner/gulag_teleporter.dm
+++ b/code/game/machinery/computer/prisoner/gulag_teleporter.dm
@@ -6,8 +6,6 @@
icon_keyboard = "security_key"
req_access = list(ACCESS_ARMORY)
circuit = /obj/item/circuitboard/computer/gulag_teleporter_console
- ui_x = 350
- ui_y = 295
var/default_goal = 200
var/obj/machinery/gulag_teleporter/teleporter = null
@@ -21,11 +19,10 @@
. = ..()
scan_machinery()
-/obj/machinery/computer/prisoner/gulag_teleporter_computer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
- datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
- ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
+/obj/machinery/computer/prisoner/gulag_teleporter_computer/ui_interact(mob/user, datum/tgui/ui)
+ ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
- ui = new(user, src, ui_key, "GulagTeleporterConsole", name, ui_x, ui_y, master_ui, state)
+ ui = new(user, src, "GulagTeleporterConsole", name)
ui.open()
/obj/machinery/computer/prisoner/gulag_teleporter_computer/ui_data(mob/user)
diff --git a/code/game/machinery/computer/robot.dm b/code/game/machinery/computer/robot.dm
index 4fd9665b1d..401d05da12 100644
--- a/code/game/machinery/computer/robot.dm
+++ b/code/game/machinery/computer/robot.dm
@@ -23,11 +23,10 @@
return
return TRUE
-/obj/machinery/computer/robotics/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
- datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
- ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
+/obj/machinery/computer/robotics/ui_interact(mob/user, datum/tgui/ui)
+ ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
- ui = new(user, src, ui_key, "RoboticsControlConsole", name, ui_x, ui_y, master_ui, state)
+ ui = new(user, src, "RoboticsControlConsole", name)
ui.open()
/obj/machinery/computer/robotics/ui_data(mob/user)
@@ -123,5 +122,5 @@
var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread
s.set_up(3, TRUE, D)
s.start()
- D.visible_message("\the [D] self destructs!")
+ D.visible_message("\the [D] self-destructs!")
D.gib()
diff --git a/code/game/machinery/computer/station_alert.dm b/code/game/machinery/computer/station_alert.dm
index b4340b9350..7b2e6ab455 100644
--- a/code/game/machinery/computer/station_alert.dm
+++ b/code/game/machinery/computer/station_alert.dm
@@ -16,11 +16,10 @@
GLOB.alert_consoles -= src
return ..()
-/obj/machinery/computer/station_alert/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
- datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
- ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
+/obj/machinery/computer/station_alert/ui_interact(mob/user, datum/tgui/ui)
+ ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
- ui = new(user, src, ui_key, "StationAlertConsole", name, 325, 500, master_ui, state)
+ ui = new(user, src, "StationAlertConsole", name)
ui.open()
/obj/machinery/computer/station_alert/ui_data(mob/user)
@@ -31,6 +30,7 @@
data["alarms"][class] = list()
for(var/area in alarms[class])
data["alarms"][class] += area
+
return data
/obj/machinery/computer/station_alert/proc/triggerAlarm(class, area/A, O, obj/source)
diff --git a/code/game/machinery/computer/teleporter.dm b/code/game/machinery/computer/teleporter.dm
index e7957a5b75..3a8ff7bf19 100644
--- a/code/game/machinery/computer/teleporter.dm
+++ b/code/game/machinery/computer/teleporter.dm
@@ -34,11 +34,10 @@
break
return power_station
-obj/machinery/computer/teleporter/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
- datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
- ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
+/obj/machinery/computer/teleporter/ui_interact(mob/user, datum/tgui/ui)
+ ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
- ui = new(user, src, ui_key, "Teleporter", name, ui_x, ui_y, master_ui, state)
+ ui = new(user, src, "Teleporter", name)
ui.open()
/obj/machinery/computer/teleporter/ui_data(mob/user)
@@ -56,7 +55,6 @@ obj/machinery/computer/teleporter/ui_interact(mob/user, ui_key = "main", datum/t
return data
-
/obj/machinery/computer/teleporter/ui_act(action, params)
if(..())
return
@@ -92,16 +90,18 @@ obj/machinery/computer/teleporter/ui_interact(mob/user, ui_key = "main", datum/t
say("Processing hub calibration to target...")
calibrating = TRUE
power_station.update_icon()
- spawn(50 * (3 - power_station.teleporter_hub.accuracy)) //Better parts mean faster calibration
- calibrating = FALSE
- if(check_hub_connection())
- power_station.teleporter_hub.calibrated = TRUE
- say("Calibration complete.")
- else
- say("Error: Unable to detect hub.")
- power_station.update_icon()
+ addtimer(CALLBACK(src, .proc/finish_calibration), 50 * (3 - power_station.teleporter_hub.accuracy)) //Better parts mean faster calibration
. = TRUE
+/obj/machinery/computer/teleporter/proc/finish_calibration()
+ calibrating = FALSE
+ if(check_hub_connection())
+ power_station.teleporter_hub.calibrated = TRUE
+ say("Calibration complete.")
+ else
+ say("Error: Unable to detect hub.")
+ power_station.update_icon()
+
/obj/machinery/computer/teleporter/proc/check_hub_connection()
if(!power_station)
return FALSE
diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm
index a950cb7e7d..d403b32896 100644
--- a/code/game/machinery/doors/airlock.dm
+++ b/code/game/machinery/doors/airlock.dm
@@ -298,10 +298,10 @@
/obj/machinery/door/airlock/Destroy()
QDEL_NULL(wires)
+ QDEL_NULL(electronics)
if(charge)
qdel(charge)
charge = null
- QDEL_NULL(electronics)
if (cyclelinkedairlock)
if (cyclelinkedairlock.cyclelinkedairlock == src)
cyclelinkedairlock.cyclelinkedairlock = null
@@ -309,7 +309,7 @@
if(id_tag)
for(var/obj/machinery/doorButtons/D in GLOB.machines)
D.removeMe(src)
- qdel(note)
+ QDEL_NULL(note)
for(var/datum/atom_hud/data/diagnostic/diag_hud in GLOB.huds)
diag_hud.remove_from_hud(src)
return ..()
@@ -1440,11 +1440,10 @@
else if(istype(note, /obj/item/photo))
return "photo"
-/obj/machinery/door/airlock/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
- datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
- SStgui.try_update_ui(user, src, ui_key, ui, force_open)
+/obj/machinery/door/airlock/ui_interact(mob/user, datum/tgui/ui)
+ ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
- ui = new(user, src, ui_key, "AiAirlock", name, 500, 390, master_ui, state)
+ ui = new(user, src, "AiAirlock", name)
ui.open()
return TRUE
@@ -1452,10 +1451,10 @@
var/list/data = list()
var/list/power = list()
- power["main"] = src.secondsMainPowerLost ? 0 : 2 // boolean
- power["main_timeleft"] = src.secondsMainPowerLost
- power["backup"] = src.secondsBackupPowerLost ? 0 : 2 // boolean
- power["backup_timeleft"] = src.secondsBackupPowerLost
+ power["main"] = secondsMainPowerLost ? 0 : 2 // boolean
+ power["main_timeleft"] = secondsMainPowerLost
+ power["backup"] = secondsBackupPowerLost ? 0 : 2 // boolean
+ power["backup_timeleft"] = secondsBackupPowerLost
data["power"] = power
data["shock"] = secondsElectrified == 0 ? 2 : 0
@@ -1495,14 +1494,14 @@
loseMainPower()
update_icon()
else
- to_chat(usr, "Main power is already offline.")
+ to_chat(usr, "Main power is already offline.")
. = TRUE
if("disrupt-backup")
if(!secondsBackupPowerLost)
loseBackupPower()
update_icon()
else
- to_chat(usr, "Backup power is already offline.")
+ to_chat(usr, "Backup power is already offline.")
. = TRUE
if("shock-restore")
shock_restore(usr)
@@ -1531,7 +1530,6 @@
. = TRUE
if("speed-toggle")
normalspeed = !normalspeed
-
. = TRUE
if("open-close")
user_toggle_open(usr)
diff --git a/code/game/machinery/doors/airlock_electronics.dm b/code/game/machinery/doors/airlock_electronics.dm
index a0ce3954c3..ef2be8d744 100644
--- a/code/game/machinery/doors/airlock_electronics.dm
+++ b/code/game/machinery/doors/airlock_electronics.dm
@@ -15,11 +15,13 @@
. = ..()
. += "Has a neat selection menu for modifying airlock access levels."
-/obj/item/electronics/airlock/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
- datum/tgui/master_ui = null, datum/ui_state/state = GLOB.hands_state)
- ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
+/obj/item/electronics/airlock/ui_state(mob/user)
+ return GLOB.hands_state
+
+/obj/item/electronics/airlock/ui_interact(mob/user, datum/tgui/ui)
+ ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
- ui = new(user, src, ui_key, "AirlockElectronics", name, 420, 485, master_ui, state)
+ ui = new(user, src, "AirlockElectronics", name)
ui.open()
/obj/item/electronics/airlock/ui_static_data(mob/user)
diff --git a/code/game/machinery/doors/brigdoors.dm b/code/game/machinery/doors/brigdoors.dm
index 5a1ed7dd19..b2e0050819 100644
--- a/code/game/machinery/doors/brigdoors.dm
+++ b/code/game/machinery/doors/brigdoors.dm
@@ -140,11 +140,10 @@
. = new_time == timer_duration //return 1 on no change
timer_duration = new_time
-/obj/machinery/door_timer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
- datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
- ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
+/obj/machinery/door_timer/ui_interact(mob/user, datum/tgui/ui)
+ ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
- ui = new(user, src, ui_key, "BrigTimer", name, 300, 138, master_ui, state)
+ ui = new(user, src, "BrigTimer", name)
ui.open()
//icon update function
@@ -235,7 +234,7 @@
preset_time = PRESET_LONG
. = set_timer(preset_time)
if(timing)
- activation_time = REALTIMEOFDAY
+ activation_time = world.time
else
. = FALSE
diff --git a/code/game/machinery/porta_turret/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm
index 1887ee46c0..38597ea158 100644
--- a/code/game/machinery/porta_turret/portable_turret.dm
+++ b/code/game/machinery/porta_turret/portable_turret.dm
@@ -4,6 +4,15 @@
#define POPUP_ANIM_TIME 5
#define POPDOWN_ANIM_TIME 5 //Be sure to change the icon animation at the same time or it'll look bad
+#define TURRET_FLAG_SHOOT_ALL_REACT (1<<0) // The turret gets pissed off and shoots at people nearby (unless they have sec access!)
+#define TURRET_FLAG_AUTH_WEAPONS (1<<1) // Checks if it can shoot people that have a weapon they aren't authorized to have
+#define TURRET_FLAG_SHOOT_CRIMINALS (1<<2) // Checks if it can shoot people that are wanted
+#define TURRET_FLAG_SHOOT_ALL (1<<3) // The turret gets pissed off and shoots at people nearby (unless they have sec access!)
+#define TURRET_FLAG_SHOOT_ANOMALOUS (1<<4) // Checks if it can shoot at unidentified lifeforms (ie xenos)
+#define TURRET_FLAG_SHOOT_UNSHIELDED (1<<5) // Checks if it can shoot people that aren't mindshielded and who arent heads
+#define TURRET_FLAG_SHOOT_BORGS (1<<6) // checks if it can shoot cyborgs
+#define TURRET_FLAG_SHOOT_HEADS (1<<7) // checks if it can shoot at heads of staff
+
/obj/machinery/porta_turret
name = "turret"
icon = 'icons/obj/turrets.dmi'
@@ -15,68 +24,72 @@
use_power = IDLE_POWER_USE //this turret uses and requires power
idle_power_usage = 50 //when inactive, this turret takes up constant 50 Equipment power
active_power_usage = 300 //when active, this turret takes up constant 300 Equipment power
- req_access = list(ACCESS_SEC_DOORS)
- power_channel = EQUIP //drains power from the EQUIPMENT channel
-
- var/base_icon_state = "standard"
- var/scan_range = 7
- var/atom/base = null //for turrets inside other objects
-
- var/raised = 0 //if the turret cover is "open" and the turret is raised
- var/raising= 0 //if the turret is currently opening or closing its cover
-
+ req_access = list(ACCESS_SECURITY) /// Only people with Security access
+ power_channel = AREA_USAGE_EQUIP //drains power from the EQUIPMENT channel
max_integrity = 160 //the turret's health
integrity_failure = 0.5
armor = list("melee" = 50, "bullet" = 30, "laser" = 30, "energy" = 30, "bomb" = 30, "bio" = 0, "rad" = 0, "fire" = 90, "acid" = 90)
-
- var/locked = TRUE //if the turret's behaviour control access is locked
- var/controllock = FALSE //if the turret responds to control panels
-
- var/installation = /obj/item/gun/energy/e_gun/turret //the type of weapon installed by default
+ /// Base turret icon state
+ var/base_icon_state = "standard"
+ /// Scan range of the turret for locating targets
+ var/scan_range = 7
+ /// For turrets inside other objects
+ var/atom/base = null
+ /// If the turret cover is "open" and the turret is raised
+ var/raised = FALSE
+ /// If the turret is currently opening or closing its cover
+ var/raising = FALSE
+ /// If the turret's behaviour control access is locked
+ var/locked = TRUE
+ /// If the turret responds to control panels
+ var/controllock = FALSE
+ /// The type of weapon installed by default
+ var/installation = /obj/item/gun/energy/e_gun/turret
+ /// What stored gun is in the turret
var/obj/item/gun/stored_gun = null
- var/gun_charge = 0 //the charge of the gun when retrieved from wreckage
-
+ /// The charge of the gun when retrieved from wreckage
+ var/gun_charge = 0
+ /// In which mode is turret in, stun or lethal
var/mode = TURRET_STUN
-
- var/stun_projectile = null //stun mode projectile type
+ /// Stun mode projectile type
+ var/stun_projectile = null
+ /// Sound of stun projectile
var/stun_projectile_sound
- var/nonlethal_projectile //projectile to use in stun mode when the target is resting, if any
- var/nonlethal_projectile_sound
- var/lethal_projectile = null //lethal mode projectile type
+ /// Lethal mode projectile type
+ var/lethal_projectile = null
+ /// Sound of lethal projectile
var/lethal_projectile_sound
-
- var/reqpower = 500 //power needed per shot
- var/always_up = 0 //Will stay active
- var/has_cover = 1 //Hides the cover
-
- var/obj/machinery/porta_turret_cover/cover = null //the cover that is covering this turret
-
- var/last_fired = 0 //world.time the turret last fired
- var/shot_delay = 15 //ticks until next shot (1.5 ?)
-
-
- var/check_records = 1 //checks if it can use the security records
- var/criminals = 1 //checks if it can shoot people on arrest
- var/auth_weapons = 0 //checks if it can shoot people that have a weapon they aren't authorized to have
- var/stun_all = 0 //if this is active, the turret shoots everything that isn't security or head of staff
- var/check_anomalies = 1 //checks if it can shoot at unidentified lifeforms (ie xenos)
- var/shoot_unloyal = 0 //checks if it can shoot people that aren't loyalty implantd
-
- var/attacked = 0 //if set to 1, the turret gets pissed off and shoots at people nearby (unless they have sec access!)
-
- var/on = TRUE //determines if the turret is on
-
- var/list/faction = list("turret") // Same faction mobs will never be shot at, no matter the other settings
-
- var/datum/effect_system/spark_spread/spark_system //the spark system, used for generating... sparks?
-
+ /// Power needed per shot
+ var/reqpower = 500
+ /// Will stay active
+ var/always_up = FALSE
+ /// Hides the cover
+ var/has_cover = TRUE
+ /// The cover that is covering this turret
+ var/obj/machinery/porta_turret_cover/cover = null
+ /// World.time the turret last fired
+ var/last_fired = 0
+ /// Ticks until next shot (1.5 ?)
+ var/shot_delay = 15
+ /// Turret flags about who is turret allowed to shoot
+ var/turret_flags = TURRET_FLAG_SHOOT_CRIMINALS | TURRET_FLAG_SHOOT_ANOMALOUS
+ /// Determines if the turret is on
+ var/on = TRUE
+ /// Same faction mobs will never be shot at, no matter the other settings
+ var/list/faction = list("turret")
+ /// The spark system, used for generating... sparks?
+ var/datum/effect_system/spark_spread/spark_system
+ /// Linked turret control panel of the turret
var/obj/machinery/turretid/cp = null
-
- var/wall_turret_direction //The turret will try to shoot from a turf in that direction when in a wall
-
- var/manual_control = FALSE //
+ /// The turret will try to shoot from a turf in that direction when in a wall
+ var/wall_turret_direction
+ /// If the turret is manually controlled
+ var/manual_control = FALSE
+ /// Action button holder for quitting manual control
var/datum/action/turret_quit/quit_action
+ /// Action button holder for switching between turret modes when manually controlling
var/datum/action/turret_toggle/toggle_action
+ /// Mob that is remotely controlling the turret
var/mob/remote_controller
/obj/machinery/porta_turret/Initialize()
@@ -99,6 +112,25 @@
if(!has_cover)
INVOKE_ASYNC(src, .proc/popUp)
+/obj/machinery/porta_turret/proc/toggle_on(var/set_to)
+ var/current = on
+ if (!isnull(set_to))
+ on = set_to
+ else
+ on = !on
+ if (current != on)
+ check_should_process()
+ if (!on)
+ popDown()
+
+/obj/machinery/porta_turret/proc/check_should_process()
+ if (datum_flags & DF_ISPROCESSING)
+ if (!on || !anchored || (stat & BROKEN) || !powered())
+ end_processing()
+ else
+ if (on && anchored && !(stat & BROKEN) && powered())
+ begin_processing()
+
/obj/machinery/porta_turret/update_icon_state()
if(!anchored)
icon_state = "turretCover"
@@ -118,7 +150,6 @@
else
icon_state = "[base_icon_state]_unpowered"
-
/obj/machinery/porta_turret/proc/setup(obj/item/gun/turret_gun)
if(stored_gun)
qdel(stored_gun)
@@ -159,83 +190,88 @@
remove_control()
return ..()
-/obj/machinery/porta_turret/ui_interact(mob/user)
- . = ..()
- var/dat
- dat += "Status: [on ? "On" : "Off"]
"
- dat += "Behaviour controls are [locked ? "locked" : "unlocked"]
"
+/obj/machinery/porta_turret/ui_interact(mob/user, datum/tgui/ui)
+ ui = SStgui.try_update_ui(user, src, ui)
+ if(!ui)
+ ui = new(user, src, "PortableTurret", name)
+ ui.open()
- if(!locked)
- dat += "Check for Weapon Authorization: [auth_weapons ? "Yes" : "No"]
"
- dat += "Check Security Records: [check_records ? "Yes" : "No"]
"
- dat += "Neutralize Identified Criminals: [criminals ? "Yes" : "No"]
"
- dat += "Neutralize All Non-Security and Non-Command Personnel: [stun_all ? "Yes" : "No"]
"
- dat += "Neutralize All Unidentified Life Signs: [check_anomalies ? "Yes" : "No"]
"
- dat += "Neutralize All Non-Loyalty Implanted Personnel: [shoot_unloyal ? "Yes" : "No"]
"
+/obj/machinery/porta_turret/ui_data(mob/user)
+ var/list/data = list(
+ "locked" = locked,
+ "on" = on,
+ "check_weapons" = turret_flags & TURRET_FLAG_AUTH_WEAPONS,
+ "neutralize_criminals" = turret_flags & TURRET_FLAG_SHOOT_CRIMINALS,
+ "neutralize_all" = turret_flags & TURRET_FLAG_SHOOT_ALL,
+ "neutralize_unidentified" = turret_flags & TURRET_FLAG_SHOOT_ANOMALOUS,
+ "neutralize_nonmindshielded" = turret_flags & TURRET_FLAG_SHOOT_UNSHIELDED,
+ "neutralize_cyborgs" = turret_flags & TURRET_FLAG_SHOOT_BORGS,
+ "ignore_heads" = turret_flags & TURRET_FLAG_SHOOT_HEADS,
+ "manual_control" = manual_control,
+ "silicon_user" = FALSE,
+ "allow_manual_control" = FALSE,
+ "lasertag_turret" = istype(src, /obj/machinery/porta_turret/lasertag),
+ )
if(issilicon(user))
+ data["silicon_user"] = TRUE
if(!manual_control)
var/mob/living/silicon/S = user
if(S.hack_software)
- dat += "Assume direct control : Manual Control
"
- else
- dat += "Warning! Remote control protocol enabled.
"
+ data["allow_manual_control"] = TRUE
+ return data
-
- var/datum/browser/popup = new(user, "autosec", "Automatic Portable Turret Installation", 300, 300)
- popup.set_content(dat)
- popup.open()
-
-/obj/machinery/porta_turret/Topic(href, href_list)
- if(..())
- return
- usr.set_machine(src)
- add_fingerprint(usr)
-
- if(href_list["power"] && !locked)
- if(anchored) //you can't turn a turret on/off if it's not anchored/secured
- on = !on //toggle on/off
- else
- to_chat(usr, "It has to be secured first!")
- interact(usr)
+/obj/machinery/porta_turret/ui_act(action, list/params)
+ . = ..()
+ if(.)
return
- if(href_list["operation"])
- switch(href_list["operation"]) //toggles customizable behavioural protocols
- if("authweapon")
- auth_weapons = !auth_weapons
- if("checkrecords")
- check_records = !check_records
- if("shootcrooks")
- criminals = !criminals
- if("shootall")
- stun_all = !stun_all
- if("checkxenos")
- check_anomalies = !check_anomalies
- if("checkloyal")
- shoot_unloyal = !shoot_unloyal
- if("manual")
- if(issilicon(usr) && !manual_control)
- give_control(usr)
- interact(usr)
+ switch(action)
+ if("power")
+ if(anchored)
+ toggle_on()
+ return TRUE
+ else
+ to_chat(usr, "It has to be secured first!")
+ if("authweapon")
+ turret_flags ^= TURRET_FLAG_AUTH_WEAPONS
+ return TRUE
+ if("shootcriminals")
+ turret_flags ^= TURRET_FLAG_SHOOT_CRIMINALS
+ return TRUE
+ if("shootall")
+ turret_flags ^= TURRET_FLAG_SHOOT_ALL
+ return TRUE
+ if("checkxenos")
+ turret_flags ^= TURRET_FLAG_SHOOT_ANOMALOUS
+ return TRUE
+ if("checkloyal")
+ turret_flags ^= TURRET_FLAG_SHOOT_UNSHIELDED
+ return TRUE
+ if("shootborgs")
+ turret_flags ^= TURRET_FLAG_SHOOT_BORGS
+ return TRUE
+ if("shootheads")
+ turret_flags ^= TURRET_FLAG_SHOOT_HEADS
+ return TRUE
+ if("manual")
+ if(!issilicon(usr))
+ return
+ give_control(usr)
+ return TRUE
+
+/obj/machinery/porta_turret/ui_host(mob/user)
+ if(has_cover && cover)
+ return cover
+ if(base)
+ return base
+ return src
/obj/machinery/porta_turret/power_change()
- if(!anchored)
+ . = ..()
+ if(!anchored || (stat & BROKEN) || !powered())
update_icon()
remove_control()
- return
- if(stat & BROKEN)
- update_icon()
- remove_control()
- else
- if( powered() )
- stat &= ~NOPOWER
- update_icon()
- else
- spawn(rand(0, 15))
- stat |= NOPOWER
- remove_control()
- update_icon()
-
+ check_should_process()
/obj/machinery/porta_turret/attackby(obj/item/I, mob/user, params)
if(stat & BROKEN)
@@ -283,8 +319,10 @@
locked = !locked
to_chat(user, "Controls are now [locked ? "locked" : "unlocked"].")
else
- to_chat(user, "Access denied.")
+ to_chat(user, "Access denied.")
else if(istype(I, /obj/item/multitool) && !locked)
+ if(!multitool_check_buffer(user, I))
+ return
var/obj/item/multitool/M = I
M.buffer = src
to_chat(user, "You add [src] to multitool buffer.")
@@ -292,19 +330,17 @@
return ..()
/obj/machinery/porta_turret/emag_act(mob/user)
- . = ..()
if(obj_flags & EMAGGED)
return
to_chat(user, "You short out [src]'s threat assessment circuits.")
- visible_message("[src] hums oddly...")
+ audible_message("[src] hums oddly...")
obj_flags |= EMAGGED
controllock = TRUE
- on = FALSE //turns off the turret temporarily
+ toggle_on(FALSE) //turns off the turret temporarily
update_icon()
- sleep(60) //6 seconds for the traitor to gtfo of the area before the turret decides to ruin his shit
- on = TRUE //turns it back on. The cover popUp() popDown() are automatically called in process(), no need to define it here
- return TRUE
-
+ //6 seconds for the traitor to gtfo of the area before the turret decides to ruin his shit
+ addtimer(CALLBACK(src, .proc/toggle_on, TRUE), 6 SECONDS)
+ //turns it back on. The cover popUp() popDown() are automatically called in process(), no need to define it here
/obj/machinery/porta_turret/emp_act(severity)
. = ..()
@@ -313,63 +349,41 @@
if(on)
//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_records = pick(0, 1)
- criminals = pick(0, 1)
- auth_weapons = pick(0, 1)
- stun_all = pick(0, 0, 0, 0, 1) //stun_all is a pretty big deal, so it's least likely to get turned on
+ if(prob(50))
+ turret_flags |= TURRET_FLAG_SHOOT_CRIMINALS
+ if(prob(50))
+ turret_flags |= TURRET_FLAG_AUTH_WEAPONS
+ if(prob(20))
+ turret_flags |= TURRET_FLAG_SHOOT_ALL // Shooting everyone is a pretty big deal, so it's least likely to get turned on
- on = FALSE
+ toggle_on(FALSE)
remove_control()
- spawn(rand(60,600))
- if(!on)
- on = TRUE
+ addtimer(CALLBACK(src, .proc/toggle_on, TRUE), rand(60,600))
/obj/machinery/porta_turret/take_damage(damage, damage_type = BRUTE, damage_flag = 0, sound_effect = 1)
. = ..()
- if(.) //damage received
+ if(. && obj_integrity > 0) //damage received
if(prob(30))
spark_system.start()
- if(on && !attacked && !(obj_flags & EMAGGED))
- attacked = TRUE
+ if(on && !(turret_flags & TURRET_FLAG_SHOOT_ALL_REACT) && !(obj_flags & EMAGGED))
+ turret_flags |= TURRET_FLAG_SHOOT_ALL_REACT
addtimer(CALLBACK(src, .proc/reset_attacked), 60)
/obj/machinery/porta_turret/proc/reset_attacked()
- attacked = FALSE
+ turret_flags &= ~TURRET_FLAG_SHOOT_ALL_REACT
/obj/machinery/porta_turret/deconstruct(disassembled = TRUE)
qdel(src)
/obj/machinery/porta_turret/obj_break(damage_flag)
- if(!(flags_1 & NODECONSTRUCT_1) && !(stat & BROKEN))
- stat |= BROKEN //enables the BROKEN bit
+ . = ..()
+ if(.)
power_change()
invisibility = 0
spark_system.start() //creates some sparks because they look cool
qdel(cover) //deletes the cover - no need on keeping it there!
-//turret healing
-/obj/machinery/porta_turret/examine(mob/user)
- . = ..()
- if(obj_integrity < max_integrity)
- . += "Use a welder to fix it."
-
-/obj/machinery/porta_turret/welder_act(mob/living/user, obj/item/I)
- . = TRUE
- if(obj_integrity < max_integrity)
- if(!I.tool_start_check(user, amount=0))
- return
- user.visible_message("[user] is welding the turret.", \
- "You begin repairing the turret...", \
- "You hear welding.")
- if(I.use_tool(src, user, 40, volume=50))
- obj_integrity = max_integrity
- user.visible_message("[user.name] has repaired [src].", \
- "You finish repairing the turret.")
- else
- to_chat(user, "The turret doesn't need repairing.")
-
-
/obj/machinery/porta_turret/process()
//the main machinery process
if(cover == null && anchored) //if it has no cover and is anchored
@@ -381,35 +395,43 @@
cover.parent_turret = src //assign the cover its parent_turret, which would be this (src)
if(!on || (stat & (NOPOWER|BROKEN)) || manual_control)
- return
+ return PROCESS_KILL
var/list/targets = list()
for(var/mob/A in view(scan_range, base))
if(A.invisibility > SEE_INVISIBLE_LIVING)
continue
- if(check_anomalies)//if it's set to check for simple animals
+ if(turret_flags & TURRET_FLAG_SHOOT_ANOMALOUS)//if it's set to check for simple animals
if(isanimal(A))
var/mob/living/simple_animal/SA = A
if(SA.stat || in_faction(SA)) //don't target if dead or in faction
continue
targets += SA
- if(issilicon(A))
- var/mob/living/silicon/sillycone = A
- if(sillycone.stat || in_faction(sillycone))
+ continue
+
+ if(issilicon(A))
+ var/mob/living/silicon/sillycone = A
+
+ if(ispAI(A))
+ continue
+
+ if((turret_flags & TURRET_FLAG_SHOOT_BORGS) && sillycone.stat != DEAD && iscyborg(sillycone))
+ targets += sillycone
+ continue
+
+ if(sillycone.stat || in_faction(sillycone))
+ continue
+
+ if(iscyborg(sillycone))
+ var/mob/living/silicon/robot/sillyconerobot = A
+ if(LAZYLEN(faction) && (ROLE_SYNDICATE in faction) && sillyconerobot.emagged == TRUE)
continue
- if(iscyborg(sillycone))
- var/mob/living/silicon/robot/sillyconerobot = A
- if(LAZYLEN(faction) && (ROLE_SYNDICATE in faction) && sillyconerobot.emagged == TRUE)
- continue
-
- targets += sillycone
-
- if(iscarbon(A))
+ else if(iscarbon(A))
var/mob/living/carbon/C = A
- //If not emagged, only target non downed carbons
- if(mode != TURRET_LETHAL && (C.stat || C.handcuffed || (C.combat_flags & COMBAT_FLAG_HARD_STAMCRIT)))//CIT CHANGE - replaces check for lying with check for recoveringstam
+ //If not emagged, only target carbons that can use items
+ if(mode != TURRET_LETHAL && (C.stat || C.handcuffed || !(C.mobility_flags & MOBILITY_USE)))
continue
//If emagged, target all but dead carbons
@@ -418,12 +440,13 @@
//if the target is a human and not in our faction, analyze threat level
if(ishuman(C) && !in_faction(C))
+
if(assess_perp(C) >= 4)
targets += C
-
- else if(check_anomalies) //non humans who are not simple animals (xenos etc)
+ else if(turret_flags & TURRET_FLAG_SHOOT_ANOMALOUS) //non humans who are not simple animals (xenos etc)
if(!in_faction(C))
targets += C
+
for(var/A in GLOB.mechas_list)
if((get_dist(A, base) < scan_range) && can_see(base, A, scan_range))
var/obj/mecha/Mech = A
@@ -431,6 +454,10 @@
if(assess_perp(Mech.occupant) >= 4)
targets += Mech
+ if((turret_flags & TURRET_FLAG_SHOOT_ANOMALOUS) && GLOB.blobs.len && (mode == TURRET_LETHAL))
+ for(var/obj/structure/blob/B in view(scan_range, base))
+ targets += B
+
if(targets.len)
tryToShootAt(targets)
else if(!always_up)
@@ -443,7 +470,6 @@
if(target(M))
return 1
-
/obj/machinery/porta_turret/proc/popUp() //pops the turret up
if(!anchored)
return
@@ -485,36 +511,37 @@
if(obj_flags & EMAGGED)
return 10 //if emagged, always return 10.
- if((stun_all || attacked) && !allowed(perp))
+ if((turret_flags & (TURRET_FLAG_SHOOT_ALL | TURRET_FLAG_SHOOT_ALL_REACT)) && !allowed(perp))
//if the turret has been attacked or is angry, target all non-sec people
if(!allowed(perp))
return 10
- if(auth_weapons) //check for weapon authorization
+ if(turret_flags & TURRET_FLAG_AUTH_WEAPONS) //check for weapon authorization
if(isnull(perp.wear_id) || istype(perp.wear_id.GetID(), /obj/item/card/id/syndicate))
if(allowed(perp)) //if the perp has security access, return 0
return 0
-
if(perp.is_holding_item_of_type(/obj/item/gun) || perp.is_holding_item_of_type(/obj/item/melee/baton))
threatcount += 4
if(istype(perp.belt, /obj/item/gun) || istype(perp.belt, /obj/item/melee/baton))
threatcount += 2
- if(check_records) //if the turret can check the records, check if they are set to *Arrest* on records
+ if(turret_flags & TURRET_FLAG_SHOOT_CRIMINALS) //if the turret can check the records, check if they are set to *Arrest* on records
var/perpname = perp.get_face_name(perp.get_id_name())
var/datum/data/record/R = find_record("name", perpname, GLOB.data_core.security)
if(!R || (R.fields["criminal"] == "*Arrest*"))
threatcount += 4
- if(shoot_unloyal)
- if (!HAS_TRAIT(perp, TRAIT_MINDSHIELD))
- threatcount += 4
+ if((turret_flags & TURRET_FLAG_SHOOT_UNSHIELDED) && (!HAS_TRAIT(perp, TRAIT_MINDSHIELD)))
+ threatcount += 4
+
+ // If we aren't shooting heads then return a threatcount of 0
+ if (!(turret_flags & TURRET_FLAG_SHOOT_HEADS) && (perp.get_assignment() in GLOB.command_positions))
+ return 0
return threatcount
-
/obj/machinery/porta_turret/proc/in_faction(mob/target)
for(var/faction1 in faction)
if(faction1 in target.faction)
@@ -557,26 +584,17 @@
T = closer
break
- var/mob/living/carbon/C
- if(iscarbon(target))
- C = target
-
update_icon()
var/obj/item/projectile/A
//any emagged turrets drains 2x power and uses a different projectile?
if(mode == TURRET_STUN)
- if(nonlethal_projectile && C && C.resting)
- use_power(reqpower*0.5)
- A = new nonlethal_projectile(T)
- playsound(loc, nonlethal_projectile_sound, 75, 1)
- else
- use_power(reqpower)
- A = new stun_projectile(T)
- playsound(loc, stun_projectile_sound, 75, 1)
+ use_power(reqpower)
+ A = new stun_projectile(T)
+ playsound(loc, stun_projectile_sound, 75, TRUE)
else
use_power(reqpower * 2)
A = new lethal_projectile(T)
- playsound(loc, lethal_projectile_sound, 75, 1)
+ playsound(loc, lethal_projectile_sound, 75, TRUE)
//Shooting Code:
@@ -586,16 +604,15 @@
A.fire()
return A
-/obj/machinery/porta_turret/proc/setState(on, mode)
+/obj/machinery/porta_turret/proc/setState(on, mode, shoot_cyborgs)
if(controllock)
return
- src.on = on
- if(!on)
- popDown()
+
+ shoot_cyborgs ? (turret_flags |= TURRET_FLAG_SHOOT_BORGS) : (turret_flags &= ~TURRET_FLAG_SHOOT_BORGS)
+ toggle_on(on)
src.mode = mode
power_change()
-
/datum/action/turret_toggle
name = "Toggle Mode"
icon_icon = 'icons/mob/actions/actions_mecha.dmi'
@@ -679,27 +696,30 @@
/obj/machinery/porta_turret/syndicate/ComponentInitialize()
. = ..()
- AddElement(/datum/element/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES)
+ // AddComponent(/datum/component/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES)
+ AddElement(/datum/element/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES) //this one or ^ one?
+
+
+/obj/machinery/porta_turret/syndicate/setup()
+ return
+
+/obj/machinery/porta_turret/syndicate/assess_perp(mob/living/carbon/human/perp)
+ return 10 //Syndicate turrets shoot everything not in their faction
/obj/machinery/porta_turret/syndicate/energy
icon_state = "standard_stun"
base_icon_state = "standard"
stun_projectile = /obj/item/projectile/energy/electrode
stun_projectile_sound = 'sound/weapons/taser.ogg'
- nonlethal_projectile = /obj/item/projectile/beam/disabler
- nonlethal_projectile_sound = 'sound/weapons/taser2.ogg'
lethal_projectile = /obj/item/projectile/beam/laser
lethal_projectile_sound = 'sound/weapons/laser.ogg'
desc = "An energy blaster auto-turret."
-
/obj/machinery/porta_turret/syndicate/energy/heavy
icon_state = "standard_stun"
base_icon_state = "standard"
stun_projectile = /obj/item/projectile/energy/electrode
stun_projectile_sound = 'sound/weapons/taser.ogg'
- nonlethal_projectile = /obj/item/projectile/beam/disabler
- nonlethal_projectile_sound = 'sound/weapons/taser2.ogg'
lethal_projectile = /obj/item/projectile/beam/laser/heavylaser
lethal_projectile_sound = 'sound/weapons/lasercannonfire.ogg'
desc = "An energy blaster auto-turret."
@@ -709,14 +729,13 @@
integrity_failure = 0.08
armor = list("melee" = 50, "bullet" = 30, "laser" = 30, "energy" = 30, "bomb" = 50, "bio" = 0, "rad" = 0, "fire" = 90, "acid" = 90)
-
-/obj/machinery/porta_turret/syndicate/setup()
- return
-
-/obj/machinery/porta_turret/syndicate/assess_perp(mob/living/carbon/human/perp)
- return 10 //Syndicate turrets shoot everything not in their faction
+/obj/machinery/porta_turret/syndicate/energy/raven
+ stun_projectile = /obj/item/projectile/beam/laser
+ stun_projectile_sound = 'sound/weapons/laser.ogg'
+ faction = list("neutral","silicon","turret")
/obj/machinery/porta_turret/syndicate/pod
+ integrity_failure = 0.5
max_integrity = 40
stun_projectile = /obj/item/projectile/bullet/syndicate_turret
lethal_projectile = /obj/item/projectile/bullet/syndicate_turret
@@ -741,8 +760,7 @@
/obj/machinery/porta_turret/ai
faction = list("silicon")
- nonlethal_projectile = /obj/item/projectile/beam/disabler
- nonlethal_projectile_sound = 'sound/weapons/taser2.ogg'
+ turret_flags = TURRET_FLAG_SHOOT_CRIMINALS | TURRET_FLAG_SHOOT_ANOMALOUS | TURRET_FLAG_SHOOT_HEADS
/obj/machinery/porta_turret/ai/assess_perp(mob/living/carbon/human/perp)
return 10 //AI turrets shoot at everything not in their faction
@@ -798,6 +816,7 @@
/obj/machinery/porta_turret/centcom_shuttle/weak
max_integrity = 120
+ integrity_failure = 0.5
name = "Old Laser Turret"
desc = "A turret built with substandard parts and run down further with age. Still capable of delivering lethal lasers to the odd space carp, but not much else."
stun_projectile = /obj/item/projectile/beam/weak/penetrator
@@ -811,7 +830,6 @@
stun_projectile_sound = 'sound/weapons/gunshot.ogg'
desc = "A ballistic machine gun auto-turret."
-
////////////////////////
//Turret Control Panel//
////////////////////////
@@ -822,14 +840,22 @@
icon = 'icons/obj/machines/turret_control.dmi'
icon_state = "control_standby"
density = FALSE
- var/enabled = 1
- var/lethal = 0
- var/locked = TRUE
- var/control_area = null //can be area name, path or nothing.
- var/ailock = 0 // AI cannot use this
req_access = list(ACCESS_AI_UPLOAD)
- var/list/obj/machinery/porta_turret/turrets = list()
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
+ /// Variable dictating if linked turrets are active and will shoot targets
+ var/enabled = TRUE
+ /// Variable dictating if linked turrets will shoot lethal projectiles
+ var/lethal = FALSE
+ /// Variable dictating if the panel is locked, preventing changes to turret settings
+ var/locked = TRUE
+ /// An area in which linked turrets are located, it can be an area name, path or nothing
+ var/control_area = null
+ /// AI is unable to use this machine if set to TRUE
+ var/ailock = FALSE
+ /// Variable dictating if linked turrets will shoot cyborgs
+ var/shoot_cyborgs = FALSE
+ /// List of all linked turrets
+ var/list/turrets = list()
/obj/machinery/turretid/Initialize(mapload, ndir = 0, built = 0)
. = ..()
@@ -862,112 +888,111 @@
T.cp = src
/obj/machinery/turretid/examine(mob/user)
- . = ..()
- if(hasSiliconAccessInArea(user) && (!stat & BROKEN))
- . += "Ctrl-click [src] to [ enabled ? "disable" : "enable"] turrets."
- . += "Alt-click [src] to set turrets to [ lethal ? "stun" : "kill"]."
+ . += ..()
+ if(issilicon(user) && !(stat & BROKEN))
+ . += {"Ctrl-click [src] to [ enabled ? "disable" : "enable"] turrets.
+ Alt-click [src] to set turrets to [ lethal ? "stun" : "kill"]."}
/obj/machinery/turretid/attackby(obj/item/I, mob/user, params)
if(stat & BROKEN)
return
if (istype(I, /obj/item/multitool))
+ if(!multitool_check_buffer(user, I))
+ return
var/obj/item/multitool/M = I
if(M.buffer && istype(M.buffer, /obj/machinery/porta_turret))
turrets |= M.buffer
- to_chat(user, "You link \the [M.buffer] with \the [src]")
+ to_chat(user, "You link \the [M.buffer] with \the [src].")
return
- if (hasSiliconAccessInArea(user))
+ if (issilicon(user))
return attack_hand(user)
if ( get_dist(src, user) == 0 ) // trying to unlock the interface
if (allowed(usr))
if(obj_flags & EMAGGED)
- to_chat(user, "The turret control is unresponsive.")
+ to_chat(user, "The turret control is unresponsive!")
return
locked = !locked
to_chat(user, "You [ locked ? "lock" : "unlock"] the panel.")
- if (locked)
- if (user.machine==src)
- user.unset_machine()
- user << browse(null, "window=turretid")
- else
- if (user.machine==src)
- attack_hand(user)
else
- to_chat(user, "Access denied.")
+ to_chat(user, "Access denied.")
/obj/machinery/turretid/emag_act(mob/user)
- . = ..()
if(obj_flags & EMAGGED)
return
- to_chat(user, "You short out the turret controls' access analysis module.")
+ to_chat(user, "You short out the turret controls' access analysis module.")
obj_flags |= EMAGGED
locked = FALSE
- if(user && user.machine == src)
- attack_hand(user)
- return TRUE
/obj/machinery/turretid/attack_ai(mob/user)
- if(!ailock || IsAdminGhost(user))
+ if(!ailock || isAdminGhostAI(user))
return attack_hand(user)
else
- to_chat(user, "There seems to be a firewall preventing you from accessing this device.")
+ to_chat(user, "There seems to be a firewall preventing you from accessing this device!")
-/obj/machinery/turretid/ui_interact(mob/user)
+/obj/machinery/turretid/ui_interact(mob/user, datum/tgui/ui)
+ ui = SStgui.try_update_ui(user, src, ui)
+ if(!ui)
+ ui = new(user, src, "TurretControl", name)
+ ui.open()
+
+/obj/machinery/turretid/ui_data(mob/user)
+ var/list/data = list()
+ data["locked"] = locked
+ data["siliconUser"] = user.has_unlimited_silicon_privilege
+ data["enabled"] = enabled
+ data["lethal"] = lethal
+ data["shootCyborgs"] = shoot_cyborgs
+ return data
+
+/obj/machinery/turretid/ui_act(action, list/params)
. = ..()
- if ( get_dist(src, user) > 0 )
- if ( !(hasSiliconAccessInArea(user) || IsAdminGhost(user)) )
- to_chat(user, "You are too far away.")
- user.unset_machine()
- user << browse(null, "window=turretid")
- return
-
- var/t = ""
-
- if(locked && !(hasSiliconAccessInArea(user) || IsAdminGhost(user)))
- t += "
| - [left_part] - | -- [list_queue()] - | -