mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-12 16:44:43 +01:00
Makes some more lists lazy (#94388)
Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
This commit is contained in:
@@ -174,7 +174,7 @@
|
||||
program_open_overlay = "generic"
|
||||
extended_desc = "This program allows for remote monitoring of mission-assigned cyborgs."
|
||||
program_flags = PROGRAM_ON_SYNDINET_STORE
|
||||
download_access = list()
|
||||
download_access = null
|
||||
circuit_comp_type = /obj/item/circuit_component/mod_program/borg_monitor/syndie
|
||||
|
||||
/datum/computer_file/program/borg_monitor/syndicate/evaluate_borg(mob/living/silicon/robot/R)
|
||||
|
||||
@@ -49,7 +49,7 @@ GLOBAL_VAR(department_cd_override)
|
||||
linked_department = department
|
||||
var/datum/job_department/linked_department_real = SSjob.get_department_type(linked_department)
|
||||
// Heads of staff can download
|
||||
download_access |= linked_department_real.head_of_staff_access
|
||||
LAZYOR(download_access, linked_department_real.head_of_staff_access)
|
||||
// Heads of staff + anyone in the dept can run it
|
||||
use_access |= linked_department_real.head_of_staff_access
|
||||
use_access |= linked_department_real.department_access
|
||||
@@ -164,7 +164,7 @@ GLOBAL_VAR(department_cd_override)
|
||||
if(action == "override_order")
|
||||
if(isnull(department_order) || !(department_order in SSshuttle.shopping_list))
|
||||
return TRUE
|
||||
if(length(download_access & id_card_access) <= 0)
|
||||
if(LAZYLEN(download_access & id_card_access) <= 0)
|
||||
computer.physical.balloon_alert(orderer, "requires head of staff access!")
|
||||
playsound(computer, 'sound/machines/buzz/buzz-sigh.ogg', 30, TRUE)
|
||||
return TRUE
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
if(!theme_app)
|
||||
return FALSE
|
||||
//don't get the same one twice
|
||||
if(theme_app.imported_themes.Find(theme_name))
|
||||
if(LAZYFIND(theme_app.imported_themes, theme_name))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
//add the theme to the computer and increase its size to match
|
||||
var/datum/computer_file/program/themeify/theme_app = locate() in computer.stored_files
|
||||
if(theme_app)
|
||||
theme_app.imported_themes += theme_name
|
||||
LAZYADD(theme_app.imported_themes, theme_name)
|
||||
theme_app.size += size
|
||||
qdel(src)
|
||||
|
||||
|
||||
+18
-18
@@ -34,7 +34,7 @@
|
||||
var/spam_mode = FALSE
|
||||
|
||||
/// An asssociative list of chats we have started, format: chatref -> pda_chat.
|
||||
var/list/saved_chats = list()
|
||||
var/list/saved_chats
|
||||
/// Whose chatlogs we currently have open. If we are in the contacts list, this is null.
|
||||
var/viewing_messages_of = null
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
/datum/computer_file/program/messenger/proc/on_imprint_reset(sender)
|
||||
SIGNAL_HANDLER
|
||||
remove_messenger(src)
|
||||
saved_chats = list()
|
||||
LAZYNULL(saved_chats)
|
||||
selected_image = null
|
||||
viewing_messages_of = null
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
data |= photo.picture_name
|
||||
|
||||
if(viewing_messages_of in saved_chats)
|
||||
var/datum/pda_chat/chat = saved_chats[viewing_messages_of]
|
||||
var/datum/pda_chat/chat = LAZYACCESS(saved_chats, viewing_messages_of)
|
||||
for(var/datum/pda_message/message as anything in chat.messages)
|
||||
if(isnull(message.photo_name))
|
||||
continue
|
||||
@@ -180,13 +180,13 @@
|
||||
|
||||
if("PDA_viewMessages")
|
||||
if(viewing_messages_of in saved_chats)
|
||||
var/datum/pda_chat/chat = saved_chats[viewing_messages_of]
|
||||
var/datum/pda_chat/chat = LAZYACCESS(saved_chats, viewing_messages_of)
|
||||
chat.unread_messages = 0
|
||||
|
||||
viewing_messages_of = params["ref"]
|
||||
|
||||
if (viewing_messages_of in saved_chats)
|
||||
var/datum/pda_chat/chat = saved_chats[viewing_messages_of]
|
||||
var/datum/pda_chat/chat = LAZYACCESS(saved_chats, viewing_messages_of)
|
||||
chat.visible_in_recents = TRUE
|
||||
|
||||
selected_image = null
|
||||
@@ -198,7 +198,7 @@
|
||||
if(!(target in saved_chats))
|
||||
return FALSE
|
||||
|
||||
var/datum/pda_chat/chat = saved_chats[target]
|
||||
var/datum/pda_chat/chat = LAZYACCESS(saved_chats, target)
|
||||
chat.visible_in_recents = FALSE
|
||||
if(viewing_messages_of == target)
|
||||
viewing_messages_of = null
|
||||
@@ -208,9 +208,9 @@
|
||||
var/chat_ref = params["ref"]
|
||||
|
||||
if(chat_ref in saved_chats)
|
||||
saved_chats.Remove(chat_ref)
|
||||
LAZYREMOVE(saved_chats, chat_ref)
|
||||
else if(isnull(chat_ref))
|
||||
saved_chats = list()
|
||||
LAZYNULL(saved_chats)
|
||||
|
||||
viewing_messages_of = null
|
||||
return TRUE
|
||||
@@ -240,7 +240,7 @@
|
||||
if(!(target_chat_ref in saved_chats))
|
||||
return FALSE
|
||||
|
||||
var/datum/pda_chat/chat = saved_chats[target_chat_ref]
|
||||
var/datum/pda_chat/chat = LAZYACCESS(saved_chats, target_chat_ref)
|
||||
|
||||
chat.message_draft = message_draft
|
||||
|
||||
@@ -252,7 +252,7 @@
|
||||
if(!(target_chat_ref in saved_chats))
|
||||
return FALSE
|
||||
|
||||
var/datum/pda_chat/chat = saved_chats[target_chat_ref]
|
||||
var/datum/pda_chat/chat = LAZYACCESS(saved_chats, target_chat_ref)
|
||||
chat.unread_messages = 0
|
||||
|
||||
return TRUE
|
||||
@@ -269,7 +269,7 @@
|
||||
var/target = null
|
||||
|
||||
if(target_ref in saved_chats)
|
||||
target = saved_chats[target_ref]
|
||||
target = LAZYACCESS(saved_chats, target_ref)
|
||||
else if(target_ref in GLOB.pda_messengers)
|
||||
target = GLOB.pda_messengers[target_ref]
|
||||
else
|
||||
@@ -357,7 +357,7 @@
|
||||
"job" = computer.saved_job,
|
||||
"ref" = REF(src)
|
||||
) : null)
|
||||
data["saved_chats"] = chats_data
|
||||
data["saved_chats"] = chats_data || list()
|
||||
data["messengers"] = messengers
|
||||
data["sort_by_job"] = sort_by_job
|
||||
data["alert_silenced"] = alert_silenced
|
||||
@@ -412,8 +412,8 @@
|
||||
for(var/mc in get_messengers())
|
||||
messenger_targets += mc
|
||||
|
||||
for(var/chatref in saved_chats)
|
||||
var/datum/pda_chat/chat = saved_chats[chatref]
|
||||
for(var/chatref, data in saved_chats)
|
||||
var/datum/pda_chat/chat = data
|
||||
if(!(chat.recipient?.reference in messenger_targets)) // if its in messenger_targets, it's valid
|
||||
continue
|
||||
messenger_targets -= chat.recipient.reference
|
||||
@@ -443,14 +443,14 @@
|
||||
new_chat.cached_job = job
|
||||
new_chat.can_reply = FALSE
|
||||
|
||||
saved_chats[REF(new_chat)] = new_chat
|
||||
LAZYSET(saved_chats, REF(new_chat), new_chat)
|
||||
|
||||
return new_chat
|
||||
|
||||
/// Gets the chat by the recipient, either by their name or messenger ref
|
||||
/datum/computer_file/program/messenger/proc/find_chat_by_recipient(recipient, fake_user = FALSE)
|
||||
for(var/chat_ref in saved_chats)
|
||||
var/datum/pda_chat/chat = saved_chats[chat_ref]
|
||||
for(var/chat_ref, data in saved_chats)
|
||||
var/datum/pda_chat/chat = data
|
||||
if(fake_user && chat.cached_name == recipient)
|
||||
return chat
|
||||
else if(chat.recipient?.reference == recipient)
|
||||
@@ -752,7 +752,7 @@
|
||||
if("message")
|
||||
if(!(target_href in saved_chats))
|
||||
return
|
||||
quick_reply_prompt(usr, saved_chats[target_href])
|
||||
quick_reply_prompt(usr, LAZYACCESS(saved_chats, target_href))
|
||||
|
||||
if("open")
|
||||
if(target_href in saved_chats)
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
program_icon = "book"
|
||||
can_run_on_flags = PROGRAM_ALL
|
||||
circuit_comp_type = /obj/item/circuit_component/mod_program/notepad
|
||||
|
||||
var/written_note = "Congratulations on your station upgrading to the new NtOS and Thinktronic based collaboration effort, \
|
||||
bringing you the best in electronics and software since 2467!\n\
|
||||
To help with navigation, we have provided the following definitions:\n\
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
data["owner_token"] = current_user.pay_token
|
||||
data["money"] = current_user.account_balance
|
||||
data["wanted_token"] = wanted_token
|
||||
data["transaction_list"] = current_user.transaction_history
|
||||
data["transaction_list"] = current_user.transaction_history || list()
|
||||
|
||||
return data
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
filename = "syndeye"
|
||||
filedesc = "SyndEye"
|
||||
extended_desc = "This program allows for illegal access to security camera networks."
|
||||
download_access = list()
|
||||
download_access = null
|
||||
can_run_on_flags = PROGRAM_ALL
|
||||
program_flags = PROGRAM_ON_SYNDINET_STORE | PROGRAM_UNIQUE_COPY
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
program_icon = "paint-roller"
|
||||
|
||||
///List of all themes imported from maintenance apps.
|
||||
var/list/imported_themes = list()
|
||||
var/list/imported_themes
|
||||
|
||||
/datum/computer_file/program/themeify/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
@@ -29,7 +29,7 @@
|
||||
var/selected_theme = params["selected_theme"]
|
||||
if( \
|
||||
!GLOB.default_pda_themes.Find(selected_theme) && \
|
||||
!imported_themes.Find(selected_theme) && \
|
||||
!LAZYFIND(imported_themes, selected_theme) && \
|
||||
!(computer.obj_flags & EMAGGED) \
|
||||
)
|
||||
return FALSE
|
||||
|
||||
Reference in New Issue
Block a user