-
-
Notifications
You must be signed in to change notification settings - Fork 452
/
portable_turret_cover.dm
102 lines (82 loc) · 3.23 KB
/
portable_turret_cover.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/************************
* PORTABLE TURRET COVER *
************************/
/obj/machinery/porta_turret_cover
name = "turret"
icon = 'icons/obj/turrets.dmi'
icon_state = "turretCover"
layer = HIGH_OBJ_LAYER
density = FALSE
max_integrity = 80
var/obj/machinery/porta_turret/parent_turret = null
/obj/machinery/porta_turret_cover/Destroy()
if(parent_turret)
parent_turret.cover = null
parent_turret.invisibility = 0
parent_turret = null
return ..()
//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, modifiers)
. = ..()
if(.)
return
return parent_turret.attack_hand(user, modifiers)
/obj/machinery/porta_turret_cover/attackby(obj/item/I, mob/user, params)
if(I.tool_behaviour == TOOL_WRENCH && !parent_turret.on)
if(parent_turret.raised)
return
if(!parent_turret.anchored)
parent_turret.setAnchored(TRUE)
to_chat(user, span_notice("You secure the exterior bolts on the turret."))
parent_turret.invisibility = 0
parent_turret.update_appearance(UPDATE_ICON)
else
parent_turret.setAnchored(FALSE)
to_chat(user, span_notice("You unsecure the exterior bolts on the turret."))
parent_turret.invisibility = INVISIBILITY_MAXIMUM
parent_turret.update_appearance(UPDATE_ICON)
qdel(src)
else if(I.GetID())
if(parent_turret.allowed(user))
parent_turret.locked = !parent_turret.locked
to_chat(user, span_notice("Controls are now [parent_turret.locked ? "locked" : "unlocked"]."))
updateUsrDialog()
else
to_chat(user, span_notice("Access denied."))
else if(I.tool_behaviour == TOOL_MULTITOOL && !parent_turret.locked)
if(!multitool_check_buffer(user, I))
return
multitool_set_buffer(user, I, parent_turret)
to_chat(user, span_notice("You add [parent_turret] to multitool buffer."))
else
return ..()
/obj/machinery/porta_turret_cover/attacked_by(obj/item/I, mob/user)
parent_turret.attacked_by(I, user)
/obj/machinery/porta_turret_cover/attack_alien(mob/living/carbon/alien/humanoid/user)
parent_turret.attack_alien(user)
/obj/machinery/porta_turret_cover/attack_animal(mob/living/simple_animal/user)
parent_turret.attack_animal(user)
/obj/machinery/porta_turret_cover/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0)
return parent_turret.attack_hulk(user)
/obj/machinery/porta_turret_cover/can_be_overridden()
. = 0
/obj/machinery/porta_turret_cover/emag_act(mob/user, obj/item/card/emag/emag_card)
if((parent_turret.obj_flags & EMAGGED))
return FALSE
to_chat(user, span_notice("You short out [parent_turret]'s threat assessment circuits."))
visible_message("[parent_turret] hums oddly...")
parent_turret.obj_flags |= EMAGGED
parent_turret.on = FALSE
addtimer(CALLBACK(src, PROC_REF(finish_emag_act)), 4 SECONDS) // 4 seconds to get away.
return TRUE
/obj/machinery/porta_turret_cover/proc/finish_emag_act()
if(QDELETED(parent_turret))
return
parent_turret.on = TRUE