diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm
similarity index 71%
rename from code/game/machinery/portable_turret.dm
rename to code/game/machinery/porta_turret/portable_turret.dm
index 6c629db9149..768f3cb6792 100644
--- a/code/game/machinery/portable_turret.dm
+++ b/code/game/machinery/porta_turret/portable_turret.dm
@@ -71,7 +71,7 @@
if(has_cover)
cover = new /obj/machinery/porta_turret_cover(loc)
- cover.Parent_Turret = src
+ cover.parent_turret = src
setup()
if(!has_cover)
popUp()
@@ -293,7 +293,7 @@
user << "You secure the exterior bolts on the turret."
if(has_cover)
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
+ cover.parent_turret = src //make the cover's parent src
else if(anchored)
anchored = 0
user << "You unsecure the exterior bolts on the turret."
@@ -445,7 +445,7 @@
else
if(has_cover)
cover = new /obj/machinery/porta_turret_cover(loc) //if the turret has no cover and is anchored, give it a cover
- cover.Parent_Turret = src //assign the cover its Parent_Turret, which would be this (src)
+ cover.parent_turret = src //assign the cover its parent_turret, which would be this (src)
if(stat & (NOPOWER|BROKEN))
if(!always_up)
@@ -601,8 +601,6 @@
return threatcount
-/obj/machinery/porta_turret/ai/assess_perp(mob/living/carbon/human/perp)
- return 10 //AI turrets shoot at everything not in their faction
/obj/machinery/porta_turret/proc/in_faction(mob/target)
if(!(faction in target.faction))
@@ -666,287 +664,6 @@
src.power_change()
-/obj/machinery/porta_turret_construct
- name = "turret frame"
- icon = 'icons/obj/turrets.dmi'
- icon_state = "turret_frame"
- density=1
- 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
- var/gun_charge = 0 //the gun charge of the gun type installed
-
-
-/obj/machinery/porta_turret_construct/attackby(obj/item/I, mob/user, params)
- //this is a bit unwieldy but self-explanatory
- switch(build_step)
- if(0) //first step
- if(istype(I, /obj/item/weapon/wrench) && !anchored)
- playsound(loc, 'sound/items/Ratchet.ogg', 100, 1)
- user << "You secure the external bolts."
- anchored = 1
- build_step = 1
- return
-
- else if(istype(I, /obj/item/weapon/crowbar) && !anchored)
- playsound(loc, 'sound/items/Crowbar.ogg', 75, 1)
- user << "You dismantle the turret construction."
- new /obj/item/stack/sheet/metal( loc, 5)
- qdel(src)
- return
-
- if(1)
- if(istype(I, /obj/item/stack/sheet/metal))
- var/obj/item/stack/sheet/metal/M = I
- if(M.use(2))
- user << "You add some metal armor to the interior frame."
- build_step = 2
- icon_state = "turret_frame2"
- else
- user << "You need two sheets of metal to continue construction!"
- return
-
- else if(istype(I, /obj/item/weapon/wrench))
- playsound(loc, 'sound/items/Ratchet.ogg', 75, 1)
- user << "You unfasten the external bolts."
- anchored = 0
- build_step = 0
- return
-
-
- if(2)
- if(istype(I, /obj/item/weapon/wrench))
- playsound(loc, 'sound/items/Ratchet.ogg', 100, 1)
- user << "You bolt the metal armor into place."
- build_step = 3
- return
-
- else if(istype(I, /obj/item/weapon/weldingtool))
- var/obj/item/weapon/weldingtool/WT = I
- if(!WT.isOn())
- return
- if(WT.get_fuel() < 5) //uses up 5 fuel.
- user << "You need more fuel to complete this task!"
- return
-
- playsound(loc, pick('sound/items/Welder.ogg', 'sound/items/Welder2.ogg'), 50, 1)
- user << "You start to remove the turret's interior metal armor..."
- if(do_after(user, 20/I.toolspeed, target = src))
- if(!src || !WT.remove_fuel(5, user)) return
- build_step = 1
- user << "You remove the turret's interior metal armor."
- new /obj/item/stack/sheet/metal( loc, 2)
- return
-
-
- if(3)
- if(istype(I, /obj/item/weapon/gun/energy)) //the gun installation part
-
- if(isrobot(user))
- return
- var/obj/item/weapon/gun/energy/E = I //typecasts the item to an energy gun
- if(!user.unEquip(I))
- user << "\the [I] is stuck to your hand, you cannot put it in \the [src]!"
- return
- installation = I.type //installation becomes I.type
- gun_charge = E.power_supply.charge //the gun's charge is stored in gun_charge
- user << "You add [I] to the turret."
- build_step = 4
- qdel(I) //delete the gun :(
- return
-
- else if(istype(I, /obj/item/weapon/wrench))
- playsound(loc, 'sound/items/Ratchet.ogg', 100, 1)
- user << "You remove the turret's metal armor bolts."
- build_step = 2
- return
-
- if(4)
- if(isprox(I))
- build_step = 5
- if(!user.unEquip(I))
- user << "\the [I] is stuck to your hand, you cannot put it in \the [src]!"
- return
- user << "You add the proximity sensor to the turret."
- qdel(I)
- return
-
-
- if(5)
- if(istype(I, /obj/item/weapon/screwdriver))
- playsound(loc, 'sound/items/Screwdriver.ogg', 100, 1)
- build_step = 6
- user << "You close the internal access hatch."
- return
-
-
- if(6)
- if(istype(I, /obj/item/stack/sheet/metal))
- var/obj/item/stack/sheet/metal/M = I
- if(M.use(2))
- user << "You add some metal armor to the exterior frame."
- build_step = 7
- else
- user << "You need two sheets of metal to continue construction!"
- return
-
- else if(istype(I, /obj/item/weapon/screwdriver))
- playsound(loc, 'sound/items/Screwdriver.ogg', 100, 1)
- build_step = 5
- user << "You open the internal access hatch."
- return
-
- if(7)
- if(istype(I, /obj/item/weapon/weldingtool))
- var/obj/item/weapon/weldingtool/WT = I
- if(!WT.isOn()) return
- if(WT.get_fuel() < 5)
- user << "You need more fuel to complete this task!"
-
- playsound(loc, pick('sound/items/Welder.ogg', 'sound/items/Welder2.ogg'), 50, 1)
- user << "You begin to weld the turret's armor down..."
- if(do_after(user, 30/I.toolspeed, target = src))
- if(!src || !WT.remove_fuel(5, user))
- return
- build_step = 8
- user << "You weld the turret's armor down."
-
- //The final step: create a full turret
- var/obj/machinery/porta_turret/Turret = new/obj/machinery/porta_turret(loc)
- Turret.name = finish_name
- Turret.installation = installation
- Turret.gun_charge = gun_charge
- Turret.setup()
-
- qdel(src)
-
- else if(istype(I, /obj/item/weapon/crowbar))
- playsound(loc, 'sound/items/Crowbar.ogg', 75, 1)
- user << "You pry off the turret's exterior armor."
- new /obj/item/stack/sheet/metal(loc, 2)
- build_step = 6
- return
-
- if(istype(I, /obj/item/weapon/pen)) //you can rename turrets like bots!
- var/t = stripped_input(user, "Enter new turret name", name, finish_name)
- if(!t)
- return
- if(!in_range(src, usr) && loc != usr)
- return
-
- finish_name = t
- return
- ..()
-
-
-/obj/machinery/porta_turret_construct/attack_hand(mob/user)
- switch(build_step)
- if(4)
- if(!installation)
- return
- build_step = 3
-
- var/obj/item/weapon/gun/energy/Gun = new installation(loc)
- Gun.power_supply.charge = gun_charge
- Gun.update_icon()
- installation = null
- gun_charge = 0
- user << "You remove [Gun] from the turret frame."
-
- if(5)
- user << "You remove the prox sensor from the turret frame."
- new /obj/item/device/assembly/prox_sensor(loc)
- build_step = 4
-
-/obj/machinery/porta_turret_construct/attack_ai()
- return
-
-
-/************************
-* PORTABLE TURRET COVER *
-************************/
-
-/obj/machinery/porta_turret_cover
- name = "turret"
- icon = 'icons/obj/turrets.dmi'
- icon_state = "turretCover"
- anchored = 1
- layer = 3.5
- density = 0
- var/obj/machinery/porta_turret/Parent_Turret = null
-
-
-//The below code is pretty much just recoded from the initial turret object. It's necessary but uncommented because it's exactly the same!
-//>necessary
-//I'm not fixing it because i'm fucking bored of this code already, but someone should just reroute these to the parent turret's procs.
-
-/obj/machinery/porta_turret_cover/attack_ai(mob/user)
- . = ..()
- if(.)
- return
-
- return Parent_Turret.attack_ai(user)
-
-
-/obj/machinery/porta_turret_cover/attack_hand(mob/user)
- . = ..()
- if(.)
- return
-
- return Parent_Turret.attack_hand(user)
-
-
-/obj/machinery/porta_turret_cover/attackby(obj/item/I, mob/user, params)
- if(istype(I, /obj/item/weapon/wrench) && !Parent_Turret.on)
- if(Parent_Turret.raised) return
-
- if(!Parent_Turret.anchored)
- Parent_Turret.anchored = 1
- Parent_Turret.invisibility = INVISIBILITY_OBSERVER
- Parent_Turret.icon_state = "grey_target_prism"
- user << "You secure the exterior bolts on the turret."
- else
- Parent_Turret.anchored = 0
- user << "You unsecure the exterior bolts on the turret."
- Parent_Turret.icon_state = "turretCover"
- Parent_Turret.invisibility = 0
- qdel(src)
-
- else if(istype(I, /obj/item/weapon/card/id)||istype(I, /obj/item/device/pda))
- if(Parent_Turret.allowed(user))
- Parent_Turret.locked = !Parent_Turret.locked
- user << "Controls are now [Parent_Turret.locked ? "locked" : "unlocked"]."
- updateUsrDialog()
- else
- user << "Access denied."
- else if(istype(I,/obj/item/device/multitool) && !Parent_Turret.locked)
- var/obj/item/device/multitool/M = I
- M.buffer = Parent_Turret
- user << "You add [Parent_Turret] to multitool buffer."
- else
- user.changeNext_move(CLICK_CD_MELEE)
- Parent_Turret.health -= I.force * 0.5
- if(Parent_Turret.health <= 0)
- Parent_Turret.die()
- if(I.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_cover/can_be_overridden()
- . = 0
-
-/obj/machinery/porta_turret_cover/emag_act(mob/user)
- if(!Parent_Turret.emagged)
- user << "You short out [Parent_Turret]'s threat assessment circuits."
- visible_message("[Parent_Turret] hums oddly...")
- Parent_Turret.emagged = 1
- Parent_Turret.on = 0
- sleep(40)
- Parent_Turret.on = 1
/obj/machinery/porta_turret/stationary
emagged = 1
@@ -975,19 +692,19 @@
return
/obj/machinery/porta_turret/syndicate/assess_perp(mob/living/carbon/human/perp)
- if(faction in perp.faction) //Shoot all non syndies
- return 0
- return 10
+ return 10 //Syndicate turrets shoot everything not in their faction
/obj/machinery/porta_turret/syndicate/pod
health = 40
projectile = /obj/item/projectile/bullet/weakbullet3
eprojectile = /obj/item/projectile/bullet/weakbullet3
-//Blame MSO
/obj/machinery/porta_turret/ai
faction = "silicon"
+/obj/machinery/porta_turret/ai/assess_perp(mob/living/carbon/human/perp)
+ return 10 //AI turrets shoot at everything not in their faction
+
////////////////////////
//Turret Control Panel//
////////////////////////
diff --git a/code/game/machinery/porta_turret/portable_turret_construct.dm b/code/game/machinery/porta_turret/portable_turret_construct.dm
new file mode 100644
index 00000000000..9cc8e06148e
--- /dev/null
+++ b/code/game/machinery/porta_turret/portable_turret_construct.dm
@@ -0,0 +1,198 @@
+#define PTURRET_UNSECURED 0
+#define PTURRET_BOLTED 1
+#define PTURRET_START_INTERNAL_ARMOUR 2
+#define PTURRET_INTERNAL_ARMOUR_ON 3
+#define PTURRET_GUN_EQUIPPED 4
+#define PTURRET_SENSORS_ON 5
+#define PTURRET_CLOSED 6
+#define PTURRET_START_EXTERNAL_ARMOUR 7
+#define PTURRET_EXTERNAL_ARMOUR_ON 8
+/obj/machinery/porta_turret_construct
+ name = "turret frame"
+ icon = 'icons/obj/turrets.dmi'
+ icon_state = "turret_frame"
+ density = 1
+ var/build_step = PTURRET_UNSECURED //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
+ var/gun_charge = 0 //the gun charge of the gun type installed
+
+
+/obj/machinery/porta_turret_construct/attackby(obj/item/I, mob/user, params)
+ //this is a bit unwieldy but self-explanatory
+ switch(build_step)
+ if(PTURRET_UNSECURED) //first step
+ if(istype(I, /obj/item/weapon/wrench) && !anchored)
+ playsound(loc, 'sound/items/Ratchet.ogg', 100, 1)
+ user << "You secure the external bolts."
+ anchored = 1
+ build_step = PTURRET_BOLTED
+ return
+
+ else if(istype(I, /obj/item/weapon/crowbar) && !anchored)
+ playsound(loc, 'sound/items/Crowbar.ogg', 75, 1)
+ user << "You dismantle the turret construction."
+ new /obj/item/stack/sheet/metal( loc, 5)
+ qdel(src)
+ return
+
+ if(PTURRET_BOLTED)
+ if(istype(I, /obj/item/stack/sheet/metal))
+ var/obj/item/stack/sheet/metal/M = I
+ if(M.use(2))
+ user << "You add some metal armor to the interior frame."
+ build_step = PTURRET_START_INTERNAL_ARMOUR
+ icon_state = "turret_frame2"
+ else
+ user << "You need two sheets of metal to continue construction!"
+ return
+
+ else if(istype(I, /obj/item/weapon/wrench))
+ playsound(loc, 'sound/items/Ratchet.ogg', 75, 1)
+ user << "You unfasten the external bolts."
+ anchored = 0
+ build_step = PTURRET_UNSECURED
+ return
+
+
+ if(PTURRET_START_INTERNAL_ARMOUR)
+ if(istype(I, /obj/item/weapon/wrench))
+ playsound(loc, 'sound/items/Ratchet.ogg', 100, 1)
+ user << "You bolt the metal armor into place."
+ build_step = PTURRET_INTERNAL_ARMOUR_ON
+ return
+
+ else if(istype(I, /obj/item/weapon/weldingtool))
+ var/obj/item/weapon/weldingtool/WT = I
+ if(!WT.isOn())
+ return
+ if(WT.get_fuel() < 5) //uses up 5 fuel.
+ user << "You need more fuel to complete this task!"
+ return
+
+ playsound(loc, pick('sound/items/Welder.ogg', 'sound/items/Welder2.ogg'), 50, 1)
+ user << "You start to remove the turret's interior metal armor..."
+ if(do_after(user, 20/I.toolspeed, target = src))
+ if(!WT.isOn() || !WT.remove_fuel(5, user))
+ return
+ build_step = PTURRET_BOLTED
+ user << "You remove the turret's interior metal armor."
+ new /obj/item/stack/sheet/metal( loc, 2)
+ return
+
+
+ if(PTURRET_INTERNAL_ARMOUR_ON)
+ if(istype(I, /obj/item/weapon/gun/energy)) //the gun installation part
+ var/obj/item/weapon/gun/energy/E = I
+ if(!user.drop_item())
+ return
+ installation = I.type
+ gun_charge = E.power_supply.charge //the gun's charge is stored in gun_charge
+ user << "You add [I] to the turret."
+ build_step = PTURRET_GUN_EQUIPPED
+ qdel(I)
+ return
+
+ else if(istype(I, /obj/item/weapon/wrench))
+ playsound(loc, 'sound/items/Ratchet.ogg', 100, 1)
+ user << "You remove the turret's metal armor bolts."
+ build_step = PTURRET_START_INTERNAL_ARMOUR
+ return
+
+ if(PTURRET_GUN_EQUIPPED)
+ if(isprox(I))
+ build_step = PTURRET_SENSORS_ON
+ if(!user.drop_item())
+ return
+ user << "You add the proximity sensor to the turret."
+ qdel(I)
+ return
+
+
+ if(PTURRET_SENSORS_ON)
+ if(istype(I, /obj/item/weapon/screwdriver))
+ playsound(loc, 'sound/items/Screwdriver.ogg', 100, 1)
+ build_step = PTURRET_CLOSED
+ user << "You close the internal access hatch."
+ return
+
+
+ if(PTURRET_CLOSED)
+ if(istype(I, /obj/item/stack/sheet/metal))
+ var/obj/item/stack/sheet/metal/M = I
+ if(M.use(2))
+ user << "You add some metal armor to the exterior frame."
+ build_step = PTURRET_START_EXTERNAL_ARMOUR
+ else
+ user << "You need two sheets of metal to continue construction!"
+ return
+
+ else if(istype(I, /obj/item/weapon/screwdriver))
+ playsound(loc, 'sound/items/Screwdriver.ogg', 100, 1)
+ build_step = PTURRET_SENSORS_ON
+ user << "You open the internal access hatch."
+ return
+
+ if(PTURRET_START_EXTERNAL_ARMOUR)
+ if(istype(I, /obj/item/weapon/weldingtool))
+ var/obj/item/weapon/weldingtool/WT = I
+ if(!WT.isOn())
+ return
+ if(WT.get_fuel() < 5)
+ user << "You need more fuel to complete this task!"
+
+ playsound(loc, pick('sound/items/Welder.ogg', 'sound/items/Welder2.ogg'), 50, 1)
+ user << "You begin to weld the turret's armor down..."
+ if(do_after(user, 30/I.toolspeed, target = src))
+ if(!WT.isOn() || !WT.remove_fuel(5, user))
+ return
+ build_step = PTURRET_EXTERNAL_ARMOUR_ON
+ user << "You weld the turret's armor down."
+
+ //The final step: create a full turret
+ var/obj/machinery/porta_turret/turret = new/obj/machinery/porta_turret(loc)
+ turret.name = finish_name
+ turret.installation = installation
+ turret.gun_charge = gun_charge
+ turret.setup()
+
+ qdel(src)
+
+ else if(istype(I, /obj/item/weapon/crowbar))
+ playsound(loc, 'sound/items/Crowbar.ogg', 75, 1)
+ user << "You pry off the turret's exterior armor."
+ new /obj/item/stack/sheet/metal(loc, 2)
+ build_step = PTURRET_CLOSED
+ return
+
+ if(istype(I, /obj/item/weapon/pen)) //you can rename turrets like bots!
+ var/t = stripped_input(user, "Enter new turret name", name, finish_name)
+ if(!t)
+ return
+ if(!Adjacent(user))
+ return
+
+ finish_name = t
+ return
+ ..()
+
+
+/obj/machinery/porta_turret_construct/attack_hand(mob/user)
+ switch(build_step)
+ if(PTURRET_GUN_EQUIPPED)
+ build_step = PTURRET_INTERNAL_ARMOUR_ON
+
+ var/obj/item/weapon/gun/energy/Gun = new installation(loc)
+ Gun.power_supply.charge = gun_charge
+ Gun.update_icon()
+ installation = null
+ gun_charge = 0
+ user << "You remove [Gun] from the turret frame."
+
+ if(PTURRET_SENSORS_ON)
+ user << "You remove the prox sensor from the turret frame."
+ new /obj/item/device/assembly/prox_sensor(loc)
+ build_step = PTURRET_GUN_EQUIPPED
+
+/obj/machinery/porta_turret_construct/attack_ai()
+ return
diff --git a/code/game/machinery/porta_turret/portable_turret_cover.dm b/code/game/machinery/porta_turret/portable_turret_cover.dm
new file mode 100644
index 00000000000..d96b9dce955
--- /dev/null
+++ b/code/game/machinery/porta_turret/portable_turret_cover.dm
@@ -0,0 +1,87 @@
+
+/************************
+* PORTABLE TURRET COVER *
+************************/
+
+/obj/machinery/porta_turret_cover
+ name = "turret"
+ icon = 'icons/obj/turrets.dmi'
+ icon_state = "turretCover"
+ anchored = 1
+ layer = 3.5
+ density = 0
+ var/obj/machinery/porta_turret/parent_turret = null
+
+
+//The below code is pretty much just recoded from the initial turret object. It's necessary but uncommented because it's exactly the same!
+//>necessary
+//I'm not fixing it because i'm fucking bored of this code already, but someone should just reroute these to the parent turret's procs.
+
+/obj/machinery/porta_turret_cover/attack_ai(mob/user)
+ . = ..()
+ if(.)
+ return
+
+ return parent_turret.attack_ai(user)
+
+
+/obj/machinery/porta_turret_cover/attack_hand(mob/user)
+ . = ..()
+ if(.)
+ return
+
+ return parent_turret.attack_hand(user)
+
+
+/obj/machinery/porta_turret_cover/attackby(obj/item/I, mob/user, params)
+ if(istype(I, /obj/item/weapon/wrench) && !parent_turret.on)
+ if(parent_turret.raised)
+ return
+
+ if(!parent_turret.anchored)
+ parent_turret.anchored = 1
+ parent_turret.invisibility = INVISIBILITY_OBSERVER
+ parent_turret.icon_state = "grey_target_prism"
+ user << "You secure the exterior bolts on the turret."
+ else
+ parent_turret.anchored = 0
+ user << "You unsecure the exterior bolts on the turret."
+ parent_turret.icon_state = "turretCover"
+ parent_turret.invisibility = 0
+ qdel(src)
+
+ else if(istype(I, /obj/item/weapon/card/id)||istype(I, /obj/item/device/pda))
+ if(parent_turret.allowed(user))
+ parent_turret.locked = !parent_turret.locked
+ user << "Controls are now [parent_turret.locked ? "locked" : "unlocked"]."
+ updateUsrDialog()
+ else
+ user << "Access denied."
+ else if(istype(I,/obj/item/device/multitool) && !parent_turret.locked)
+ var/obj/item/device/multitool/M = I
+ M.buffer = parent_turret
+ user << "You add [parent_turret] to multitool buffer."
+ else
+ user.changeNext_move(CLICK_CD_MELEE)
+ parent_turret.health -= I.force * 0.5
+ if(parent_turret.health <= 0)
+ parent_turret.die()
+ if(I.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_cover/can_be_overridden()
+ . = 0
+
+/obj/machinery/porta_turret_cover/emag_act(mob/user)
+ if(!parent_turret.emagged)
+ user << "You short out [parent_turret]'s threat assessment circuits."
+ visible_message("[parent_turret] hums oddly...")
+ parent_turret.emagged = 1
+ parent_turret.on = 0
+ sleep(40)
+ parent_turret.on = 1
diff --git a/tgstation.dme b/tgstation.dme
index 2fb7c791662..d4cf4bd45cd 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -374,7 +374,9 @@
#include "code\game\machinery\newscaster.dm"
#include "code\game\machinery\overview.dm"
#include "code\game\machinery\PDApainter.dm"
-#include "code\game\machinery\portable_turret.dm"
+#include "code\game\machinery\porta_turret\portable_turret.dm"
+#include "code\game\machinery\porta_turret\portable_turret_cover.dm"
+#include "code\game\machinery\porta_turret\portable_turret_construct.dm"
#include "code\game\machinery\recharger.dm"
#include "code\game\machinery\rechargestation.dm"
#include "code\game\machinery\recycler.dm"