From 5ea2e57419a5132b10b6f3deba945ace0456b180 Mon Sep 17 00:00:00 2001 From: vuonojenmustaturska Date: Fri, 16 Feb 2018 14:06:32 +0200 Subject: [PATCH 1/2] Merge pull request #35629 from ShizCalev/floor-tool_acts Converts floor tool interactions to tool_act, fixes flooring exploits --- code/game/turfs/simulated/floor.dm | 5 +++-- .../game/turfs/simulated/floor/fancy_floor.dm | 22 ++++++++----------- .../turfs/simulated/floor/mineral_floor.dm | 2 +- code/game/turfs/simulated/floor/misc_floor.dm | 3 +++ code/game/turfs/simulated/floor/plating.dm | 3 +++ .../turfs/simulated/floor/plating/asteroid.dm | 4 ++++ .../turfs/simulated/floor/plating/dirt.dm | 3 +++ .../simulated/floor/plating/misc_plating.dm | 14 ++++++++++++ .../game/turfs/simulated/floor/reinf_floor.dm | 6 +++++ code/modules/holodeck/turfs.dm | 3 +++ 10 files changed, 49 insertions(+), 16 deletions(-) diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm index 129a8c119a..c73dd50e44 100644 --- a/code/game/turfs/simulated/floor.dm +++ b/code/game/turfs/simulated/floor.dm @@ -139,12 +139,13 @@ return 1 if(..()) return 1 - if(intact && istype(C, /obj/item/crowbar)) - return pry_tile(C, user) if(intact && istype(C, /obj/item/stack/tile)) try_replace_tile(C, user, params) return 0 +/turf/open/floor/crowbar_act(mob/living/user, obj/item/I) + return intact ? pry_tile(I, user) : FALSE + /turf/open/floor/proc/try_replace_tile(obj/item/stack/tile/T, mob/user, params) if(T.turf_type == type) return diff --git a/code/game/turfs/simulated/floor/fancy_floor.dm b/code/game/turfs/simulated/floor/fancy_floor.dm index d3a340965f..e664c62023 100644 --- a/code/game/turfs/simulated/floor/fancy_floor.dm +++ b/code/game/turfs/simulated/floor/fancy_floor.dm @@ -17,12 +17,8 @@ ..() to_chat(user, "There's a few screws and a small crack visible.") -/turf/open/floor/wood/attackby(obj/item/C, mob/user, params) - if(..()) - return - if(istype(C, /obj/item/screwdriver)) - pry_tile(C, user) - return +/turf/open/floor/wood/screwdriver_act(mob/living/user, obj/item/I) + return pry_tile(I, user) /turf/open/floor/wood/try_replace_tile(obj/item/stack/tile/T, mob/user, params) if(T.turf_type == type) @@ -38,9 +34,8 @@ P.attackby(T, user, params) /turf/open/floor/wood/pry_tile(obj/item/C, mob/user, silent = FALSE) - var/is_screwdriver = istype(C, /obj/item/screwdriver) C.play_tool_sound(src, 80) - return remove_tile(user, silent, make_tile = is_screwdriver) + return remove_tile(user, silent, (C.tool_behaviour == TOOL_SCREWDRIVER)) /turf/open/floor/wood/remove_tile(mob/user, silent = FALSE, make_tile = TRUE) if(broken || burnt) @@ -80,7 +75,7 @@ update_icon() /turf/open/floor/grass/attackby(obj/item/C, mob/user, params) - if(istype(C, /obj/item/shovel) && params) + if((C.tool_behaviour == TOOL_SHOVEL) && params) new ore_type(src, 2) user.visible_message("[user] digs up [src].", "You [turfverb] [src].") playsound(src, 'sound/effects/shovel_dig.ogg', 50, 1) @@ -99,10 +94,11 @@ initial_gas_mix = "o2=22;n2=82;TEMP=180" slowdown = 2 -/turf/open/floor/grass/snow/attackby(obj/item/W, mob/user, params) - if(istype(W, /obj/item/crowbar))//You need to dig this turf out instead of crowbarring it - return - ..() +/turf/open/floor/grass/snow/try_replace_tile(obj/item/stack/tile/T, mob/user, params) + return + +/turf/open/floor/grass/snow/crowbar_act(mob/living/user, obj/item/I) + return /turf/open/floor/grass/snow/basalt //By your powers combined, I am captain planet name = "volcanic floor" diff --git a/code/game/turfs/simulated/floor/mineral_floor.dm b/code/game/turfs/simulated/floor/mineral_floor.dm index 8ad09829b2..07e324bb02 100644 --- a/code/game/turfs/simulated/floor/mineral_floor.dm +++ b/code/game/turfs/simulated/floor/mineral_floor.dm @@ -42,7 +42,7 @@ if(exposed_temperature > 300) PlasmaBurn(exposed_temperature) -/turf/open/floor/mineral/plasma/attackby(obj/item/W as obj, mob/user as mob, params) +/turf/open/floor/mineral/plasma/attackby(obj/item/W, mob/user, params) if(W.is_hot() > 300)//If the temperature of the object is over 300, then ignite message_admins("Plasma flooring was ignited by [ADMIN_LOOKUPFLW(user)] in [ADMIN_COORDJMP(src)]",0,1) log_game("Plasma flooring was ignited by [key_name(user)] in [COORD(src)]") diff --git a/code/game/turfs/simulated/floor/misc_floor.dm b/code/game/turfs/simulated/floor/misc_floor.dm index 721cb12e9d..73e99d7b41 100644 --- a/code/game/turfs/simulated/floor/misc_floor.dm +++ b/code/game/turfs/simulated/floor/misc_floor.dm @@ -196,6 +196,9 @@ flick_overlay(I, viewing, 8) L.adjustToxLoss(-3, TRUE, TRUE) +/turf/open/floor/clockwork/try_replace_tile(obj/item/stack/tile/T, mob/user, params) + return + /turf/open/floor/clockwork/crowbar_act(mob/living/user, obj/item/I) if(baseturfs == type) return TRUE diff --git a/code/game/turfs/simulated/floor/plating.dm b/code/game/turfs/simulated/floor/plating.dm index be55db5408..c2322fd594 100644 --- a/code/game/turfs/simulated/floor/plating.dm +++ b/code/game/turfs/simulated/floor/plating.dm @@ -123,3 +123,6 @@ /turf/open/floor/plating/foam/ex_act() ..() ScrapeAway() + +/turf/open/floor/plating/foam/tool_act(mob/living/user, obj/tool/I, tool_type) + return diff --git a/code/game/turfs/simulated/floor/plating/asteroid.dm b/code/game/turfs/simulated/floor/plating/asteroid.dm index d60192796c..2b8400abdb 100644 --- a/code/game/turfs/simulated/floor/plating/asteroid.dm +++ b/code/game/turfs/simulated/floor/plating/asteroid.dm @@ -26,6 +26,10 @@ if(LAZYLEN(archdrops)) AddComponent(/datum/component/archaeology, 100, archdrops) + +/turf/open/floor/plating/asteroid/try_replace_tile(obj/item/stack/tile/T, mob/user, params) + return + /turf/open/floor/plating/asteroid/burn_tile() return diff --git a/code/game/turfs/simulated/floor/plating/dirt.dm b/code/game/turfs/simulated/floor/plating/dirt.dm index a9ddd4180e..ff16addd33 100644 --- a/code/game/turfs/simulated/floor/plating/dirt.dm +++ b/code/game/turfs/simulated/floor/plating/dirt.dm @@ -10,3 +10,6 @@ /turf/open/floor/plating/dirt/dark icon_state = "greenerdirt" + +/turf/open/floor/plating/dirt/try_replace_tile(obj/item/stack/tile/T, mob/user, params) + return diff --git a/code/game/turfs/simulated/floor/plating/misc_plating.dm b/code/game/turfs/simulated/floor/plating/misc_plating.dm index eeed718aba..6e66d5deba 100644 --- a/code/game/turfs/simulated/floor/plating/misc_plating.dm +++ b/code/game/turfs/simulated/floor/plating/misc_plating.dm @@ -22,6 +22,8 @@ /turf/open/floor/plating/abductor2/burn_tile() return //unburnable +/turf/open/floor/plating/abductor2/try_replace_tile(obj/item/stack/tile/T, mob/user, params) + return /turf/open/floor/plating/astplate icon_state = "asteroidplating" @@ -49,6 +51,9 @@ icon = smooth_icon . = ..() +/turf/open/floor/plating/ashplanet/try_replace_tile(obj/item/stack/tile/T, mob/user, params) + return + /turf/open/floor/plating/ashplanet/break_tile() return @@ -84,6 +89,9 @@ flags_1 = NONE attachment_holes = FALSE +/turf/open/floor/plating/beach/try_replace_tile(obj/item/stack/tile/T, mob/user, params) + return + /turf/open/floor/plating/beach/ex_act(severity, target) contents_explosion(severity, target) @@ -122,6 +130,9 @@ /turf/open/floor/plating/ironsand/burn_tile() return +/turf/open/floor/plating/ironsand/try_replace_tile(obj/item/stack/tile/T, mob/user, params) + return + /turf/open/floor/plating/ice name = "ice sheet" desc = "A sheet of solid ice. Looks slippery." @@ -135,6 +146,9 @@ wet = TURF_WET_PERMAFROST attachment_holes = FALSE +/turf/open/floor/plating/ice/try_replace_tile(obj/item/stack/tile/T, mob/user, params) + return + /turf/open/floor/plating/ice/HandleWet() if(wet == TURF_WET_ICE) return diff --git a/code/game/turfs/simulated/floor/reinf_floor.dm b/code/game/turfs/simulated/floor/reinf_floor.dm index 0bd4572b35..71887fa08e 100644 --- a/code/game/turfs/simulated/floor/reinf_floor.dm +++ b/code/game/turfs/simulated/floor/reinf_floor.dm @@ -25,6 +25,12 @@ ..() return //unplateable +/turf/open/floor/engine/try_replace_tile(obj/item/stack/tile/T, mob/user, params) + return + +/turf/open/floor/engine/crowbar_act(mob/living/user, obj/item/I) + return + /turf/open/floor/engine/wrench_act(mob/living/user, obj/item/I) to_chat(user, "You begin removing rods...") if(I.use_tool(src, user, 30, volume=80)) diff --git a/code/modules/holodeck/turfs.dm b/code/modules/holodeck/turfs.dm index ab49f5c042..a9ec1ac9f1 100644 --- a/code/modules/holodeck/turfs.dm +++ b/code/modules/holodeck/turfs.dm @@ -6,6 +6,9 @@ /turf/open/floor/holofloor/attackby(obj/item/I, mob/living/user) return // HOLOFLOOR DOES NOT GIVE A FUCK +/turf/open/floor/holofloor/tool_act(mob/living/user, obj/item/I, tool_type) + return + /turf/open/floor/holofloor/burn_tile() return //you can't burn a hologram!