From cdbf339c027d7eff6d12ec7ce34fe4508423f8eb Mon Sep 17 00:00:00 2001 From: Kates <24830358+lbnesquik@users.noreply.github.com> Date: Tue, 30 Jun 2020 09:09:59 +0200 Subject: [PATCH] Add straffing to mechs. This took my entire morning goddamnit. (#7306) * Fix a typo in a verb. * Add straffing to mechs. This took my entire morning goddamnit. You now have a straffing verb. Very convenient to shoot while firing back. Thanks to @drexample even if i didn't use all that much of the original code i stole. * Change straffing to strafing. * Correct an oversight. --- code/game/mecha/mecha.dm | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 4aa82bad7a..894f8cc64f 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -100,6 +100,7 @@ var/static/image/radial_image_lighttoggle = image(icon = 'icons/mob/radial.dmi', icon_state = "radial_light") var/static/image/radial_image_statpanel = image(icon = 'icons/mob/radial.dmi', icon_state = "radial_examine2") + var/strafing = 0 /obj/mecha/drain_power(var/drain_check) @@ -508,9 +509,16 @@ break if(result) move_result = mechstep(direction) + //Turning + else if(src.dir != direction) - move_result = mechturn(direction) + + if(strafing) + move_result = mechstep(direction) + else + move_result = mechturn(direction) + //Stepping else move_result = mechstep(direction) @@ -541,11 +549,14 @@ return 1 /obj/mecha/proc/mechstep(direction) + var/current_dir = dir //For strafing var/result = get_step(src,direction) if(result && Move(result)) if(stomp_sound) playsound(src,stomp_sound,40,1) handle_equipment_movement() + if(strafing) //Also for strafing + set_dir(current_dir) return result @@ -1227,7 +1238,7 @@ /obj/mecha/verb/toggle_internal_tank() - set name = "Toggle internal airtank usage." + set name = "Toggle internal airtank usage" set category = "Exosuit Interface" set src = usr.loc set popup_menu = 0 @@ -1238,6 +1249,17 @@ src.log_message("Now taking air from [use_internal_tank?"internal airtank":"environment"].") return +/obj/mecha/verb/toggle_strafing() + set name = "Toggle strafing" + set category = "Exosuit Interface" + set src = usr.loc + set popup_menu = 0 + if(usr!=src.occupant) + return + strafing = !strafing + src.occupant_message("Toggled strafing mode [strafing?"on":"off"].") + src.log_message("Toggled strafing mode [strafing?"on":"off"].") + return /obj/mecha/MouseDrop_T(mob/O, mob/user as mob) //Humans can pilot mechs. @@ -1383,7 +1405,7 @@ return -/obj/mecha/proc/go_out() +/obj/mecha/proc/go_out() //Eject/Exit the mech. Yes this is for easier searching. if(!src.occupant) return var/atom/movable/mob_container if(ishuman(occupant)) @@ -1411,6 +1433,7 @@ icon_state = src.reset_icon()+"-open" set_dir(dir_in) verbs -= /obj/mecha/verb/eject + strafing = 0 return /////////////////////////