[READY]Refactors uplinks to a component!
This commit is contained in:
committed by
CitadelStationBot
parent
2e9f3bc1c0
commit
cec6c028f5
@@ -57,7 +57,6 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
|
||||
var/slowdown = 0 // How much clothing is slowing you down. Negative values speeds you up
|
||||
var/armour_penetration = 0 //percentage of armour effectiveness to remove
|
||||
var/list/allowed = null //suit storage stuff.
|
||||
var/obj/item/device/uplink/hidden_uplink = null
|
||||
var/equip_delay_self = 0 //In deciseconds, how long an item takes to equip; counts only for normal clothing slots, not pockets etc.
|
||||
var/equip_delay_other = 20 //In deciseconds, how long an item takes to put on another person
|
||||
var/strip_delay = 40 //In deciseconds, how long an item takes to remove from another person
|
||||
@@ -224,9 +223,6 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
|
||||
|
||||
/obj/item/interact(mob/user)
|
||||
add_fingerprint(user)
|
||||
if(hidden_uplink && hidden_uplink.active)
|
||||
hidden_uplink.interact(user)
|
||||
return 1
|
||||
ui_interact(user)
|
||||
|
||||
/obj/item/ui_act(action, params)
|
||||
|
||||
@@ -155,15 +155,20 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
return
|
||||
|
||||
/obj/item/device/pda/attack_self(mob/user)
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
if(!user.IsAdvancedToolUser())
|
||||
to_chat(user, "<span class='warning'>You don't have the dexterity to do this!</span>")
|
||||
return
|
||||
|
||||
. = ..()
|
||||
|
||||
>>>>>>> ccd4981... Merge pull request #32624 from kevinz000/component_uplinks
|
||||
var/datum/asset/assets = get_asset_datum(/datum/asset/simple/pda)
|
||||
assets.send(user)
|
||||
|
||||
user.set_machine(src)
|
||||
|
||||
if(hidden_uplink && hidden_uplink.active)
|
||||
hidden_uplink.interact(user)
|
||||
return
|
||||
|
||||
var/dat = "<!DOCTYPE html><html><head><title>Personal Data Assistant</title><link href=\"https://fonts.googleapis.com/css?family=Orbitron|Share+Tech+Mono|VT323\" rel=\"stylesheet\"></head><body bgcolor=\"" + background_color + "\"><style>body{" + font_mode + "}ul,ol{list-style-type: none;}a, a:link, a:visited, a:active, a:hover { color: #000000;text-decoration:none; }img {border-style:none;}a img{padding-right: 9px;}</style>"
|
||||
|
||||
|
||||
@@ -496,7 +501,9 @@ 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.")
|
||||
U << browse(null, "window=pda")
|
||||
@@ -822,8 +829,6 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
var/obj/item/photo/P = C
|
||||
photo = P.img
|
||||
to_chat(user, "<span class='notice'>You scan \the [C].</span>")
|
||||
else if(hidden_uplink && hidden_uplink.active)
|
||||
hidden_uplink.attackby(C, user, params)
|
||||
else
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
/obj/item/cartridge/virus/message_header()
|
||||
return "<b>[charges] viral files left.</b><HR>"
|
||||
|
||||
|
||||
/obj/item/cartridge/virus/message_special(obj/item/device/pda/target)
|
||||
if (!istype(loc, /obj/item/device/pda))
|
||||
return "" //Sanity check, this shouldn't be possible.
|
||||
@@ -67,11 +67,12 @@
|
||||
var/difficulty = 0
|
||||
if(target.cartridge)
|
||||
difficulty += BitCount(target.cartridge.access&(CART_MEDICAL | CART_SECURITY | CART_ENGINE | CART_CLOWN | CART_JANITOR | CART_MANIFEST))
|
||||
if(target.cartridge.access & CART_MANIFEST)
|
||||
if(target.cartridge.access & CART_MANIFEST)
|
||||
difficulty++ //if cartridge has manifest access it has extra snowflake difficulty
|
||||
else
|
||||
difficulty += 2
|
||||
if(!target.detonatable || prob(difficulty * 15) || (target.hidden_uplink))
|
||||
GET_COMPONENT_FROM(hidden_uplink, /datum/component/uplink, target)
|
||||
if(!target.detonatable || prob(difficulty * 15) || (hidden_uplink))
|
||||
U.show_message("<span class='danger'>An error flashes on your [src].</span>", 1)
|
||||
else
|
||||
U.show_message("<span class='notice'>Success!</span>", 1)
|
||||
@@ -92,14 +93,14 @@
|
||||
charges--
|
||||
var/lock_code = "[rand(100,999)] [pick(GLOB.phonetic_alphabet)]"
|
||||
to_chat(U, "<span class='notice'>Virus Sent! The unlock code to the target is: [lock_code]</span>")
|
||||
if(!target.hidden_uplink)
|
||||
var/obj/item/device/uplink/uplink = new(target)
|
||||
target.hidden_uplink = uplink
|
||||
GET_COMPONENT_FROM(hidden_uplink, /datum/component/uplink, target)
|
||||
if(!hidden_uplink)
|
||||
hidden_uplink = target.LoadComponent(/datum/component/uplink)
|
||||
target.lock_code = lock_code
|
||||
else
|
||||
target.hidden_uplink.hidden_crystals += target.hidden_uplink.telecrystals //Temporarially hide the PDA's crystals, so you can't steal telecrystals.
|
||||
target.hidden_uplink.telecrystals = telecrystals
|
||||
hidden_uplink.hidden_crystals += hidden_uplink.telecrystals //Temporarially hide the PDA's crystals, so you can't steal telecrystals.
|
||||
hidden_uplink.telecrystals = telecrystals
|
||||
telecrystals = 0
|
||||
target.hidden_uplink.active = TRUE
|
||||
hidden_uplink.active = TRUE
|
||||
else
|
||||
to_chat(U, "PDA not found.")
|
||||
|
||||
@@ -155,7 +155,9 @@
|
||||
if(.)
|
||||
frequency = sanitize_frequency(tune, freerange)
|
||||
set_frequency(frequency)
|
||||
if(frequency == traitor_frequency && hidden_uplink)
|
||||
GET_COMPONENT(hidden_uplink, /datum/component/uplink)
|
||||
if(hidden_uplink && (frequency == traitor_frequency))
|
||||
hidden_uplink.locked = FALSE
|
||||
hidden_uplink.interact(usr)
|
||||
ui.close()
|
||||
if("listen")
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
// A collection of pre-set uplinks, for admin spawns.
|
||||
/obj/item/device/radio/uplink/Initialize(mapload, _owner, _tc_amount = 20)
|
||||
. = ..()
|
||||
icon_state = "radio"
|
||||
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
|
||||
LoadComponent(/datum/component/uplink, _owner, FALSE, TRUE, null, _tc_amount)
|
||||
|
||||
/obj/item/device/radio/uplink/nuclear/Initialize()
|
||||
. = ..()
|
||||
GET_COMPONENT(hidden_uplink, /datum/component/uplink)
|
||||
hidden_uplink.set_gamemode(/datum/game_mode/nuclear)
|
||||
|
||||
/obj/item/device/multitool/uplink/Initialize(mapload, _owner, _tc_amount = 20)
|
||||
. = ..()
|
||||
LoadComponent(/datum/component/uplink, _owner, FALSE, TRUE, null, _tc_amount)
|
||||
|
||||
/obj/item/pen/uplink/Initialize(mapload, _owner, _tc_amount = 20)
|
||||
. = ..()
|
||||
LoadComponent(/datum/component/uplink)
|
||||
traitor_unlock_degrees = 360
|
||||
|
||||
/obj/item/device/radio/uplink/old
|
||||
name = "dusty radio"
|
||||
desc = "A dusty looking radio."
|
||||
|
||||
/obj/item/device/radio/uplink/old/Initialize(mapload, _owner, _tc_amount = 10)
|
||||
. = ..()
|
||||
GET_COMPONENT(hidden_uplink, /datum/component/uplink)
|
||||
hidden_uplink.name = "dusty radio"
|
||||
@@ -1,3 +1,4 @@
|
||||
<<<<<<< HEAD
|
||||
/obj/item/implant/uplink
|
||||
name = "uplink implant"
|
||||
desc = "Sneeki breeki."
|
||||
@@ -40,3 +41,53 @@
|
||||
|
||||
/obj/item/implant/uplink/precharged
|
||||
starting_tc = 10
|
||||
=======
|
||||
/obj/item/implant/uplink
|
||||
name = "uplink implant"
|
||||
desc = "Sneeki breeki."
|
||||
icon = 'icons/obj/radio.dmi'
|
||||
icon_state = "radio"
|
||||
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
|
||||
var/starting_tc = 0
|
||||
|
||||
/obj/item/implant/uplink/Initialize(mapload, _owner)
|
||||
. = ..()
|
||||
LoadComponent(/datum/component/uplink, _owner, TRUE, FALSE, null, starting_tc)
|
||||
|
||||
/obj/item/implant/uplink/implant(mob/living/target, mob/user, silent = 0)
|
||||
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.interact(usr)
|
||||
|
||||
/obj/item/implanter/uplink
|
||||
name = "implanter (uplink)"
|
||||
imp_type = /obj/item/implant/uplink
|
||||
|
||||
/obj/item/implanter/uplink/precharged
|
||||
name = "implanter (precharged uplink)"
|
||||
imp_type = /obj/item/implant/uplink/precharged
|
||||
|
||||
/obj/item/implant/uplink/precharged
|
||||
starting_tc = 10
|
||||
>>>>>>> ccd4981... Merge pull request #32624 from kevinz000/component_uplinks
|
||||
|
||||
@@ -13,18 +13,16 @@
|
||||
if(target == user) //You can't go around smacking people with crystals to find out if they have an uplink or not.
|
||||
for(var/obj/item/implant/uplink/I in target)
|
||||
if(I && I.imp_in)
|
||||
I.hidden_uplink.telecrystals += amount
|
||||
use(amount)
|
||||
to_chat(user, "<span class='notice'>You press [src] onto yourself and charge your hidden uplink.</span>")
|
||||
GET_COMPONENT_FROM(hidden_uplink, /datum/component/uplink, I)
|
||||
if(hidden_uplink)
|
||||
hidden_uplink.telecrystals += amount
|
||||
use(amount)
|
||||
to_chat(user, "<span class='notice'>You press [src] onto yourself and charge your hidden uplink.</span>")
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/stack/telecrystal/afterattack(obj/item/I, mob/user, proximity)
|
||||
if(!proximity)
|
||||
return
|
||||
if(isitem(I) && I.hidden_uplink && I.hidden_uplink.active) //No metagaming by using this on every PDA around just to see if it gets used up.
|
||||
I.hidden_uplink.telecrystals += amount
|
||||
use(amount)
|
||||
to_chat(user, "<span class='notice'>You slot [src] into [I] and charge its internal uplink.</span>")
|
||||
else if(istype(I, /obj/item/cartridge/virus/frame))
|
||||
if(istype(I, /obj/item/cartridge/virus/frame))
|
||||
var/obj/item/cartridge/virus/frame/cart = I
|
||||
if(!cart.charges)
|
||||
to_chat(user, "<span class='notice'>[cart] is out of charges, it's refusing to accept [src].</span>")
|
||||
@@ -32,6 +30,8 @@
|
||||
cart.telecrystals += amount
|
||||
use(amount)
|
||||
to_chat(user, "<span class='notice'>You slot [src] into [cart]. The next time it's used, it will also give telecrystals.</span>")
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/stack/telecrystal/five
|
||||
amount = 5
|
||||
|
||||
Reference in New Issue
Block a user