Portable turret overhaul (#11874)

* Portable turret overhaul

* caps

* visible_message

* revision 1

* thought I did this

* Temperature gun turrets work fully now

* revision 2

* Magic number removal

* energy weapon power usage isn't helpful for this

* more defines
This commit is contained in:
Sprok0
2016-09-18 20:40:25 -04:00
committed by clusterfack
parent fd95360411
commit a0276aab47
8 changed files with 252 additions and 559 deletions

View File

@@ -0,0 +1,2 @@
#define PERP_LEVEL_ARREST 4
#define PERP_LEVEL_ARREST_MORE 6

View File

@@ -237,7 +237,7 @@ Auto Patrol: []"},
if (!isscrewdriver(W) && (!src.target)) if (!isscrewdriver(W) && (!src.target))
if(hasvar(W,"force") && W.force)//If force is defined and non-zero if(hasvar(W,"force") && W.force)//If force is defined and non-zero
threatlevel = user.assess_threat(src) threatlevel = user.assess_threat(src)
threatlevel += 6 threatlevel += PERP_LEVEL_ARREST_MORE
if(threatlevel > 0) if(threatlevel > 0)
src.target = user src.target = user
src.shootAt(user) src.shootAt(user)
@@ -247,7 +247,7 @@ Auto Patrol: []"},
..() ..()
threatlevel = H.assess_threat(src) threatlevel = H.assess_threat(src)
threatlevel += 6 threatlevel += PERP_LEVEL_ARREST_MORE
if(threatlevel > 0) if(threatlevel > 0)
src.target = H src.target = H
@@ -293,9 +293,9 @@ Auto Patrol: []"},
if (istype(C, /mob/living/carbon/human)) if (istype(C, /mob/living/carbon/human))
threatlevel = C.assess_threat(src,lasercolor) threatlevel = C.assess_threat(src,lasercolor)
else if ((istype(C, /mob/living/carbon/monkey)) && (C.client) && (ticker.mode.name == "monkey")) else if ((istype(C, /mob/living/carbon/monkey)) && (C.client) && (ticker.mode.name == "monkey"))
threatlevel = 4 threatlevel = PERP_LEVEL_ARREST
//src.speak(C.real_name + text(": threat: []", threatlevel)) //src.speak(C.real_name + text(": threat: []", threatlevel))
if (threatlevel < 4 ) if (threatlevel < PERP_LEVEL_ARREST )
continue continue
var/dst = get_dist(src, C) var/dst = get_dist(src, C)
@@ -712,12 +712,12 @@ Auto Patrol: []"},
if (istype(C, /mob/living/carbon/human)) if (istype(C, /mob/living/carbon/human))
src.threatlevel = src.assess_perp(C) src.threatlevel = src.assess_perp(C)
else if ((istype(C, /mob/living/carbon/monkey)) && (C.client) && (ticker.mode.name == "monkey")) else if ((istype(C, /mob/living/carbon/monkey)) && (C.client) && (ticker.mode.name == "monkey"))
src.threatlevel = 4 src.threatlevel = PERP_LEVEL_ARREST
if (!src.threatlevel) if (!src.threatlevel)
continue continue
else if (src.threatlevel >= 4) else if (src.threatlevel >= PERP_LEVEL_ARREST)
src.target = C src.target = C
src.oldtarget_name = C.name src.oldtarget_name = C.name
src.speak("Level [src.threatlevel] infraction alert!") src.speak("Level [src.threatlevel] infraction alert!")
@@ -736,55 +736,55 @@ Auto Patrol: []"},
//Or if they have weapons and aren't security, arrest them. //Or if they have weapons and aren't security, arrest them.
//THIS CODE IS COPYPASTED IN secbot.dm AND metaldetector.dm, with slight variations //THIS CODE IS COPYPASTED IN secbot.dm AND metaldetector.dm, with slight variations
/obj/machinery/bot/ed209/proc/assess_perp(mob/living/carbon/human/perp as mob) /obj/machinery/bot/ed209/proc/assess_perp(mob/living/carbon/human/perp as mob)
var/threatcount = 0 //If threat >= 4 at the end, they get arrested var/threatcount = 0 //If threat >= PERP_LEVEL_ARREST at the end, they get arrested
if(src.emagged == 2) if(src.emagged == 2)
return 10 //Everyone is a criminal! return PERP_LEVEL_ARREST + rand(PERP_LEVEL_ARREST, PERP_LEVEL_ARREST*5) //Everyone is a criminal!
if(!src.allowed(perp)) //cops can do no wrong, unless set to arrest. if(!src.allowed(perp)) //cops can do no wrong, unless set to arrest.
if(weaponscheck && !wpermit(perp)) if(weaponscheck && !wpermit(perp))
for(var/obj/item/W in perp.held_items) for(var/obj/item/W in perp.held_items)
if(check_for_weapons(W)) if(check_for_weapons(W))
threatcount += 4 threatcount += PERP_LEVEL_ARREST
if(istype(perp.belt, /obj/item/weapon/gun) || istype(perp.belt, /obj/item/weapon/melee)) if(istype(perp.belt, /obj/item/weapon/gun) || istype(perp.belt, /obj/item/weapon/melee))
if(!(perp.belt.type in safe_weapons)) if(!(perp.belt.type in safe_weapons))
threatcount += 2 threatcount += PERP_LEVEL_ARREST/2
if(istype(perp.wear_suit, /obj/item/clothing/suit/wizrobe)) if(istype(perp.wear_suit, /obj/item/clothing/suit/wizrobe))
threatcount += 2 threatcount += PERP_LEVEL_ARREST/2
if(perp.dna && perp.dna.mutantrace && perp.dna.mutantrace != "none") if(perp.dna && perp.dna.mutantrace && perp.dna.mutantrace != "none")
threatcount += 2 threatcount += PERP_LEVEL_ARREST/2
var/visible_id = perp.get_visible_id() var/visible_id = perp.get_visible_id()
if(!visible_id) if(!visible_id)
if(idcheck) if(idcheck)
threatcount += 4 threatcount += PERP_LEVEL_ARREST
else else
threatcount += 2 threatcount += PERP_LEVEL_ARREST/2
//Agent cards lower threatlevel. //Agent cards lower threatlevel.
if(istype(visible_id, /obj/item/weapon/card/id/syndicate)) if(istype(visible_id, /obj/item/weapon/card/id/syndicate))
threatcount -= 2 threatcount -= PERP_LEVEL_ARREST/2
if(src.lasercolor == "b")//Lasertag turrets target the opposing team, how great is that? -Sieve if(src.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 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)) if(istype(perp.wear_suit, /obj/item/clothing/suit/redtag))
threatcount += 4 threatcount += PERP_LEVEL_ARREST
if(perp.find_held_item_by_type(/obj/item/weapon/gun/energy/laser/redtag)) if(perp.find_held_item_by_type(/obj/item/weapon/gun/energy/laser/redtag))
threatcount += 4 threatcount += PERP_LEVEL_ARREST
if(istype(perp.belt, /obj/item/weapon/gun/energy/laser/redtag)) if(istype(perp.belt, /obj/item/weapon/gun/energy/laser/redtag))
threatcount += 2 threatcount += PERP_LEVEL_ARREST/2
if(src.lasercolor == "r") if(src.lasercolor == "r")
threatcount = 0 threatcount = 0
if(istype(perp.wear_suit, /obj/item/clothing/suit/bluetag)) if(istype(perp.wear_suit, /obj/item/clothing/suit/bluetag))
threatcount += 4 threatcount += PERP_LEVEL_ARREST
if(perp.find_held_item_by_type(/obj/item/weapon/gun/energy/laser/bluetag)) if(perp.find_held_item_by_type(/obj/item/weapon/gun/energy/laser/bluetag))
threatcount += 4 threatcount += PERP_LEVEL_ARREST
if(istype(perp.belt, /obj/item/weapon/gun/energy/laser/bluetag)) if(istype(perp.belt, /obj/item/weapon/gun/energy/laser/bluetag))
threatcount += 2 threatcount += PERP_LEVEL_ARREST/2
if(src.check_records) if(src.check_records)
for (var/datum/data/record/E in data_core.general) for (var/datum/data/record/E in data_core.general)
@@ -796,7 +796,7 @@ Auto Patrol: []"},
if(E.fields["name"] == perpname) if(E.fields["name"] == perpname)
for (var/datum/data/record/R in data_core.security) for (var/datum/data/record/R in data_core.security)
if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "*Arrest*")) if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "*Arrest*"))
threatcount = 4 threatcount = PERP_LEVEL_ARREST
break break
return threatcount return threatcount

