mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-18 03:26:31 +01:00
Some uplink component GetComponent cleanup
This commit is contained in:
@@ -519,16 +519,11 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
if("Ringtone")
|
||||
var/t = input(U, "Please enter new ringtone", name, ttone) as text
|
||||
if(in_range(src, U) && loc == U && t)
|
||||
GET_COMPONENT(hidden_uplink, /datum/component/uplink)
|
||||
if(hidden_uplink && (trim(lowertext(t)) == trim(lowertext(lock_code))))
|
||||
hidden_uplink.locked = FALSE
|
||||
hidden_uplink.interact(U)
|
||||
to_chat(U, "The PDA softly beeps.")
|
||||
if(SEND_SIGNAL(src, COMSIG_PDA_CHANGE_RINGTONE, U, t) & COMPONENT_STOP_RINGTONE_CHANGE)
|
||||
U << browse(null, "window=pda")
|
||||
src.mode = 0
|
||||
return
|
||||
else
|
||||
t = copytext(sanitize(t), 1, 20)
|
||||
ttone = t
|
||||
ttone = copytext(sanitize(t), 1, 20)
|
||||
else
|
||||
U << browse(null, "window=pda")
|
||||
return
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
return BRUTELOSS
|
||||
|
||||
/obj/item/radio/proc/set_frequency(new_frequency)
|
||||
SEND_SIGNAL(src, COMSIG_RADIO_NEW_FREQUENCY, args)
|
||||
remove_radio(src, frequency)
|
||||
frequency = add_radio(src, new_frequency)
|
||||
|
||||
@@ -159,13 +160,7 @@
|
||||
tune = tune * 10
|
||||
. = TRUE
|
||||
if(.)
|
||||
frequency = sanitize_frequency(tune, freerange)
|
||||
set_frequency(frequency)
|
||||
GET_COMPONENT(hidden_uplink, /datum/component/uplink)
|
||||
if(hidden_uplink && (frequency == traitor_frequency))
|
||||
hidden_uplink.locked = FALSE
|
||||
hidden_uplink.interact(usr)
|
||||
ui.close()
|
||||
set_frequency(sanitize_frequency(tune, freerange))
|
||||
if("listen")
|
||||
listening = !listening
|
||||
. = TRUE
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
return
|
||||
|
||||
/obj/item/implant/proc/activate()
|
||||
return
|
||||
SEND_SIGNAL(src, COMSIG_IMPLANT_ACTIVATED)
|
||||
|
||||
/obj/item/implant/ui_action_click()
|
||||
activate("action_button")
|
||||
@@ -41,12 +41,26 @@
|
||||
//return 1 if the implant injects
|
||||
//return 0 if there is no room for implant / it fails
|
||||
/obj/item/implant/proc/implant(mob/living/target, mob/user, silent = FALSE)
|
||||
if(SEND_SIGNAL(src, COMSIG_IMPLANT_IMPLANTING, args) & COMPONENT_STOP_IMPLANTING)
|
||||
return
|
||||
LAZYINITLIST(target.implants)
|
||||
if(!target.can_be_implanted() || !can_be_implanted_in(target))
|
||||
return 0
|
||||
return FALSE
|
||||
for(var/X in target.implants)
|
||||
if(istype(X, type))
|
||||
var/obj/item/implant/imp_e = X
|
||||
var/obj/item/implant/imp_e = X
|
||||
var/flags = SEND_SIGNAL(imp_e, COMSIG_IMPLANT_OTHER, args, src)
|
||||
if(flags & COMPONENT_DELETE_NEW_IMPLANT)
|
||||
UNSETEMPTY(target.implants)
|
||||
qdel(src)
|
||||
return TRUE
|
||||
if(flags & COMPONENT_DELETE_OLD_IMPLANT)
|
||||
qdel(imp_e)
|
||||
continue
|
||||
if(flags & COMPONENT_STOP_IMPLANTING)
|
||||
UNSETEMPTY(target.implants)
|
||||
return FALSE
|
||||
|
||||
if(istype(imp_e, type))
|
||||
if(!allow_multiple)
|
||||
if(imp_e.uses < initial(imp_e.uses)*2)
|
||||
if(uses == -1)
|
||||
@@ -54,9 +68,9 @@
|
||||
else
|
||||
imp_e.uses = min(imp_e.uses + uses, initial(imp_e.uses)*2)
|
||||
qdel(src)
|
||||
return 1
|
||||
return TRUE
|
||||
else
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
forceMove(target)
|
||||
imp_in = target
|
||||
@@ -72,7 +86,7 @@
|
||||
if(user)
|
||||
add_logs(user, target, "implanted", "\a [name]")
|
||||
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/obj/item/implant/proc/removed(mob/living/source, silent = FALSE, special = 0)
|
||||
moveToNullspace()
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
var/cooldown = 30
|
||||
|
||||
/obj/item/implant/abductor/activate()
|
||||
. = ..()
|
||||
if(cooldown == initial(cooldown))
|
||||
home.Retrieve(imp_in,1)
|
||||
cooldown = 0
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
activate(reagents.total_volume)
|
||||
|
||||
/obj/item/implant/chem/activate(cause)
|
||||
. = ..()
|
||||
if(!cause || !imp_in)
|
||||
return 0
|
||||
var/mob/living/carbon/R = imp_in
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
return dat
|
||||
|
||||
/obj/item/implant/explosive/activate(cause)
|
||||
. = ..()
|
||||
if(!cause || !imp_in || active)
|
||||
return 0
|
||||
if(cause == "action_button" && !popup)
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
|
||||
/obj/item/implant/freedom/activate()
|
||||
. = ..()
|
||||
uses--
|
||||
to_chat(imp_in, "You feel a faint click.")
|
||||
if(iscarbon(imp_in))
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
return dat
|
||||
|
||||
/obj/item/implant/krav_maga/activate()
|
||||
. = ..()
|
||||
var/mob/living/carbon/human/H = imp_in
|
||||
if(!ishuman(H))
|
||||
return
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
return dat
|
||||
|
||||
/obj/item/implant/adrenalin/activate()
|
||||
. = ..()
|
||||
uses--
|
||||
to_chat(imp_in, "<span class='notice'>You feel a sudden surge of energy!</span>")
|
||||
imp_in.SetStun(0)
|
||||
@@ -54,6 +55,7 @@
|
||||
uses = 3
|
||||
|
||||
/obj/item/implant/emp/activate()
|
||||
. = ..()
|
||||
uses--
|
||||
empulse(imp_in, 3, 5)
|
||||
if(!uses)
|
||||
@@ -88,6 +90,7 @@
|
||||
icon_state = "walkietalkie"
|
||||
|
||||
/obj/item/implant/radio/activate()
|
||||
. = ..()
|
||||
// needs to be GLOB.deep_inventory_state otherwise it won't open
|
||||
radio.ui_interact(usr, "main", null, FALSE, null, GLOB.deep_inventory_state)
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
var/max_slot_stacking = 4
|
||||
|
||||
/obj/item/implant/storage/activate()
|
||||
. = ..()
|
||||
SEND_SIGNAL(src, COMSIG_TRY_STORAGE_SHOW, imp_in, TRUE)
|
||||
|
||||
/obj/item/implant/storage/removed(source, silent = FALSE, special = 0)
|
||||
|
||||
@@ -11,32 +11,6 @@
|
||||
. = ..()
|
||||
AddComponent(/datum/component/uplink, _owner, TRUE, FALSE, null, starting_tc)
|
||||
|
||||
/obj/item/implant/uplink/implant(mob/living/target, mob/user, silent = FALSE)
|
||||
GET_COMPONENT(hidden_uplink, /datum/component/uplink)
|
||||
if(hidden_uplink)
|
||||
for(var/X in target.implants)
|
||||
if(istype(X, type))
|
||||
var/obj/item/implant/imp_e = X
|
||||
GET_COMPONENT_FROM(their_hidden_uplink, /datum/component/uplink, imp_e)
|
||||
if(their_hidden_uplink)
|
||||
their_hidden_uplink.telecrystals += hidden_uplink.telecrystals
|
||||
qdel(src)
|
||||
return TRUE
|
||||
else
|
||||
qdel(imp_e) //INFERIOR AND EMPTY!
|
||||
|
||||
if(..())
|
||||
if(hidden_uplink)
|
||||
hidden_uplink.owner = "[user.key]"
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/item/implant/uplink/activate()
|
||||
GET_COMPONENT(hidden_uplink, /datum/component/uplink)
|
||||
if(hidden_uplink)
|
||||
hidden_uplink.locked = FALSE
|
||||
hidden_uplink.interact(usr)
|
||||
|
||||
/obj/item/implanter/uplink
|
||||
name = "implanter (uplink)"
|
||||
imp_type = /obj/item/implant/uplink
|
||||
|
||||
Reference in New Issue
Block a user