Merge branch 'master' of https://github.com/Citadel-Station-13/Citadel-Station-13 into station_traits
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
expire = _expire
|
||||
|
||||
/datum/component/anti_magic/proc/on_equip(datum/source, mob/equipper, slot)
|
||||
if(!(allowed_slots & slotdefine2slotbit(slot))) //Check that the slot is valid for antimagic
|
||||
if(!(allowed_slots & slot)) //Check that the slot is valid for antimagic
|
||||
UnregisterSignal(equipper, COMSIG_MOB_RECEIVE_MAGIC)
|
||||
return
|
||||
RegisterSignal(equipper, COMSIG_MOB_RECEIVE_MAGIC, .proc/protect, TRUE)
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
///Allows you to set a theme for a set of areas without tying them to looping sounds explicitly
|
||||
/datum/component/area_sound_manager
|
||||
///area -> looping sound type
|
||||
var/list/area_to_looping_type = list()
|
||||
///Current sound loop
|
||||
var/datum/looping_sound/our_loop
|
||||
///A list of "acceptable" z levels to be on. If you leave this, we're gonna delete ourselves
|
||||
var/list/accepted_zs
|
||||
///The timer id of our current start delay, if it exists
|
||||
var/timerid
|
||||
|
||||
/datum/component/area_sound_manager/Initialize(area_loop_pairs, change_on, remove_on, acceptable_zs)
|
||||
if(!ismovable(parent))
|
||||
return
|
||||
area_to_looping_type = area_loop_pairs
|
||||
accepted_zs = acceptable_zs
|
||||
change_the_track()
|
||||
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, .proc/react_to_move)
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_Z_CHANGED, .proc/react_to_z_move)
|
||||
RegisterSignal(parent, change_on, .proc/handle_change)
|
||||
RegisterSignal(parent, remove_on, .proc/handle_removal)
|
||||
|
||||
/datum/component/area_sound_manager/Destroy(force, silent)
|
||||
QDEL_NULL(our_loop)
|
||||
. = ..()
|
||||
|
||||
/datum/component/area_sound_manager/proc/react_to_move(datum/source, atom/oldloc, dir, forced)
|
||||
SIGNAL_HANDLER
|
||||
var/list/loop_lookup = area_to_looping_type
|
||||
if(loop_lookup[get_area(oldloc)] == loop_lookup[get_area(parent)])
|
||||
return
|
||||
change_the_track(TRUE)
|
||||
|
||||
/datum/component/area_sound_manager/proc/react_to_z_move(datum/source, old_z, new_z)
|
||||
SIGNAL_HANDLER
|
||||
if(!length(accepted_zs) || (new_z in accepted_zs))
|
||||
return
|
||||
qdel(src)
|
||||
|
||||
/datum/component/area_sound_manager/proc/handle_removal(datum/source)
|
||||
SIGNAL_HANDLER
|
||||
qdel(src)
|
||||
|
||||
/datum/component/area_sound_manager/proc/handle_change(datum/source)
|
||||
SIGNAL_HANDLER
|
||||
change_the_track()
|
||||
|
||||
/datum/component/area_sound_manager/proc/change_the_track(skip_start = FALSE)
|
||||
var/time_remaining = 0
|
||||
|
||||
if(our_loop)
|
||||
var/our_id = our_loop.timerid || timerid
|
||||
if(our_id)
|
||||
time_remaining = timeleft(our_id, SSsound_loops) || 0
|
||||
//Time left will sometimes return negative values, just ignore them and start a new sound loop now
|
||||
time_remaining = max(time_remaining, 0)
|
||||
QDEL_NULL(our_loop)
|
||||
|
||||
var/area/our_area = get_area(parent)
|
||||
var/new_loop_type = area_to_looping_type[our_area]
|
||||
if(!new_loop_type)
|
||||
return
|
||||
|
||||
our_loop = new new_loop_type(parent, FALSE, TRUE, skip_start)
|
||||
|
||||
//If we're still playing, wait a bit before changing the sound so we don't double up
|
||||
if(time_remaining)
|
||||
timerid = addtimer(CALLBACK(src, .proc/start_looping_sound), time_remaining, TIMER_UNIQUE | TIMER_CLIENT_TIME | TIMER_STOPPABLE | TIMER_NO_HASH_WAIT | TIMER_DELETE_ME, SSsound_loops)
|
||||
return
|
||||
timerid = null
|
||||
our_loop.start()
|
||||
|
||||
/datum/component/area_sound_manager/proc/start_looping_sound()
|
||||
timerid = null
|
||||
if(our_loop)
|
||||
our_loop.start()
|
||||
@@ -1,19 +1,3 @@
|
||||
/datum/crafting_recipe/pin_removal
|
||||
name = "Pin Removal"
|
||||
result = /obj/item/gun
|
||||
reqs = list(/obj/item/gun = 1)
|
||||
parts = list(/obj/item/gun = 1)
|
||||
tools = list(TOOL_WELDER, TOOL_SCREWDRIVER, TOOL_WIRECUTTER)
|
||||
time = 50
|
||||
category = CAT_WEAPONRY
|
||||
subcategory = CAT_OTHER
|
||||
|
||||
/datum/crafting_recipe/pin_removal/check_requirements(mob/user, list/collected_requirements)
|
||||
var/obj/item/gun/G = collected_requirements[/obj/item/gun][1]
|
||||
if (G.no_pin_required || !G.pin)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/datum/crafting_recipe/strobeshield
|
||||
name = "Strobe Shield"
|
||||
result = /obj/item/shield/riot/flash
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
var/filter_size
|
||||
var/filter_color
|
||||
|
||||
/datum/component/wearertargeting/phantomthief/Initialize(_x = -2, _y = 0, _size = 0, _color = "#E62111", list/_valid_slots = list(SLOT_GLASSES))
|
||||
/datum/component/wearertargeting/phantomthief/Initialize(_x = -2, _y = 0, _size = 0, _color = "#E62111", list/_valid_slots = list(ITEM_SLOT_EYES))
|
||||
. = ..()
|
||||
if(. == COMPONENT_INCOMPATIBLE)
|
||||
return
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
SSvis_overlays.add_vis_overlay(holder, 'icons/effects/effects.dmi', to_add, layer, GAME_PLANE, holder.dir)
|
||||
|
||||
/datum/component/shielded/proc/on_equip(obj/item/source, mob/living/equipper, slot)
|
||||
if(!(accepted_slots & slotdefine2slotbit(slot)))
|
||||
if(!(accepted_slots & slot))
|
||||
return
|
||||
holder = equipper
|
||||
RegisterSignal(parent, COMSIG_ITEM_RUN_BLOCK, .proc/on_run_block)
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
/datum/component/storage/concrete/_insert_physical_item(obj/item/I, override = FALSE)
|
||||
. = TRUE
|
||||
var/atom/real_location = real_location()
|
||||
if(I.loc != real_location && real_location)
|
||||
if(real_location && I.loc != real_location)
|
||||
I.forceMove(real_location)
|
||||
refresh_mob_views()
|
||||
|
||||
@@ -95,16 +95,19 @@
|
||||
return FALSE
|
||||
|
||||
/datum/component/storage/concrete/proc/on_contents_del(datum/source, atom/A)
|
||||
SIGNAL_HANDLER
|
||||
var/atom/real_location = parent
|
||||
if(A in real_location)
|
||||
usr = null
|
||||
remove_from_storage(A, null)
|
||||
|
||||
/datum/component/storage/concrete/proc/on_deconstruct(datum/source, disassembled)
|
||||
SIGNAL_HANDLER
|
||||
if(drop_all_on_deconstruct)
|
||||
do_quick_empty()
|
||||
|
||||
/datum/component/storage/concrete/proc/on_break(datum/source, damage_flag)
|
||||
SIGNAL_HANDLER
|
||||
if(drop_all_on_break)
|
||||
do_quick_empty()
|
||||
if(unlock_on_break)
|
||||
@@ -131,14 +134,16 @@
|
||||
var/list/seeing_mobs = can_see_contents()
|
||||
for(var/mob/M in seeing_mobs)
|
||||
M.client.screen -= AM
|
||||
if(ismob(parent.loc) && isitem(AM))
|
||||
var/obj/item/I = AM
|
||||
var/mob/M = parent.loc
|
||||
I.dropped(M)
|
||||
I.item_flags &= ~IN_STORAGE
|
||||
I.remove_outline()
|
||||
if(isitem(AM))
|
||||
var/obj/item/removed_item = AM
|
||||
removed_item.item_flags &= ~IN_STORAGE
|
||||
if(ismob(parent.loc))
|
||||
var/mob/carrying_mob = parent.loc
|
||||
removed_item.dropped(carrying_mob, TRUE)
|
||||
if(new_location)
|
||||
AM.forceMove(new_location) // exited comsig will handle removal reset.
|
||||
//Reset the items values
|
||||
_removal_reset(AM)
|
||||
AM.forceMove(new_location)
|
||||
//We don't want to call this if the item is being destroyed
|
||||
AM.on_exit_storage(src)
|
||||
else
|
||||
@@ -147,7 +152,7 @@
|
||||
refresh_mob_views()
|
||||
if(isobj(parent))
|
||||
var/obj/O = parent
|
||||
O.update_icon()
|
||||
O.update_appearance()
|
||||
return TRUE
|
||||
|
||||
/datum/component/storage/concrete/proc/slave_can_insert_object(datum/component/storage/slave, obj/item/I, stop_messages = FALSE, mob/M)
|
||||
@@ -158,7 +163,7 @@
|
||||
if(. && !prevent_warning)
|
||||
slave.mob_item_insertion_feedback(usr, M, I)
|
||||
|
||||
/datum/component/storage/concrete/handle_item_insertion(obj/item/I, prevent_warning = FALSE, mob/M, datum/component/storage/remote) //Remote is null or the slave datum
|
||||
/datum/component/storage/concrete/handle_item_insertion(obj/item/I, prevent_warning = FALSE, mob/M, datum/component/storage/remote) //Remote is null or the slave datum
|
||||
var/datum/component/storage/concrete/master = master()
|
||||
var/atom/parent = src.parent
|
||||
var/moved = FALSE
|
||||
@@ -168,7 +173,7 @@
|
||||
if(!M.temporarilyRemoveItemFromInventory(I))
|
||||
return FALSE
|
||||
else
|
||||
moved = TRUE //At this point if the proc fails we need to manually move the object back to the turf/mob/whatever.
|
||||
moved = TRUE //At this point if the proc fails we need to manually move the object back to the turf/mob/whatever.
|
||||
if(I.pulledby)
|
||||
I.pulledby.stop_pulling()
|
||||
if(silent)
|
||||
@@ -203,7 +208,7 @@
|
||||
/datum/component/storage/concrete/update_icon()
|
||||
if(isobj(parent))
|
||||
var/obj/O = parent
|
||||
O.update_icon()
|
||||
O.update_appearance()
|
||||
for(var/i in slaves)
|
||||
var/datum/component/storage/slave = i
|
||||
slave.update_icon()
|
||||
|
||||
@@ -418,38 +418,38 @@
|
||||
return TRUE
|
||||
|
||||
/datum/component/storage/proc/mousedrop_onto(datum/source, atom/over_object, mob/M)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
set waitfor = FALSE
|
||||
. = COMPONENT_NO_MOUSEDROP
|
||||
if(!ismob(M))
|
||||
return
|
||||
if(!over_object)
|
||||
return
|
||||
if(ismecha(M.loc)) // stops inventory actions in a mech
|
||||
return
|
||||
if(M.incapacitated() || !M.canUseStorage())
|
||||
return
|
||||
var/atom/A = parent
|
||||
if(ismob(M)) //all the check for item manipulation are in other places, you can safely open any storages as anything and its not buggy, i checked
|
||||
A.add_fingerprint(M)
|
||||
if(istype(A, /obj/item))
|
||||
var/obj/item/I = A
|
||||
I.remove_outline() //Removes the outline when we drag
|
||||
if(!over_object)
|
||||
return FALSE
|
||||
if(ismecha(M.loc)) // stops inventory actions in a mech
|
||||
return FALSE
|
||||
// this must come before the screen objects only block, dunno why it wasn't before
|
||||
if(over_object == M)
|
||||
user_show_to_mob(M, trigger_on_found = TRUE)
|
||||
return
|
||||
if(isrevenant(M))
|
||||
RevenantThrow(over_object, M, source)
|
||||
return
|
||||
if(!M.incapacitated())
|
||||
if(!istype(over_object, /atom/movable/screen))
|
||||
dump_content_at(over_object, M)
|
||||
return
|
||||
if(A.loc != M)
|
||||
return
|
||||
playsound(A, "rustle", 50, 1, -5)
|
||||
A.do_jiggle()
|
||||
if(istype(over_object, /atom/movable/screen/inventory/hand))
|
||||
var/atom/movable/screen/inventory/hand/H = over_object
|
||||
M.putItemFromInventoryInHandIfPossible(A, H.held_index)
|
||||
return
|
||||
A.add_fingerprint(M)
|
||||
A.add_fingerprint(M)
|
||||
// this must come before the screen objects only block, dunno why it wasn't before
|
||||
if(over_object == M)
|
||||
user_show_to_mob(M, trigger_on_found = TRUE)
|
||||
if(isrevenant(M))
|
||||
INVOKE_ASYNC(GLOBAL_PROC, .proc/RevenantThrow, over_object, M, source)
|
||||
return
|
||||
if(!istype(over_object, /atom/movable/screen))
|
||||
INVOKE_ASYNC(src, .proc/dump_content_at, over_object, M)
|
||||
return
|
||||
if(A.loc != M)
|
||||
return
|
||||
playsound(A, "rustle", 50, TRUE, -5)
|
||||
A.do_jiggle()
|
||||
if(istype(over_object, /atom/movable/screen/inventory/hand))
|
||||
var/atom/movable/screen/inventory/hand/H = over_object
|
||||
M.putItemFromInventoryInHandIfPossible(A, H.held_index)
|
||||
return
|
||||
A.add_fingerprint(M)
|
||||
|
||||
/datum/component/storage/proc/user_show_to_mob(mob/M, force = FALSE, trigger_on_found = FALSE)
|
||||
var/atom/A = parent
|
||||
|
||||
@@ -370,7 +370,7 @@
|
||||
user.emote("scream")
|
||||
user.gain_trauma(/datum/brain_trauma/severe/paralysis/spinesnapped) // oopsie indeed!
|
||||
shake_camera(user, 7, 7)
|
||||
user.overlay_fullscreen("flash", /atom/movable/screen/fullscreen/flash)
|
||||
user.overlay_fullscreen("flash", /atom/movable/screen/fullscreen/tiled/flash)
|
||||
user.clear_fullscreen("flash", 4.5)
|
||||
|
||||
if(94 to 98)
|
||||
@@ -381,7 +381,7 @@
|
||||
user.gain_trauma_type(BRAIN_TRAUMA_MILD)
|
||||
user.playsound_local(get_turf(user), 'sound/weapons/flashbang.ogg', 100, TRUE, 8, 0.9)
|
||||
shake_camera(user, 6, 6)
|
||||
user.overlay_fullscreen("flash", /atom/movable/screen/fullscreen/flash)
|
||||
user.overlay_fullscreen("flash", /atom/movable/screen/fullscreen/tiled/flash)
|
||||
user.clear_fullscreen("flash", 3.5)
|
||||
|
||||
if(84 to 93)
|
||||
@@ -394,7 +394,7 @@
|
||||
user.playsound_local(get_turf(user), 'sound/weapons/flashbang.ogg', 100, TRUE, 8, 0.9)
|
||||
user.DefaultCombatKnockdown(40)
|
||||
shake_camera(user, 5, 5)
|
||||
user.overlay_fullscreen("flash", /atom/movable/screen/fullscreen/flash)
|
||||
user.overlay_fullscreen("flash", /atom/movable/screen/fullscreen/tiled/flash)
|
||||
user.clear_fullscreen("flash", 2.5)
|
||||
|
||||
if(64 to 83)
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
|
||||
/// Triggered on equip of the item containing the component
|
||||
/datum/component/two_handed/proc/on_equip(datum/source, mob/user, slot)
|
||||
if(require_twohands && slot == SLOT_HANDS) // force equip the item
|
||||
if(require_twohands && slot == ITEM_SLOT_HANDS) // force equip the item
|
||||
wield(user)
|
||||
if(!user.is_holding(parent) && wielded && !require_twohands)
|
||||
unwield(user)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
GLOBAL_LIST_EMPTY(uplinks)
|
||||
#define PEN_ROTATIONS 2
|
||||
|
||||
/**
|
||||
* Uplinks
|
||||
@@ -17,7 +18,7 @@ GLOBAL_LIST_EMPTY(uplinks)
|
||||
var/telecrystals
|
||||
var/selected_cat
|
||||
var/owner = null
|
||||
var/datum/game_mode/gamemode
|
||||
var/uplink_flag
|
||||
var/datum/uplink_purchase_log/purchase_log
|
||||
var/list/uplink_items
|
||||
var/hidden_crystals = 0
|
||||
@@ -26,11 +27,11 @@ GLOBAL_LIST_EMPTY(uplinks)
|
||||
var/failsafe_code
|
||||
var/compact_mode = FALSE
|
||||
var/debug = FALSE
|
||||
var/saved_player_population = 0
|
||||
var/list/filters = list()
|
||||
///Instructions on how to access the uplink based on location
|
||||
var/unlock_text
|
||||
var/list/previous_attempts
|
||||
|
||||
|
||||
/datum/component/uplink/Initialize(_owner, _lockable = TRUE, _enabled = FALSE, datum/game_mode/_gamemode, starting_tc = 20, datum/traitor_class/traitor_class)
|
||||
/datum/component/uplink/Initialize(_owner, _lockable = TRUE, _enabled = FALSE, uplink_flag = UPLINK_TRAITORS, starting_tc = TELECRYSTALS_DEFAULT)
|
||||
if(!isitem(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
|
||||
@@ -44,16 +45,13 @@ GLOBAL_LIST_EMPTY(uplinks)
|
||||
RegisterSignal(parent, COMSIG_IMPLANT_EXISTING_UPLINK, .proc/new_implant)
|
||||
else if(istype(parent, /obj/item/pda))
|
||||
RegisterSignal(parent, COMSIG_PDA_CHANGE_RINGTONE, .proc/new_ringtone)
|
||||
// RegisterSignal(parent, COMSIG_PDA_CHECK_DETONATE, .proc/check_detonate)
|
||||
else if(istype(parent, /obj/item/radio))
|
||||
RegisterSignal(parent, COMSIG_RADIO_NEW_FREQUENCY, .proc/new_frequency)
|
||||
else if(istype(parent, /obj/item/pen))
|
||||
RegisterSignal(parent, COMSIG_PEN_ROTATED, .proc/pen_rotation)
|
||||
|
||||
GLOB.uplinks += src
|
||||
if(istype(traitor_class))
|
||||
filters = traitor_class.uplink_filters
|
||||
starting_tc = traitor_class.TC
|
||||
uplink_items = get_uplink_items(gamemode, TRUE, allow_restricted, filters)
|
||||
GLOB.uplinks |= src
|
||||
|
||||
if(_owner)
|
||||
owner = _owner
|
||||
@@ -64,44 +62,58 @@ GLOBAL_LIST_EMPTY(uplinks)
|
||||
purchase_log = new(owner, src)
|
||||
lockable = _lockable
|
||||
active = _enabled
|
||||
gamemode = _gamemode
|
||||
src.uplink_flag = uplink_flag
|
||||
update_items()
|
||||
telecrystals = starting_tc
|
||||
if(!lockable)
|
||||
active = TRUE
|
||||
locked = FALSE
|
||||
saved_player_population = GLOB.joined_player_list.len
|
||||
|
||||
previous_attempts = list()
|
||||
|
||||
/datum/component/uplink/InheritComponent(datum/component/uplink/U)
|
||||
lockable |= U.lockable
|
||||
active |= U.active
|
||||
if(!gamemode)
|
||||
gamemode = U.gamemode
|
||||
uplink_flag |= U.uplink_flag
|
||||
telecrystals += U.telecrystals
|
||||
if(purchase_log && U.purchase_log)
|
||||
purchase_log.MergeWithAndDel(U.purchase_log)
|
||||
|
||||
/datum/component/uplink/Destroy()
|
||||
GLOB.uplinks -= src
|
||||
gamemode = null
|
||||
purchase_log = null
|
||||
return ..()
|
||||
|
||||
/datum/component/uplink/proc/update_items()
|
||||
var/updated_items
|
||||
updated_items = get_uplink_items(uplink_flag, TRUE, allow_restricted)
|
||||
update_sales(updated_items)
|
||||
uplink_items = updated_items
|
||||
|
||||
/datum/component/uplink/proc/update_sales(updated_items)
|
||||
var/discount_categories = list("Discounted Gear", "Discounted Team Gear", "Limited Stock Team Gear")
|
||||
if (uplink_items == null)
|
||||
return
|
||||
for (var/category in discount_categories) // Makes sure discounted items aren't renewed or replaced
|
||||
if (uplink_items[category] != null && updated_items[category] != null)
|
||||
updated_items[category] = uplink_items[category]
|
||||
|
||||
/datum/component/uplink/proc/LoadTC(mob/user, obj/item/stack/telecrystal/TC, silent = FALSE)
|
||||
if(!silent)
|
||||
to_chat(user, "<span class='notice'>You slot [TC] into [parent] and charge its internal uplink.</span>")
|
||||
to_chat(user, span_notice("You slot [TC] into [parent] and charge its internal uplink."))
|
||||
var/amt = TC.amount
|
||||
telecrystals += amt
|
||||
TC.use(amt)
|
||||
|
||||
/datum/component/uplink/proc/set_gamemode(_gamemode)
|
||||
gamemode = _gamemode
|
||||
uplink_items = get_uplink_items(gamemode, TRUE, allow_restricted)
|
||||
// log_uplink("[key_name(user)] loaded [amt] telecrystals into [parent]'s uplink")
|
||||
|
||||
/datum/component/uplink/proc/OnAttackBy(datum/source, obj/item/I, mob/user)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(!active)
|
||||
return //no hitting everyone/everything just to try to slot tcs in!
|
||||
return //no hitting everyone/everything just to try to slot tcs in!
|
||||
if(istype(I, /obj/item/stack/telecrystal))
|
||||
LoadTC(user, I)
|
||||
// CIT SPECIFIC: STEALING from unlocked uplink.
|
||||
if(active)
|
||||
if(I.GetComponent(/datum/component/uplink))
|
||||
var/datum/component/uplink/hidden_uplink = I.GetComponent(/datum/component/uplink)
|
||||
@@ -118,31 +130,26 @@ GLOBAL_LIST_EMPTY(uplinks)
|
||||
var/cost = UI.refund_amount || UI.cost
|
||||
if(I.type == path && UI.refundable && I.check_uplink_validity())
|
||||
telecrystals += cost
|
||||
purchase_log.total_spent -= cost
|
||||
to_chat(user, "<span class='notice'>[I] refunded.</span>")
|
||||
// log_uplink("[key_name(user)] refunded [UI] for [cost] telecrystals using [parent]'s uplink")
|
||||
if(purchase_log)
|
||||
purchase_log.total_spent -= cost
|
||||
to_chat(user, span_notice("[I] refunded."))
|
||||
qdel(I)
|
||||
return
|
||||
|
||||
/datum/component/uplink/proc/interact(datum/source, mob/user)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(locked)
|
||||
return
|
||||
active = TRUE
|
||||
update_items()
|
||||
if(user)
|
||||
//update the saved population
|
||||
var/previous_player_population = saved_player_population
|
||||
saved_player_population = GLOB.joined_player_list.len
|
||||
//if population has changed, update uplink items
|
||||
if(saved_player_population != previous_player_population)
|
||||
//make sure discounts are not rerolled
|
||||
var/old_discounts = uplink_items["Discounted Gear"]
|
||||
uplink_items = get_uplink_items(gamemode, FALSE, allow_restricted, filters)
|
||||
if(old_discounts)
|
||||
uplink_items["Discounted Gear"] = old_discounts
|
||||
ui_interact(user)
|
||||
|
||||
INVOKE_ASYNC(src, .proc/ui_interact, user)
|
||||
// an unlocked uplink blocks also opening the PDA or headset menu
|
||||
return COMPONENT_NO_INTERACT
|
||||
|
||||
|
||||
/datum/component/uplink/ui_state(mob/user)
|
||||
if(istype(parent, /obj/item/implant/uplink))
|
||||
return GLOB.not_incapacitated_state
|
||||
@@ -178,15 +185,10 @@ GLOBAL_LIST_EMPTY(uplinks)
|
||||
var/datum/uplink_item/I = uplink_items[category][item]
|
||||
if(I.limited_stock == 0)
|
||||
continue
|
||||
if(I.restricted_roles.len)
|
||||
var/is_inaccessible = TRUE
|
||||
for(var/R in I.restricted_roles)
|
||||
if(R == user.mind.assigned_role || debug)
|
||||
is_inaccessible = FALSE
|
||||
if(is_inaccessible)
|
||||
if(length(I.restricted_roles))
|
||||
if(!debug && !(user.mind.assigned_role in I.restricted_roles))
|
||||
continue
|
||||
/*
|
||||
if(I.restricted_species) //catpeople specfic gloves.
|
||||
if(I.restricted_species)
|
||||
if(ishuman(user))
|
||||
var/is_inaccessible = TRUE
|
||||
var/mob/living/carbon/human/H = user
|
||||
@@ -196,7 +198,6 @@ GLOBAL_LIST_EMPTY(uplinks)
|
||||
break
|
||||
if(is_inaccessible)
|
||||
continue
|
||||
*/
|
||||
cat["items"] += list(list(
|
||||
"name" = I.name,
|
||||
"cost" = I.cost,
|
||||
@@ -255,25 +256,41 @@ GLOBAL_LIST_EMPTY(uplinks)
|
||||
// Implant signal responses
|
||||
|
||||
/datum/component/uplink/proc/implant_activation()
|
||||
SIGNAL_HANDLER
|
||||
|
||||
var/obj/item/implant/implant = parent
|
||||
locked = FALSE
|
||||
interact(null, implant.imp_in)
|
||||
|
||||
/datum/component/uplink/proc/implanting(datum/source, list/arguments)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
var/mob/user = arguments[2]
|
||||
owner = "[user.key]"
|
||||
owner = user?.key
|
||||
if(owner && !purchase_log)
|
||||
LAZYINITLIST(GLOB.uplink_purchase_logs_by_key)
|
||||
if(GLOB.uplink_purchase_logs_by_key[owner])
|
||||
purchase_log = GLOB.uplink_purchase_logs_by_key[owner]
|
||||
else
|
||||
purchase_log = new(owner, src)
|
||||
|
||||
/datum/component/uplink/proc/old_implant(datum/source, list/arguments, obj/item/implant/new_implant)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
// It kinda has to be weird like this until implants are components
|
||||
return SEND_SIGNAL(new_implant, COMSIG_IMPLANT_EXISTING_UPLINK, src)
|
||||
|
||||
/datum/component/uplink/proc/new_implant(datum/source, datum/component/uplink/uplink)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
uplink.telecrystals += telecrystals
|
||||
return COMPONENT_DELETE_NEW_IMPLANT
|
||||
|
||||
// PDA signal responses
|
||||
|
||||
/datum/component/uplink/proc/new_ringtone(datum/source, mob/living/user, new_ring_text)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
var/obj/item/pda/master = parent
|
||||
if(trim(lowertext(new_ring_text)) != trim(lowertext(unlock_code)))
|
||||
if(trim(lowertext(new_ring_text)) == trim(lowertext(failsafe_code)))
|
||||
@@ -282,14 +299,21 @@ GLOBAL_LIST_EMPTY(uplinks)
|
||||
return
|
||||
locked = FALSE
|
||||
interact(null, user)
|
||||
to_chat(user, "<span class='hear'>The PDA softly beeps.</span>")
|
||||
to_chat(user, span_hear("The PDA softly beeps."))
|
||||
user << browse(null, "window=pda")
|
||||
master.mode = 0
|
||||
return COMPONENT_STOP_RINGTONE_CHANGE
|
||||
|
||||
/datum/component/uplink/proc/check_detonate()
|
||||
SIGNAL_HANDLER
|
||||
|
||||
// return COMPONENT_PDA_NO_DETONATE
|
||||
|
||||
// Radio signal responses
|
||||
|
||||
/datum/component/uplink/proc/new_frequency(datum/source, list/arguments)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
var/obj/item/radio/master = parent
|
||||
var/frequency = arguments[1]
|
||||
if(frequency != unlock_code)
|
||||
@@ -303,15 +327,22 @@ GLOBAL_LIST_EMPTY(uplinks)
|
||||
// Pen signal responses
|
||||
|
||||
/datum/component/uplink/proc/pen_rotation(datum/source, degrees, mob/living/carbon/user)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
var/obj/item/pen/master = parent
|
||||
if(degrees != unlock_code)
|
||||
if(degrees == failsafe_code) //Getting failsafes on pens is risky business
|
||||
failsafe()
|
||||
return
|
||||
locked = FALSE
|
||||
master.degrees = 0
|
||||
interact(null, user)
|
||||
to_chat(user, "<span class='warning'>Your pen makes a clicking noise, before quickly rotating back to 0 degrees!</span>")
|
||||
previous_attempts += degrees
|
||||
if(length(previous_attempts) > PEN_ROTATIONS)
|
||||
popleft(previous_attempts)
|
||||
|
||||
if(compare_list(previous_attempts, unlock_code))
|
||||
locked = FALSE
|
||||
previous_attempts.Cut()
|
||||
master.degrees = 0
|
||||
interact(null, user)
|
||||
to_chat(user, span_warning("Your pen makes a clicking noise, before quickly rotating back to 0 degrees!"))
|
||||
|
||||
else if(compare_list(previous_attempts, failsafe_code))
|
||||
failsafe(user)
|
||||
|
||||
/datum/component/uplink/proc/setup_unlock_code()
|
||||
unlock_code = generate_code()
|
||||
@@ -321,15 +352,18 @@ GLOBAL_LIST_EMPTY(uplinks)
|
||||
else if(istype(parent,/obj/item/radio))
|
||||
unlock_note = "<B>Radio Frequency:</B> [format_frequency(unlock_code)] ([P.name])."
|
||||
else if(istype(parent,/obj/item/pen))
|
||||
unlock_note = "<B>Uplink Degrees:</B> [unlock_code] ([P.name])."
|
||||
unlock_note = "<B>Uplink Degrees:</B> [english_list(unlock_code)] ([P.name])."
|
||||
|
||||
/datum/component/uplink/proc/generate_code()
|
||||
if(istype(parent,/obj/item/pda))
|
||||
return "[rand(100,999)] [pick(GLOB.phonetic_alphabet)]"
|
||||
else if(istype(parent,/obj/item/radio))
|
||||
return sanitize_frequency(rand(MIN_FREQ, MAX_FREQ))
|
||||
return return_unused_frequency()
|
||||
else if(istype(parent,/obj/item/pen))
|
||||
return rand(1, 360)
|
||||
var/list/L = list()
|
||||
for(var/i in 1 to PEN_ROTATIONS)
|
||||
L += rand(1, 360)
|
||||
return L
|
||||
|
||||
/datum/component/uplink/proc/failsafe(mob/living/carbon/user)
|
||||
if(!parent)
|
||||
@@ -339,5 +373,5 @@ GLOBAL_LIST_EMPTY(uplinks)
|
||||
return
|
||||
message_admins("[ADMIN_LOOKUPFLW(user)] has triggered an uplink failsafe explosion at [AREACOORD(T)] The owner of the uplink was [ADMIN_LOOKUPFLW(owner)].")
|
||||
log_game("[key_name(user)] triggered an uplink failsafe explosion. The owner of the uplink was [key_name(owner)].")
|
||||
explosion(T,1,2,3)
|
||||
explosion(parent, devastation_range = 1, heavy_impact_range = 2, light_impact_range = 3)
|
||||
qdel(parent) //Alternatively could brick the uplink.
|
||||
|
||||
Reference in New Issue
Block a user