View File

@@ -206,7 +206,7 @@ Auto Patrol: []"},
return return
if(!isscrewdriver(W) && (W.force) && (!target) ) // Added check for welding tool to fix #2432. Welding tool behavior is handled in superclass. if(!isscrewdriver(W) && (W.force) && (!target) ) // Added check for welding tool to fix #2432. Welding tool behavior is handled in superclass.
threatlevel = user.assess_threat(src) threatlevel = user.assess_threat(src)
threatlevel += 6 threatlevel += PERP_LEVEL_ARREST_MORE
if(threatlevel > 0) if(threatlevel > 0)
target = user target = user
mode = SECBOT_HUNT mode = SECBOT_HUNT
@@ -215,7 +215,7 @@ Auto Patrol: []"},
..() ..()
threatlevel = H.assess_threat(src) threatlevel = H.assess_threat(src)
threatlevel += 6 threatlevel += PERP_LEVEL_ARREST_MORE
if(threatlevel > 0) if(threatlevel > 0)
src.target = H src.target = H
@@ -686,7 +686,7 @@ Auto Patrol: []"},
if(!src.threatlevel) if(!src.threatlevel)
continue continue
else if(src.threatlevel >= 4) else if(src.threatlevel >= PERP_LEVEL_ARREST)
src.target = M src.target = M
src.oldtarget_name = M.name src.oldtarget_name = M.name
src.speak("Level [src.threatlevel] infraction alert!") src.speak("Level [src.threatlevel] infraction alert!")
@@ -707,34 +707,34 @@ Auto Patrol: []"},
var/threatcount = 0 //If threat >= 4 at the end, they get arrested var/threatcount = 0 //If threat >= 4 at the end, they get arrested
if(src.emagged == 2) if(src.emagged == 2)
return 10 //Everyone is a criminal! return PERP_LEVEL_ARREST + rand(PERP_LEVEL_ARREST, PERP_LEVEL_ARREST*5) //Everyone is a criminal!
if(!src.allowed(perp)) //cops can do no wrong, unless set to arrest. if(!src.allowed(perp)) //cops can do no wrong, unless set to arrest.
if(weaponscheck && !wpermit(perp)) if(weaponscheck && !wpermit(perp))
for(var/obj/item/I in perp.held_items) for(var/obj/item/I in perp.held_items)
if(check_for_weapons(I)) if(check_for_weapons(I))
threatcount += 4 threatcount += PERP_LEVEL_ARREST
if(istype(perp.belt, /obj/item/weapon/gun) || istype(perp.belt, /obj/item/weapon/melee)) if(istype(perp.belt, /obj/item/weapon/gun) || istype(perp.belt, /obj/item/weapon/melee))
if(!(perp.belt.type in safe_weapons)) if(!(perp.belt.type in safe_weapons))
threatcount += 2 threatcount += PERP_LEVEL_ARREST/2
if(istype(perp.wear_suit, /obj/item/clothing/suit/wizrobe)) if(istype(perp.wear_suit, /obj/item/clothing/suit/wizrobe))
threatcount += 2 threatcount += PERP_LEVEL_ARREST/2
if(perp.dna && perp.dna.mutantrace && perp.dna.mutantrace != "none") if(perp.dna && perp.dna.mutantrace && perp.dna.mutantrace != "none")
threatcount += 2 threatcount += PERP_LEVEL_ARREST/2
var/visible_id = perp.get_visible_id() var/visible_id = perp.get_visible_id()
if(!visible_id) if(!visible_id)
if(idcheck) if(idcheck)
threatcount += 4 threatcount += PERP_LEVEL_ARREST
else else
threatcount += 2 threatcount += PERP_LEVEL_ARREST/2
//Agent cards lower threatlevel. //Agent cards lower threatlevel.
if(istype(visible_id, /obj/item/weapon/card/id/syndicate)) if(istype(visible_id, /obj/item/weapon/card/id/syndicate))
threatcount -= 2 threatcount -= PERP_LEVEL_ARREST/2
if(src.check_records) if(src.check_records)
for (var/datum/data/record/E in data_core.general) for (var/datum/data/record/E in data_core.general)
@@ -746,7 +746,7 @@ Auto Patrol: []"},
if(E.fields["name"] == perpname) if(E.fields["name"] == perpname)
for (var/datum/data/record/R in data_core.security) for (var/datum/data/record/R in data_core.security)
if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "*Arrest*")) if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "*Arrest*"))
threatcount = 4 threatcount = PERP_LEVEL_ARREST
break break
return threatcount return threatcount

View File

@@ -311,12 +311,8 @@
/obj/structure/computerframe/attackby(obj/item/P as obj, mob/user as mob) /obj/structure/computerframe/attackby(obj/item/P as obj, mob/user as mob)
switch(state) switch(state)
if(0) if(0)
if(iswrench(P)) if(iswrench(P) && wrenchAnchor(user))
playsound(get_turf(src), 'sound/items/Ratchet.ogg', 50, 1) src.state = 1
if(do_after(user, src, 5) && state == 0)
to_chat(user, "<span class='notice'>You wrench the frame into place.</span>")
src.anchored = 1
src.state = 1
return 1 return 1
if(iswelder(P)) if(iswelder(P))
var/obj/item/weapon/weldingtool/WT = P var/obj/item/weapon/weldingtool/WT = P
@@ -334,12 +330,8 @@
qdel(src) qdel(src)
return 1 return 1
if(1) if(1)
if(iswrench(P)) if(iswrench(P) && wrenchAnchor(user))
playsound(get_turf(src), 'sound/items/Ratchet.ogg', 50, 1) src.state = 0
if(do_after(user, src, 20) && state == 1)
to_chat(user, "<span class='notice'>You unfasten the frame.</span>")
src.anchored = 0
src.state = 0
return 1 return 1
if(istype(P, /obj/item/weapon/circuitboard) && !circuit) if(istype(P, /obj/item/weapon/circuitboard) && !circuit)
var/obj/item/weapon/circuitboard/B = P var/obj/item/weapon/circuitboard/B = P
@@ -443,3 +435,6 @@
qdel(src) qdel(src)
return 1 return 1
return 0 return 0
/obj/structure/computerframe/can_wrench_shuttle()
return 1

View File

