Reworks the exosuit tracking beacon (#18958)

* Reworks the exosuit tracking beacon

* Fixes tracker check
This commit is contained in:
Adri
2022-09-07 14:38:35 +02:00
committed by GitHub
parent ba802a199a
commit d8fed6808d
2 changed files with 41 additions and 9 deletions
+11 -2
View File
@@ -729,9 +729,18 @@
if(!user.unEquip(W))
to_chat(user, "<span class='notice'>\the [W] is stuck to your hand, you cannot put it in \the [src]</span>")
return
W.forceMove(src)
// 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>")
user.put_in_hands(new_tracker)
return
new_tracker.forceMove(src)
trackers += W
user.visible_message("[user] attaches [W] to [src].", "<span class='notice'>You attach [W] to [src].</span>")
user.visible_message("[user] attaches [new_tracker] to [src].", "<span class='notice'>You attach [new_tracker] to [src].</span>")
diag_hud_set_mechtracking()
return
+30 -7
View File
@@ -55,9 +55,14 @@
return TRUE
if("shock")
var/obj/item/mecha_parts/mecha_tracking/MT = locateUID(params["mt"])
if(istype(MT))
MT.shock()
return TRUE
if(!istype(MT))
return
// Is it sabotaged already?
var/error_message = MT.shock()
if(error_message)
atom_say(error_message)
return FALSE
return TRUE
if("get_log")
var/obj/item/mecha_parts/mecha_tracking/MT = locateUID(params["mt"])
if(istype(MT))
@@ -75,6 +80,7 @@
w_class = WEIGHT_CLASS_SMALL
origin_tech = "programming=2;magnets=2"
var/ai_beacon = FALSE //If this beacon allows for AI control. Exists to avoid using istype() on checking.
var/charges_left = 2
/obj/item/mecha_parts/mecha_tracking/proc/get_mecha_info()
if(!in_mecha())
@@ -154,11 +160,28 @@
return loc
return FALSE
// Makes the user lose control over the exosuit's coordination system.
// They can still move around and use tools, they just cannot tell the exosuit which way to go.
/obj/item/mecha_parts/mecha_tracking/proc/shock()
var/obj/mecha/M = in_mecha()
if(M)
M.emp_act(2)
qdel(src)
var/obj/mecha/mech = in_mecha()
var/error_message
if(!mech)
error_message = "This tracking beacon is no longer in an exosuit."
return error_message
if(mech.internal_damage & MECHA_INT_CONTROL_LOST)
error_message = "The exosuit's coordination system is not responding."
return error_message
mech.setInternalDamage(MECHA_INT_CONTROL_LOST)
if(mech.occupant)
mech.occupant_message("<span class='danger'>Coordination system calibration failure. Manual restart required.</span>")
SEND_SOUND(mech.occupant, sound('sound/machines/warning-buzzer.ogg'))
charges_left--
if(charges_left < 1)
qdel(src)
/obj/item/mecha_parts/mecha_tracking/proc/get_mecha_log()
if(!in_mecha())