From f43fcbd1d6605b86efb56e0389933a063f1622b7 Mon Sep 17 00:00:00 2001 From: ACCount12 Date: Sun, 11 Feb 2018 10:16:09 +0300 Subject: [PATCH] Replaces istype checks for mining tools with tool_behavior checks --- code/datums/components/archaeology.dm | 2 +- code/game/gamemodes/meteor/meteors.dm | 4 +-- code/game/objects/structures/mineral_doors.dm | 2 +- code/game/turfs/simulated/minerals.dm | 10 +++---- code/modules/hydroponics/hydroponics.dm | 28 +++++++++---------- code/modules/mining/ores_coins.dm | 2 +- 6 files changed, 23 insertions(+), 25 deletions(-) diff --git a/code/datums/components/archaeology.dm b/code/datums/components/archaeology.dm index ab950090306..5b5d52b0b40 100644 --- a/code/datums/components/archaeology.dm +++ b/code/datums/components/archaeology.dm @@ -27,7 +27,7 @@ if(!isturf(user.loc)) return - if(istype(I, /obj/item/shovel) || istype(I, /obj/item/pickaxe)) + if(I.tool_behaviour == TOOL_SHOVEL || I.tool_behaviour == TOOL_MINING) to_chat(user, "You start digging...") if(I.use_tool(parent, user, 40, volume=50)) diff --git a/code/game/gamemodes/meteor/meteors.dm b/code/game/gamemodes/meteor/meteors.dm index 8d83c646c20..c717b815e98 100644 --- a/code/game/gamemodes/meteor/meteors.dm +++ b/code/game/gamemodes/meteor/meteors.dm @@ -173,8 +173,8 @@ GLOBAL_LIST_INIT(meteorsC, list(/obj/effect/meteor/dust)) //for space dust event #undef METEOR_MEDAL -/obj/effect/meteor/attackby(obj/item/W, mob/user, params) - if(istype(W, /obj/item/pickaxe)) +/obj/effect/meteor/attackby(obj/item/I, mob/user, params) + if(I.tool_behaviour == TOOL_MINING) make_debris() qdel(src) else diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm index 1e6bd29c0c1..35d10084742 100644 --- a/code/game/objects/structures/mineral_doors.dm +++ b/code/game/objects/structures/mineral_doors.dm @@ -125,7 +125,7 @@ icon_state = initial_state /obj/structure/mineral_door/attackby(obj/item/I, mob/user, params) - if(istype(I, /obj/item/pickaxe)) + if(I.tool_behaviour == TOOL_MINING) to_chat(user, "You start digging the [name]...") if(I.use_tool(src, user, 40, volume=50)) to_chat(user, "You finish digging.") diff --git a/code/game/turfs/simulated/minerals.dm b/code/game/turfs/simulated/minerals.dm index 51ebe1515b9..b9d92021906 100644 --- a/code/game/turfs/simulated/minerals.dm +++ b/code/game/turfs/simulated/minerals.dm @@ -51,7 +51,7 @@ to_chat(usr, "You don't have the dexterity to do this!") return - if (istype(I, /obj/item/pickaxe)) + if(I.tool_behaviour == TOOL_MINING) var/turf/T = user.loc if (!isturf(T)) return @@ -98,14 +98,14 @@ ..() if(ishuman(AM)) var/mob/living/carbon/human/H = AM - var/obj/item/I = H.is_holding_item_of_type(/obj/item/pickaxe) + var/obj/item/I = H.is_holding_tool_quality(TOOL_MINING) if(I) - attackby(I,H) + attackby(I, H) return else if(iscyborg(AM)) var/mob/living/silicon/robot/R = AM - if(istype(R.module_active, /obj/item/pickaxe)) - attackby(R.module_active,R) + if(R.module_active && R.module_active.tool_behaviour == TOOL_MINING) + attackby(R.module_active, R) return else return diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 5277a25991c..2bcf03c5957 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -829,21 +829,19 @@ if(!myseed && !weedlevel) to_chat(user, "[src] doesn't have any plants or weeds!") return - user.visible_message("[user] starts digging out [src]'s plants...", "You start digging out [src]'s plants...") - O.play_tool_sound(src) - if(!do_after(user, 50, target = src) || (!myseed && !weedlevel)) - return - user.visible_message("[user] digs out the plants in [src]!", "You dig out all of [src]'s plants!") - O.play_tool_sound(src) - if(myseed) //Could be that they're just using it as a de-weeder - age = 0 - plant_health = 0 - if(harvest) - harvest = FALSE //To make sure they can't just put in another seed and insta-harvest it - qdel(myseed) - myseed = null - weedlevel = 0 //Has a side effect of cleaning up those nasty weeds - update_icon() + user.visible_message("[user] starts digging out [src]'s plants...", + "You start digging out [src]'s plants...") + if(O.use_tool(src, user, 50, volume=50) || (!myseed && !weedlevel)) + user.visible_message("[user] digs out the plants in [src]!", "You dig out all of [src]'s plants!") + if(myseed) //Could be that they're just using it as a de-weeder + age = 0 + plant_health = 0 + if(harvest) + harvest = FALSE //To make sure they can't just put in another seed and insta-harvest it + qdel(myseed) + myseed = null + weedlevel = 0 //Has a side effect of cleaning up those nasty weeds + update_icon() else return ..() diff --git a/code/modules/mining/ores_coins.dm b/code/modules/mining/ores_coins.dm index 56020b5407e..5ce6abc73db 100644 --- a/code/modules/mining/ores_coins.dm +++ b/code/modules/mining/ores_coins.dm @@ -198,7 +198,7 @@ GLOBAL_LIST_INIT(sand_recipes, list(\ wires.interact(user) return - if(istype(I, /obj/item/pickaxe) || istype(I, /obj/item/resonator) || I.force >= 10) + if(I.tool_behaviour == TOOL_MINING || istype(I, /obj/item/resonator) || I.force >= 10) GibtoniteReaction(user) return if(primed)