mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-24 04:27:35 +01:00
* Migrate security cameras to the new attack chain and refactor slightly. * Only use one sheet of plasma. * Remove double fingerprint. * Apply suggestions from CRUNCH review. Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com> Signed-off-by: Alan <alfalfascout@users.noreply.github.com> * Extrapolate from CRUNCH review. * Apply suggestions from CRUNCH review. Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com> Signed-off-by: Alan <alfalfascout@users.noreply.github.com> --------- Signed-off-by: Alan <alfalfascout@users.noreply.github.com> Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com>
206 lines
6.9 KiB
Plaintext
206 lines
6.9 KiB
Plaintext
#define ASSEMBLY_UNBUILT 0 // Nothing done to it
|
|
#define ASSEMBLY_WRENCHED 1 // Wrenched in place
|
|
#define ASSEMBLY_WELDED 2 // Welded in place
|
|
#define ASSEMBLY_WIRED 3 // Wires attached (Upgradable now)
|
|
#define ASSEMBLY_BUILT 4 // Fully built (incl panel closed)
|
|
#define HEY_IM_WORKING_HERE 666 //So nobody can mess with the camera while we're inputting settings
|
|
|
|
/obj/item/camera_assembly
|
|
name = "camera assembly"
|
|
desc = "A pre-fabricated security camera kit, ready to be assembled and mounted to a surface."
|
|
icon = 'icons/obj/monitors.dmi'
|
|
icon_state = "cameracase"
|
|
w_class = WEIGHT_CLASS_SMALL
|
|
materials = list(MAT_METAL = 400, MAT_GLASS = 250)
|
|
new_attack_chain = TRUE
|
|
// Motion, EMP-Proof
|
|
var/list/obj/item/possible_upgrades = list(/obj/item/assembly/prox_sensor, /obj/item/stack/sheet/mineral/plasma)
|
|
var/list/upgrades = list()
|
|
var/state = ASSEMBLY_UNBUILT
|
|
|
|
/obj/item/camera_assembly/Destroy()
|
|
QDEL_LIST_CONTENTS(upgrades)
|
|
return ..()
|
|
|
|
/obj/item/camera_assembly/examine(mob/user)
|
|
. = ..()
|
|
switch(state)
|
|
if(ASSEMBLY_UNBUILT)
|
|
. += SPAN_NOTICE("The camera assembly's <i>bolts</i> need to be secured in a wall.")
|
|
if(ASSEMBLY_WRENCHED)
|
|
. += SPAN_NOTICE("The camera assembly is <b>bolted</b>, but it needs to be <i>welded</i> into place.")
|
|
if(ASSEMBLY_WELDED)
|
|
. += SPAN_NOTICE("The camera assembly is <b>welded</b> to the wall, it's lacking <i>wires</i>.")
|
|
if(ASSEMBLY_WIRED)
|
|
. += SPAN_NOTICE("The camera assembly is <b>wired</b>, but the maintenence panel needs to be <i>screwed shut</i>.")
|
|
. += SPAN_NOTICE("Upgrades can be added to the camera assembly, and removed with a crowbar.")
|
|
|
|
/obj/item/camera_assembly/item_interaction(mob/living/user, obj/item/used, list/modifiers)
|
|
if(state == ASSEMBLY_WELDED && iscoil(used))
|
|
var/obj/item/stack/cable_coil/cables = used
|
|
if(!cables.use(2))
|
|
to_chat(user, SPAN_WARNING("You need 2 coils of wire to wire the assembly."))
|
|
return ITEM_INTERACT_COMPLETE
|
|
|
|
to_chat(user, SPAN_NOTICE("You add wires to the assembly."))
|
|
playsound(loc, used.usesound, 50, 1)
|
|
state = ASSEMBLY_WIRED
|
|
add_fingerprint(user)
|
|
return ITEM_INTERACT_COMPLETE
|
|
|
|
// Upgrades!
|
|
if(is_type_in_list(used, upgrades))
|
|
to_chat(user, SPAN_WARNING("The assembly already has that upgrade!"))
|
|
return ITEM_INTERACT_COMPLETE
|
|
|
|
if(!is_type_in_list(used, possible_upgrades))
|
|
return NONE
|
|
|
|
if(istype(used, /obj/item/stack/sheet/mineral/plasma))
|
|
var/obj/item/stack/sheet/mineral/plasma/old_stack = used
|
|
var/obj/item/new_stack = old_stack.split(user, 1)
|
|
if(!new_stack)
|
|
to_chat(user, SPAN_WARNING("You need at least one sheet of plasma to add EMP shielding to [src]!"))
|
|
return ITEM_INTERACT_COMPLETE
|
|
|
|
to_chat(user, SPAN_NOTICE("You attach [used] to the inner circuits of [src]."))
|
|
new_stack.forceMove(src)
|
|
upgrades += new_stack
|
|
add_fingerprint(user)
|
|
return ITEM_INTERACT_COMPLETE
|
|
|
|
if(!user.drop_item_to_ground(used))
|
|
to_chat(user, SPAN_WARNING("[used] is stuck to your hand!"))
|
|
return ITEM_INTERACT_COMPLETE
|
|
|
|
to_chat(user, SPAN_NOTICE("You attach [used] to the inner circuits of [src]."))
|
|
upgrades += used
|
|
add_fingerprint(user)
|
|
used.forceMove(src)
|
|
return ITEM_INTERACT_COMPLETE
|
|
|
|
/obj/item/camera_assembly/crowbar_act(mob/user, obj/item/I)
|
|
if(!length(upgrades))
|
|
return
|
|
. = TRUE
|
|
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
|
return
|
|
var/obj/U = locate(/obj) in upgrades
|
|
if(U)
|
|
to_chat(user, SPAN_NOTICE("You detach an upgrade from the assembly."))
|
|
playsound(loc, I.usesound, 50, 1)
|
|
U.forceMove(get_turf(src))
|
|
upgrades -= U
|
|
|
|
/obj/item/camera_assembly/screwdriver_act(mob/user, obj/item/I)
|
|
if(state != ASSEMBLY_WIRED)
|
|
return
|
|
. = TRUE
|
|
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
|
return
|
|
state = HEY_IM_WORKING_HERE
|
|
var/input = strip_html(input(usr, "Which networks would you like to connect this camera to? Separate networks with a comma. No Spaces!\nFor example: SS13,Security,Secret ", "Set Network", "SS13"))
|
|
if(!input)
|
|
state = ASSEMBLY_WIRED
|
|
to_chat(usr, SPAN_WARNING("No input found. Please hang up and try your call again."))
|
|
return
|
|
|
|
var/list/tempnetwork = splittext(input, ",")
|
|
if(length(tempnetwork) < 1)
|
|
state = ASSEMBLY_WIRED
|
|
to_chat(usr, SPAN_WARNING("No network found. Please hang up and try your call again."))
|
|
return
|
|
|
|
var/area/camera_area = get_area(src)
|
|
var/temptag = "[sanitize(camera_area.name)] ([rand(1, 999)])"
|
|
input = strip_html(input(usr, "How would you like to name the camera?", "Set Camera Name", temptag))
|
|
state = ASSEMBLY_BUILT
|
|
var/list/network_list = uniquelist(tempnetwork)
|
|
var/list/visible_networks = difflist(network_list, GLOB.restricted_camera_networks)
|
|
|
|
var/obj/machinery/camera/C = new(loc, length(visible_networks) > 0, src)
|
|
forceMove(C)
|
|
C.auto_turn()
|
|
C.network = network_list
|
|
C.c_tag = input
|
|
|
|
for(var/i = 5; i >= 0; i -= 1)
|
|
var/direct = input(user, "Direction?", "Assembling Camera", null) in list("LEAVE IT", "NORTH", "EAST", "SOUTH", "WEST" )
|
|
if(direct != "LEAVE IT")
|
|
C.dir = text2dir(direct)
|
|
if(i != 0)
|
|
var/confirm = tgui_alert(user, "Is this what you want? Chances Remaining: [i]", "Confirmation", list("Yes", "No"))
|
|
if(confirm == "Yes")
|
|
break
|
|
|
|
/obj/item/camera_assembly/wirecutter_act(mob/user, obj/item/I)
|
|
if(state != ASSEMBLY_WIRED)
|
|
return
|
|
. = TRUE
|
|
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
|
return
|
|
new/obj/item/stack/cable_coil(get_turf(src), 2)
|
|
WIRECUTTER_SNIP_MESSAGE
|
|
state = ASSEMBLY_WELDED
|
|
return
|
|
|
|
/obj/item/camera_assembly/wrench_act(mob/user, obj/item/I)
|
|
if(state != ASSEMBLY_UNBUILT && state != ASSEMBLY_WRENCHED)
|
|
return
|
|
. = TRUE
|
|
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
|
return
|
|
if(state == ASSEMBLY_UNBUILT && isturf(loc))
|
|
WRENCH_ANCHOR_TO_WALL_MESSAGE
|
|
anchored = TRUE
|
|
state = ASSEMBLY_WRENCHED
|
|
update_icon(UPDATE_ICON_STATE)
|
|
auto_turn()
|
|
else if(state == ASSEMBLY_WRENCHED)
|
|
WRENCH_UNANCHOR_WALL_MESSAGE
|
|
anchored = FALSE
|
|
update_icon(UPDATE_ICON_STATE)
|
|
state = ASSEMBLY_UNBUILT
|
|
else
|
|
to_chat(user, SPAN_WARNING("[src] can't fit here!"))
|
|
|
|
/obj/item/camera_assembly/welder_act(mob/user, obj/item/I)
|
|
if(state == ASSEMBLY_UNBUILT)
|
|
return
|
|
. = TRUE
|
|
if(!I.tool_use_check(user, 0))
|
|
return
|
|
WELDER_ATTEMPT_WELD_MESSAGE
|
|
if(state == ASSEMBLY_WRENCHED)
|
|
if(!I.use_tool(src, user, 50, volume = I.tool_volume))
|
|
return
|
|
to_chat(user, SPAN_NOTICE("You weld [src] into place."))
|
|
state = ASSEMBLY_WELDED
|
|
else if(state == ASSEMBLY_WELDED)
|
|
if(!I.use_tool(src, user, 50, volume = I.tool_volume))
|
|
return
|
|
to_chat(user, SPAN_NOTICE("You unweld [src] from its place."))
|
|
state = ASSEMBLY_WRENCHED
|
|
|
|
/obj/item/camera_assembly/update_icon_state()
|
|
if(anchored)
|
|
icon_state = "camera1"
|
|
else
|
|
icon_state = "cameracase"
|
|
|
|
/obj/item/camera_assembly/attack_hand(mob/user as mob)
|
|
if(!anchored)
|
|
..()
|
|
|
|
/obj/item/camera_assembly/deconstruct(disassembled = TRUE)
|
|
if(!(flags & NODECONSTRUCT))
|
|
new /obj/item/stack/sheet/metal(loc)
|
|
qdel(src)
|
|
|
|
#undef ASSEMBLY_UNBUILT
|
|
#undef ASSEMBLY_WRENCHED
|
|
#undef ASSEMBLY_WELDED
|
|
#undef ASSEMBLY_WIRED
|
|
#undef ASSEMBLY_BUILT
|
|
#undef HEY_IM_WORKING_HERE
|