@@ -36,7 +36,7 @@
//THIS CODE IS COPYPASTED IN ed209bot.dm AND secbot.dm, with slight variations //THIS CODE IS COPYPASTED IN ed209bot.dm AND secbot.dm, with slight variations
/obj/machinery/detector/proc/assess_perp(mob/living/carbon/human/perp as mob) /obj/machinery/detector/proc/assess_perp(mob/living/carbon/human/perp as mob)
var/threatcount = 0 //If threat >= 4 at the end, they get arrested var/threatcount = 0 //If threat >= PERP_LEVEL_ARREST at the end, they get arrested
if(!(istype(perp, /mob/living/carbon)) || isalien(perp) || isbrain(perp)) if(!(istype(perp, /mob/living/carbon)) || isalien(perp) || isbrain(perp))
return -1 return -1
@@ -45,36 +45,36 @@
if(!wpermit(perp)) if(!wpermit(perp))
for(var/obj/item/I in perp.held_items) for(var/obj/item/I in perp.held_items)
if(check_for_weapons(I)) if(check_for_weapons(I))
threatcount += 4 threatcount += PERP_LEVEL_ARREST
for(var/obj/item/I in list(perp.back, perp.belt, perp.s_store) + (scanmode ? list(perp.l_store, perp.r_store) : null)) for(var/obj/item/I in list(perp.back, perp.belt, perp.s_store) + (scanmode ? list(perp.l_store, perp.r_store) : null))
if(check_for_weapons(I)) if(check_for_weapons(I))
threatcount += 2 threatcount += PERP_LEVEL_ARREST/2
if (perp.back && istype(perp.back, /obj/item/weapon/storage/backpack)) if (perp.back && istype(perp.back, /obj/item/weapon/storage/backpack))
var/obj/item/weapon/storage/backpack/B = perp.back var/obj/item/weapon/storage/backpack/B = perp.back
for(var/obj/item/weapon/thing in B.contents) for(var/obj/item/weapon/thing in B.contents)
if(check_for_weapons(I)) if(check_for_weapons(I))
threatcount += 2 threatcount += PERP_LEVEL_ARREST/2
if(idmode) if(idmode)
if(!perp.wear_id) if(!perp.wear_id)
threatcount += 4 threatcount += PERP_LEVEL_ARREST
else else
if(!perp.wear_id) if(!perp.wear_id)
threatcount += 2 threatcount += PERP_LEVEL_ARREST/2
if(ishuman(perp)) if(ishuman(perp))
if(istype(perp.wear_suit, /obj/item/clothing/suit/wizrobe)) if(istype(perp.wear_suit, /obj/item/clothing/suit/wizrobe))
threatcount += 2 threatcount += PERP_LEVEL_ARREST/2
if(perp.dna && perp.dna.mutantrace && perp.dna.mutantrace != "none") if(perp.dna && perp.dna.mutantrace && perp.dna.mutantrace != "none")
threatcount += 2 threatcount += PERP_LEVEL_ARREST/2
//Agent cards lower threatlevel. //Agent cards lower threatlevel.
if(perp.wear_id && istype(perp.wear_id.GetID(), /obj/item/weapon/card/id/syndicate)) if(perp.wear_id && istype(perp.wear_id.GetID(), /obj/item/weapon/card/id/syndicate))
threatcount -= 2 threatcount -= PERP_LEVEL_ARREST/2
var/passperpname = "" var/passperpname = ""
for (var/datum/data/record/E in data_core.general) for (var/datum/data/record/E in data_core.general)
@@ -91,12 +91,12 @@
if(E.fields["name"] == perpname) if(E.fields["name"] == perpname)
for (var/datum/data/record/R in data_core.security) for (var/datum/data/record/R in data_core.security)
if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "*Arrest*")) if((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "*Arrest*"))
threatcount = 4 threatcount = PERP_LEVEL_ARREST
break break
var/list/retlist = list(threatcount, passperpname) var/list/retlist = list(threatcount, passperpname)
if(emagged) if(emagged)
retlist[1] = 10 retlist[1] = PERP_LEVEL_ARREST + rand(PERP_LEVEL_ARREST, PERP_LEVEL_ARREST*5)
return retlist return retlist
@@ -199,7 +199,7 @@
if (dudesthreat >= 4) if (dudesthreat >= PERP_LEVEL_ARREST)
if(maxthreat < 2) if(maxthreat < 2)
sndstr = "sound/machines/alert.ogg" sndstr = "sound/machines/alert.ogg"
@@ -212,7 +212,7 @@
src.visible_message("<span class = 'warning'>Threat Detected! Subject: [dudesname]</span>")//// src.visible_message("<span class = 'warning'>Threat Detected! Subject: [dudesname]</span>")////
else if(dudesthreat <= 3 && dudesthreat != 0 && senset) else if(dudesthreat <= PERP_LEVEL_ARREST*0.75 && dudesthreat != 0 && senset)
if(maxthreat < 1) if(maxthreat < 1)
sndstr = "sound/machines/domore.ogg" sndstr = "sound/machines/domore.ogg"

View File

