[MIRROR] improved robot HUD handling (#7381)

Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com>
Co-authored-by: CHOMPStation2 <chompsation2@gmail.com>
This commit is contained in:
CHOMPStation2
2023-12-09 16:32:40 -07:00
committed by GitHub
parent 4185f52a96
commit 8c8f025be3
3 changed files with 12 additions and 5 deletions

View File

@@ -217,13 +217,13 @@ var/obj/screen/robot_inventory
update_robot_modules_display()
/datum/hud/proc/update_robot_modules_display()
/datum/hud/proc/update_robot_modules_display(var/reset = FALSE)
if(!isrobot(mymob))
return
var/mob/living/silicon/robot/r = mymob
if(r.shown_robot_modules)
if(r.shown_robot_modules && !reset)
//Modules display is shown
//r.client.screen += robot_inventory //"store" icon
@@ -292,4 +292,4 @@ var/obj/screen/robot_inventory
return sprite_datum.sprite_hud_icon_state
if(modtype)
return lowertext(modtype)
return "nomod"
return "nomod"

View File

@@ -6,7 +6,7 @@
if(!check_rights(R_ADMIN))
return
if(!istype(target))
if(!istype(target) || !target.module)
return
if(!target.module.modules)
@@ -45,6 +45,7 @@
robot.module.contents.Remove(add_item)
target.module.modules.Add(add_item)
target.module.contents.Add(add_item)
target.hud_used.update_robot_modules_display()
to_chat(usr, "<span class='danger'>You added \"[add_item]\" to [target].</span>")
if(istype(add_item, /obj/item/stack/))
var/obj/item/stack/item_with_synth = add_item
@@ -94,6 +95,8 @@
if(!istype(selected_module_module, /obj/item/))
break
to_chat(usr, "<span class='danger'>You removed \"[selected_module_module]\" from [target]</span>")
target.uneq_all()
target.hud_used.update_robot_modules_display(TRUE)
target.module.emag.Remove(selected_module_module)
target.module.modules.Remove(selected_module_module)
target.module.contents.Remove(selected_module_module)

View File

@@ -349,6 +349,7 @@
hands.icon_state = get_hud_module_icon()
feedback_inc("cyborg_[lowertext(modtype)]",1)
updatename()
hud_used.update_robot_modules_display()
notify_ai(ROBOT_NOTIFICATION_NEW_MODULE, module.name)
/mob/living/silicon/robot/proc/update_braintype()
@@ -775,6 +776,7 @@
to_chat(usr, "<span class='filter_notice'>You apply the upgrade to [src]!</span>")
usr.drop_item()
U.loc = src
hud_used.update_robot_modules_display()
else
to_chat(usr, "<span class='filter_notice'>Upgrade error!</span>")
@@ -812,12 +814,13 @@
/mob/living/silicon/robot/proc/module_reset()
transform_with_anim() //VOREStation edit: sprite animation
uneq_all()
hud_used.update_robot_modules_display(TRUE)
modtype = initial(modtype)
hands.icon_state = get_hud_module_icon()
notify_ai(ROBOT_NOTIFICATION_MODULE_RESET, module.name)
module.Reset(src)
qdel(module)
module.Destroy()
module = null
updatename("Default")
@@ -1383,6 +1386,7 @@
laws.show_laws(src)
to_chat(src, "<span class='danger'>ALERT: [user.real_name] is your new master. Obey your new laws and [TU.his] commands.</span>")
update_icon()
hud_used.update_robot_modules_display()
else
to_chat(user, "<span class='filter_warning'>You fail to hack [src]'s interface.</span>")
to_chat(src, "<span class='filter_warning'>Hack attempt detected.</span>")