From 4ad066c70b71ab88e90fcff356cc44ec7448ce6d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A1=D0=B8=D1=80=D0=BE=D1=82=D0=BA=D0=B0?=
<114731039+ErdGinalD@users.noreply.github.com>
Date: Mon, 22 Jan 2024 00:04:28 +0300
Subject: [PATCH] REFACTOR: Mecha icon_state (#23693)
* REFACTOR: Mecha icon_state
* oopc
* Update code/game/mecha/mecha.dm
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
* Update code/game/mecha/mecha.dm
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
---------
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
---
code/game/mecha/mecha.dm | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm
index 2fb25b4111f..217f9531a5b 100644
--- a/code/game/mecha/mecha.dm
+++ b/code/game/mecha/mecha.dm
@@ -355,7 +355,7 @@
if(phasing && get_charge() >= phasing_energy_drain)
if(can_move < world.time)
. = FALSE // We lie to mech code and say we didn't get to move, because we want to handle power usage + cooldown ourself
- flick("phazon-phase", src)
+ flick("[initial_icon]-phase", src)
forceMove(get_step(src, direction))
use_power(phasing_energy_drain)
playsound(src, stepsound, 40, 1)
@@ -614,7 +614,7 @@
/obj/mecha/handle_atom_del(atom/A)
if(A == occupant)
occupant = null
- icon_state = initial(icon_state)+"-open"
+ icon_state = reset_icon(icon_state)+"-open"
setDir(dir_in)
if(A in trackers)
trackers -= A
@@ -777,14 +777,13 @@
return
user.visible_message("[user] opens [P] and spends some quality time customising [src].")
-
- name = P.new_name
- desc = P.new_desc
- initial_icon = P.new_icon
- reset_icon()
-
- user.drop_item()
- qdel(P)
+ if(do_after_once(user, 3 SECONDS, target = src))
+ name = P.new_name
+ desc = P.new_desc
+ initial_icon = P.new_icon
+ reset_icon()
+ user.drop_item()
+ qdel(P)
else if(istype(W, /obj/item/mecha_modkit))
if(occupant)
@@ -959,7 +958,7 @@
occupant = null
AI.controlled_mech = null
AI.remote_control = null
- icon_state = initial(icon_state)+"-open"
+ icon_state = reset_icon(icon_state)+"-open"
to_chat(AI, "You have been downloaded to a mobile storage device. Wireless connection offline.")
to_chat(user, "Transfer successful: [AI.name] ([rand(1000,9999)].exe) removed from [name] and stored within local memory.")
@@ -993,7 +992,7 @@
AI.aiRestorePowerRoutine = 0
AI.forceMove(src)
occupant = AI
- icon_state = initial(icon_state)
+ icon_state = reset_icon(icon_state)
playsound(src, 'sound/machines/windowdoor.ogg', 50, 1)
if(!hasInternalDamage())
SEND_SOUND(occupant, sound(nominalsound, volume = 50))
@@ -1304,7 +1303,7 @@
var/obj/item/mmi/robotic_brain/R = mmi
if(R.imprinted_master)
to_chat(L, "Imprint re-enabled, you are once again bound to [R.imprinted_master]'s commands.")
- icon_state = initial(icon_state)+"-open"
+ icon_state = reset_icon(icon_state)+"-open"
dir = dir_in
if(L && L.client)
@@ -1413,7 +1412,7 @@
if(initial_icon)
icon_state = initial_icon
else
- icon_state = initial(icon_state)
+ icon_state = reset_icon(icon_state)
return icon_state
//////////////////////////////////////////
@@ -1536,6 +1535,7 @@
AI = occupant
occupant = null
var/obj/structure/mecha_wreckage/WR = new wreckage(loc, AI)
+ WR.icon_state = "[reset_icon(loc, AI)]-broken"
for(var/obj/item/mecha_parts/mecha_equipment/E in equipment)
if(E.salvageable && prob(30))
WR.crowbar_salvage += E