From bc2c10adb2ccb078d5e53395e7a3bd61d68eb4ce Mon Sep 17 00:00:00 2001 From: lbnesquik Date: Fri, 14 Aug 2020 01:02:21 +0200 Subject: [PATCH] Delete some duplication in the mech drill. --- code/game/mecha/equipment/tools/drill.dm | 48 +++++------------------- 1 file changed, 9 insertions(+), 39 deletions(-) diff --git a/code/game/mecha/equipment/tools/drill.dm b/code/game/mecha/equipment/tools/drill.dm index 6f44c92d5f..346481eb66 100644 --- a/code/game/mecha/equipment/tools/drill.dm +++ b/code/game/mecha/equipment/tools/drill.dm @@ -5,6 +5,7 @@ equip_cooldown = 30 energy_drain = 10 force = 15 + var/advanced = 0 //Determines if you can pierce the heavens or not. Used in diamond drill. required_type = list(/obj/mecha/working/ripley) /obj/item/mecha_parts/mecha_equipment/tool/drill/action(atom/target) @@ -22,11 +23,17 @@ if(T == chassis.loc && src == chassis.selected) if(istype(target, /turf/simulated/wall)) var/turf/simulated/wall/W = target - if(W.reinf_material) + if(W.reinf_material && !advanced)//R wall but no good drill occupant_message("[target] is too durable to drill through.") + return + + else if((W.reinf_material && advanced) || do_after_cooldown(target))//R wall with good drill + log_message("Drilled through [target]") + target.ex_act(3) else log_message("Drilled through [target]") target.ex_act(2) + else if(istype(target, /turf/simulated/mineral)) if(enable_special) for(var/turf/simulated/mineral/M in range(chassis,1)) @@ -54,44 +61,7 @@ origin_tech = list(TECH_MATERIAL = 4, TECH_ENGINEERING = 3) equip_cooldown = 10 force = 15 - -/obj/item/mecha_parts/mecha_equipment/tool/drill/diamonddrill/action(atom/target) - if(!action_checks(target)) return - if(isobj(target)) - var/obj/target_obj = target - if(target_obj.unacidable) return - set_ready_state(0) - chassis.use_power(energy_drain) - chassis.visible_message("[chassis] starts to drill [target]", "You hear the drill.") - occupant_message("You start to drill [target]") - var/T = chassis.loc - var/C = target.loc //why are these backwards? we may never know -Pete - if(do_after_cooldown(target)) - if(T == chassis.loc && src == chassis.selected) - if(istype(target, /turf/simulated/wall)) - var/turf/simulated/wall/W = target - if(!W.reinf_material || do_after_cooldown(target))//To slow down how fast mechs can drill through the station - log_message("Drilled through [target]") - target.ex_act(3) - else if(istype(target, /turf/simulated/mineral)) - if(enable_special) - for(var/turf/simulated/mineral/M in range(chassis,1)) - if(get_dir(chassis,M)&chassis.dir) - M.GetDrilled() - else - var/turf/simulated/mineral/M1 = target - M1.GetDrilled() - log_message("Drilled through [target]") - if(locate(/obj/item/mecha_parts/mecha_equipment/tool/hydraulic_clamp) in chassis.equipment) - var/obj/structure/ore_box/ore_box = locate(/obj/structure/ore_box) in chassis:cargo - if(ore_box) - for(var/obj/item/weapon/ore/ore in range(chassis,1)) - if(get_dir(chassis,ore)&chassis.dir) - ore.forceMove(ore_box) - else if(target.loc == C) - log_message("Drilled through [target]") - target.ex_act(2) - return 1 + advanced = 1 /obj/item/mecha_parts/mecha_equipment/tool/drill/bore name = "depth bore"