mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-21 19:19:12 +01:00
Relocates lasercolor snowflakes.
Relocates some of the laser tag assessment code into more relevant areas. Portable turrets are no longer considered fully emagged while in lethal mode. Affects target assessment. Fixes an issue with turret control windows not refreshing.
This commit is contained in:
@@ -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"
|
||||
|
||||
+11
-67
@@ -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")
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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*"))
|
||||
|
||||
@@ -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({"
|
||||
<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
|
||||
|
||||
/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
|
||||
@@ -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({"
|
||||
<TT><B>Automatic Portable Turret Installation</B></TT><BR><BR>
|
||||
Status: []<BR>
|
||||
Behaviour controls are [locked ? "locked" : "unlocked"]"},
|
||||
/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>" )
|
||||
"<A href='?src=\ref[src];power=1'>[on ? "On" : "Off"]</A>" )
|
||||
|
||||
if(!locked || issilicon(user))
|
||||
dat += text({"<BR><BR>
|
||||
Neutralize All Non-Synthetics: []<BR>
|
||||
Check for Weapon Authorization: []<BR>
|
||||
Check Security Records: []<BR>
|
||||
Neutralize All Non-Authorized Personnel: []<BR>
|
||||
Neutralize All Unidentified Life Signs: []<BR>"},
|
||||
|
||||
"<A href='?src=\ref[src];operation=toggleai'>[ai ? "Yes" : "No"]</A>",
|
||||
"<A href='?src=\ref[src];operation=authweapon'>[auth_weapons ? "Yes" : "No"]</A>",
|
||||
"<A href='?src=\ref[src];operation=checkrecords'>[check_records ? "Yes" : "No"]</A>",
|
||||
"<A href='?src=\ref[src];operation=shootall'>[stun_all ? "Yes" : "No"]</A>",
|
||||
"<A href='?src=\ref[src];operation=checkxenos'>[check_anomalies ? "Yes" : "No"]</A>" )
|
||||
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({"
|
||||
<TT><B>Automatic Portable Turret Installation</B></TT><BR><BR>
|
||||
Status: []<BR>"},
|
||||
|
||||
"<A href='?src=\ref[src];power=1'>[on ? "On" : "Off"]</A>" )
|
||||
if(!locked || issilicon(user))
|
||||
dat += text({"<BR><BR>
|
||||
Neutralize All Non-Synthetics: []<BR>
|
||||
Check for Weapon Authorization: []<BR>
|
||||
Check Security Records: []<BR>
|
||||
Neutralize All Non-Authorized Personnel: []<BR>
|
||||
Neutralize All Unidentified Life Signs: []<BR>"},
|
||||
|
||||
"<A href='?src=\ref[src];operation=toggleai'>[ai ? "Yes" : "No"]</A>",
|
||||
"<A href='?src=\ref[src];operation=authweapon'>[auth_weapons ? "Yes" : "No"]</A>",
|
||||
"<A href='?src=\ref[src];operation=checkrecords'>[check_records ? "Yes" : "No"]</A>",
|
||||
"<A href='?src=\ref[src];operation=shootall'>[stun_all ? "Yes" : "No"]</A>",
|
||||
"<A href='?src=\ref[src];operation=checkxenos'>[check_anomalies ? "Yes" : "No"]</A>" )
|
||||
|
||||
user << browse("<HEAD><TITLE>Automatic Portable Turret Installation</TITLE></HEAD>[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 << "<span class='notice'>You begin prying the metal coverings off.</span>"
|
||||
sleep(20)
|
||||
if(prob(70))
|
||||
user << "<span class='notice'>You remove the turret and salvage some components.</span>"
|
||||
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 << "<span class='notice'>You remove the turret but did not manage to salvage anything.</span>"
|
||||
del(src) // qdel
|
||||
if(do_after(user, 20))
|
||||
if(prob(70))
|
||||
user << "<span class='notice'>You remove the turret and salvage some components.</span>"
|
||||
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 << "<span class='notice'>You remove the turret but did not manage to salvage anything.</span>"
|
||||
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 << "<span class='notice'>You secure the exterior bolts on the turret.</span>"
|
||||
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 << "<span class='notice'>You unsecure the exterior bolts on the turret.</span>"
|
||||
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 << "<span class='notice'>You add [I] to the turret.</span>"
|
||||
|
||||
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 << "<span class='notice'>You weld the turret's armor down.</span>"
|
||||
|
||||
//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({"
|
||||
<TT><B>Automatic Portable Turret Installation</B></TT><BR><BR>
|
||||
Status: []<BR>
|
||||
@@ -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({"
|
||||
<TT><B>Automatic Portable Turret Installation</B></TT><BR><BR>
|
||||
@@ -949,7 +901,7 @@
|
||||
|
||||
|
||||
/obj/machinery/porta_turret/stationary
|
||||
emagged = 1
|
||||
lethal = 1
|
||||
|
||||
New()
|
||||
installation = /obj/item/weapon/gun/energy/laser
|
||||
|
||||
@@ -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 << "<span class='notice'>You are too far away.</span>"
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=turretid")
|
||||
return 0
|
||||
|
||||
if(ailock && issilicon(user))
|
||||
user << "<span class='notice'>There seems to be a firewall preventing you from accessing this device.</span>"
|
||||
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 << "<span class='warning'>Access denied.</span>"
|
||||
|
||||
/obj/machinery/turretid/attack_ai(mob/user as mob)
|
||||
if(!ailock)
|
||||
return attack_hand(user)
|
||||
else
|
||||
user << "<span class='notice'>There seems to be a firewall preventing you from accessing this device.</span>"
|
||||
|
||||
/obj/machinery/turretid/attack_hand(mob/user as mob)
|
||||
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")
|
||||
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 << "<span class='notice'>There seems to be a firewall preventing you from accessing this device.</span>"
|
||||
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))
|
||||
|
||||
Reference in New Issue
Block a user