@@ -28,15 +28,8 @@
var/health = 80 // the turret's health var/health = 80 // the turret's health
var/locked = 1 // if the turret's behaviour control access is locked var/locked = 1 // if the turret's behaviour control access is locked
var/installation // the type of weapon installed var/obj/item/weapon/gun/energy/installed = null // the type of weapon installed
var/gun_charge = 0 // the charge of the gun inserted var/reqpower = 750 //power used per shot
var/projectile = null //holder for bullettype
var/eprojectile = null//holder for the shot when emagged
var/reqpower = 0 //holder for power needed
var/fire_sound = 'sound/weapons/Laser.ogg'
var/efire_sound = 'sound/weapons/Laser.ogg'
var/iconholder = null//holder for the icon_state
var/egun = null//holder to handle certain guns switching bullettypes
var/obj/machinery/porta_turret_cover/cover = null // the cover that is covering this turret var/obj/machinery/porta_turret_cover/cover = null // the cover that is covering this turret
var/last_fired = 0 // 1: if the turret is cooling down from a shot, 0: turret is ready to fire var/last_fired = 0 // 1: if the turret is cooling down from a shot, 0: turret is ready to fire
@@ -51,13 +44,12 @@
var/attacked = 0 // if set to 1, the turret gets pissed off and shoots at people nearby (unless they have sec access!) var/attacked = 0 // if set to 1, the turret gets pissed off and shoots at people nearby (unless they have sec access!)
//var/emagged = 0 // 1: emagged, 0: not emagged
var/on = 1 // determines if the turret is on var/on = 1 // determines if the turret is on
var/disabled = 0 var/disabled = 0
var/datum/effect/effect/system/spark_spread/spark_system // the spark system, used for generating... sparks? var/datum/effect/effect/system/spark_spread/spark_system // the spark system, used for generating... sparks?
machine_flags = EMAGGABLE machine_flags = EMAGGABLE | SHUTTLEWRENCH
/obj/machinery/porta_turret/New() /obj/machinery/porta_turret/New()
..() ..()
@@ -66,24 +58,19 @@
spark_system = new /datum/effect/effect/system/spark_spread spark_system = new /datum/effect/effect/system/spark_spread
spark_system.set_up(5, 0, src) spark_system.set_up(5, 0, src)
spark_system.attach(src) spark_system.attach(src)
power_change()
spawn(10) spawn(10)
update_gun() update_gun()
/obj/machinery/porta_turret/proc/update_gun() /obj/machinery/porta_turret/proc/update_gun()
if(!installation)// if for some reason the turret has no gun (ie, admin spawned) it resorts to basic taser shots if(!installed)// if for some reason the turret has no gun (ie, admin spawned) it resorts to basic taser shots
projectile = /obj/item/projectile/energy/electrode//holder for the projectile, here it is being set installed = new /obj/item/weapon/gun/energy/taser(src)
eprojectile = /obj/item/projectile/beam//holder for the projectile when emagged, if it is different
reqpower = 200
iconholder = 1
else else
var/obj/item/weapon/gun/energy/E=new installation var/obj/item/weapon/gun/energy/E = installed
// All energy-based weapons are applicable
switch(E.type) switch(E.type)
if(/obj/item/weapon/gun/energy/laser/bluetag) if(/obj/item/weapon/gun/energy/laser/bluetag)
projectile = /obj/item/projectile/beam/lasertag/blue
eprojectile = /obj/item/projectile/beam/lasertag/omni//This bolt will stun ERRYONE with a vest
iconholder = null
reqpower = 100
lasercolor = "b" lasercolor = "b"
req_access = list(access_maint_tunnels) req_access = list(access_maint_tunnels)
check_records = 0 check_records = 0
@@ -91,13 +78,8 @@
auth_weapons = 1 auth_weapons = 1
stun_all = 0 stun_all = 0
check_anomalies = 0 check_anomalies = 0
shot_delay = 30
if(/obj/item/weapon/gun/energy/laser/redtag) if(/obj/item/weapon/gun/energy/laser/redtag)
projectile = /obj/item/projectile/beam/lasertag/red
eprojectile = /obj/item/projectile/beam/lasertag/omni
iconholder = null
reqpower = 100
lasercolor = "r" lasercolor = "r"
req_access = list(access_maint_tunnels) req_access = list(access_maint_tunnels)
check_records = 0 check_records = 0
@@ -105,140 +87,12 @@
auth_weapons = 1 auth_weapons = 1
stun_all = 0 stun_all = 0
check_anomalies = 0 check_anomalies = 0
shot_delay = 30
if(/obj/item/weapon/gun/energy/laser/practice)
projectile = /obj/item/projectile/beam/practice
eprojectile = /obj/item/projectile/beam
iconholder = null
reqpower = 100
if(/obj/item/weapon/gun/energy/pulse_rifle)
projectile = /obj/item/projectile/beam/pulse
eprojectile = projectile
iconholder = null
reqpower = 700
fire_sound = 'sound/weapons/pulse.ogg'
efire_sound = fire_sound
if(/obj/item/weapon/gun/energy/staff)
projectile = /obj/item/projectile/change
eprojectile = projectile
iconholder = 1
reqpower = 700
fire_sound = 'sound/weapons/radgun.ogg'
efire_sound = fire_sound
if(/obj/item/weapon/gun/energy/ionrifle)
projectile = /obj/item/projectile/ion
eprojectile = projectile
iconholder = 1
reqpower = 700
fire_sound = 'sound/weapons/ion.ogg'
efire_sound = fire_sound
if(/obj/item/weapon/gun/energy/taser)
projectile = /obj/item/projectile/energy/electrode
eprojectile = projectile
iconholder = 1
reqpower = 200
fire_sound = 'sound/weapons/Taser.ogg'
efire_sound = fire_sound
if(/obj/item/weapon/gun/energy/stunrevolver)
projectile = /obj/item/projectile/energy/electrode
eprojectile = projectile
iconholder = 1
reqpower = 200
fire_sound = 'sound/weapons/Gunshot.ogg'
efire_sound = fire_sound
if(/obj/item/weapon/gun/energy/lasercannon)
projectile = /obj/item/projectile/beam/heavylaser
eprojectile = projectile
iconholder = null
reqpower = 600
fire_sound = 'sound/weapons/lasercannonfire.ogg'
efire_sound = fire_sound
if(/obj/item/weapon/gun/energy/decloner)
projectile = /obj/item/projectile/energy/declone
eprojectile = projectile
iconholder = null
reqpower = 600
fire_sound = 'sound/weapons/pulse3.ogg'
efire_sound = fire_sound
if(/obj/item/weapon/gun/energy/crossbow/largecrossbow)
projectile = /obj/item/projectile/energy/bolt/large
eprojectile = projectile
iconholder = null
reqpower = 125
fire_sound = 'sound/weapons/ebow.ogg'
efire_sound = fire_sound
if(/obj/item/weapon/gun/energy/crossbow)
projectile = /obj/item/projectile/energy/bolt
eprojectile = projectile
iconholder = null
reqpower = 50
fire_sound = 'sound/weapons/ebow.ogg'
efire_sound = fire_sound
if(/obj/item/weapon/gun/energy/laser)
projectile = /obj/item/projectile/beam
eprojectile = projectile
iconholder = null
reqpower = 500
if(/obj/item/weapon/gun/energy/ricochet)
projectile = /obj/item/projectile/ricochet
eprojectile = projectile
iconholder = null
reqpower = 500
if(/obj/item/weapon/gun/energy/bison)
projectile = /obj/item/projectile/beam/bison
eprojectile = projectile
iconholder = null
reqpower = 250
fire_sound = 'sound/weapons/bison_fire.ogg'
efire_sound = fire_sound
if(/obj/item/weapon/gun/energy/polarstar/spur)
projectile = /obj/item/projectile/spur
eprojectile = projectile
iconholder = null
reqpower = 700
fire_sound = 'sound/weapons/spur_high.ogg'
efire_sound = fire_sound
if(/obj/item/weapon/gun/energy/polarstar)
projectile = /obj/item/projectile/spur/polarstar
eprojectile = projectile
iconholder = null
reqpower = 400
fire_sound = 'sound/weapons/spur_high.ogg'
efire_sound = fire_sound
else // Energy gun shots
projectile = /obj/item/projectile/energy/electrode// if it hasn't been emagged, it uses normal taser shots
eprojectile = /obj/item/projectile/beam//If it has, going to kill mode
iconholder = 1
egun = 1
reqpower = 200
fire_sound = 'sound/weapons/Taser.ogg'
if(!eprojectile || !projectile)
projectile = /obj/item/projectile/energy/electrode// if it hasn't been emagged, it uses normal taser shots
eprojectile = /obj/item/projectile/beam//If it has, going to kill mode
iconholder = 1
egun = 1
reqpower = 200
fire_sound = 'sound/weapons/Taser.ogg'
/obj/machinery/porta_turret/Destroy() /obj/machinery/porta_turret/Destroy()
// deletes its own cover with it // deletes its own cover with it
qdel(cover) qdel(cover)
qdel(installed)
..() ..()
@@ -298,6 +152,9 @@ Status: []<BR>"},
usr.set_machine(src) usr.set_machine(src)
src.add_fingerprint(usr) src.add_fingerprint(usr)
if ((href_list["power"]) && (src.allowed(usr))) if ((href_list["power"]) && (src.allowed(usr)))
if(on && emagged)
to_chat(usr, "<span class='warning'>The turret isn't responding!</span>")
return
if(anchored) // you can't turn a turret on/off if it's not anchored/secured if(anchored) // you can't turn a turret on/off if it's not anchored/secured
on = !on // toggle on/off on = !on // toggle on/off
else else
@@ -317,6 +174,8 @@ Status: []<BR>"},
src.criminals = !src.criminals src.criminals = !src.criminals
if("shootall") if("shootall")
stun_all = !stun_all stun_all = !stun_all
if("checkxenos")
check_anomalies = !check_anomalies
updateUsrDialog() updateUsrDialog()
@@ -330,11 +189,9 @@ Status: []<BR>"},
else else
if( powered() ) if( powered() )
if (on) if (on)
if (installation == /obj/item/weapon/gun/energy/laser || installation == /obj/item/weapon/gun/energy/pulse_rifle) if (emagged)
// laser guns and pulse rifles have an orange icon
icon_state = "[lasercolor]orange_target_prism" icon_state = "[lasercolor]orange_target_prism"
else else
// anything else has a blue icon
icon_state = "[lasercolor]target_prism" icon_state = "[lasercolor]target_prism"
else else
icon_state = "[lasercolor]grey_target_prism" icon_state = "[lasercolor]grey_target_prism"
@@ -347,13 +204,19 @@ Status: []<BR>"},
/obj/machinery/porta_turret/emag(mob/user) /obj/machinery/porta_turret/emag(mob/user)
if(!emagged) if(!emagged)
to_chat(user, "<span class='warning'>You short out [src]'s threat assessment circuits.</span>") to_chat(user, "<span class='warning'>You short out [src]'s threat assessment circuits.</span>")
spawn(0) if(anchored) //this is like this because the turret itself is invisible when retracted, so the cover displays the message instead
for(var/mob/O in hearers(src, null)) cover.visible_message("<span class='warning'>[src] hums oddly...</span>", "<span class='warning'>You hear an odd humming.</span>")
O.show_message("<span class='warning'>[src] hums oddly...</span>", 1) else //But when unsecured the cover is gone, so it shows the message itself
visible_message("<span class='warning'>[src] hums oddly...</span>", "<span class='warning'>You hear an odd humming.</span>")
if(istype(installed, /obj/item/weapon/gun/energy/laser/redtag) || istype(installed, /obj/item/weapon/gun/energy/laser/redtag))
installed.projectile_type = /obj/item/projectile/beam/lasertag/omni //if you manage to get this gun back out, good for you
emagged = 1 emagged = 1
src.on = 0 // turns off the turret temporarily req_access = null
on = 0 // turns off the turret temporarily
sleep(60) // 6 seconds for the traitor to gtfo of the area before the turret decides to ruin his shit sleep(60) // 6 seconds for the traitor to gtfo of the area before the turret decides to ruin his shit
on = 1 // turns it back on. The cover popUp() popDown() are automatically called in process(), no need to define it here if(anchored) //Can't turn on if not secure
on = 1 // turns it back on. The cover popUp() popDown() are automatically called in process(), no need to define it here
/obj/machinery/porta_turret/attackby(obj/item/W as obj, mob/user as mob) /obj/machinery/porta_turret/attackby(obj/item/W as obj, mob/user as mob)
if(stat & BROKEN) if(stat & BROKEN)
if(iscrowbar(W)) if(iscrowbar(W))
@@ -362,18 +225,22 @@ Status: []<BR>"},
// try and salvage its components // try and salvage its components
to_chat(user, "You begin prying the metal coverings off.") to_chat(user, "You begin prying the metal coverings off.")
sleep(20) sleep(20)
if(prob(70)) var/salvaged
to_chat(user, "You remove the turret and salvage some components.") if(installed)
if(installation) if(prob(70))
var/obj/item/weapon/gun/energy/Gun = new installation(src.loc) var/obj/item/I = installed
Gun.power_supply.charge=gun_charge I.forceMove(get_turf(src))
Gun.update_icon() installed = null
lasercolor = null lasercolor = null
if(prob(50)) salvaged++
var/obj/item/stack/sheet/metal/M = getFromPool(/obj/item/stack/sheet/metal,loc) if(prob(75))
M.amount = rand(1,4) getFromPool(/obj/item/stack/sheet/metal, loc, rand(2,6))
if(prob(50)) salvaged++
new /obj/item/device/assembly/prox_sensor(locate(x,y,z)) if(prob(50))
new /obj/item/device/assembly/prox_sensor(get_turf(src))
salvaged++
if(salvaged)
to_chat(user, "You remove the turret and salvage some components.")
else else
to_chat(user, "You remove the turret but did not manage to salvage anything.") to_chat(user, "You remove the turret but did not manage to salvage anything.")
qdel(src) qdel(src)
@@ -381,21 +248,16 @@ Status: []<BR>"},
..() ..()
if((iswrench(W)) && (!on)) if(iswrench(W) && !on && !raised && wrenchAnchor(user))
if(raised)
return
// This code handles moving the turret around. After all, it's a portable turret! // This code handles moving the turret around. After all, it's a portable turret!
if(!anchored) if(anchored)
anchored = 1
invisibility = INVISIBILITY_LEVEL_TWO invisibility = INVISIBILITY_LEVEL_TWO
icon_state = "[lasercolor]grey_target_prism" icon_state = "[lasercolor]grey_target_prism"
to_chat(user, "You secure the exterior bolts on the turret.") cover=new/obj/machinery/porta_turret_cover(src.loc) // create a new turret cover. While this is handled in process(), this is to workaround a bug where the turret becomes invisible for a split second
cover=new/obj/machinery/porta_turret_cover(src.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 cover.Parent_Turret = src // make the cover's parent src
power_change()
else else
anchored = 0
to_chat(user, "You unsecure the exterior bolts on the turret.")
icon_state = "turretCover" icon_state = "turretCover"
invisibility = 0 invisibility = 0
qdel(cover) // deletes the cover, and the turret instance itself becomes its own cover. qdel(cover) // deletes the cover, and the turret instance itself becomes its own cover.
@@ -411,25 +273,28 @@ Status: []<BR>"},
else else
user.delayNextAttack(10) user.delayNextAttack(10)
// if the turret was attacked with the intention of harming it: // if the turret was attacked with the intention of harming it:
src.health -= W.force * 0.5 if (W.force >= 2)
if (src.health <= 0) src.health -= W.force * 0.5
src.die() if (src.health <= 0)
if ((W.force * 0.5) > 1) // if the force of impact dealt at least 1 damage, the turret gets pissed off src.die()
if(!attacked && !emagged) // if the force of impact dealt at least 1 damage, the turret gets pissed off
attacked = 1 playsound(loc, 'sound/effects/grillehit.ogg', 75, 1)
spawn() if(W.attack_verb && W.attack_verb.len)
sleep(60) user.visible_message("<span class='warning'><B>[user] [pick(W.attack_verb)] \the [src] with \the [W]!</span>", \
attacked = 0 "<span class='warning'>You attack \the [src] with \the [W]!</span>", \
"<span class='warning'>You hear a clang!</span>")
else
user.visible_message("<span class='warning'><B>[user] attacks \the [src] with \the [W]!</span>", \
"<span class='warning'>You attack \the [src] with \the [W]!</span>", \
"<span class='warning'>You hear a clang!</span>")
if(on)
attacked += 5
/obj/machinery/porta_turret/bullet_act(var/obj/item/projectile/Proj) /obj/machinery/porta_turret/bullet_act(var/obj/item/projectile/Proj)
if(on) if(on && Proj.damage > 0)
if(!attacked && !emagged) attacked += 5
attacked = 1
spawn()
sleep(60)
attacked = 0
src.health -= Proj.damage src.health -= Proj.damage
..() ..()
@@ -462,7 +327,7 @@ Status: []<BR>"},
auth_weapons=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 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(5)) if(prob(5))
emagged=1 emagged = 1
on=0 on=0
sleep(rand(60,600)) sleep(rand(60,600))
if(!on) if(!on)
@@ -471,10 +336,12 @@ Status: []<BR>"},
..() ..()
/obj/machinery/porta_turret/ex_act(severity) /obj/machinery/porta_turret/ex_act(severity)
if(severity >= 3) // turret dies if an explosion touches it! if(severity < 3)
qdel(src) qdel(src)
else else
src.die() health -= 30
if(health <= 0)
die()
/obj/machinery/porta_turret/proc/die() // called when the turret dies, ie, health <= 0 /obj/machinery/porta_turret/proc/die() // called when the turret dies, ie, health <= 0
src.health = 0 src.health = 0
@@ -511,61 +378,72 @@ Status: []<BR>"},
popDown() popDown()
return return
last_fired = 0
if(attacked)
attacked--
var/list/targets = list() // list of primary targets var/list/targets = list() // list of primary targets
var/list/secondarytargets = list() // targets that are least important var/list/secondarytargets = list() // targets that are least important
if(src.check_anomalies) // if its set to check for xenos/carps, check for non-mob "crittersssss"(And simple_animals)
for(var/mob/living/simple_animal/C in view(7,src))
if(C.stat)
continue
if(C.flags & INVULNERABLE)
continue
// Ignore lazarus-injected mobs.
if(dd_hasprefix(C.faction, "lazarus"))
continue
targets += C
for (var/mob/living/carbon/C in view(7,src)) // loops through all living carbon-based lifeforms in view(12)
if(C.flags & INVULNERABLE)
for(var/mob/living/L in view(7+emagged*5, src))
if(L.flags & INVULNERABLE)
continue continue
if(istype(C, /mob/living/carbon/alien) && src.check_anomalies) // git those fukken xenos if(L.isDead() || isMoMMI(L))//mommis are always safe
if(!C.stat) // if it's dead/dying, there's no need to keep shooting at it. continue
targets += C if(emagged)
if(L.isUnconscious())
else secondarytargets += L //if the turret is emagged, skip all the fancy target picking stuff
if(emagged) // if emagged, HOLY SHIT EVERYONE IS DANGEROUS beep boop beep
targets += C
else else
if (C.stat || C.handcuffed) // if the perp is handcuffed or dead/dying, no need to bother really targets += L //and focus on murdering everything
else if(!issilicon(L))
if(isanimal(L)) // if its set to check for xenos/carps, check for non-mob "crittersssss"(And simple_animals)
if(check_anomalies || stun_all || attacked)
if(L.isUnconscious())
continue
// Ignore lazarus-injected mobs.
if(dd_hasprefix(L.faction, "lazarus"))
continue
targets += L
if(isalien(L))
if(check_anomalies || stun_all || attacked) // git those fukken xenos
if(!L.isUnconscious())
targets += L
else
secondarytargets += L
else
if(L.isUnconscious() || L.restrained()) // if the perp is handcuffed or dead/dying, no need to bother really
continue // move onto next potential victim! continue // move onto next potential victim!
var/dst = get_dist(src, C) // if it's too far away, why bother?
if (dst > 7)
continue
if(ai) // If it's set to attack all nonsilicons, target them! if(ai) // If it's set to attack all nonsilicons, target them!
if(C.lying) if(L.lying)
if(lasercolor) secondarytargets += L
continue continue
else
secondarytargets += C
continue
else else
targets += C targets += L
continue continue
if (istype(C, /mob/living/carbon/human)) // if the target is a human, analyze threat level if(ishuman(L)) // if the target is a human, analyze threat level
if(src.assess_perp(C)<4) if(assess_perp(L) < PERP_LEVEL_ARREST)
continue // if threat level < 4, keep going continue // if threat level < PERP_LEVEL_ARREST, keep going
else if (istype(C, /mob/living/carbon/monkey)) if(ismonkey(L) && !(stun_all || check_anomalies || attacked))
continue // Don't target monkeys or borgs/AIs you dumb shit continue // Don't target monkeys or borgs/AIs you dumb shit
if (C.lying) // if the perp is lying down, it's still a target but a less-important target if(isslime(L) && !(stun_all || check_anomalies || attacked))
secondarytargets += C
continue continue
targets += C // if the perp has passed all previous tests, congrats, it is now a "shoot-me!" nominee if(L.lying) // if the perp is lying down, it's still a target but a less-important target
secondarytargets += L
continue
targets += L // if the perp has passed all previous tests, congrats, it is now a "shoot-me!" nominee
if (targets.len>0) // if there are targets to shoot if (targets.len>0) // if there are targets to shoot
@@ -633,7 +511,7 @@ Status: []<BR>"},
raising=0 raising=0
cover.icon_state="turretCover" cover.icon_state="turretCover"
raised=0 raised=0
invisibility=2 invisibility = INVISIBILITY_LEVEL_TWO
icon_state="[lasercolor]grey_target_prism" icon_state="[lasercolor]grey_target_prism"
@@ -641,12 +519,12 @@ Status: []<BR>"},
var/threatcount = 0 // the integer returned var/threatcount = 0 // the integer returned
if(src.emagged) if(src.emagged)
return 10 // if emagged, always return 10. return PERP_LEVEL_ARREST + rand(PERP_LEVEL_ARREST, PERP_LEVEL_ARREST*5) // if emagged, always return more than PERP_LEVEL_ARREST.
if((stun_all && !src.allowed(perp)) || attacked && !src.allowed(perp)) if((stun_all && !src.allowed(perp)) || attacked && !src.allowed(perp))
// if the turret has been attacked or is angry, target all non-sec people // if the turret has been attacked or is angry, target all non-sec people
if(!src.allowed(perp)) if(!src.allowed(perp))
return 10 return PERP_LEVEL_ARREST + rand(PERP_LEVEL_ARREST, PERP_LEVEL_ARREST*5)
if(auth_weapons) // check for weapon authorization if(auth_weapons) // check for weapon authorization
if((isnull(perp.wear_id)) || (istype(perp.wear_id.GetID(), /obj/item/weapon/card/id/syndicate))) if((isnull(perp.wear_id)) || (istype(perp.wear_id.GetID(), /obj/item/weapon/card/id/syndicate)))
@@ -662,28 +540,28 @@ Status: []<BR>"},
continue continue
//Scan for guns and stun batons. Bartender's shotgun doesn't trigger the turret //Scan for guns and stun batons. Bartender's shotgun doesn't trigger the turret
threatcount += 4 threatcount += PERP_LEVEL_ARREST
if(istype(perp.belt, /obj/item/weapon/gun) || istype(perp.belt, /obj/item/weapon/melee/baton)) if(istype(perp.belt, /obj/item/weapon/gun) || istype(perp.belt, /obj/item/weapon/melee/baton))
threatcount += 2 threatcount += PERP_LEVEL_ARREST/2
if((src.lasercolor) == "b")//Lasertag turrets target the opposing team, how great is that? -Sieve if((src.lasercolor) == "b")//Lasertag turrets target the opposing team, how great is that? -Sieve
threatcount = 0//But does not target anyone else threatcount = 0//But does not target anyone else
if(istype(perp.wear_suit, /obj/item/clothing/suit/redtag)) if(istype(perp.wear_suit, /obj/item/clothing/suit/redtag))
threatcount += 4 threatcount += PERP_LEVEL_ARREST
if(perp.find_held_item_by_type(/obj/item/weapon/gun/energy/laser/redtag)) if(perp.find_held_item_by_type(/obj/item/weapon/gun/energy/laser/redtag))
threatcount += 4 threatcount += PERP_LEVEL_ARREST
if(istype(perp.belt, /obj/item/weapon/gun/energy/laser/redtag)) if(istype(perp.belt, /obj/item/weapon/gun/energy/laser/redtag))
threatcount += 2 threatcount += PERP_LEVEL_ARREST/2
if((src.lasercolor) == "r") if((src.lasercolor) == "r")
threatcount = 0 threatcount = 0
if(istype(perp.wear_suit, /obj/item/clothing/suit/bluetag)) if(istype(perp.wear_suit, /obj/item/clothing/suit/bluetag))
threatcount += 4 threatcount += PERP_LEVEL_ARREST
if(perp.find_held_item_by_type(/obj/item/weapon/gun/energy/laser/bluetag)) if(perp.find_held_item_by_type(/obj/item/weapon/gun/energy/laser/bluetag))
threatcount += 4 threatcount += PERP_LEVEL_ARREST
if(istype(perp.belt, /obj/item/weapon/gun/energy/laser/bluetag)) if(istype(perp.belt, /obj/item/weapon/gun/energy/laser/bluetag))
threatcount += 2 threatcount += PERP_LEVEL_ARREST/2
if (src.check_records) // if the turret can check the records, check if they are set to *Arrest* on records if (src.check_records) // if the turret can check the records, check if they are set to *Arrest* on records
for (var/datum/data/record/E in data_core.general) for (var/datum/data/record/E in data_core.general)
@@ -697,7 +575,7 @@ Status: []<BR>"},
if (E.fields["name"] == perpname) if (E.fields["name"] == perpname)
for (var/datum/data/record/R in data_core.security) for (var/datum/data/record/R in data_core.security)
if ((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "*Arrest*")) if ((R.fields["id"] == E.fields["id"]) && (R.fields["criminal"] == "*Arrest*"))
threatcount = 4 threatcount = PERP_LEVEL_ARREST
break break
@@ -717,14 +595,6 @@ Status: []<BR>"},
if(H.lying) if(H.lying)
return return
if(!emagged) // if it hasn't been emagged, it has to obey a cooldown rate
if(last_fired || !raised)
return // prevents rapid-fire shooting, unless it's been emagged
last_fired = 1
spawn()
sleep(shot_delay)
last_fired = 0
var/turf/T = get_turf(src) var/turf/T = get_turf(src)
var/turf/U = get_turf(target) var/turf/U = get_turf(target)
if (!istype(T) || !istype(U)) if (!istype(T) || !istype(U))
@@ -733,35 +603,31 @@ Status: []<BR>"},
if (!raised) // the turret has to be raised in order to fire - makes sense, right? if (!raised) // the turret has to be raised in order to fire - makes sense, right?
return return
if(!emagged)
// any emagged turrets will shoot extremely fast! This not only is deadly, but drains a lot power!
if(iconholder)
icon_state = "[lasercolor]target_prism" icon_state = "[lasercolor]target_prism"
else else
icon_state = "[lasercolor]orange_target_prism" icon_state = "[lasercolor]orange_target_prism"
use_power(reqpower)
// //Shooting Code:
playsound(get_turf(src), installed.fire_sound, 75, 1)
var/obj/item/projectile/A var/obj/item/projectile/A
if(emagged) A = new installed.projectile_type(loc)
playsound(get_turf(src), efire_sound, 75, 1) A.original = target
A = new eprojectile( loc )
else
playsound(get_turf(src), fire_sound, 75, 1)
A = new projectile( loc )
A.original = target.loc
if(!emagged)
use_power(reqpower)
else
use_power((reqpower*2))
// Shooting Code:
A.starting = T A.starting = T
A.shot_from = src A.shot_from = installed
A.current = T A.current = T
A.yo = U.y - T.y A.yo = U.y - T.y
A.xo = U.x - T.x A.xo = U.x - T.x
spawn( 1 ) A.OnFired()
A.OnFired() spawn()
A.process() A.process()
if(emagged && !last_fired)
sleep(5)
last_fired = 1
shootAt(target)
return return
@@ -781,8 +647,8 @@ Status: []<BR>"},
density=1 density=1
var/build_step = 0 // the current step in the building process var/build_step = 0 // the current step in the building process
var/finish_name="turret" // the name applied to the product turret var/finish_name="turret" // the name applied to the product turret
var/installation = null // the gun type installed var/obj/item/weapon/gun/energy/installed = null // the gun installed
var/gun_charge = 0 // the gun charge of the gun type installed machine_flags = SHUTTLEWRENCH
@@ -791,37 +657,30 @@ Status: []<BR>"},
// this is a bit unweildy but self-explanitory // this is a bit unweildy but self-explanitory
switch(build_step) switch(build_step)
if(0) // first step if(0) // first step
if(iswrench(W) && !anchored) if(iswrench(W) && !anchored && wrenchAnchor(user))
playsound(get_turf(src), 'sound/items/Ratchet.ogg', 100, 1)
to_chat(user, "<span class='notice'>You secure the external bolts.</span>")
anchored = 1
build_step = 1 build_step = 1
return return
else if(iscrowbar(W) && !anchored) else if(iscrowbar(W) && !anchored)
playsound(get_turf(src), 'sound/items/Crowbar.ogg', 75, 1) playsound(get_turf(src), 'sound/items/Crowbar.ogg', 75, 1)
to_chat(user, "You dismantle the turret construction.") to_chat(user, "You dismantle the turret construction.")
//new /obj/item/stack/sheet/metal( loc, 5) getFromPool(/obj/item/stack/sheet/metal, loc, 5)
var/obj/item/stack/sheet/metal/M = getFromPool(/obj/item/stack/sheet/metal, loc)
M.amount = 5
qdel(src) qdel(src)
return return
if(1) if(1)
if(istype(W, /obj/item/stack/sheet/metal)) if(istype(W, /obj/item/stack/sheet/metal))
if(W:amount>=2) // requires 2 metal sheets var/obj/item/stack/sheet/metal/stack = W
if(stack.use(2)) // requires 2 metal sheets
to_chat(user, "<span class='notice'>You add some metal armor to the interior frame.</span>") to_chat(user, "<span class='notice'>You add some metal armor to the interior frame.</span>")
build_step = 2 build_step = 2
W:amount -= 2
icon_state = "turret_frame2" icon_state = "turret_frame2"
if(W:amount <= 0) return
returnToPool(W) else
to_chat(user, "<span class='warning'>You need at least 2 [stack] to add internal armor.</span>")
return return
else if(iswrench(W)) else if(iswrench(W) && wrenchAnchor(user))
playsound(get_turf(src), 'sound/items/Ratchet.ogg', 75, 1)
to_chat(user, "You unfasten the external bolts.")
anchored = 0
build_step = 0 build_step = 0
return return
@@ -847,21 +706,20 @@ Status: []<BR>"},
return return
build_step = 1 build_step = 1
to_chat(user, "You remove the turret's interior metal armor.") to_chat(user, "You remove the turret's interior metal armor.")
//new /obj/item/stack/sheet/metal( loc, 2) getFromPool(/obj/item/stack/sheet/metal, loc, 2)
var/obj/item/stack/sheet/metal/M = getFromPool(/obj/item/stack/sheet/metal,loc) icon_state = "turret_frame"
M.amount = 2
return return
if(3) if(3)
if(istype(W, /obj/item/weapon/gun/energy)) // the gun installation part if(istype(W, /obj/item/weapon/gun/energy)) // the gun installation part
if(!user.drop_item(W, src))
to_chat(user, "<span class='warning'>You can't let go of \the [W]!</span>")
return
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 100, 1) playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 100, 1)
var/obj/item/weapon/gun/energy/E = W // typecasts the item to an energy gun installed = W
installation = W.type // installation becomes W.type
gun_charge = E.power_supply.charge // the gun's charge is stored in src.gun_charge
to_chat(user, "<span class='notice'>You add \the [W] to the turret.</span>") to_chat(user, "<span class='notice'>You add \the [W] to the turret.</span>")
build_step = 4 build_step = 4
qdel(W) // delete the gun :(
return return
else if(iswrench(W)) else if(iswrench(W))
@@ -872,6 +730,9 @@ Status: []<BR>"},
if(4) if(4)
if(isprox(W)) if(isprox(W))
if(!user.drop_item(W, src))
to_chat(user, "<span class='warning'>You can't let go of \the [W]!</span>")
return
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 100, 1) playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 100, 1)
build_step = 5 build_step = 5
to_chat(user, "<span class='notice'>You add the prox sensor to the turret.</span>") to_chat(user, "<span class='notice'>You add the prox sensor to the turret.</span>")
@@ -891,12 +752,13 @@ Status: []<BR>"},
if(6) if(6)
if(istype(W, /obj/item/stack/sheet/metal)) if(istype(W, /obj/item/stack/sheet/metal))
if(W:amount>=2) var/obj/item/stack/sheet/metal/stack = W
if(stack.use(2))
to_chat(user, "<span class='notice'>You add some metal armor to the exterior frame.</span>") to_chat(user, "<span class='notice'>You add some metal armor to the exterior frame.</span>")
build_step = 7 build_step = 7
W:amount -= 2 return
if(W:amount <= 0) else
qdel(W) to_chat(user, "<span class='warning'>You need at least 2 [stack] to add external armor.</span>")
return return
else if(isscrewdriver(W)) else if(isscrewdriver(W))
@@ -923,17 +785,15 @@ Status: []<BR>"},
// The final step: create a full turret // The final step: create a full turret
var/obj/machinery/porta_turret/Turret = new/obj/machinery/porta_turret(locate(x,y,z)) var/obj/machinery/porta_turret/Turret = new/obj/machinery/porta_turret(locate(x,y,z))
Turret.name = finish_name Turret.name = finish_name
Turret.installation = src.installation Turret.installed = src.installed
Turret.gun_charge = src.gun_charge installed.forceMove(Turret)
Turret.update_gun() Turret.update_gun()
qdel(src) qdel(src)
else if(iscrowbar(W)) else if(iscrowbar(W))
playsound(get_turf(src), 'sound/items/Crowbar.ogg', 75, 1) playsound(get_turf(src), 'sound/items/Crowbar.ogg', 75, 1)
to_chat(user, "You pry off the turret's exterior armor.") to_chat(user, "You pry off the turret's exterior armor.")
//new /obj/item/stack/sheet/metal( loc, 2) getFromPool(/obj/item/stack/sheet/metal, loc, 2)
var/obj/item/stack/sheet/metal/M = getFromPool(/obj/item/stack/sheet/metal,loc)
M.amount = 2
build_step = 6 build_step = 6
return return
@@ -949,38 +809,32 @@ Status: []<BR>"},
return return
..() ..()
/obj/machinery/porta_turret_construct/attack_ghost(var/mob/user) //stop taking the guns out
return 0
/obj/machinery/porta_turret_construct/attack_ai(var/mob/user)
return 0
/obj/machinery/porta_turret_construct/attack_hand(mob/user as mob) /obj/machinery/porta_turret_construct/attack_hand(mob/user as mob)
switch(build_step) switch(build_step)
if(4) if(4)
if(!installation) if(!installed)
return return
build_step = 3 build_step = 3
var/obj/item/weapon/gun/energy/Gun = new installation(src.loc) to_chat(user, "You remove \the [installed] from the turret frame.")
Gun.power_supply.charge=gun_charge var/obj/item/I = installed
Gun.update_icon() user.put_in_hands(I)
installation = null installed = null
gun_charge = 0
to_chat(user, "You remove \the [Gun] from the turret frame.")
if(5) if(5)
to_chat(user, "You remove the prox sensor from the turret frame.") to_chat(user, "You remove the prox sensor from the turret frame.")
new/obj/item/device/assembly/prox_sensor(locate(x,y,z)) var/obj/item/device/assembly/prox_sensor/P = new(user.loc)
user.put_in_hands(P)
build_step = 4 build_step = 4
/obj/machinery/porta_turret_cover /obj/machinery/porta_turret_cover
name = "turret" name = "turret"
icon = 'icons/obj/turrets.dmi' icon = 'icons/obj/turrets.dmi'
@@ -990,182 +844,24 @@ Status: []<BR>"},
density = 0 density = 0
var/obj/machinery/porta_turret/Parent_Turret = null var/obj/machinery/porta_turret/Parent_Turret = null
machine_flags = SHUTTLEWRENCH
// The below code is pretty much just recoded from the initial turret object. It's necessary but uncommented because it's exactly the same!
/obj/machinery/porta_turret_cover/attack_ai(mob/user as mob) /obj/machinery/porta_turret_cover/attack_ai(mob/user as mob)
. = ..() add_hiddenprint(user)
if (.) return Parent_Turret.attack_ai(user)
return
src.add_hiddenprint(user)
var/dat
if(!(Parent_Turret.lasercolor))
dat += text({"
<TT><B>Automatic Portable Turret Installation</B></TT><BR><BR>
Status: []<BR>
Behaviour controls are [Parent_Turret.locked ? "locked" : "unlocked"]"},
"<A href='?src=\ref[src];power=1'>[Parent_Turret.on ? "On" : "Off"]</A>" )
dat += text({"<BR>
Check for Weapon Authorization: []<BR>
Check Security Records: []<BR>
Neutralize Identified Criminals: []<BR>
Neutralize All Non-Security and Non-Command Personnel: []<BR>
Neutralize All Unidentified Life Signs: []<BR>"},
"<A href='?src=\ref[src];operation=authweapon'>[Parent_Turret.auth_weapons ? "Yes" : "No"]</A>",
"<A href='?src=\ref[src];operation=checkrecords'>[Parent_Turret.check_records ? "Yes" : "No"]</A>",
"<A href='?src=\ref[src];operation=shootcrooks'>[Parent_Turret.criminals ? "Yes" : "No"]</A>",
"<A href='?src=\ref[src];operation=shootall'>[Parent_Turret.stun_all ? "Yes" : "No"]</A>" ,
"<A href='?src=\ref[src];operation=checkxenos'>[Parent_Turret.check_anomalies ? "Yes" : "No"]</A>" )
else
dat += text({"
<TT><B>Automatic Portable Turret Installation</B></TT><BR><BR>
Status: []<BR>"},
"<A href='?src=\ref[src];power=1'>[Parent_Turret.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_cover/attack_hand(mob/user as mob)
. = ..()
if (.)
return
var/dat
if(!(Parent_Turret.lasercolor))
dat += text({"
<TT><B>Automatic Portable Turret Installation</B></TT><BR><BR>
Status: []<BR>
Behaviour controls are [Parent_Turret.locked ? "locked" : "unlocked"]"},
"<A href='?src=\ref[src];power=1'>[Parent_Turret.on ? "On" : "Off"]</A>" )
if(!Parent_Turret.locked)
dat += text({"<BR>
Check for Weapon Authorization: []<BR>
Check Security Records: []<BR>
Neutralize Identified Criminals: []<BR>
Neutralize All Non-Security and Non-Command Personnel: []<BR>
Neutralize All Unidentified Life Signs: []<BR>"},
"<A href='?src=\ref[src];operation=authweapon'>[Parent_Turret.auth_weapons ? "Yes" : "No"]</A>",
"<A href='?src=\ref[src];operation=checkrecords'>[Parent_Turret.check_records ? "Yes" : "No"]</A>",
"<A href='?src=\ref[src];operation=shootcrooks'>[Parent_Turret.criminals ? "Yes" : "No"]</A>",
"<A href='?src=\ref[src];operation=shootall'>[Parent_Turret.stun_all ? "Yes" : "No"]</A>" ,
"<A href='?src=\ref[src];operation=checkxenos'>[Parent_Turret.check_anomalies ? "Yes" : "No"]</A>" )
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)))
return
if(((Parent_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>
Status: []<BR>"},
"<A href='?src=\ref[src];power=1'>[Parent_Turret.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_cover/Topic(href, href_list)
if (..())
return
usr.set_machine(src)
Parent_Turret.add_fingerprint(usr)
src.add_fingerprint(usr)
if ((href_list["power"]) && (Parent_Turret.allowed(usr)))
if(Parent_Turret.anchored)
if (Parent_Turret.on)
Parent_Turret.on=0
else
Parent_Turret.on=1
else
to_chat(usr, "<span class='warning'>It has to be secured first!</span>")
updateUsrDialog()
return
switch(href_list["operation"])
if ("authweapon")
Parent_Turret.auth_weapons = !Parent_Turret.auth_weapons
if ("checkrecords")
Parent_Turret.check_records = !Parent_Turret.check_records
if ("shootcrooks")
Parent_Turret.criminals = !Parent_Turret.criminals
if("shootall")
Parent_Turret.stun_all = !Parent_Turret.stun_all
if("checkxenos")
Parent_Turret.check_anomalies = !Parent_Turret.check_anomalies
updateUsrDialog()
/obj/machinery/porta_turret_cover/attackby(obj/item/W as obj, mob/user as mob) /obj/machinery/porta_turret_cover/attackby(obj/item/W as obj, mob/user as mob)
add_fingerprint(user)
return Parent_Turret.attackby(W, user)
if ((istype(W, /obj/item/weapon/card/emag)) && (!Parent_Turret.emagged)) /obj/machinery/porta_turret_cover/attack_hand(mob/user as mob)
to_chat(user, "<span class='warning'>You short out [Parent_Turret]'s threat assessment circuits.</span>") add_fingerprint(user)
spawn(0) return Parent_Turret.attack_hand(user)
for(var/mob/O in hearers(Parent_Turret, null))
O.show_message("<span class='warning'>[Parent_Turret] hums oddly...</span>", 1)
Parent_Turret.emagged = 1
Parent_Turret.on = 0
sleep(40)
Parent_Turret.on = 1
else if((iswrench(W)) && (!Parent_Turret.on))
if(Parent_Turret.raised)
return
if(!Parent_Turret.anchored)
Parent_Turret.anchored = 1
Parent_Turret.invisibility = INVISIBILITY_LEVEL_TWO
Parent_Turret.icon_state = "grey_target_prism"
to_chat(user, "You secure the exterior bolts on the turret.")
else
Parent_Turret.anchored = 0
to_chat(user, "You unsecure the exterior bolts on the turret.")
Parent_Turret.icon_state = "turretCover"
Parent_Turret.invisibility = 0
qdel(src)
else if (istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda))
if (Parent_Turret.allowed(user))
Parent_Turret.locked = !Parent_Turret.locked
to_chat(user, "Controls are now [Parent_Turret.locked ? "locked." : "unlocked."]")
updateUsrDialog()
else
to_chat(user, "<span class='warning'>Access denied.</span>")
else
playsound(get_turf(src), 'sound/weapons/smash.ogg', 60, 1)
Parent_Turret.health -= W.force * 0.5
if (Parent_Turret.health <= 0)
Parent_Turret.die()
if ((W.force * 0.5) > 2)
if(!Parent_Turret.attacked && !Parent_Turret.emagged)
Parent_Turret.attacked = 1
spawn()
sleep(30)
Parent_Turret.attacked = 0
..()
/obj/machinery/porta_turret/stationary /obj/machinery/porta_turret/stationary
emagged = 1 emagged = 1
New() New()
installation = new/obj/item/weapon/gun/energy/laser(src.loc) installed = new/obj/item/weapon/gun/energy/laser(src)
..() ..()

View File

@@ -3308,11 +3308,10 @@
return return
var/obj/item/weapon/gun/energy/gun = new choice() var/obj/item/weapon/gun/energy/gun = new choice()
var/obj/machinery/porta_turret/Turret = new(get_turf(usr)) var/obj/machinery/porta_turret/Turret = new(get_turf(usr))
Turret.installation = choice Turret.installed = gun
Turret.gun_charge = gun.power_supply.charge gun.forceMove(Turret)
Turret.update_gun() Turret.update_gun()
qdel(gun) var/emag = input("Emag the turret?") in list("No", "Yes")
var/emag = input("Emag the turret?") in list("Yes", "No")
if(emag=="Yes") if(emag=="Yes")
Turret.emag(usr) Turret.emag(usr)
if("hardcore_mode") if("hardcore_mode")

View File

@@ -27,6 +27,7 @@
#include "code\__DEFINES\pipes.dm" #include "code\__DEFINES\pipes.dm"
#include "code\__DEFINES\reagents.dm" #include "code\__DEFINES\reagents.dm"
#include "code\__DEFINES\research_levels.dm" #include "code\__DEFINES\research_levels.dm"
#include "code\__DEFINES\security.dm"
#include "code\__HELPERS\_macros.dm" #include "code\__HELPERS\_macros.dm"
#include "code\__HELPERS\cmp.dm" #include "code\__HELPERS\cmp.dm"
#include "code\__HELPERS\constants.dm" #include "code\__HELPERS\constants.dm"