Converts move intents to /decl/move_intent (#8993)

* Converts move intents to /decl/move_intent

Adds /decl/move_intent/walk and /decl/move_intent/run.

Switches all move intent checks to use the new IS_RUNNING and IS_WALKING macros.

Renames and refactors /mob/living/proc/set_m_intent() to /mob/living/proc/set_move_intent(decl/move_intent/intent).

Removes the unnecessary /mob/var/m_int and associated code.

Updates all move intent setters to use set_move_intent().

* Swaps incorrect config values

Swaps incorrect move delays since I got them backwards somehow, oopsies.

* Adds suggested ?. operator

Compactifies two if statements using the ?. operator instead.
This commit is contained in:
Frenjo
2023-03-04 22:28:10 +00:00
committed by GitHub
parent 633e8c6dd8
commit 20cdc4b676
27 changed files with 110 additions and 115 deletions

View File

@@ -12,7 +12,7 @@
using.name = "mov_intent"
using.set_dir(SOUTHWEST)
using.icon = HUD.ui_style
using.icon_state = (m_intent == "run" ? "running" : "walking")
using.icon_state = move_intent.hud_icon_state
using.screen_loc = ui_acti
using.layer = HUD_LAYER
HUD.adding += using

View File

@@ -14,7 +14,7 @@
var/other = list()
var/hotkeybuttons = list()
var/slot_info = list()
HUD.adding = adding
HUD.other = other
HUD.hotkeybuttons = hotkeybuttons //These can be disabled for hotkey users
@@ -132,7 +132,7 @@
using = new /obj/screen()
using.name = "mov_intent"
using.icon = HUD.ui_style
using.icon_state = (m_intent == "run" ? "running" : "walking")
using.icon_state = move_intent.hud_icon_state
using.screen_loc = ui_movi
using.color = HUD.ui_color
using.alpha = HUD.ui_alpha
@@ -351,4 +351,4 @@
/obj/screen/wizard/energy
name = "energy"
icon_state = "wiz_energy"
icon_state = "wiz_energy"

View File

@@ -274,42 +274,16 @@
L.resist()
if("mov_intent")
if(isliving(usr))
if(iscarbon(usr))
var/mob/living/carbon/C = usr
if(C.legcuffed)
to_chat(C, "<span class='notice'>You are legcuffed! You cannot run until you get [C.legcuffed] removed!</span>")
C.m_intent = "walk" //Just incase
C.hud_used.move_intent.icon_state = "walking"
return 1
var/mob/living/L = usr
switch(L.m_intent)
if("run")
L.m_intent = "walk"
L.hud_used.move_intent.icon_state = "walking"
if("walk")
L.m_intent = "run"
L.hud_used.move_intent.icon_state = "running"
if("m_intent")
if(!usr.m_int)
switch(usr.m_intent)
if("run")
usr.m_int = "13,14"
if("walk")
usr.m_int = "14,14"
if("face")
usr.m_int = "15,14"
else
usr.m_int = null
if("walk")
usr.m_intent = "walk"
usr.m_int = "14,14"
if("face")
usr.m_intent = "face"
usr.m_int = "15,14"
if("run")
usr.m_intent = "run"
usr.m_int = "13,14"
if(iscarbon(usr))
var/mob/living/carbon/C = usr
if(C.legcuffed)
to_chat(C, "<span class='notice'>You are legcuffed! You cannot run until you get [C.legcuffed] removed!</span>")
C.set_move_intent(/decl/move_intent/walk) // Just incase.
return 1
else
var/next_move_intent = next_in_list(C.move_intent.type, C.move_intents)
C.set_move_intent(next_move_intent)
if("Reset Machine")
usr.unset_machine()
if("internal")