diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index bf01bca6e3c..7dd3c140b4c 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -17,7 +17,7 @@ return SendSignal(COMSIG_PARENT_ATTACKBY, W, user, params) /obj/attackby(obj/item/I, mob/living/user, params) - return ..() || I.attack_obj(src, user) + return ..() || (can_be_hit && I.attack_obj(src, user)) /mob/living/attackby(obj/item/I, mob/living/user, params) user.changeNext_move(CLICK_CD_MELEE) diff --git a/code/datums/wires/camera.dm b/code/datums/wires/camera.dm deleted file mode 100644 index ee25f8c3898..00000000000 --- a/code/datums/wires/camera.dm +++ /dev/null @@ -1,94 +0,0 @@ -// Wires for cameras. - -/datum/wires/camera - random = 0 - holder_type = /obj/machinery/camera - wire_count = 6 - -/datum/wires/camera/get_status() - . = ..() - var/obj/machinery/camera/C = holder - . += "The focus light is [(C.view_range == initial(C.view_range)) ? "on" : "off"]." - . += "The power link light is [C.can_use() ? "on" : "off"]." - . += "The camera light is [C.light_disabled ? "off" : "on"]." - . += "The alarm light is [C.alarm_on ? "on" : "off"]." - -/datum/wires/camera/CanUse(mob/living/L) - var/obj/machinery/camera/C = holder - if(!C.panel_open) - return 0 - return 1 - -var/const/CAMERA_WIRE_FOCUS = 1 -var/const/CAMERA_WIRE_POWER = 2 -var/const/CAMERA_WIRE_LIGHT = 4 -var/const/CAMERA_WIRE_ALARM = 8 -var/const/CAMERA_WIRE_NOTHING1 = 16 -var/const/CAMERA_WIRE_NOTHING2 = 32 - -/datum/wires/camera/GetWireName(index) - switch(index) - if(CAMERA_WIRE_FOCUS) - return "Focus" - - if(CAMERA_WIRE_POWER) - return "Power" - - if(CAMERA_WIRE_LIGHT) - return "Light" - - if(CAMERA_WIRE_ALARM) - return "Alarm" - - if(CAMERA_WIRE_NOTHING1) - return "Nothing" - - if(CAMERA_WIRE_NOTHING2) - return "Nothing" - -/datum/wires/camera/UpdateCut(index, mended) - var/obj/machinery/camera/C = holder - - switch(index) - if(CAMERA_WIRE_FOCUS) - var/range = (mended ? initial(C.view_range) : C.short_range) - C.setViewRange(range) - - if(CAMERA_WIRE_POWER) - if(C.status && !mended || !C.status && mended) - C.toggle_cam(usr, 1) - - if(CAMERA_WIRE_LIGHT) - C.light_disabled = !mended - - if(CAMERA_WIRE_ALARM) - if(!mended) - C.triggerCameraAlarm() - else - C.cancelCameraAlarm() - ..() - -/datum/wires/camera/UpdatePulsed(index) - var/obj/machinery/camera/C = holder - if(IsIndexCut(index)) - return - switch(index) - if(CAMERA_WIRE_FOCUS) - var/new_range = (C.view_range == initial(C.view_range) ? C.short_range : initial(C.view_range)) - C.setViewRange(new_range) - - if(CAMERA_WIRE_POWER) - C.toggle_cam(null) // Deactivate the camera - - if(CAMERA_WIRE_LIGHT) - C.light_disabled = !C.light_disabled - - if(CAMERA_WIRE_ALARM) - C.visible_message("[bicon(C)] *beep*", "[bicon(C)] *beep*") - ..() - -/datum/wires/camera/proc/CanDeconstruct() - if(IsIndexCut(CAMERA_WIRE_POWER) && IsIndexCut(CAMERA_WIRE_FOCUS) && IsIndexCut(CAMERA_WIRE_LIGHT) && IsIndexCut(CAMERA_WIRE_NOTHING1) && IsIndexCut(CAMERA_WIRE_NOTHING2)) - return 1 - else - return 0 \ No newline at end of file diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 0e9f261d73d..bbd4ed6201c 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -6,15 +6,17 @@ use_power = 2 idle_power_usage = 5 active_power_usage = 10 - layer = 5 + layer = WALL_OBJ_LAYER + armor = list(melee = 50, bullet = 20, laser = 20, energy = 20, bomb = 0, bio = 0, rad = 0) - var/datum/wires/camera/wires = null // Wires datum + max_integrity = 100 + integrity_failure = 50 var/list/network = list("SS13") var/c_tag = null var/c_tag_order = 999 var/status = 1 - anchored = 1 - var/start_active = 0 //If it ignores the random chance to start broken on round start + anchored = TRUE + var/start_active = FALSE //If it ignores the random chance to start broken on round start var/invuln = null var/obj/item/camera_bug/bug = null var/obj/item/camera_assembly/assembly = null @@ -24,17 +26,14 @@ var/view_range = 7 var/short_range = 2 - var/light_disabled = 0 - var/alarm_on = 0 - var/busy = 0 - var/emped = 0 //Number of consecutive EMP's on this camera + var/alarm_on = FALSE + var/busy = FALSE + var/emped = FALSE //Number of consecutive EMP's on this camera - var/toggle_message = 'sound/items/Wirecutter.ogg' + var/toggle_sound = 'sound/items/Wirecutter.ogg' /obj/machinery/camera/New() ..() - wires = new(src) - assembly = new(src) assembly.state = 4 assembly.anchored = 1 @@ -47,17 +46,15 @@ ..() if(is_station_level(z) && prob(3) && !start_active) toggle_cam() - wires.CutAll() /obj/machinery/camera/Destroy() toggle_cam(null, 0) //kick anyone viewing out QDEL_NULL(assembly) if(istype(bug)) - bug.bugged_cameras -= src.c_tag + bug.bugged_cameras -= c_tag if(bug.current == src) bug.current = null bug = null - QDEL_NULL(wires) cameranet.removeCamera(src) //Will handle removal from the camera network and the chunks, so we don't need to worry about that cameranet.cameras -= src var/area/ai_monitored/A = get_area(src) @@ -71,33 +68,33 @@ return if(!isEmpProof()) if(prob(150/severity)) - icon_state = "[initial(icon_state)]emp" + update_icon() var/list/previous_network = network network = list() cameranet.removeCamera(src) stat |= EMPED set_light(0) emped = emped+1 //Increase the number of consecutive EMP's + update_icon() var/thisemp = emped //Take note of which EMP this proc is for spawn(900) if(loc) //qdel limbo triggerCameraAlarm() //camera alarm triggers even if multiple EMPs are in effect. if(emped == thisemp) //Only fix it if the camera hasn't been EMP'd again network = previous_network - icon_state = initial(icon_state) stat &= ~EMPED - cancelCameraAlarm() + update_icon() if(can_use()) cameranet.addCamera(src) emped = 0 //Resets the consecutive EMP count spawn(100) if(!QDELETED(src)) cancelCameraAlarm() - for(var/mob/O in mob_list) - if(O.client && O.client.eye == src) - O.unset_machine() - O.reset_perspective(null) - to_chat(O, "The screen bursts into static.") + for(var/mob/M in player_list) + if(M.client && M.client.eye == src) + M.unset_machine() + M.reset_perspective(null) + to_chat(M, "The screen bursts into static.") ..() /obj/machinery/camera/tesla_act(var/power)//EMP proof upgrade also makes it tesla immune @@ -106,109 +103,91 @@ ..() qdel(src)//to prevent bomb testing camera from exploding over and over forever -/obj/machinery/camera/ex_act(severity, target) - if(src.invuln) +/obj/machinery/camera/ex_act(severity) + if(invuln) return - else - ..() - return - -/obj/machinery/camera/blob_act() - qdel(src) - return - -/obj/machinery/camera/attack_ghost(mob/user) - if(panel_open) - wires.Interact(user) - -/obj/machinery/camera/attack_alien(mob/living/carbon/alien/humanoid/user) - if(!istype(user)) - return - user.do_attack_animation(src) - add_hiddenprint(user) - status = 0 - visible_message("\The [user] slashes at [src]!") - playsound(src.loc, 'sound/weapons/slash.ogg', 100, 1) - toggle_cam(user, 0) - + ..() /obj/machinery/camera/proc/setViewRange(num = 7) - src.view_range = num + view_range = num cameranet.updateVisibility(src, 0) -/obj/machinery/camera/attackby(obj/item/W, mob/living/user as mob, params) - var/msg = "You attach [W] into the assembly inner circuits." +/obj/machinery/camera/attackby(obj/item/I, mob/living/user as mob, params) + var/msg = "You attach [I] into the assembly inner circuits." var/msg2 = "The camera already has that upgrade!" // DECONSTRUCTION - if(istype(W, /obj/item/screwdriver)) -// to_chat(user, "You start to [panel_open ? "close" : "open"] the camera's panel.") - //if(toggle_panel(user)) // No delay because no one likes screwdrivers trying to be hip and have a duration cooldown + if(isscrewdriver(I)) panel_open = !panel_open - user.visible_message("[user] screws the camera's panel [panel_open ? "open" : "closed"]!", - "You screw the camera's panel [panel_open ? "open" : "closed"].") - playsound(src.loc, W.usesound, 50, 1) + to_chat(user, "You screw the camera's panel [panel_open ? "open" : "closed"].") + playsound(loc, I.usesound, 50, 1) - else if((istype(W, /obj/item/wirecutters) || istype(W, /obj/item/multitool)) && panel_open) - wires.Interact(user) + else if(iswirecutter(I) && panel_open) + toggle_cam(user, 1) + obj_integrity = max_integrity //this is a pretty simplistic way to heal the camera, but there's no reason for this to be complex. + playsound(loc, I.usesound, 50, 1) - else if(istype(W, /obj/item/weldingtool) && wires.CanDeconstruct()) - if(weld(W, user)) - to_chat(user, "You unweld the camera leaving it as just a frame screwed to the wall.") - if(!assembly) - assembly = new() - assembly.loc = src.loc - assembly.state = 1 - assembly.dir = src.dir - assembly.update_icon() - assembly = null - qdel(src) + else if(ismultitool(I) && panel_open) + setViewRange((view_range == initial(view_range)) ? short_range : initial(view_range)) + to_chat(user, "You [(view_range == initial(view_range)) ? "restore" : "mess up"] the camera's focus.") + + else if(iswelder(I) && panel_open) + var/obj/item/weldingtool/WT = I + if(!WT.remove_fuel(0, user)) return - else if(istype(W, /obj/item/analyzer) && panel_open) //XRay - if(!user.unEquip(W)) - to_chat(user, "[W] is stuck!") + to_chat(user, "You start to weld [src]...") + playsound(loc, WT.usesound, 50, 1) + if(do_after(user, 100 * WT.toolspeed, target = src)) + user.visible_message("[user] unwelds [src], leaving it as just a frame bolted to the wall.", + "You unweld [src], leaving it as just a frame bolted to the wall") + deconstruct(TRUE) + + else if(istype(I, /obj/item/analyzer) && panel_open) //XRay + if(!user.drop_item()) + to_chat(user, "[I] is stuck to your hand!") return if(!isXRay()) upgradeXRay() - qdel(W) + qdel(I) to_chat(user, "[msg]") else to_chat(user, "[msg2]") - else if(istype(W, /obj/item/stack/sheet/mineral/plasma) && panel_open) - if(!user.unEquip(W)) - to_chat(user, "[W] is stuck!") + else if(istype(I, /obj/item/stack/sheet/mineral/plasma) && panel_open) + if(!user.drop_item()) + to_chat(user, "[I] is stuck to your hand!") return if(!isEmpProof()) upgradeEmpProof() to_chat(user, "[msg]") - qdel(W) + qdel(I) else to_chat(user, "[msg2]") - else if(istype(W, /obj/item/assembly/prox_sensor) && panel_open) - if(!user.unEquip(W)) + else if(istype(I, /obj/item/assembly/prox_sensor) && panel_open) + if(!user.drop_item()) + to_chat(user, "[I] is stuck to your hand!") return if(!isMotion()) upgradeMotion() to_chat(user, "[msg]") - qdel(W) + qdel(I) else to_chat(user, "[msg2]") // OTHER - else if((istype(W, /obj/item/paper) || istype(W, /obj/item/pda)) && isliving(user)) + else if((istype(I, /obj/item/paper) || istype(I, /obj/item/pda)) && isliving(user)) var/mob/living/U = user var/obj/item/paper/X = null var/obj/item/pda/P = null var/itemname = "" var/info = "" - if(istype(W, /obj/item/paper)) - X = W + if(istype(I, /obj/item/paper)) + X = I itemname = X.name info = X.info else - P = W + P = I var/datum/data/pda/app/notekeeper/N = P.find_program(/datum/data/pda/app/notekeeper) if(N) itemname = P.name @@ -229,37 +208,58 @@ to_chat(O, "[U] holds \a [itemname] up to one of the cameras ...") O << browse(text("[][]", itemname, info), text("window=[]", itemname)) - else if(istype(W, /obj/item/camera_bug)) - if(!src.can_use()) + else if(istype(I, /obj/item/camera_bug)) + if(!can_use()) to_chat(user, "Camera non-functional.") return - if(istype(src.bug)) + if(istype(bug)) to_chat(user, "Camera bug removed.") - src.bug.bugged_cameras -= src.c_tag - src.bug = null + bug.bugged_cameras -= c_tag + bug = null else to_chat(user, "Camera bugged.") - src.bug = W - src.bug.bugged_cameras[src.c_tag] = src + bug = I + bug.bugged_cameras[c_tag] = src - else if(istype(W, /obj/item/melee/energy/blade))//Putting it here last since it's a special case. I wonder if there is a better way to do these than type casting. - toggle_cam(user, 1) - var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread() - spark_system.set_up(5, 0, loc) - spark_system.start() - playsound(loc, W.usesound, 50, 1) - playsound(loc, "sparks", 50, 1) - visible_message("[user] has sliced the camera apart with an energy blade!") - qdel(src) - - else if(istype(W, /obj/item/laser_pointer)) - var/obj/item/laser_pointer/L = W + else if(istype(I, /obj/item/laser_pointer)) + var/obj/item/laser_pointer/L = I L.laser_act(src, user) else - ..() - return + return ..() -/obj/machinery/camera/proc/toggle_cam(mob/user, displaymessage = 1) +/obj/machinery/camera/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir) + if(damage_flag == "melee" && damage_amount < 12 && !(stat & BROKEN)) + return 0 + . = ..() + +/obj/machinery/camera/obj_break(damage_flag) + if(status) + triggerCameraAlarm() + toggle_cam(null, 0) + +/obj/machinery/camera/deconstruct(disassembled = TRUE) + if(disassembled) + if(!assembly) + assembly = new() + assembly.forceMove(loc) + assembly.state = 1 + assembly.setDir(dir) + assembly.update_icon() + assembly = null + else + new /obj/item/camera_assembly(loc) + new /obj/item/stack/cable_coil(loc, 2) + qdel(src) + +/obj/machinery/camera/update_icon() + if(!status) + icon_state = "[initial(icon_state)]1" + else if(stat & EMPED) + icon_state = "[initial(icon_state)]emp" + else + icon_state = "[initial(icon_state)]" + +/obj/machinery/camera/proc/toggle_cam(mob/user, displaymessage = TRUE) status = !status if(can_use()) cameranet.addCamera(src) @@ -268,10 +268,7 @@ cameranet.removeCamera(src) cameranet.updateChunk(x, y, z) var/change_msg = "deactivates" - if(!status) - icon_state = "[initial(icon_state)]1" - else - icon_state = initial(icon_state) + if(status) change_msg = "reactivates" triggerCameraAlarm() spawn(100) @@ -284,7 +281,8 @@ else visible_message("\The [src] [change_msg]!") - playsound(src.loc, toggle_message, 100, 1) + playsound(loc, toggle_sound, 100, 1) + update_icon() // now disconnect anyone using the camera //Apparently, this will disconnect anyone even if the camera was re-activated. @@ -300,9 +298,6 @@ motion_alarm.triggerAlarm(loc, src) /obj/machinery/camera/proc/cancelCameraAlarm() - if(wires.IsIndexCut(CAMERA_WIRE_ALARM)) - return - alarm_on = 0 motion_alarm.clearAlarm(loc, src) @@ -331,13 +326,13 @@ //If someone knows a better way to do this, let me know. -Giacom switch(i) if(NORTH) - src.dir = SOUTH + setDir(SOUTH) if(SOUTH) - src.dir = NORTH + setDir(NORTH) if(WEST) - src.dir = EAST + setDir(EAST) if(EAST) - src.dir = WEST + setDir(WEST) break //Return a working camera that can see a given mob @@ -357,32 +352,15 @@ return null -/obj/machinery/camera/proc/weld(var/obj/item/weldingtool/WT, var/mob/user) - if(busy) - return 0 - if(!WT.remove_fuel(0, user)) - return 0 - - to_chat(user, "You start to weld [src]...") - playsound(src.loc, WT.usesound, 50, 1) - busy = 1 - if(do_after(user, 100 * WT.toolspeed, target = src)) - busy = 0 - if(!WT.isOn()) - return 0 - return 1 - busy = 0 - return 0 - /obj/machinery/camera/proc/Togglelight(on=0) for(var/mob/living/silicon/ai/A in ai_list) for(var/obj/machinery/camera/cam in A.lit_cameras) if(cam == src) return if(on) - src.set_light(AI_CAMERA_LUMINOSITY) + set_light(AI_CAMERA_LUMINOSITY) else - src.set_light(0) + set_light(0) /obj/machinery/camera/proc/nano_structure() var/cam[0] diff --git a/code/game/machinery/camera/camera_assembly.dm b/code/game/machinery/camera/camera_assembly.dm index dc5a0141b27..8baf02088bb 100644 --- a/code/game/machinery/camera/camera_assembly.dm +++ b/code/game/machinery/camera/camera_assembly.dm @@ -6,7 +6,8 @@ w_class = WEIGHT_CLASS_SMALL anchored = 0 materials = list(MAT_METAL=400, MAT_GLASS=250) - + max_integrity = 150 + can_be_hit = TRUE // Motion, EMP-Proof, X-Ray var/list/obj/item/possible_upgrades = list(/obj/item/assembly/prox_sensor, /obj/item/stack/sheet/mineral/plasma, /obj/item/analyzer) var/list/upgrades = list() @@ -24,13 +25,13 @@ QDEL_LIST(upgrades) return ..() -/obj/item/camera_assembly/attackby(obj/item/W, mob/living/user, params) +/obj/item/camera_assembly/attackby(obj/item/I, mob/living/user, params) switch(state) if(0) // State 0 - if(iswrench(W) && isturf(src.loc)) - playsound(src.loc, W.usesound, 50, 1) + if(iswrench(I) && isturf(loc)) + playsound(loc, I.usesound, 50, 1) to_chat(user, "You wrench the assembly into place.") anchored = 1 state = 1 @@ -40,15 +41,15 @@ if(1) // State 1 - if(iswelder(W)) - if(weld(W, user)) + if(iswelder(I)) + if(weld(I, user)) to_chat(user, "You weld the assembly securely into place.") anchored = 1 state = 2 return - else if(iswrench(W)) - playsound(src.loc, W.usesound, 50, 1) + else if(iswrench(I)) + playsound(loc, I.usesound, 50, 1) to_chat(user, "You unattach the assembly from it's place.") anchored = 0 update_icon() @@ -57,19 +58,18 @@ if(2) // State 2 - if(iscoil(W)) - var/obj/item/stack/cable_coil/C = W + if(iscoil(I)) + var/obj/item/stack/cable_coil/C = I if(C.use(2)) to_chat(user, "You add wires to the assembly.") - playsound(loc, W.usesound, 50, 1) + playsound(loc, I.usesound, 50, 1) state = 3 else to_chat(user, "You need 2 coils of wire to wire the assembly.") return - else if(iswelder(W)) - - if(weld(W, user)) + else if(iswelder(I)) + if(weld(I, user)) to_chat(user, "You unweld the assembly from it's place.") state = 1 anchored = 1 @@ -78,8 +78,8 @@ if(3) // State 3 - if(isscrewdriver(W)) - playsound(src.loc, W.usesound, 50, 1) + if(isscrewdriver(I)) + playsound(loc, I.usesound, 50, 1) 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) @@ -96,8 +96,8 @@ input = strip_html(input(usr, "How would you like to name the camera?", "Set Camera Name", temptag)) state = 4 - var/obj/machinery/camera/C = new(src.loc) - src.loc = C + var/obj/machinery/camera/C = new(loc) + loc = C C.assembly = src C.auto_turn() @@ -119,35 +119,36 @@ break return - else if(iswirecutter(W)) + else if(iswirecutter(I)) new/obj/item/stack/cable_coil(get_turf(src), 2) - playsound(src.loc, W.usesound, 50, 1) + playsound(loc, I.usesound, 50, 1) to_chat(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. - if(!user.unEquip(W)) - to_chat(user, "[W] is stuck!") + 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, "[I] is stuck!") return - to_chat(user, "You attach \the [W] into the assembly inner circuits.") - upgrades += W + to_chat(user, "You attach [I] into the assembly inner circuits.") + upgrades += I user.drop_item() - W.loc = src + I.loc = src return // Taking out upgrades - else if(iscrowbar(W) && upgrades.len) + else if(iscrowbar(I) && upgrades.len) var/obj/U = locate(/obj) in upgrades if(U) to_chat(user, "You unattach an upgrade from the assembly.") - playsound(src.loc, W.usesound, 50, 1) + playsound(loc, I.usesound, 50, 1) U.loc = get_turf(src) upgrades -= U return - ..() + else + return ..() /obj/item/camera_assembly/update_icon() if(anchored) @@ -159,7 +160,7 @@ if(!anchored) ..() -/obj/item/camera_assembly/proc/weld(var/obj/item/weldingtool/WT, var/mob/living/user) +/obj/item/camera_assembly/proc/weld(obj/item/weldingtool/WT, mob/living/user) if(busy) return 0 @@ -167,7 +168,7 @@ return 0 to_chat(user, "You start to weld the [src]..") - playsound(src.loc, WT.usesound, 50, 1) + playsound(loc, WT.usesound, 50, 1) busy = 1 if(do_after(user, 20 * WT.toolspeed, target = src)) busy = 0 @@ -176,3 +177,7 @@ return 1 busy = 0 return 0 + +/obj/item/camera_assembly/deconstruct(disassembled = TRUE) + new /obj/item/stack/sheet/metal(loc) + qdel(src) \ No newline at end of file diff --git a/code/game/objects/effects/effects.dm b/code/game/objects/effects/effects.dm index 467858ad670..6a3e1aba86a 100644 --- a/code/game/objects/effects/effects.dm +++ b/code/game/objects/effects/effects.dm @@ -6,6 +6,7 @@ icon = 'icons/effects/effects.dmi' burn_state = LAVA_PROOF | FIRE_PROOF resistance_flags = INDESTRUCTIBLE + can_be_hit = FALSE /obj/effect/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir) return diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 21bc0453500..c57bbab4d27 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -15,6 +15,8 @@ var/global/image/fire_overlay = image("icon" = 'icons/goonstation/effects/fire.d var/inhand_x_dimension = 32 var/inhand_y_dimension = 32 + can_be_hit = FALSE + var/r_speed = 1.0 var/health = null var/hitsound = null @@ -277,25 +279,25 @@ var/global/image/fire_overlay = image("icon" = 'icons/goonstation/effects/fire.d // Due to storage type consolidation this should get used more now. // I have cleaned it up a little, but it could probably use more. -Sayu -/obj/item/attackby(obj/item/W as obj, mob/user as mob, params) - if(istype(W,/obj/item/storage)) - var/obj/item/storage/S = W +/obj/item/attackby(obj/item/I, mob/user, params) + if(istype(I, /obj/item/storage)) + var/obj/item/storage/S = I if(S.use_to_pickup) if(S.collection_mode) //Mode is set to collect all items on a tile and we clicked on a valid one. - if(isturf(src.loc)) + if(isturf(loc)) var/list/rejections = list() var/success = 0 var/failure = 0 - for(var/obj/item/I in src.loc) - if(I.type in rejections) // To limit bag spamming: any given type only complains once + for(var/obj/item/IT in loc) + if(IT.type in rejections) // To limit bag spamming: any given type only complains once continue - if(!S.can_be_inserted(I)) // Note can_be_inserted still makes noise when the answer is no - rejections += I.type // therefore full bags are still a little spammy + if(!S.can_be_inserted(IT)) // Note can_be_inserted still makes noise when the answer is no + rejections += IT.type // therefore full bags are still a little spammy failure = 1 continue success = 1 - S.handle_item_insertion(I, 1) //The 1 stops the "You put the [src] into [S]" insertion message from being displayed. + S.handle_item_insertion(IT, 1) //The 1 stops the "You put the [src] into [S]" insertion message from being displayed. if(success && !failure) to_chat(user, "You put everything in [S].") else if(success) @@ -305,8 +307,8 @@ var/global/image/fire_overlay = image("icon" = 'icons/goonstation/effects/fire.d else if(S.can_be_inserted(src)) S.handle_item_insertion(src) - - return + else + return ..() /obj/item/proc/hit_reaction(mob/living/carbon/human/owner, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) if(prob(final_block_chance)) diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm index 93f230a07e8..66316b6f7ef 100644 --- a/code/game/objects/items/weapons/storage/storage.dm +++ b/code/game/objects/items/weapons/storage/storage.dm @@ -357,19 +357,22 @@ remove_from_storage(Item, loc, burn) //This proc is called when you want to place an item into the storage item. -/obj/item/storage/attackby(obj/item/W as obj, mob/user as mob, params) +/obj/item/storage/attackby(obj/item/I, mob/user, params) ..() - + if(istype(I, /obj/item/hand_labeler)) + var/obj/item/hand_labeler/labeler = I + if(labeler.mode) + return FALSE + . = 1 //no afterattack if(isrobot(user)) - to_chat(user, "You're a robot. No.") - return 1//Robots can't interact with storage items. + return //Robots can't interact with storage items. - if(!can_be_inserted(W)) - return 0 - - handle_item_insertion(W) - return 1 + if(!can_be_inserted(I)) + if(contents.len >= storage_slots) //don't use items on the backpack if they don't fit + return TRUE + return FALSE + handle_item_insertion(I) /obj/item/storage/attack_hand(mob/user as mob) playsound(src.loc, "rustle", 50, 1, -5) diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index fe9e8444378..dc642dcbde5 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -17,6 +17,7 @@ var/integrity_failure = 0 //0 if we have no special broken behavior var/resistance_flags = NONE // INDESTRUCTIBLE + var/can_be_hit = TRUE //can this be bludgeoned by items? var/Mtoollink = 0 // variable to decide if an object should show the multitool menu linking menu, not all objects use it diff --git a/paradise.dme b/paradise.dme index 6cf47e457f5..c10e5633cc6 100644 --- a/paradise.dme +++ b/paradise.dme @@ -360,7 +360,6 @@ #include "code\datums\wires\alarm.dm" #include "code\datums\wires\apc.dm" #include "code\datums\wires\autolathe.dm" -#include "code\datums\wires\camera.dm" #include "code\datums\wires\explosive.dm" #include "code\datums\wires\mulebot.dm" #include "code\datums\wires\nuclearbomb.dm"