From 1f7054b6d0bb0305475b402697217eedd14dd01f Mon Sep 17 00:00:00 2001 From: Nerezza Date: Sat, 24 Feb 2018 13:59:51 -0600 Subject: [PATCH 1/2] Adds TG-style floor tile swapping Hold the tool for pulling a floor tile in your offhand and use a stack of floor tiles (ie, carpet) on the target floor. This respects the different tools and their effects. Replacing wooden tiles should be done with a screwdriver, not a crowbar. --- code/game/turfs/simulated/floor_attackby.dm | 81 ++++++++++++------- .../mob/living/silicon/robot/inventory.dm | 6 ++ 2 files changed, 56 insertions(+), 31 deletions(-) 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 From 1421a2c68cd94e5c6881f9e9231795413d949509 Mon Sep 17 00:00:00 2001 From: Nerezza Date: Sat, 24 Feb 2018 15:26:06 -0600 Subject: [PATCH 2/2] Added changelog They probably wanna know what the new stuph iz --- html/changelogs/Nerezza - Tilematic.yml | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 html/changelogs/Nerezza - Tilematic.yml diff --git a/html/changelogs/Nerezza - Tilematic.yml b/html/changelogs/Nerezza - Tilematic.yml new file mode 100644 index 00000000000..058a3dfc1c7 --- /dev/null +++ b/html/changelogs/Nerezza - Tilematic.yml @@ -0,0 +1,36 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +################################# + +# Your name. +author: Nerezza + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Added /tg/-style floor tile swapping. Equip crowbar/screwdriver in offhand and click the floor tiles you want to directly swap with a stack of new floor tiles (like teal carpet)."