diff --git a/code/game/turfs/simulated/floor_attackby.dm b/code/game/turfs/simulated/floor_attackby.dm index ef36121b12c..5602eac320d 100644 --- a/code/game/turfs/simulated/floor_attackby.dm +++ b/code/game/turfs/simulated/floor_attackby.dm @@ -4,40 +4,15 @@ return 0 if(flooring) - if(istype(C, /obj/item/weapon/crowbar)) - if(broken || burnt) - to_chat(user, "You remove the broken [flooring.descriptor].") - make_plating() - else if(flooring.flags & TURF_IS_FRAGILE) - to_chat(user, "You forcefully pry off the [flooring.descriptor], destroying them in the process.") - make_plating() - else if(flooring.flags & TURF_REMOVE_CROWBAR) - to_chat(user, "You lever off the [flooring.descriptor].") - make_plating(1) - else - return - playsound(src, C.usesound, 80, 1) - return - else if(istype(C, /obj/item/weapon/screwdriver) && (flooring.flags & TURF_REMOVE_SCREWDRIVER)) - if(broken || burnt) - return - to_chat(user, "You unscrew and remove the [flooring.descriptor].") - make_plating(1) - playsound(src, C.usesound, 80, 1) - return - else if(istype(C, /obj/item/weapon/wrench) && (flooring.flags & TURF_REMOVE_WRENCH)) - to_chat(user, "You unwrench and remove the [flooring.descriptor].") - make_plating(1) - playsound(src, C.usesound, 80, 1) - return - else if(istype(C, /obj/item/weapon/shovel) && (flooring.flags & TURF_REMOVE_SHOVEL)) - to_chat(user, "You shovel off the [flooring.descriptor].") - make_plating(1) - playsound(src, 'sound/items/Deconstruct.ogg', 80, 1) + if(istype(C, /obj/item/weapon)) + try_deconstruct_tile(C, user) return else if(istype(C, /obj/item/stack/cable_coil)) to_chat(user, "You must remove the [flooring.descriptor] first.") return + else if(istype(C, /obj/item/stack/tile)) + try_replace_tile(C, user) + return else if(istype(C, /obj/item/stack/cable_coil)) @@ -87,4 +62,48 @@ burnt = null broken = null else - to_chat(user, "You need more welding fuel to complete this task.") \ No newline at end of file + to_chat(user, "You need more welding fuel to complete this task.") + +/turf/simulated/floor/proc/try_deconstruct_tile(obj/item/weapon/W as obj, mob/user as mob) + if(istype(W, /obj/item/weapon/crowbar)) + if(broken || burnt) + to_chat(user, "You remove the broken [flooring.descriptor].") + make_plating() + else if(flooring.flags & TURF_IS_FRAGILE) + to_chat(user, "You forcefully pry off the [flooring.descriptor], destroying them in the process.") + make_plating() + else if(flooring.flags & TURF_REMOVE_CROWBAR) + to_chat(user, "You lever off the [flooring.descriptor].") + make_plating(1) + else + return 0 + playsound(src, W.usesound, 80, 1) + return 1 + else if(istype(W, /obj/item/weapon/screwdriver) && (flooring.flags & TURF_REMOVE_SCREWDRIVER)) + if(broken || burnt) + return 0 + to_chat(user, "You unscrew and remove the [flooring.descriptor].") + make_plating(1) + playsound(src, W.usesound, 80, 1) + return 1 + else if(istype(W, /obj/item/weapon/wrench) && (flooring.flags & TURF_REMOVE_WRENCH)) + to_chat(user, "You unwrench and remove the [flooring.descriptor].") + make_plating(1) + playsound(src, W.usesound, 80, 1) + return 1 + else if(istype(W, /obj/item/weapon/shovel) && (flooring.flags & TURF_REMOVE_SHOVEL)) + to_chat(user, "You shovel off the [flooring.descriptor].") + make_plating(1) + playsound(src, 'sound/items/Deconstruct.ogg', 80, 1) + return 1 + return 0 + +/turf/simulated/floor/proc/try_replace_tile(obj/item/stack/tile/T as obj, mob/user as mob) + if(T.type == flooring.build_type) + return + var/obj/item/weapon/W = user.is_holding_item_of_type(/obj/item/weapon) + if(!try_deconstruct_tile(W, user)) + return + if(flooring) + return + attackby(T, user) \ No newline at end of file diff --git a/code/modules/mob/living/silicon/robot/inventory.dm b/code/modules/mob/living/silicon/robot/inventory.dm index fd8164b01c8..48455c38447 100644 --- a/code/modules/mob/living/silicon/robot/inventory.dm +++ b/code/modules/mob/living/silicon/robot/inventory.dm @@ -256,3 +256,9 @@ /mob/living/silicon/robot/put_in_hands(var/obj/item/W) // No hands. W.loc = get_turf(src) return 1 + +/mob/living/silicon/robot/is_holding_item_of_type(typepath) + for(var/obj/item/I in list(module_state_1, module_state_2, module_state_3)) + if(istype(I, typepath)) + return I + return FALSE \ No newline at end of file