Cyborg Inventory Refactor (#27788)

* Initial variable changes

* Add defines

* oh my god huds

* Removes update_items(), it seems useless but this might need reverting later

* the hud doesn't work but the inventory itself seems to

* Renames a var, gets inventory working properly

* Activation/Deactivation support, ore bag fixed

* Fixes CL and also this would have been a massive, hilarious bug

* Apply suggestions from code review

Dr and Lewc reviews

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Co-authored-by: Drsmail <60036448+Drsmail@users.noreply.github.com>
Signed-off-by: BiancaWilkson <42818125+BiancaWilkson@users.noreply.github.com>

* Update code/_onclick/hud/robot_hud.dm

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Signed-off-by: BiancaWilkson <42818125+BiancaWilkson@users.noreply.github.com>

* Fixes a comment

* Wait I forgot this worked like this for a reason

* Lewc Suggestions

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Signed-off-by: BiancaWilkson <42818125+BiancaWilkson@users.noreply.github.com>

* Burza Suggestions

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Signed-off-by: BiancaWilkson <42818125+BiancaWilkson@users.noreply.github.com>

---------

Signed-off-by: BiancaWilkson <42818125+BiancaWilkson@users.noreply.github.com>
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Co-authored-by: Drsmail <60036448+Drsmail@users.noreply.github.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
This commit is contained in:
BiancaWilkson
2025-02-12 21:55:11 +00:00
committed by GitHub
co-authored by Luc Drsmail Burzah
parent c895b91bb3
commit 4fdc79ca90
14 changed files with 250 additions and 308 deletions
+1 -1
View File
@@ -383,7 +383,7 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons
return
var/mob/living/silicon/robot/R = user
if(!R.low_power_mode) // Can't equip modules with an empty cell.
R.activate_module(src)
R.activate_item(src)
R.hud_used.update_robot_modules_display()
// Due to storage type consolidation this should get used more now.
@@ -179,17 +179,26 @@
. = ..()
if(listening_to == user)
return
begin_listening(src, user)
/obj/item/storage/bag/ore/proc/begin_listening(datum/source, mob/user) // Even though its unused, the datum/source argument is required to make the signals work.
SIGNAL_HANDLER // COMSIG_CYBORG_ITEM_ACTIVATED
if(listening_to)
UnregisterSignal(listening_to, COMSIG_MOVABLE_MOVED)
RegisterSignal(user, COMSIG_MOVABLE_MOVED, PROC_REF(pickup_ores))
listening_to = user
/obj/item/storage/bag/ore/dropped()
. = ..()
/obj/item/storage/bag/ore/proc/end_listening()
SIGNAL_HANDLER // COMSIG_CYBORG_ITEM_DEACTIVATED
if(listening_to)
UnregisterSignal(listening_to, COMSIG_MOVABLE_MOVED)
listening_to = null
/obj/item/storage/bag/ore/dropped()
. = ..()
end_listening()
/obj/item/storage/bag/ore/proc/pickup_ores(mob/living/user)
SIGNAL_HANDLER // COMSIG_MOVABLE_MOVED
var/turf/simulated/floor/plating/asteroid/tile = get_turf(user)
@@ -208,6 +217,16 @@
name = "cyborg mining satchel"
flags = NODROP
/obj/item/storage/bag/ore/cyborg/Initialize(mapload)
. = ..()
RegisterSignal(src, COMSIG_CYBORG_ITEM_ACTIVATED, PROC_REF(begin_listening))
RegisterSignal(src, COMSIG_CYBORG_ITEM_DEACTIVATED, PROC_REF(end_listening))
/obj/item/storage/bag/ore/cyborg/Destroy()
UnregisterSignal(src, COMSIG_CYBORG_ITEM_ACTIVATED)
UnregisterSignal(src, COMSIG_CYBORG_ITEM_DEACTIVATED)
return ..()
/// miners, your messiah has arrived
/obj/item/storage/bag/ore/holding
name = "mining satchel of holding"
@@ -50,12 +50,9 @@
R = user.get_inactive_hand()
else if(isrobot(user))
var/mob/living/silicon/robot/robouser = user
if(istype(robouser.module_state_1, /obj/item/stack/sheet/metal))
R = robouser.module_state_1
else if(istype(robouser.module_state_2, /obj/item/stack/sheet/metal))
R = robouser.module_state_2
else if(istype(robouser.module_state_3, /obj/item/stack/sheet/metal))
R = robouser.module_state_3
var/metal_slot = robouser.get_module_by_item(/obj/item/stack/sheet/metal)
if(metal_slot)
R = robouser.all_active_items[metal_slot]
if(!istype(R, /obj/item/stack/sheet/metal) || R.get_amount() < 2)
to_chat(user, "<span class='danger'>You also need to hold two sheets of metal to dismantle \the [src]!</span>")
+2 -2
View File
@@ -143,8 +143,8 @@
else if(isrobot(AM))
var/mob/living/silicon/robot/R = AM
if(istype(R.module_active, /obj/item/pickaxe))
attack_by(R.module_active, R)
if(istype(R.selected_item, /obj/item/pickaxe))
attack_by(R.selected_item, R)
else if(ismecha(AM))
var/obj/mecha/M = AM