Fix duplicate tracking beacon issue (#23508)

* Fix duplicate tracking beacon issue

emoved the possibility of having both an AI tracking beacon and a standard one, ensuring that the "tracking" can no longer appear twice in the "robotic control console".
Whenever someone add a different tracking to a mech, the old one is returned upon the player hand while the new one is within the mech.

* Update code/game/mecha/mecha.dm

Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com>

---------

Co-authored-by: Pierre-Louis <hernandezpierrelouis@protonmail.com>
Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com>
This commit is contained in:
Pierre-Louis
2024-01-06 21:38:35 +00:00
committed by GitHub
co-authored by S34N Pierre-Louis
parent c44231e9e1
commit 5627b5bbc9
+7 -2
View File
@@ -743,11 +743,16 @@
// Check if a tracker exists
var/obj/item/mecha_parts/mecha_tracking/new_tracker = W
for(var/obj/item/mecha_parts/mecha_tracking/current_tracker in trackers)
if(new_tracker.ai_beacon == current_tracker.ai_beacon)
to_chat(user, "<span class='warning'>This exosuit already has \a [new_tracker.ai_beacon ? "AI" : "tracking"] beacon.</span>")
if(new_tracker.type == current_tracker.type)
to_chat(user, "<span class='warning'>This exosuit already has a [current_tracker].</span>")
user.put_in_hands(new_tracker)
return
trackers -= current_tracker
to_chat(user, "<span class='notice'>You remove [current_tracker].</span>")
var/obj/item/mecha_parts/mecha_tracking/duplicate_tracker = new current_tracker.type
user.put_in_hands(duplicate_tracker)
qdel(current_tracker)
new_tracker.forceMove(src)
trackers += W
user.visible_message("[user] attaches [new_tracker] to [src].", "<span class='notice'>You attach [new_tracker] to [src].</span>")