diff --git a/code/modules/library/lib_items.dm b/code/modules/library/lib_items.dm
index 5ff1cbceb1..459212aad0 100644
--- a/code/modules/library/lib_items.dm
+++ b/code/modules/library/lib_items.dm
@@ -112,7 +112,6 @@
else
return ..()
-
/obj/structure/bookcase/attack_hand(mob/user)
. = ..()
if(.)
@@ -129,6 +128,17 @@
choice.forceMove(drop_location())
update_icon()
+/obj/structure/bookcase/attack_ghost(mob/dead/observer/user)
+ . = ..()
+ if(!length(contents))
+ to_chat(user, "It's empty!")
+ return
+ var/obj/item/book/choice = input("Which book would you like to read?") as null|obj in contents
+ if(choice)
+ if(!istype(choice)) //spellbook, cult tome, or the one weird bible storage
+ to_chat(user,"A mysterious force is keeping you from reading that.")
+ return
+ choice.attack_ghost(user)
/obj/structure/bookcase/deconstruct(disassembled = TRUE)
new /obj/item/stack/sheet/mineral/wood(loc, 4)
@@ -203,13 +213,17 @@
to_chat(user, "You skim through the book but can't comprehend any of it.")
return
if(dat)
- user << browse("Penned by [author].
" + "[dat]", "window=book[window_size != null ? ";size=[window_size]" : ""]")
+ show_to(user)
user.visible_message("[user] opens a book titled \"[title]\" and begins reading intently.")
- SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "book_nerd", /datum/mood_event/book_nerd)
- onclose(user, "book")
else
to_chat(user, "This book is completely blank!")
+/obj/item/book/attack_ghost(mob/dead/observer/O)
+ . = ..()
+ show_to(O)
+
+/obj/item/book/proc/show_to(mob/user)
+ user << browse("Penned by [author].
" + "[dat]", "window=book[window_size != null ? ";size=[window_size]" : ""]")
/obj/item/book/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/pen))
diff --git a/code/modules/newscaster/feed_channel.dm b/code/modules/newscaster/feed_channel.dm
new file mode 100644
index 0000000000..98c8d35493
--- /dev/null
+++ b/code/modules/newscaster/feed_channel.dm
@@ -0,0 +1,34 @@
+/datum/newscaster/feed_channel
+ var/channel_name = ""
+ var/list/datum/newscaster/feed_message/messages = list()
+ var/locked = FALSE
+ var/author = ""
+ var/censored = 0
+ var/list/authorCensorTime = list()
+ var/list/DclassCensorTime = list()
+ var/authorCensor
+ var/is_admin_channel = 0
+
+/datum/newscaster/feed_channel/proc/returnAuthor(censor)
+ if(censor == -1)
+ censor = authorCensor
+ var/txt = "[GLOB.news_network.redactedText]"
+ if(!censor)
+ txt = author
+ return txt
+
+/datum/newscaster/feed_channel/proc/toggleCensorDclass()
+ if(censored)
+ DclassCensorTime.Add(GLOB.news_network.lastAction*-1)
+ else
+ DclassCensorTime.Add(GLOB.news_network.lastAction)
+ censored = !censored
+ GLOB.news_network.lastAction ++
+
+/datum/newscaster/feed_channel/proc/toggleCensorAuthor()
+ if(authorCensor)
+ authorCensorTime.Add(GLOB.news_network.lastAction*-1)
+ else
+ authorCensorTime.Add(GLOB.news_network.lastAction)
+ authorCensor = !authorCensor
+ GLOB.news_network.lastAction ++
diff --git a/code/modules/newscaster/feed_comment.dm b/code/modules/newscaster/feed_comment.dm
new file mode 100644
index 0000000000..f5f847ab8e
--- /dev/null
+++ b/code/modules/newscaster/feed_comment.dm
@@ -0,0 +1,4 @@
+/datum/newscaster/feed_comment
+ var/author = ""
+ var/body = ""
+ var/time_stamp = ""
diff --git a/code/modules/newscaster/feed_message.dm b/code/modules/newscaster/feed_message.dm
new file mode 100644
index 0000000000..1930177555
--- /dev/null
+++ b/code/modules/newscaster/feed_message.dm
@@ -0,0 +1,47 @@
+/datum/newscaster/feed_message
+ var/author =""
+ var/body =""
+ var/list/authorCensorTime = list()
+ var/list/bodyCensorTime = list()
+ var/is_admin_message = 0
+ var/icon/img = null
+ var/time_stamp = ""
+ var/list/datum/newscaster/feed_comment/comments = list()
+ var/locked = FALSE
+ var/caption = ""
+ var/creationTime
+ var/authorCensor
+ var/bodyCensor
+ var/photo_file
+
+/datum/newscaster/feed_message/proc/returnAuthor(censor)
+ if(censor == -1)
+ censor = authorCensor
+ var/txt = "[GLOB.news_network.redactedText]"
+ if(!censor)
+ txt = author
+ return txt
+
+/datum/newscaster/feed_message/proc/returnBody(censor)
+ if(censor == -1)
+ censor = bodyCensor
+ var/txt = "[GLOB.news_network.redactedText]"
+ if(!censor)
+ txt = body
+ return txt
+
+/datum/newscaster/feed_message/proc/toggleCensorAuthor()
+ if(authorCensor)
+ authorCensorTime.Add(GLOB.news_network.lastAction*-1)
+ else
+ authorCensorTime.Add(GLOB.news_network.lastAction)
+ authorCensor = !authorCensor
+ GLOB.news_network.lastAction ++
+
+/datum/newscaster/feed_message/proc/toggleCensorBody()
+ if(bodyCensor)
+ bodyCensorTime.Add(GLOB.news_network.lastAction*-1)
+ else
+ bodyCensorTime.Add(GLOB.news_network.lastAction)
+ bodyCensor = !bodyCensor
+ GLOB.news_network.lastAction ++
diff --git a/code/modules/newscaster/feed_network.dm b/code/modules/newscaster/feed_network.dm
new file mode 100644
index 0000000000..12a211891e
--- /dev/null
+++ b/code/modules/newscaster/feed_network.dm
@@ -0,0 +1,71 @@
+GLOBAL_DATUM_INIT(news_network, /datum/newscaster/feed_network, new)
+
+/datum/newscaster/feed_network
+ var/list/datum/newscaster/feed_channel/network_channels = list()
+ var/datum/newscaster/wanted_message/wanted_issue
+ var/lastAction
+ var/redactedText = "\[REDACTED\]"
+
+/datum/newscaster/feed_network/New()
+ CreateFeedChannel("Station Announcements", "SS13", 1)
+ wanted_issue = new /datum/newscaster/wanted_message
+
+/datum/newscaster/feed_network/proc/CreateFeedChannel(channel_name, author, locked, adminChannel = 0)
+ var/datum/newscaster/feed_channel/newChannel = new /datum/newscaster/feed_channel
+ newChannel.channel_name = channel_name
+ newChannel.author = author
+ newChannel.locked = locked
+ newChannel.is_admin_channel = adminChannel
+ network_channels += newChannel
+
+/datum/newscaster/feed_network/proc/SubmitArticle(msg, author, channel_name, datum/picture/picture, adminMessage = 0, allow_comments = 1)
+ var/datum/newscaster/feed_message/newMsg = new /datum/newscaster/feed_message
+ newMsg.author = author
+ newMsg.body = msg
+ newMsg.time_stamp = STATION_TIME_TIMESTAMP("hh:mm:ss", world.time)
+ newMsg.is_admin_message = adminMessage
+ newMsg.locked = !allow_comments
+ if(picture)
+ newMsg.img = picture.picture_image
+ newMsg.caption = picture.caption
+ newMsg.photo_file = save_photo(picture.picture_image)
+ for(var/datum/newscaster/feed_channel/FC in network_channels)
+ if(FC.channel_name == channel_name)
+ FC.messages += newMsg
+ break
+ for(var/obj/machinery/newscaster/NEWSCASTER in GLOB.allCasters)
+ NEWSCASTER.newsAlert(channel_name)
+ lastAction ++
+ newMsg.creationTime = lastAction
+
+/datum/newscaster/feed_network/proc/submitWanted(criminal, body, scanned_user, datum/picture/picture, adminMsg = 0, newMessage = 0)
+ wanted_issue.active = 1
+ wanted_issue.criminal = criminal
+ wanted_issue.body = body
+ wanted_issue.scannedUser = scanned_user
+ wanted_issue.isAdminMsg = adminMsg
+ if(picture)
+ wanted_issue.img = picture.picture_image
+ wanted_issue.photo_file = save_photo(picture.picture_image)
+ if(newMessage)
+ for(var/obj/machinery/newscaster/N in GLOB.allCasters)
+ N.newsAlert()
+ N.update_icon()
+
+/datum/newscaster/feed_network/proc/deleteWanted()
+ wanted_issue.active = 0
+ wanted_issue.criminal = null
+ wanted_issue.body = null
+ wanted_issue.scannedUser = null
+ wanted_issue.img = null
+ for(var/obj/machinery/newscaster/NEWSCASTER in GLOB.allCasters)
+ NEWSCASTER.update_icon()
+
+/datum/newscaster/feed_network/proc/save_photo(icon/photo)
+ var/photo_file = copytext_char(md5("\icon[photo]"), 1, 6)
+ if(!fexists("[GLOB.log_directory]/photos/[photo_file].png"))
+ //Clean up repeated frames
+ var/icon/clean = new /icon()
+ clean.Insert(photo, "", SOUTH, 1, 0)
+ fcopy(clean, "[GLOB.log_directory]/photos/[photo_file].png")
+ return photo_file
diff --git a/code/modules/newscaster/news_datum.dm b/code/modules/newscaster/news_datum.dm
new file mode 100644
index 0000000000..3c42d04734
--- /dev/null
+++ b/code/modules/newscaster/news_datum.dm
@@ -0,0 +1 @@
+/datum/newscaster
diff --git a/code/game/machinery/newscaster.dm b/code/modules/newscaster/newscaster.dm
similarity index 88%
rename from code/game/machinery/newscaster.dm
rename to code/modules/newscaster/newscaster.dm
index a9b4461085..e9458666f3 100644
--- a/code/game/machinery/newscaster.dm
+++ b/code/modules/newscaster/newscaster.dm
@@ -1,175 +1,5 @@
-GLOBAL_DATUM_INIT(news_network, /datum/newscaster/feed_network, new)
GLOBAL_LIST_EMPTY(allCasters)
-/datum/newscaster
-
-/datum/newscaster/feed_comment
- var/author = ""
- var/body = ""
- var/time_stamp = ""
-
-/datum/newscaster/feed_message
- var/author =""
- var/body =""
- var/list/authorCensorTime = list()
- var/list/bodyCensorTime = list()
- var/is_admin_message = 0
- var/icon/img = null
- var/time_stamp = ""
- var/list/datum/newscaster/feed_comment/comments = list()
- var/locked = FALSE
- var/caption = ""
- var/creationTime
- var/authorCensor
- var/bodyCensor
- var/photo_file
-
-/datum/newscaster/feed_message/proc/returnAuthor(censor)
- if(censor == -1)
- censor = authorCensor
- var/txt = "[GLOB.news_network.redactedText]"
- if(!censor)
- txt = author
- return txt
-
-/datum/newscaster/feed_message/proc/returnBody(censor)
- if(censor == -1)
- censor = bodyCensor
- var/txt = "[GLOB.news_network.redactedText]"
- if(!censor)
- txt = body
- return txt
-
-/datum/newscaster/feed_message/proc/toggleCensorAuthor()
- if(authorCensor)
- authorCensorTime.Add(GLOB.news_network.lastAction*-1)
- else
- authorCensorTime.Add(GLOB.news_network.lastAction)
- authorCensor = !authorCensor
- GLOB.news_network.lastAction ++
-
-/datum/newscaster/feed_message/proc/toggleCensorBody()
- if(bodyCensor)
- bodyCensorTime.Add(GLOB.news_network.lastAction*-1)
- else
- bodyCensorTime.Add(GLOB.news_network.lastAction)
- bodyCensor = !bodyCensor
- GLOB.news_network.lastAction ++
-
-/datum/newscaster/feed_channel
- var/channel_name = ""
- var/list/datum/newscaster/feed_message/messages = list()
- var/locked = FALSE
- var/author = ""
- var/censored = 0
- var/list/authorCensorTime = list()
- var/list/DclassCensorTime = list()
- var/authorCensor
- var/is_admin_channel = 0
-
-/datum/newscaster/feed_channel/proc/returnAuthor(censor)
- if(censor == -1)
- censor = authorCensor
- var/txt = "[GLOB.news_network.redactedText]"
- if(!censor)
- txt = author
- return txt
-
-/datum/newscaster/feed_channel/proc/toggleCensorDclass()
- if(censored)
- DclassCensorTime.Add(GLOB.news_network.lastAction*-1)
- else
- DclassCensorTime.Add(GLOB.news_network.lastAction)
- censored = !censored
- GLOB.news_network.lastAction ++
-
-/datum/newscaster/feed_channel/proc/toggleCensorAuthor()
- if(authorCensor)
- authorCensorTime.Add(GLOB.news_network.lastAction*-1)
- else
- authorCensorTime.Add(GLOB.news_network.lastAction)
- authorCensor = !authorCensor
- GLOB.news_network.lastAction ++
-
-/datum/newscaster/wanted_message
- var/active
- var/criminal
- var/body
- var/scannedUser
- var/isAdminMsg
- var/icon/img
- var/photo_file
-
-/datum/newscaster/feed_network
- var/list/datum/newscaster/feed_channel/network_channels = list()
- var/datum/newscaster/wanted_message/wanted_issue
- var/lastAction
- var/redactedText = "\[REDACTED\]"
-
-/datum/newscaster/feed_network/New()
- CreateFeedChannel("Station Announcements", "SS13", 1)
- wanted_issue = new /datum/newscaster/wanted_message
-
-/datum/newscaster/feed_network/proc/CreateFeedChannel(channel_name, author, locked, adminChannel = 0)
- var/datum/newscaster/feed_channel/newChannel = new /datum/newscaster/feed_channel
- newChannel.channel_name = channel_name
- newChannel.author = author
- newChannel.locked = locked
- newChannel.is_admin_channel = adminChannel
- network_channels += newChannel
-
-/datum/newscaster/feed_network/proc/SubmitArticle(msg, author, channel_name, datum/picture/picture, adminMessage = 0, allow_comments = 1)
- var/datum/newscaster/feed_message/newMsg = new /datum/newscaster/feed_message
- newMsg.author = author
- newMsg.body = msg
- newMsg.time_stamp = STATION_TIME_TIMESTAMP("hh:mm:ss", world.time)
- newMsg.is_admin_message = adminMessage
- newMsg.locked = !allow_comments
- if(picture)
- newMsg.img = picture.picture_image
- newMsg.caption = picture.caption
- newMsg.photo_file = save_photo(picture.picture_image)
- for(var/datum/newscaster/feed_channel/FC in network_channels)
- if(FC.channel_name == channel_name)
- FC.messages += newMsg
- break
- for(var/obj/machinery/newscaster/NEWSCASTER in GLOB.allCasters)
- NEWSCASTER.newsAlert(channel_name)
- lastAction ++
- newMsg.creationTime = lastAction
-
-/datum/newscaster/feed_network/proc/submitWanted(criminal, body, scanned_user, datum/picture/picture, adminMsg = 0, newMessage = 0)
- wanted_issue.active = 1
- wanted_issue.criminal = criminal
- wanted_issue.body = body
- wanted_issue.scannedUser = scanned_user
- wanted_issue.isAdminMsg = adminMsg
- if(picture)
- wanted_issue.img = picture.picture_image
- wanted_issue.photo_file = save_photo(picture.picture_image)
- if(newMessage)
- for(var/obj/machinery/newscaster/N in GLOB.allCasters)
- N.newsAlert()
- N.update_icon()
-
-/datum/newscaster/feed_network/proc/deleteWanted()
- wanted_issue.active = 0
- wanted_issue.criminal = null
- wanted_issue.body = null
- wanted_issue.scannedUser = null
- wanted_issue.img = null
- for(var/obj/machinery/newscaster/NEWSCASTER in GLOB.allCasters)
- NEWSCASTER.update_icon()
-
-/datum/newscaster/feed_network/proc/save_photo(icon/photo)
- var/photo_file = copytext_char(md5("\icon[photo]"), 1, 6)
- if(!fexists("[GLOB.log_directory]/photos/[photo_file].png"))
- //Clean up repeated frames
- var/icon/clean = new /icon()
- clean.Insert(photo, "", SOUTH, 1, 0)
- fcopy(clean, "[GLOB.log_directory]/photos/[photo_file].png")
- return photo_file
-
/obj/item/wallframe/newscaster
name = "newscaster frame"
desc = "Used to build newscasters, just secure to the wall."
@@ -177,7 +7,6 @@ GLOBAL_LIST_EMPTY(allCasters)
materials = list(MAT_METAL=14000, MAT_GLASS=8000)
result_path = /obj/machinery/newscaster
-
/obj/machinery/newscaster
name = "newscaster"
desc = "A standard Nanotrasen-licensed newsfeed handler for use in commercial space stations. All the news you absolutely have no use for, in one place!"
diff --git a/code/modules/newscaster/wanted_message.dm b/code/modules/newscaster/wanted_message.dm
new file mode 100644
index 0000000000..de67bbeaf5
--- /dev/null
+++ b/code/modules/newscaster/wanted_message.dm
@@ -0,0 +1,8 @@
+/datum/newscaster/wanted_message
+ var/active
+ var/criminal
+ var/body
+ var/scannedUser
+ var/isAdminMsg
+ var/icon/img
+ var/photo_file