mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-01-26 17:24:21 +00:00
# Conflicts: # code/__defines/holomap.dm # code/__defines/mobs.dm # code/_helpers/icons.dm # code/_helpers/unsorted.dm # code/_onclick/hud/hud.dm # code/_onclick/item_attack.dm # code/controllers/Processes/supply.dm # code/controllers/subsystems/planets.dm # code/datums/supplypacks/munitions.dm # code/datums/supplypacks/science.dm # code/datums/supplypacks/security.dm # code/datums/supplypacks/supply.dm # code/game/area/Space Station 13 areas.dm # code/game/atoms_movable.dm # code/game/machinery/autolathe.dm # code/game/machinery/doors/door.dm # code/game/machinery/jukebox.dm # code/game/machinery/recharger.dm # code/game/machinery/vending.dm # code/game/mecha/equipment/tools/medical_tools.dm # code/game/mecha/equipment/weapons/weapons.dm # code/game/objects/items/devices/PDA/PDA.dm # code/game/objects/items/devices/megaphone.dm # code/game/objects/items/poi_items.dm # code/game/objects/items/weapons/implants/implantlanguage.dm # code/game/objects/items/weapons/storage/firstaid.dm # code/game/objects/items/weapons/tools/weldingtool.dm # code/game/objects/structures/flora/trees.dm # code/game/objects/structures/plasticflaps.dm # code/game/supplyshuttle.dm # code/game/turfs/simulated/wall_attacks.dm # code/modules/admin/admin_verbs.dm # code/modules/assembly/infrared.dm # code/modules/client/client procs.dm # code/modules/client/preference_setup/loadout/loadout_utility.dm # code/modules/client/preferences.dm # code/modules/clothing/suits/miscellaneous.dm # code/modules/holomap/holomap_datum.dm # code/modules/holomap/station_holomap.dm # code/modules/integrated_electronics/core/printer.dm # code/modules/mining/machine_processing.dm # code/modules/mob/living/carbon/human/human_defense.dm # code/modules/mob/living/carbon/human/species/virtual_reality/avatar.dm # code/modules/mob/living/death.dm # code/modules/mob/living/silicon/ai/ai.dm # code/modules/mob/living/silicon/pai/pai.dm # code/modules/mob/living/silicon/robot/robot.dm # code/modules/mob/living/simple_animal/animals/parrot.dm # code/modules/mob/mob_movement.dm # code/modules/organs/organ_external.dm # code/modules/organs/organ_icon.dm # code/modules/organs/subtypes/standard.dm # code/modules/planet/weather.dm # code/modules/power/cable.dm # code/modules/power/fusion/core/core_control.dm # code/modules/power/fusion/fuel_assembly/fuel_control.dm # code/modules/power/fusion/gyrotron/gyrotron_control.dm # code/modules/projectiles/gun.dm # code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Food-Drinks.dm # config/names/first_name_skrell.txt # config/names/last_name_skrell.txt # icons/mob/head.dmi # icons/mob/robots.dmi # icons/mob/species/tajaran/helmet.dmi # icons/obj/ammo.dmi # icons/obj/gun.dmi # icons/obj/mining.dmi # icons/obj/projectiles.dmi # icons/obj/rig_modules.dmi # icons/obj/surgery.dmi # icons/turf/walls.dmi # maps/southern_cross/southern_cross-1.dmm # maps/southern_cross/southern_cross-3.dmm # maps/southern_cross/southern_cross-6.dmm # maps/southern_cross/southern_cross-8.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1A.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1B.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1C.dmm # maps/submaps/surface_submaps/mountains/crashedcontainmentshuttle.dmm # maps/submaps/surface_submaps/mountains/deadspy.dmm # maps/submaps/surface_submaps/mountains/mountains_areas.dm # maps/submaps/surface_submaps/plains/Thiefc.dmm # maps/~map_system/maps.dm # vorestation.dme
174 lines
4.9 KiB
Plaintext
174 lines
4.9 KiB
Plaintext
/obj/item/weapon/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_vr.dmi' //VOREStation Edit - New Icons
|
|
icon_state = "cameracase"
|
|
w_class = ITEMSIZE_SMALL
|
|
anchored = 0
|
|
|
|
matter = list(DEFAULT_WALL_MATERIAL = 700,"glass" = 300)
|
|
|
|
// Motion, EMP-Proof, X-Ray
|
|
var/list/obj/item/possible_upgrades = list(/obj/item/device/assembly/prox_sensor, /obj/item/stack/material/osmium, /obj/item/weapon/stock_parts/scanning_module)
|
|
var/list/upgrades = list()
|
|
var/camera_name
|
|
var/camera_network
|
|
var/state = 0
|
|
var/busy = 0
|
|
/*
|
|
0 = Nothing done to it
|
|
1 = Wrenched in place
|
|
2 = Welded in place
|
|
3 = Wires attached to it (you can now attach/dettach upgrades)
|
|
4 = Screwdriver panel closed and is fully built (you cannot attach upgrades)
|
|
*/
|
|
|
|
/obj/item/weapon/camera_assembly/attackby(obj/item/W as obj, mob/living/user as mob)
|
|
|
|
switch(state)
|
|
|
|
if(0)
|
|
// State 0
|
|
if(W.is_wrench() && isturf(src.loc))
|
|
playsound(src, W.usesound, 50, 1)
|
|
user << "You wrench the assembly into place."
|
|
anchored = 1
|
|
state = 1
|
|
update_icon()
|
|
auto_turn()
|
|
return
|
|
|
|
if(1)
|
|
// State 1
|
|
if(istype(W, /obj/item/weapon/weldingtool))
|
|
if(weld(W, user))
|
|
user << "You weld the assembly securely into place."
|
|
anchored = 1
|
|
state = 2
|
|
return
|
|
|
|
else if(W.is_wrench())
|
|
playsound(src, W.usesound, 50, 1)
|
|
user << "You unattach the assembly from its place."
|
|
anchored = 0
|
|
update_icon()
|
|
state = 0
|
|
return
|
|
|
|
if(2)
|
|
// State 2
|
|
if(istype(W, /obj/item/stack/cable_coil))
|
|
var/obj/item/stack/cable_coil/C = W
|
|
if(C.use(2))
|
|
user << "<span class='notice'>You add wires to the assembly.</span>"
|
|
state = 3
|
|
else
|
|
user << "<span class='warning'>You need 2 coils of wire to wire the assembly.</span>"
|
|
return
|
|
|
|
else if(istype(W, /obj/item/weapon/weldingtool))
|
|
|
|
if(weld(W, user))
|
|
user << "You unweld the assembly from its place."
|
|
state = 1
|
|
anchored = 1
|
|
return
|
|
|
|
|
|
if(3)
|
|
// State 3
|
|
if(W.is_screwdriver())
|
|
playsound(src.loc, W.usesound, 50, 1)
|
|
|
|
var/input = sanitize(input(usr, "Which networks would you like to connect this camera to? Separate networks with a comma. No Spaces!\nFor example: "+using_map.station_short+",Security,Secret ", "Set Network", camera_network ? camera_network : NETWORK_DEFAULT))
|
|
if(!input)
|
|
usr << "No input found please hang up and try your call again."
|
|
return
|
|
|
|
var/list/tempnetwork = splittext(input, ",")
|
|
if(tempnetwork.len < 1)
|
|
usr << "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 = sanitizeSafe(input(usr, "How would you like to name the camera?", "Set Camera Name", camera_name ? camera_name : temptag), MAX_NAME_LEN)
|
|
|
|
state = 4
|
|
var/obj/machinery/camera/C = new(src.loc)
|
|
src.loc = C
|
|
C.assembly = src
|
|
|
|
C.auto_turn()
|
|
|
|
C.replace_networks(uniquelist(tempnetwork))
|
|
|
|
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
|
|
return
|
|
|
|
else if(W.is_wirecutter())
|
|
|
|
new/obj/item/stack/cable_coil(get_turf(src), 2)
|
|
playsound(src.loc, W.usesound, 50, 1)
|
|
user << "You cut the wires from the circuits."
|
|
state = 2
|
|
return
|
|
|
|
// Upgrades!
|
|
if(is_type_in_list(W, possible_upgrades) && !is_type_in_list(W, upgrades)) // Is a possible upgrade and isn't in the camera already.
|
|
user << "You attach \the [W] into the assembly inner circuits."
|
|
upgrades += W
|
|
user.remove_from_mob(W)
|
|
W.loc = src
|
|
return
|
|
|
|
// Taking out upgrades
|
|
else if(W.is_crowbar() && upgrades.len)
|
|
var/obj/U = locate(/obj) in upgrades
|
|
if(U)
|
|
user << "You unattach an upgrade from the assembly."
|
|
playsound(src, W.usesound, 50, 1)
|
|
U.loc = get_turf(src)
|
|
upgrades -= U
|
|
return
|
|
|
|
..()
|
|
|
|
/obj/item/weapon/camera_assembly/update_icon()
|
|
if(anchored)
|
|
icon_state = "camera1"
|
|
else
|
|
icon_state = "cameracase"
|
|
|
|
/obj/item/weapon/camera_assembly/attack_hand(mob/user as mob)
|
|
if(!anchored)
|
|
..()
|
|
|
|
/obj/item/weapon/camera_assembly/proc/weld(var/obj/item/weapon/weldingtool/WT, var/mob/user)
|
|
|
|
if(busy)
|
|
return 0
|
|
if(!WT.isOn())
|
|
return 0
|
|
|
|
user << "<span class='notice'>You start to weld the [src]..</span>"
|
|
playsound(src.loc, WT.usesound, 50, 1)
|
|
WT.eyecheck(user)
|
|
busy = 1
|
|
if(do_after(user, 20 * WT.toolspeed))
|
|
busy = 0
|
|
if(!WT.isOn())
|
|
return 0
|
|
return 1
|
|
busy = 0
|
|
return 0
|