diff --git a/baystation12.dme b/baystation12.dme
index d13c5536497..8cca12d06b2 100644
--- a/baystation12.dme
+++ b/baystation12.dme
@@ -325,6 +325,7 @@
#include "code\game\machinery\newscaster.dm"
#include "code\game\machinery\OpTable.dm"
#include "code\game\machinery\overview.dm"
+#include "code\game\machinery\portable_tag_turret.dm"
#include "code\game\machinery\portable_turret.dm"
#include "code\game\machinery\recharger.dm"
#include "code\game\machinery\rechargestation.dm"
diff --git a/code/game/jobs/access.dm b/code/game/jobs/access.dm
index 8441ab790be..0dc946aa167 100644
--- a/code/game/jobs/access.dm
+++ b/code/game/jobs/access.dm
@@ -417,76 +417,20 @@
/proc/get_all_centcom_jobs()
return list("VIP Guest","Custodian","Thunderdome Overseer","Intel Officer","Medical Officer","Death Commando","Research Officer","BlackOps Commander","Supreme Commander")
-//gets the actual job rank (ignoring alt titles)
-//this is used solely for sechuds
-/obj/proc/GetJobRealName()
- if (!istype(src, /obj/item/device/pda) && !istype(src,/obj/item/weapon/card/id))
- return
-
- var/rank
- var/assignment
- if(istype(src, /obj/item/device/pda))
- if(src:id)
- rank = src:id:rank
- assignment = src:id:assignment
- else if(istype(src, /obj/item/weapon/card/id))
- rank = src:rank
- assignment = src:assignment
-
- if( rank in joblist )
- return rank
-
- if( assignment in joblist )
- return assignment
-
- return "Unknown"
-
-//gets the alt title, failing that the actual job rank
-//this is unused
-/obj/proc/sdsdsd() //GetJobDisplayName
- if (!istype(src, /obj/item/device/pda) && !istype(src,/obj/item/weapon/card/id))
- return
-
- var/assignment
- if(istype(src, /obj/item/device/pda))
- if(src:id)
- assignment = src:id:assignment
- else if(istype(src, /obj/item/weapon/card/id))
- assignment = src:assignment
-
- if(assignment)
- return assignment
-
- return "Unknown"
+proc/GetIdCard(var/mob/living/carbon/human/H)
+ if(H.wear_id)
+ var/id = H.wear_id.GetID()
+ if(id)
+ return id
+ if(H.get_active_hand())
+ var/obj/item/I = H.get_active_hand()
+ return I.GetID()
proc/FindNameFromID(var/mob/living/carbon/human/H)
ASSERT(istype(H))
- var/obj/item/weapon/card/id/C = H.get_active_hand()
- if( istype(C) || istype(C, /obj/item/device/pda) )
- var/obj/item/weapon/card/id/ID = C
-
- if( istype(C, /obj/item/device/pda) )
- var/obj/item/device/pda/pda = C
- ID = pda.id
- if(!istype(ID))
- ID = null
-
- if(ID)
- return ID.registered_name
-
- C = H.wear_id
-
- if( istype(C) || istype(C, /obj/item/device/pda) )
- var/obj/item/weapon/card/id/ID = C
-
- if( istype(C, /obj/item/device/pda) )
- var/obj/item/device/pda/pda = C
- ID = pda.id
- if(!istype(ID))
- ID = null
-
- if(ID)
- return ID.registered_name
+ var/obj/item/weapon/card/id/C = GetIdCard(H)
+ if(C)
+ return C.registered_name
proc/get_all_job_icons() //For all existing HUD icons
return joblist + list("Prisoner")
diff --git a/code/game/machinery/bots/secbot.dm b/code/game/machinery/bots/secbot.dm
index f6140d91029..84f3efb167f 100644
--- a/code/game/machinery/bots/secbot.dm
+++ b/code/game/machinery/bots/secbot.dm
@@ -260,6 +260,12 @@ Auto Patrol: []"},
src.mode = 0
walk_to(src,0)
+ // We re-assess human targets, before bashing their head in, in case their credentials change
+ if(target && istype(target, /mob/living/carbon/human))
+ var/threat = src.assess_perp(target, idcheck, check_records)
+ if(threat < 4)
+ target = null
+
if(target) // make sure target exists
if(!lasercolor && Adjacent(target)) // If right next to perp. Lasertag bots do not arrest anyone, just patrol and shoot and whatnot
if(istype(src.target,/mob/living/carbon))
@@ -643,7 +649,7 @@ Auto Patrol: []"},
continue
if(istype(C, /mob/living/carbon/human))
- src.threatlevel = src.assess_perp(C, idcheck, check_records, lasercolor)
+ src.threatlevel = src.assess_perp(C, idcheck, check_records)
else if(istype(M, /mob/living/simple_animal/hostile))
if(M.stat == DEAD)
@@ -669,6 +675,40 @@ Auto Patrol: []"},
else
continue
+/obj/machinery/bot/secbot/on_assess_perp(mob/living/carbon/human/perp)
+ if(lasercolor)
+ return laser_check(perp, lasercolor)
+
+ var/threat = 0
+ threat -= laser_check(perp, "b")
+ threat -= laser_check(perp, "r")
+
+ return threat
+
+/obj/machinery/bot/secbot/proc/laser_check(mob/living/carbon/human/perp, var/lasercolor)
+ var/target_suit
+ var/target_weapon
+ var/threat = 0
+ //Lasertag turrets target the opposing team, how great is that? -Sieve
+ switch(lasercolor)
+ if("b")
+ target_suit = /obj/item/clothing/suit/redtag
+ target_weapon = /obj/item/weapon/gun/energy/laser/redtag
+ if("r")
+ target_suit = /obj/item/clothing/suit/bluetag
+ target_weapon = /obj/item/weapon/gun/energy/laser/bluetag
+
+ if((istype(perp.r_hand, target_weapon)) || (istype(perp.l_hand, target_weapon)))
+ threat += 4
+
+ if(istype(perp, /mob/living/carbon/human))
+ if(istype(perp.wear_suit, target_suit))
+ threat += 4
+ if(istype(perp.belt, target_weapon))
+ threat += 2
+
+ return threat
+
/obj/machinery/bot/secbot/is_assess_emagged()
return emagged == 2
diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm
index 3f08862d9a1..c7d6db50691 100644
--- a/code/game/machinery/machinery.dm
+++ b/code/game/machinery/machinery.dm
@@ -316,7 +316,7 @@ Class Procs:
/obj/machinery/proc/is_assess_emagged()
return emagged
-/obj/machinery/proc/assess_perp(mob/living/carbon/human/perp, var/auth_weapons, var/check_records, var/lasercolor)
+/obj/machinery/proc/assess_perp(mob/living/carbon/human/perp, var/auth_weapons, var/check_records)
var/threatcount = 0 //the integer returned
if(is_assess_emagged())
@@ -326,56 +326,27 @@ Class Procs:
if(threatcount >= 10)
return threatcount
+ //Agent cards lower threatlevel.
+ var/obj/item/weapon/card/id/id = GetIdCard(perp)
+ if(id && istype(id, /obj/item/weapon/card/id/syndicate))
+ threatcount -= 2
+
if(auth_weapons && !src.allowed(perp))
if(istype(perp.l_hand, /obj/item/weapon/gun) || istype(perp.l_hand, /obj/item/weapon/melee))
- if(!istype(perp.l_hand, /obj/item/weapon/gun/energy/laser/bluetag) \
- && !istype(perp.l_hand, /obj/item/weapon/gun/energy/laser/redtag) \
- && !istype(perp.l_hand, /obj/item/weapon/gun/energy/laser/practice))
- threatcount += 4
+ threatcount += 4
if(istype(perp.r_hand, /obj/item/weapon/gun) || istype(perp.r_hand, /obj/item/weapon/melee))
- if(!istype(perp.r_hand, /obj/item/weapon/gun/energy/laser/bluetag) \
- && !istype(perp.r_hand, /obj/item/weapon/gun/energy/laser/redtag) \
- && !istype(perp.r_hand, /obj/item/weapon/gun/energy/laser/practice))
- threatcount += 4
+ threatcount += 4
if(istype(perp.belt, /obj/item/weapon/gun) || istype(perp.belt, /obj/item/weapon/melee))
- if(!istype(perp.belt, /obj/item/weapon/gun/energy/laser/bluetag) \
- && !istype(perp.belt, /obj/item/weapon/gun/energy/laser/redtag) \
- && !istype(perp.belt, /obj/item/weapon/gun/energy/laser/practice))
- threatcount += 2
+ threatcount += 2
if(perp.dna && perp.dna.mutantrace && perp.dna.mutantrace != "none")
threatcount += 2
-
- //Agent cards lower threatlevel.
- if(perp.wear_id && istype(perp.wear_id.GetID(), /obj/item/weapon/card/id/syndicate))
- threatcount -= 2
-
- if(lasercolor == "b")//Lasertag turrets target the opposing team, how great is that? -Sieve
- threatcount = 0//They will not, however shoot at people who have guns, because it gets really fucking annoying
- if(istype(perp.wear_suit, /obj/item/clothing/suit/redtag))
- threatcount += 4
- if((istype(perp.r_hand,/obj/item/weapon/gun/energy/laser/redtag)) || (istype(perp.l_hand,/obj/item/weapon/gun/energy/laser/redtag)))
- threatcount += 4
- if(istype(perp.belt, /obj/item/weapon/gun/energy/laser/redtag))
- threatcount += 2
-
- if(lasercolor == "r")
- threatcount = 0
- if(istype(perp.wear_suit, /obj/item/clothing/suit/bluetag))
- threatcount += 4
- if((istype(perp.r_hand,/obj/item/weapon/gun/energy/laser/bluetag)) || (istype(perp.l_hand,/obj/item/weapon/gun/energy/laser/bluetag)))
- threatcount += 4
- if(istype(perp.belt, /obj/item/weapon/gun/energy/laser/bluetag))
- threatcount += 2
-
if(check_records)
var/perpname = perp.name
- if(perp.wear_id)
- var/obj/item/weapon/card/id/id = perp.wear_id.GetID()
- if(id)
- perpname = id.registered_name
+ if(id)
+ perpname = id.registered_name
var/datum/data/record/R = find_record("name", perpname, data_core.security)
if(!R || (R.fields["criminal"] == "*Arrest*"))
diff --git a/code/game/machinery/portable_tag_turret.dm b/code/game/machinery/portable_tag_turret.dm
new file mode 100644
index 00000000000..fa4e75bfc5a
--- /dev/null
+++ b/code/game/machinery/portable_tag_turret.dm
@@ -0,0 +1,128 @@
+#define TURRET_PRIORITY_TARGET 2
+#define TURRET_SECONDARY_TARGET 1
+#define TURRET_NOT_TARGET 0
+
+/obj/machinery/porta_turret/tag
+ // Reasonable defaults, in case someone manually spawns us
+ var/lasercolor = "r" //Something to do with lasertag turrets, blame Sieve for not adding a comment.
+ installation = /obj/item/weapon/gun/energy/laser/redtag
+
+/obj/machinery/porta_turret/tag/red
+
+/obj/machinery/porta_turret/tag/blue
+ lasercolor = "b"
+ installation = /obj/item/weapon/gun/energy/laser/bluetag
+
+/obj/machinery/porta_turret/tag/New()
+ ..()
+ icon_state = "[lasercolor]grey_target_prism"
+
+/obj/machinery/porta_turret/tag/weapon_setup(var/obj/item/weapon/gun/energy/E)
+ switch(E.type)
+ if(/obj/item/weapon/gun/energy/laser/bluetag)
+ eprojectile = /obj/item/weapon/gun/energy/laser/bluetag
+ lasercolor = "b"
+ req_access = list(access_maint_tunnels, access_theatre)
+ check_records = 0
+ auth_weapons = 1
+ stun_all = 0
+ check_anomalies = 0
+ shot_delay = 30
+
+ if(/obj/item/weapon/gun/energy/laser/redtag)
+ eprojectile = /obj/item/weapon/gun/energy/laser/redtag
+ lasercolor = "r"
+ req_access = list(access_maint_tunnels, access_theatre)
+ check_records = 0
+ auth_weapons = 1
+ stun_all = 0
+ check_anomalies = 0
+ shot_delay = 30
+ iconholder = 1
+
+/obj/machinery/porta_turret/tag/interact(mob/user)
+ var/dat
+
+ 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({"
+ Automatic Portable Turret Installation
+ Status: []
"},
+
+ "[on ? "On" : "Off"]" )
+
+
+ user << browse("
Automatic Portable Turret Installation[dat]", "window=autosec")
+ onclose(user, "autosec")
+ return
+
+/obj/machinery/porta_turret/tag/update_icon()
+ if(!anchored)
+ icon_state = "turretCover"
+ return
+ if(stat & BROKEN)
+ icon_state = "[lasercolor]destroyed_target_prism"
+ else
+ if(powered())
+ if(on)
+ if(iconholder)
+ //lasers have a orange icon
+ icon_state = "[lasercolor]orange_target_prism"
+ else
+ //almost everything has a blue icon
+ icon_state = "[lasercolor]target_prism"
+ else
+ icon_state = "[lasercolor]grey_target_prism"
+ else
+ icon_state = "[lasercolor]grey_target_prism"
+
+/obj/machinery/porta_turret/tag/bullet_act(obj/item/projectile/Proj)
+ ..()
+
+ if(lasercolor == "b" && disabled == 0)
+ if(istype(Proj, /obj/item/weapon/gun/energy/laser/redtag))
+ disabled = 1
+ del(Proj) // qdel
+ sleep(100)
+ disabled = 0
+ if(lasercolor == "r" && disabled == 0)
+ if(istype(Proj, /obj/item/weapon/gun/energy/laser/bluetag))
+ disabled = 1
+ del(Proj) // qdel
+ sleep(100)
+ disabled = 0
+
+/obj/machinery/porta_turret/tag/assess_living(var/mob/living/L)
+ if(!L)
+ return TURRET_NOT_TARGET
+
+ if(L.lying)
+ return TURRET_NOT_TARGET
+
+ var/target_suit
+ var/target_weapon
+ switch(lasercolor)
+ if("b")
+ target_suit = /obj/item/clothing/suit/redtag
+ target_weapon = /obj/item/weapon/gun/energy/laser/redtag
+ if("r")
+ target_suit = /obj/item/clothing/suit/bluetag
+ target_weapon = /obj/item/weapon/gun/energy/laser/bluetag
+
+
+ if(target_suit)//Lasertag turrets target the opposing team, how great is that? -Sieve
+ if((istype(L.r_hand, target_weapon)) || (istype(L.l_hand, target_weapon)))
+ return TURRET_PRIORITY_TARGET
+
+ if(istype(L, /mob/living/carbon/human))
+ var/mob/living/carbon/human/H = L
+ if(istype(H.wear_suit, target_suit))
+ return TURRET_PRIORITY_TARGET
+ if(istype(H.belt, target_weapon))
+ return TURRET_SECONDARY_TARGET
+
+ return TURRET_NOT_TARGET
\ No newline at end of file
diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm
index 4701669b24f..94dbd8b611d 100644
--- a/code/game/machinery/portable_turret.dm
+++ b/code/game/machinery/portable_turret.dm
@@ -3,10 +3,6 @@
This code is slightly more documented than normal, as requested by XSI on IRC.
*/
-#define TURRET_PRIORITY_TARGET 2
-#define TURRET_SECONDARY_TARGET 1
-#define TURRET_NOT_TARGET 0
-
/obj/machinery/porta_turret
name = "turret"
icon = 'icons/obj/turrets.dmi'
@@ -22,7 +18,6 @@
req_one_access = list(access_security, access_heads)
power_channel = EQUIP //drains power from the EQUIPMENT channel
- var/lasercolor = "" //Something to do with lasertag turrets, blame Sieve for not adding a comment.
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
var/health = 80 //the turret's health
@@ -51,6 +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/lethal = 0 //whether in lethal or stun mode
var/disabled = 0
var/shot_sound //what sound should play when the turret fires
@@ -60,7 +56,7 @@
/obj/machinery/porta_turret/New()
..()
- icon_state = "[lasercolor]grey_target_prism"
+ icon_state = "grey_target_prism"
//Sets up a spark system
spark_system = new /datum/effect/effect/system/spark_spread
spark_system.set_up(5, 0, src)
@@ -71,7 +67,6 @@
setup()
/obj/machinery/porta_turret/proc/setup()
-
var/obj/item/weapon/gun/energy/E = new installation //All energy-based weapons are applicable
//var/obj/item/ammo_casing/shottype = E.projectile_type
@@ -80,66 +75,66 @@
shot_sound = E.fire_sound
eshot_sound = shot_sound
- switch(E.type)
- if(/obj/item/weapon/gun/energy/laser/bluetag)
- eprojectile = /obj/item/weapon/gun/energy/laser/bluetag
- lasercolor = "b"
- req_access = list(access_maint_tunnels, access_theatre)
- check_records = 0
- auth_weapons = 1
- stun_all = 0
- check_anomalies = 0
- shot_delay = 30
+ weapon_setup(E)
- if(/obj/item/weapon/gun/energy/laser/redtag)
- eprojectile = /obj/item/weapon/gun/energy/laser/redtag
- lasercolor = "r"
- req_access = list(access_maint_tunnels, access_theatre)
- check_records = 0
- auth_weapons = 1
- stun_all = 0
- check_anomalies = 0
- shot_delay = 30
- iconholder = 1
-
- if(/obj/item/weapon/gun/energy/laser/practice)
- iconholder = 1
- eprojectile = /obj/item/projectile/beam
+/obj/machinery/porta_turret/proc/weapon_setup(var/obj/item/weapon/gun/energy/E)
+ if(/obj/item/weapon/gun/energy/laser/practice)
+ iconholder = 1
+ eprojectile = /obj/item/projectile/beam
// if(/obj/item/weapon/gun/energy/laser/practice/sc_laser)
// iconholder = 1
// eprojectile = /obj/item/projectile/beam
- if(/obj/item/weapon/gun/energy/laser/retro)
- iconholder = 1
+ if(/obj/item/weapon/gun/energy/laser/retro)
+ iconholder = 1
// if(/obj/item/weapon/gun/energy/laser/retro/sc_retro)
// iconholder = 1
- if(/obj/item/weapon/gun/energy/laser/captain)
- iconholder = 1
+ if(/obj/item/weapon/gun/energy/laser/captain)
+ iconholder = 1
- if(/obj/item/weapon/gun/energy/lasercannon)
- iconholder = 1
+ if(/obj/item/weapon/gun/energy/lasercannon)
+ iconholder = 1
- if(/obj/item/weapon/gun/energy/taser)
- eprojectile = /obj/item/projectile/beam
- eshot_sound = 'sound/weapons/Laser.ogg'
+ if(/obj/item/weapon/gun/energy/taser)
+ eprojectile = /obj/item/projectile/beam
+ eshot_sound = 'sound/weapons/Laser.ogg'
- if(/obj/item/weapon/gun/energy/stunrevolver)
- eprojectile = /obj/item/projectile/beam
- eshot_sound = 'sound/weapons/Laser.ogg'
+ if(/obj/item/weapon/gun/energy/stunrevolver)
+ eprojectile = /obj/item/projectile/beam
+ eshot_sound = 'sound/weapons/Laser.ogg'
- if(/obj/item/weapon/gun/energy/gun)
- eprojectile = /obj/item/projectile/beam //If it has, going to kill mode
- eshot_sound = 'sound/weapons/Laser.ogg'
- egun = 1
+ if(/obj/item/weapon/gun/energy/gun)
+ eprojectile = /obj/item/projectile/beam //If it has, going to kill mode
+ eshot_sound = 'sound/weapons/Laser.ogg'
+ egun = 1
- if(/obj/item/weapon/gun/energy/gun/nuclear)
- eprojectile = /obj/item/projectile/beam //If it has, going to kill mode
- eshot_sound = 'sound/weapons/Laser.ogg'
- egun = 1
+ if(/obj/item/weapon/gun/energy/gun/nuclear)
+ eprojectile = /obj/item/projectile/beam //If it has, going to kill mode
+ eshot_sound = 'sound/weapons/Laser.ogg'
+ egun = 1
+/obj/machinery/porta_turret/update_icon()
+ if(!anchored)
+ icon_state = "turretCover"
+ return
+ if(stat & BROKEN)
+ icon_state = "destroyed_target_prism"
+ else
+ if(powered())
+ if(on)
+ if(iconholder)
+ //lasers have a orange icon
+ icon_state = "orange_target_prism"
+ else
+ //almost everything has a blue icon
+ icon_state = "target_prism"
+ else
+ icon_state = "grey_target_prism"
+ else
+ icon_state = "grey_target_prism"
/obj/machinery/porta_turret/Del()
//deletes its own cover with it
@@ -158,43 +153,29 @@
. = ..()
if(.)
return
- var/dat
+ interact(user)
- //The browse() text, similar to ED-209s and beepskies.
- if(!lasercolor) //Lasertag turrets have less options
- dat += text({"
- Automatic Portable Turret Installation
- Status: []
- Behaviour controls are [locked ? "locked" : "unlocked"]"},
+/obj/machinery/porta_turret/interact(mob/user)
+ var/dat = text({"
+ Automatic Portable Turret Installation
+ Status: []
+ Behaviour controls are [locked ? "locked" : "unlocked"]"},
- "[on ? "On" : "Off"]" )
+ "[on ? "On" : "Off"]" )
- if(!locked || issilicon(user))
- dat += text({"
- Neutralize All Non-Synthetics: []
- Check for Weapon Authorization: []
- Check Security Records: []
- Neutralize All Non-Authorized Personnel: []
- Neutralize All Unidentified Life Signs: []
"},
-
- "[ai ? "Yes" : "No"]",
- "[auth_weapons ? "Yes" : "No"]",
- "[check_records ? "Yes" : "No"]",
- "[stun_all ? "Yes" : "No"]",
- "[check_anomalies ? "Yes" : "No"]" )
- else
- 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({"
- Automatic Portable Turret Installation
- Status: []
"},
-
- "[on ? "On" : "Off"]" )
+ if(!locked || issilicon(user))
+ dat += text({"
+ Neutralize All Non-Synthetics: []
+ Check for Weapon Authorization: []
+ Check Security Records: []
+ Neutralize All Non-Authorized Personnel: []
+ Neutralize All Unidentified Life Signs: []
"},
+ "[ai ? "Yes" : "No"]",
+ "[auth_weapons ? "Yes" : "No"]",
+ "[check_records ? "Yes" : "No"]",
+ "[stun_all ? "Yes" : "No"]",
+ "[check_anomalies ? "Yes" : "No"]" )
user << browse("Automatic Portable Turret Installation[dat]", "window=autosec")
onclose(user, "autosec")
@@ -227,29 +208,13 @@
/obj/machinery/porta_turret/power_change()
-
- if(!anchored)
- icon_state = "turretCover"
- return
- if(stat & BROKEN)
- icon_state = "[lasercolor]destroyed_target_prism"
+ if(powered())
+ stat &= ~NOPOWER
+ update_icon()
else
- if(powered())
- if(on)
- if(iconholder)
- //lasers have a orange icon
- icon_state = "[lasercolor]orange_target_prism"
- else
- //almost everything has a blue icon
- icon_state = "[lasercolor]target_prism"
- else
- icon_state = "[lasercolor]grey_target_prism"
- stat &= ~NOPOWER
- else
- spawn(rand(0, 15))
- icon_state = "[lasercolor]grey_target_prism"
- stat |= NOPOWER
-
+ spawn(rand(0, 15))
+ stat |= NOPOWER
+ update_icon()
/obj/machinery/porta_turret/attackby(obj/item/I, mob/user)
@@ -258,21 +223,20 @@
//If the turret is destroyed, you can remove it with a crowbar to
//try and salvage its components
user << "You begin prying the metal coverings off."
- sleep(20)
- if(prob(70))
- user << "You remove the turret and salvage some components."
- if(installation)
- var/obj/item/weapon/gun/energy/Gun = new installation(loc)
- Gun.power_supply.charge = gun_charge
- Gun.update_icon()
- lasercolor = null
- if(prob(50))
- new /obj/item/stack/sheet/metal(loc, rand(1,4))
- if(prob(50))
- new /obj/item/device/assembly/prox_sensor(loc)
- else
- user << "You remove the turret but did not manage to salvage anything."
- del(src) // qdel
+ if(do_after(user, 20))
+ if(prob(70))
+ user << "You remove the turret and salvage some components."
+ if(installation)
+ var/obj/item/weapon/gun/energy/Gun = new installation(loc)
+ Gun.power_supply.charge = gun_charge
+ Gun.update_icon()
+ if(prob(50))
+ new /obj/item/stack/sheet/metal(loc, rand(1,4))
+ if(prob(50))
+ new /obj/item/device/assembly/prox_sensor(loc)
+ else
+ user << "You remove the turret but did not manage to salvage anything."
+ del(src) // qdel
if(istype(I, /obj/item/weapon/card/emag) && !emagged)
//Emagging the turret makes it go bonkers and stun everyone. It also makes
@@ -292,15 +256,15 @@
if(!anchored && !isinspace())
anchored = 1
invisibility = INVISIBILITY_LEVEL_TWO
- icon_state = "[lasercolor]grey_target_prism"
+ update_icon()
user << "You secure the exterior bolts on the turret."
cover = new /obj/machinery/porta_turret_cover(loc) //create a new turret. While this is handled in process(), this is to workaround a bug where the turret becomes invisible for a split second
cover.Parent_Turret = src //make the cover's parent src
else if(anchored)
anchored = 0
user << "You unsecure the exterior bolts on the turret."
- icon_state = "turretCover"
invisibility = 0
+ update_icon()
del(cover) //deletes the cover, and the turret instance itself becomes its own cover. - qdel
else if(istype(I, /obj/item/weapon/card/id)||istype(I, /obj/item/device/pda))
@@ -345,20 +309,6 @@
if(health <= 0)
die() //the death process :(
- if(lasercolor == "b" && disabled == 0)
- if(istype(Proj, /obj/item/weapon/gun/energy/laser/redtag))
- disabled = 1
- del(Proj) // qdel
- sleep(100)
- disabled = 0
- if(lasercolor == "r" && disabled == 0)
- if(istype(Proj, /obj/item/weapon/gun/energy/laser/bluetag))
- disabled = 1
- del(Proj) // qdel
- sleep(100)
- disabled = 0
-
-
/obj/machinery/porta_turret/emp_act(severity)
if(on)
//if the turret is on, the EMP no matter how severe disables the turret for a while
@@ -386,10 +336,10 @@
health = 0
density = 0
stat |= BROKEN //enables the BROKEN bit
- icon_state = "[lasercolor]destroyed_target_prism"
invisibility = 0
spark_system.start() //creates some sparks because they look cool
density = 1
+ update_icon()
del(cover) //deletes the cover - no need on keeping it there! - del
@@ -445,8 +395,9 @@
if(!L)
return TURRET_NOT_TARGET
- if(emagged && !isAI(L)) //if emagged, target everything (except the AI, otherwise lethal-set turrets attempt to fire at it in the core)
- return TURRET_PRIORITY_TARGET
+ // If emagged not even the dead get a rest
+ if(emagged)
+ return L.stat ? TURRET_SECONDARY_TARGET : TURRET_PRIORITY_TARGET
if(issilicon(L)) // Don't target silica
return TURRET_NOT_TARGET
@@ -460,26 +411,20 @@
if(ai) //If it's set to attack all non-silicons, target them!
if(L.lying)
- if(lasercolor)
- return TURRET_NOT_TARGET
- else
- return TURRET_SECONDARY_TARGET
- else
- return TURRET_PRIORITY_TARGET
+ return TURRET_SECONDARY_TARGET
+ return TURRET_PRIORITY_TARGET
if(iscuffed(L)) // If the target is handcuffed, leave it alone
return TURRET_NOT_TARGET
- if(isanimal(L)) // Animals are not so dangerous
+ if(isanimal(L) || ismonkey(L)) // Animals are not so dangerous
return check_anomalies ? TURRET_SECONDARY_TARGET : TURRET_NOT_TARGET
if(isxenomorph(L) || isalien(L)) // Xenos are dangerous
return check_anomalies ? TURRET_PRIORITY_TARGET : TURRET_NOT_TARGET
if(ishuman(L)) //if the target is a human, analyze threat level
- if(assess_perp(L, auth_weapons, check_records, lasercolor) < 4)
+ if(assess_perp(L, auth_weapons, check_records) < 4)
return TURRET_NOT_TARGET //if threat level < 4, keep going
- else if(ismonkey(L))
- return TURRET_NOT_TARGET //Don't target monkeys or borgs/AIs
if(L.lying) //if the perp is lying down, it's still a target but a less-important target
return TURRET_SECONDARY_TARGET
@@ -509,6 +454,7 @@
cover.icon_state = "openTurretCover"
raised = 1
layer = 4
+ update_icon()
/obj/machinery/porta_turret/proc/popDown() //pops the turret down
if(disabled)
@@ -525,7 +471,7 @@
cover.icon_state = "turretCover"
raised = 0
invisibility = 2
- icon_state = "[lasercolor]grey_target_prism"
+ update_icon()
/obj/machinery/porta_turret/on_assess_perp(mob/living/carbon/human/perp)
@@ -549,7 +495,8 @@
return
/obj/machinery/porta_turret/proc/shootAt(var/mob/living/target)
- if(!emagged) //if it hasn't been emagged, it has to obey a cooldown rate
+ //any emagged turrets will shoot extremely fast! This not only is deadly, but drains a lot power!
+ if(!(emagged || lethal)) //if it hasn't been emagged, it has to obey a cooldown rate
if(last_fired || !raised) //prevents rapid-fire shooting, unless it's been emagged
return
last_fired = 1
@@ -565,20 +512,17 @@
if(!raised) //the turret has to be raised in order to fire - makes sense, right?
return
- //any emagged turrets will shoot extremely fast! This not only is deadly, but drains a lot power!
- if(iconholder)
- icon_state = "[lasercolor]orange_target_prism"
- else
- icon_state = "[lasercolor]target_prism"
+
+ update_icon()
var/obj/item/projectile/A
- if(emagged)
+ if(emagged || lethal)
A = new eprojectile(loc)
playsound(loc, eshot_sound, 75, 1)
else
A = new projectile(loc)
playsound(loc, shot_sound, 75, 1)
A.original = target
- if(!emagged)
+ if(!(emagged || lethal))
use_power(reqpower)
else
use_power(reqpower * 2)
@@ -589,12 +533,12 @@
spawn(1)
A.process()
-/obj/machinery/porta_turret/proc/setState(var/on, var/emagged)
+/obj/machinery/porta_turret/proc/setState(var/on, var/lethal)
if(controllock)
return
src.on = on
- src.emagged = emagged
- src.iconholder = emagged
+ src.lethal = lethal
+ src.iconholder = lethal
src.power_change()
/*
@@ -607,6 +551,7 @@
icon = 'icons/obj/turrets.dmi'
icon_state = "turret_frame"
density=1
+ var/target_type = /obj/machinery/porta_turret // The type we intend to build
var/build_step = 0 //the current step in the building process
var/finish_name="turret" //the name applied to the product turret
var/installation = null //the gun type installed
@@ -686,6 +631,12 @@
installation = I.type //installation becomes I.type
gun_charge = E.power_supply.charge //the gun's charge is stored in gun_charge
user << "You add [I] to the turret."
+
+ if(istype(installation, /obj/item/weapon/gun/energy/laser/bluetag) || istype(installation, /obj/item/weapon/gun/energy/laser/redtag))
+ target_type = /obj/machinery/porta_turret/tag
+ else
+ target_type = /obj/machinery/porta_turret
+
build_step = 4
del(I) //delete the gun :( qdel
return
@@ -748,7 +699,7 @@
user << "You weld the turret's armor down."
//The final step: create a full turret
- var/obj/machinery/porta_turret/Turret = new/obj/machinery/porta_turret(loc)
+ var/obj/machinery/porta_turret/Turret = new target_type(loc)
Turret.name = finish_name
Turret.installation = installation
Turret.gun_charge = gun_charge
@@ -831,7 +782,7 @@
if(.)
return
var/dat
- if(!Parent_Turret.lasercolor)
+ if(!istype(Parent_Turret, /obj/machinery/porta_turret/tag))
dat += text({"
Automatic Portable Turret Installation
Status: []
@@ -855,9 +806,10 @@
else
if(istype(user,/mob/living/carbon/human))
var/mob/living/carbon/human/H = user
- if(Parent_Turret.lasercolor == "b" && istype(H.wear_suit, /obj/item/clothing/suit/redtag))
+ var/obj/machinery/porta_turret/tag/laser_turret = Parent_Turret
+ if(laser_turret.lasercolor == "b" && istype(H.wear_suit, /obj/item/clothing/suit/redtag))
return
- if(Parent_Turret.lasercolor == "r" && istype(H.wear_suit, /obj/item/clothing/suit/bluetag))
+ if(laser_turret.lasercolor == "r" && istype(H.wear_suit, /obj/item/clothing/suit/bluetag))
return
dat += text({"
Automatic Portable Turret Installation
@@ -949,7 +901,7 @@
/obj/machinery/porta_turret/stationary
- emagged = 1
+ lethal = 1
New()
installation = /obj/item/weapon/gun/energy/laser
diff --git a/code/game/machinery/turret_control.dm b/code/game/machinery/turret_control.dm
index f203186eb98..ab023eb87ef 100644
--- a/code/game/machinery/turret_control.dm
+++ b/code/game/machinery/turret_control.dm
@@ -41,6 +41,18 @@
//don't have to check if control_area is path, since get_area_all_atoms can take path.
return
+/obj/machinery/turretid/proc/can_use(mob/user)
+ if (get_dist(src, user) > 0 && !issilicon(user))
+ user << "You are too far away."
+ user.unset_machine()
+ user << browse(null, "window=turretid")
+ return 0
+
+ if(ailock && issilicon(user))
+ user << "There seems to be a firewall preventing you from accessing this device."
+ return 0
+ return 1
+
/obj/machinery/turretid/attackby(obj/item/weapon/W, mob/user)
if(stat & BROKEN) return
if (istype(user, /mob/living/silicon))
@@ -73,17 +85,8 @@
else
user << "Access denied."
-/obj/machinery/turretid/attack_ai(mob/user as mob)
- if(!ailock)
- return attack_hand(user)
- else
- user << "There seems to be a firewall preventing you from accessing this device."
-
/obj/machinery/turretid/attack_hand(mob/user as mob)
- if (get_dist(src, user) > 0 && !issilicon(user))
- user << "You are too far away."
- user.unset_machine()
- user << browse(null, "window=turretid")
+ if(!can_use(user))
return
user.set_machine(src)
@@ -106,7 +109,7 @@
//user << browse(t, "window=turretid")
//onclose(user, "turretid")
- var/datum/browser/popup = new(user, "turretid", "Turret Control Panel ([area.name])")
+ var/datum/browser/popup = new(user, "turretid", "Turret Control Panel ([area.name])", 500, 200)
popup.set_content(t)
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
popup.open()
@@ -115,14 +118,9 @@
if(..())
return 1
- if(ailock)
- usr << "There seems to be a firewall preventing you from accessing this device."
+ if(!can_use(usr))
return 1
- if (src.locked)
- if (!istype(usr, /mob/living/silicon))
- usr << "Control panel is locked!"
- return 1
if (href_list["toggleOn"])
src.enabled = !src.enabled
src.updateTurrets()
@@ -131,7 +129,7 @@
src.updateTurrets()
if(!nowindow)
- updateDialog()
+ attack_hand(usr)
/obj/machinery/turretid/updateDialog()
if (stat & (BROKEN|MAINT))