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.
This commit is contained in:
Kates
2020-06-30 00:09:59 -07:00
committed by GitHub
parent 11b0798ea7
commit cdbf339c02
+26 -3
View File
@@ -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
/////////////////////////