Files
Paradise/code/game/machinery/camera/camera_assembly.dm
Vi3trice f4b37b4177 Port TG updating appearances (#17943)
* Get pants that match or else you gonna look silly yo

* Posters

* Fix other hud elements

* Rereviewed

* Update shotglass.dm

* Fix for new merged PRs

* Typo

* Coming across other stuff

* Update theblob.dm

* No takebacksies

* smh i forget to leave a comment

* Updated for the detgun and cards

* Should have rerun langserver again

* No longer plastic, more in scope

* Damn you bluespace

* Reverting turret logic, out of scope at this point

* Tweak that part

* Went over energy guns again, and fixed UI White's sprite sheet

* Welding masks, glasses, and JUSTICE

* Update portable_atmospherics.dm

* Cleaning up, clearing things up

* Review and suggestions

* Update valve.dm

* More tweaks

* Missing character

* Not distinct lightmasks, so they can be overlays

* Update generator.dm

* Add parameter so holodeck doesn't try to make a perfect copy

* Update unsorted.dm

* Spiders

* Better fix for spiders, fix vamps too

* Ghosts

* Update telekinesis.dm

* Cleaning up old procs

* It's set up to not copy datums... Unless they're in a list

* Donuts, duct tape, and detgun. D3VR coming to Early Access

* Update procs that interact with doors so they call update_state instead

* Forgot one spot, and actually might as well just force lock

* Cleaning up other things... Sigh, and kitty ears

* oops

* Getting used to how it works

* blinds

* Going back to the suit obscuring thing, so it doesn't update all the time

* Missed that from merging master

* I made this PR and forgot about it

* Fix runtimes in cards

* Make things a bit more unified

* Update update_icons.dm

* yarn, really?

* Update library_equipment.dm

* Update shieldgen.dm

* Every time Charlie merges something, I go back and see if I can improve things further

* what's this? more?

* Update misc_special.dm

* wow, paper

* Review

* More reviews

* To be sure, seems like being broken messed something sometimes

* Brought airlocks closer to how TG works to iron out some stuff

* Pizza and morgue

* Doesn't seem to hurt, tried with holodeck

* Revert "Doesn't seem to hurt, tried with holodeck"

This reverts commit 158529302b.

* Icon conflict

* Fix organ damage

* Don't ask how. Why. It's like that on prod too.

* Cutting down on things and updating from TG.

* More flexible. Just in case the thing you stuck it on didn't destroy.

* Hydro was one the things I touched earlier on, better rework it

* Reviews

* Cleaning up further, also bri'ish

* Undo a change I did, and switch over to a more recent implementation

* Update biogenerator.dm

* Rolling back to old airlocks, but with new duct taped note

* Functionally the same. I'd just rather not have the smoothing happen there

* Went over APCs again

* Fix welding helmet names in species files

* Update airlock.dm

* Update persistent_overlay.dm

* Oh, topic
2022-07-21 08:11:59 +02:00

180 lines
5.7 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
anchored = FALSE
materials = list(MAT_METAL=400, MAT_GLASS=250)
// 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(upgrades)
return ..()
/obj/item/camera_assembly/attackby(obj/item/I, mob/living/user, params)
if(state == ASSEMBLY_WELDED && iscoil(I))
var/obj/item/stack/cable_coil/C = I
if(C.use(2))
to_chat(user, "<span class='notice'>You add wires to the assembly.</span>")
playsound(loc, I.usesound, 50, 1)
state = ASSEMBLY_WIRED
else
to_chat(user, "<span class='warning'>You need 2 coils of wire to wire the assembly.</span>")
return
// Upgrades!
else if(is_type_in_list(I, possible_upgrades) && !is_type_in_list(I, upgrades)) // Is a possible upgrade and isn't in the camera already.
if(!user.unEquip(I))
to_chat(user, "<span class='warning'>[I] is stuck!</span>")
return
to_chat(user, "<span class='notice'>You attach [I] into the assembly inner circuits.</span>")
upgrades += I
user.drop_item()
I.loc = src
return
else
return ..()
/obj/item/camera_assembly/crowbar_act(mob/user, obj/item/I)
if(!upgrades.len)
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 class='notice'>You unattach an upgrade from the assembly.</span>")
playsound(loc, I.usesound, 50, 1)
U.loc = 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? Seperate networks with a comma. No Spaces!\nFor example: SS13,Security,Secret ", "Set Network", "SS13"))
if(!input)
state = ASSEMBLY_WIRED
to_chat(usr, "<span class='warning'>No input found please hang up and try your call again.</span>")
return
var/list/tempnetwork = splittext(input, ",")
if(tempnetwork.len < 1)
state = ASSEMBLY_WIRED
to_chat(usr, "<span class='warning'>No network found please hang up and try your call again.</span>")
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/obj/machinery/camera/C = new(loc)
loc = C
C.assembly = src
C.auto_turn()
C.network = uniquelist(tempnetwork)
tempnetwork = difflist(C.network,GLOB.restricted_camera_networks)
if(!tempnetwork.len) // Camera isn't on any open network - remove its chunk from AI visibility.
GLOB.cameranet.removeCamera(C)
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 = alert(user, "Is this what you want? Chances Remaining: [i]", "Confirmation", "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 class='warning'>[src] can't fit here!</span>")
/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 class='notice'>You weld [src] into place.</span>")
state = ASSEMBLY_WELDED
else if(state == ASSEMBLY_WELDED)
if(!I.use_tool(src, user, 50, volume = I.tool_volume))
return
to_chat(user, "<span class='notice'>You unweld [src] from its place.</span>")
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