diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index fa3d6098f00..9bf2014d4c9 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -187,6 +187,15 @@ return +/obj/machinery/door/window/mech_melee_attack(obj/mecha/M) + if(M.damtype == "brute") + playsound(src.loc, 'sound/effects/Glasshit.ogg', 75, 1) + M.occupant_message("You hit [src].") + visible_message("[src] has been hit by [M.name].") + take_damage(M.force) + return + + /obj/machinery/door/window/attack_ai(mob/user as mob) return src.attack_hand(user) diff --git a/code/game/mecha/combat/combat.dm b/code/game/mecha/combat/combat.dm index 65b49cca717..47a46c00513 100644 --- a/code/game/mecha/combat/combat.dm +++ b/code/game/mecha/combat/combat.dm @@ -1,98 +1,10 @@ /obj/mecha/combat force = 30 - var/melee_cooldown = 10 - var/melee_can_hit = 1 - var/list/destroyable_obj = list(/obj/mecha, /obj/structure/window, /obj/structure/grille, /turf/simulated/wall) internal_damage_threshold = 50 maint_access = 0 damage_absorption = list("brute"=0.7,"fire"=1,"bullet"=0.7,"laser"=0.85,"energy"=1,"bomb"=0.8) var/am = "d3c2fbcadca903a41161ccc9df9cf948" -/obj/mecha/combat/melee_action(target as obj|mob|turf) - if(internal_damage&MECHA_INT_CONTROL_LOST) - target = safepick(oview(1,src)) - if(!melee_can_hit || !istype(target, /atom)) return - if(istype(target, /mob/living)) - var/mob/living/M = target - if(src.occupant.a_intent == "harm") - if(damtype == "brute") - step_away(M,src,15) - if(istype(target, /mob/living/carbon/human)) - var/mob/living/carbon/human/H = target - var/obj/item/organ/limb/temp = H.get_organ(pick("chest", "chest", "chest", "head")) - if(temp) - var/update = 0 - switch(damtype) - if("brute") - H.Paralyse(1) - update |= temp.take_damage(rand(force/2, force), 0) - playsound(src, 'sound/weapons/punch4.ogg', 50, 1) - if("fire") - update |= temp.take_damage(0, rand(force/2, force)) - playsound(src, 'sound/items/Welder.ogg', 50, 1) - if("tox") - playsound(src, 'sound/effects/spray2.ogg', 50, 1) - if(H.reagents) - if(H.reagents.get_reagent_amount("cryptobiolin") + force < force*2) - H.reagents.add_reagent("cryptobiolin", force/2) - if(H.reagents.get_reagent_amount("toxin") + force < force*2) - H.reagents.add_reagent("toxin", force/2.5) - else - return - if(update) H.update_damage_overlays(0) - H.updatehealth() - - else - switch(damtype) - if("brute") - M.Paralyse(1) - M.take_overall_damage(rand(force/2, force)) - playsound(src, 'sound/weapons/punch4.ogg', 50, 1) - if("fire") - M.take_overall_damage(0, rand(force/2, force)) - playsound(src, 'sound/items/Welder.ogg', 50, 1) - if("tox") - playsound(src, 'sound/effects/spray2.ogg', 50, 1) - if(M.reagents) - if(M.reagents.get_reagent_amount("cryptobiolin") + force < force*2) - M.reagents.add_reagent("cryptobiolin", force/2) - if(M.reagents.get_reagent_amount("toxin") + force < force*2) - M.reagents.add_reagent("toxin", force/2.5) - else - return - M.updatehealth() - src.occupant_message("You hit [target].") - src.visible_message("[src.name] hits [target].") - add_logs(occupant, M, "attacked", object=src, addition="(INTENT: [uppertext(occupant.a_intent)]) (DAMTYE: [uppertext(damtype)])") - else - step_away(M,src) - src.occupant_message("You push [target] out of the way.") - src.visible_message("[src] pushes [target] out of the way.") - - melee_can_hit = 0 - if(do_after(melee_cooldown)) - melee_can_hit = 1 - return - - else - if(damtype == "brute") - for(var/target_type in src.destroyable_obj) - if(istype(target, target_type) && hascall(target, "attackby")) - src.occupant_message("You hit [target].") - src.visible_message("[src.name] hits [target]") - if(!istype(target, /turf/simulated/wall)) - target:attackby(src,src.occupant) - else if(prob(5)) - target:dismantle_wall(1) - src.occupant_message("You smash through the wall.") - src.visible_message("[src.name] smashes through the wall") - playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1) - melee_can_hit = 0 - if(do_after(melee_cooldown)) - melee_can_hit = 1 - break - return - /obj/mecha/combat/moved_inside(var/mob/living/carbon/human/H as mob) if(..()) if(H.client) diff --git a/code/game/mecha/combat/honker.dm b/code/game/mecha/combat/honker.dm index 85ba2351add..9018e16eff6 100644 --- a/code/game/mecha/combat/honker.dm +++ b/code/game/mecha/combat/honker.dm @@ -26,13 +26,14 @@ return */ - +/* /obj/mecha/combat/honker/melee_action(target) if(!melee_can_hit) return else if(istype(target, /mob)) step_away(target,src,15) return +*/ /obj/mecha/combat/honker/get_stats_part() var/integrity = health/initial(health)*100 diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index acbe4455335..0a528b9a4f4 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -18,6 +18,7 @@ unacidable = 1 //and no deleting hoomans inside layer = MOB_LAYER //icon draw layer infra_luminosity = 15 //byond implementation is bugged. + force = 5 var/can_move = 1 var/mob/living/carbon/occupant = null var/step_in = 10 //make a step in step_in/10 sec. @@ -70,6 +71,9 @@ var/stepsound = 'sound/mecha/mechstep.ogg' var/turnsound = 'sound/mecha/mechturn.ogg' + var/melee_cooldown = 10 + var/melee_can_hit = 1 + /obj/mecha/New() ..() @@ -259,12 +263,15 @@ /obj/mecha/proc/click_action(atom/target,mob/user) if(!src.occupant || src.occupant != user ) return - if(user.stat) return - if(state) - occupant_message("Maintenance protocols in effect") + if(user.stat || !user.canmove) + return + if(state) + occupant_message("Maintenance protocols in effect.") + return + if(!get_charge()) + return + if(src == target) return - if(!get_charge()) return - if(src == target) return var/dir_to_target = get_dir(src,target) if(dir_to_target && !(dir_to_target & src.dir))//wrong direction return @@ -278,11 +285,38 @@ else if(selected && selected.is_melee()) selected.action(target) else - src.melee_action(target) + if(internal_damage&MECHA_INT_CONTROL_LOST) + target = safepick(oview(1,src)) + if(!melee_can_hit || !istype(target, /atom)) + return + target.mech_melee_attack(src) + melee_can_hit = 0 + if(do_after(melee_cooldown)) + melee_can_hit = 1 return +/obj/mecha/proc/mech_toxin_damage(mob/living/target) + playsound(src, 'sound/effects/spray2.ogg', 50, 1) + if(target.reagents) + if(target.reagents.get_reagent_amount("cryptobiolin") + force < force*2) + target.reagents.add_reagent("cryptobiolin", force/2) + if(target.reagents.get_reagent_amount("toxin") + force < force*2) + target.reagents.add_reagent("toxin", force/2.5) -/obj/mecha/proc/melee_action(atom/target) + +/atom/proc/mech_melee_attack(obj/mecha/M) + return + +/obj/mecha/mech_melee_attack(obj/mecha/M) + if(M.damtype =="brute") + playsound(src, 'sound/weapons/punch4.ogg', 50, 1) + else if(M.damtype == "fire") + playsound(src, 'sound/items/Welder.ogg', 50, 1) + else + return + M.occupant_message("You hit [src].") + visible_message("[src] has been hit by [M.name].") + take_damage(M.force, damtype) return /obj/mecha/proc/range_action(atom/target) diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index df9b873ecbf..c31bad49e2c 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -145,4 +145,4 @@ if(current_size >= 9) anchored = 0 step_towards(src,S) - else step_towards(src,S) \ No newline at end of file + else step_towards(src,S) diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm index 54d65faa2b2..260d3b09271 100644 --- a/code/game/objects/structures.dm +++ b/code/game/objects/structures.dm @@ -1,11 +1,11 @@ -obj/structure +/obj/structure icon = 'icons/obj/structures.dmi' -obj/structure/blob_act() +/obj/structure/blob_act() if(prob(50)) qdel(src) -obj/structure/ex_act(severity) +/obj/structure/ex_act(severity) switch(severity) if(1.0) qdel(src) @@ -17,7 +17,14 @@ obj/structure/ex_act(severity) if(3.0) return -obj/structure/Destroy() +/obj/structure/Destroy() if(opacity) UpdateAffectingLights() - ..() \ No newline at end of file + ..() + +/obj/structure/mech_melee_attack(obj/mecha/M) + if(M.damtype == "brute") + M.occupant_message("You hit [src].") + visible_message("[src] has been hit by [M.name].") + return 1 + return 0 diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index b94c5588c60..1f09a7e0aa0 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -80,6 +80,13 @@ return +/obj/structure/grille/mech_melee_attack(obj/mecha/M) + if(..()) + playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) + health -= M.force * 0.5 + healthcheck() + + /obj/structure/grille/CanPass(atom/movable/mover, turf/target, height=0) if(height==0) return 1 if(istype(mover) && mover.checkpass(PASSGRILLE)) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 415360bb913..599cc119d2e 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -202,6 +202,11 @@ ..() return +/obj/structure/window/mech_melee_attack(obj/mecha/M) + if(..()) + hit(M.force, 1) + + /obj/structure/window/proc/can_be_reached(mob/user) if(!is_fulltile()) if(get_dir(user,src) & dir) diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index b66e903b068..2f45f336126 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -92,13 +92,24 @@ if(prob(50)) dismantle_wall() +/turf/simulated/wall/mech_melee_attack(obj/mecha/M) + if(M.damtype == "brute") + playsound(src, 'sound/weapons/punch4.ogg', 50, 1) + M.occupant_message("You hit [src].") + visible_message("[src] has been hit by [M.name].") + if(prob(5) && M.force > 20) + dismantle_wall(1) + M.occupant_message("You smash through the wall.") + visible_message("[src.name] smashes through the wall!") + playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1) + /turf/simulated/wall/attack_paw(mob/user as mob) user.changeNext_move(CLICK_CD_MELEE) if ((HULK in user.mutations)) if (prob(hardness)) playsound(src, 'sound/effects/meteorimpact.ogg', 100, 1) - usr << text("You smash through the wall.") - usr.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" )) + user << "You smash through the wall." + user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" )) dismantle_wall(1) return else diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 5f06c653d7e..9470b558e09 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -227,3 +227,37 @@ emp_act L.take_damage(0,5) src.Stun(5) ..() + +/mob/living/carbon/human/mech_melee_attack(obj/mecha/M) + + if(M.occupant.a_intent == "harm") + if(M.damtype == "brute") + step_away(src,M,15) + var/obj/item/organ/limb/temp = get_organ(pick("chest", "chest", "chest", "head")) + if(temp) + var/update = 0 + switch(M.damtype) + if("brute") + Paralyse(1) + update |= temp.take_damage(rand(M.force/2, M.force), 0) + playsound(src, 'sound/weapons/punch4.ogg', 50, 1) + if("fire") + update |= temp.take_damage(0, rand(M.force/2, M.force)) + playsound(src, 'sound/items/Welder.ogg', 50, 1) + if("tox") + M.mech_toxin_damage(src) + else + return + if(update) + update_damage_overlays(0) + updatehealth() + + M.occupant_message("You hit [src].") + visible_message("[src] has been hit by [M.name].", \ + "[src] has been hit by [M.name].") + add_logs(M.occupant, M, "attacked", object=src, addition="(INTENT: [uppertext(M.occupant.a_intent)]) (DAMTYE: [uppertext(M.damtype)])") + + else + ..() + + return diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index e903b7cef30..2a878381f5a 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -69,6 +69,35 @@ proc/vol_by_throwforce_and_or_w_class(var/obj/item/I) var/mob/M = assailant.mob add_logs(M, src, "hit", object="[I]") +/mob/living/mech_melee_attack(obj/mecha/M) + if(M.occupant.a_intent == "harm") + if(M.damtype == "brute") + step_away(src,M,15) + switch(M.damtype) + if("brute") + Paralyse(1) + take_overall_damage(rand(M.force/2, M.force)) + playsound(src, 'sound/weapons/punch4.ogg', 50, 1) + if("fire") + take_overall_damage(0, rand(M.force/2, M.force)) + playsound(src, 'sound/items/Welder.ogg', 50, 1) + if("tox") + M.mech_toxin_damage(src) + else + return + updatehealth() + M.occupant_message("You hit [src].") + visible_message("[src] has been hit by [M.name].", \ + "[src] has been hit by [M.name].") + add_logs(M.occupant, src, "attacked", object=src, addition="(INTENT: [uppertext(M.occupant.a_intent)]) (DAMTYE: [uppertext(M.damtype)])") + else + step_away(src,M) + M.occupant_message("You push [src] out of the way.") + visible_message("[M] pushes [src] out of the way.") + + return + + //Mobs on Fire /mob/living/proc/IgniteMob() if(fire_stacks > 0 && !on_fire)