Merge pull request #14816 from SandPoot/tablet-pen-slot
Adds a pen slot for tablet computers
This commit is contained in:
@@ -63,4 +63,4 @@
|
|||||||
if(printer_slot)
|
if(printer_slot)
|
||||||
. += "It has a printer installed."
|
. += "It has a printer installed."
|
||||||
if(user_is_adjacent)
|
if(user_is_adjacent)
|
||||||
. += "The printer's paper levels are at: [printer_slot.stored_paper]/[printer_slot.max_paper].</span>]"
|
. += "The printer's paper levels are at: [printer_slot.stored_paper]/[printer_slot.max_paper].</span>"
|
||||||
|
|||||||
@@ -114,6 +114,12 @@
|
|||||||
update_icon()
|
update_icon()
|
||||||
if(user && istype(user))
|
if(user && istype(user))
|
||||||
ui_interact(user) // Re-open the UI on this computer. It should show the main screen now.
|
ui_interact(user) // Re-open the UI on this computer. It should show the main screen now.
|
||||||
|
if("eject_pen")
|
||||||
|
if(istype(src, /obj/item/modular_computer/tablet))
|
||||||
|
var/obj/item/modular_computer/tablet/self = src
|
||||||
|
if(self.can_have_pen)
|
||||||
|
self.remove_pen()
|
||||||
|
return
|
||||||
|
|
||||||
if("PC_killprogram")
|
if("PC_killprogram")
|
||||||
var/prog = params["name"]
|
var/prog = params["name"]
|
||||||
|
|||||||
@@ -18,6 +18,69 @@
|
|||||||
var/has_variants = TRUE
|
var/has_variants = TRUE
|
||||||
var/finish_color = null
|
var/finish_color = null
|
||||||
|
|
||||||
|
//Pen stuff
|
||||||
|
var/list/contained_item = list(/obj/item/pen, /obj/item/toy/crayon, /obj/item/lipstick, /obj/item/flashlight/pen, /obj/item/clothing/mask/cigarette)
|
||||||
|
var/obj/item/inserted_item //Used for pen, crayon, and lipstick insertion or removal. Same as above.
|
||||||
|
var/can_have_pen = TRUE
|
||||||
|
|
||||||
|
/obj/item/modular_computer/tablet/examine(mob/user)
|
||||||
|
. = ..()
|
||||||
|
if(inserted_item && (!isturf(loc)))
|
||||||
|
. += "<span class='notice'>Ctrl-click to remove [inserted_item].</span>"
|
||||||
|
|
||||||
|
/obj/item/modular_computer/tablet/Initialize()
|
||||||
|
. = ..()
|
||||||
|
if(can_have_pen)
|
||||||
|
if(inserted_item)
|
||||||
|
inserted_item = new inserted_item(src)
|
||||||
|
else
|
||||||
|
inserted_item = new /obj/item/pen(src)
|
||||||
|
|
||||||
|
/obj/item/modular_computer/tablet/proc/insert_pen(obj/item/pen)
|
||||||
|
if(!usr.transferItemToLoc(pen, src))
|
||||||
|
return
|
||||||
|
to_chat(usr, "<span class='notice'>You slide \the [pen] into \the [src]'s pen slot.</span>")
|
||||||
|
inserted_item = pen
|
||||||
|
playsound(src, 'sound/machines/button.ogg', 50, 1)
|
||||||
|
|
||||||
|
/obj/item/modular_computer/tablet/proc/remove_pen()
|
||||||
|
if(hasSiliconAccessInArea(usr) || !usr.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
|
||||||
|
return
|
||||||
|
|
||||||
|
if(inserted_item)
|
||||||
|
usr.put_in_hands(inserted_item)
|
||||||
|
to_chat(usr, "<span class='notice'>You remove [inserted_item] from \the [src]'s pen slot.</span>")
|
||||||
|
inserted_item = null
|
||||||
|
else
|
||||||
|
to_chat(usr, "<span class='warning'>\The [src] does not have a pen in it!</span>")
|
||||||
|
|
||||||
|
/obj/item/modular_computer/tablet/CtrlClick(mob/user)
|
||||||
|
. = ..()
|
||||||
|
if(isturf(loc))
|
||||||
|
return
|
||||||
|
|
||||||
|
if(can_have_pen)
|
||||||
|
remove_pen(user)
|
||||||
|
|
||||||
|
/obj/item/modular_computer/tablet/attackby(obj/item/W, mob/user)
|
||||||
|
if(can_have_pen && is_type_in_list(W, contained_item))
|
||||||
|
if(inserted_item)
|
||||||
|
to_chat(user, "<span class='warning'>There is \a [inserted_item] blocking \the [src]'s pen slot!</span>")
|
||||||
|
return
|
||||||
|
else
|
||||||
|
insert_pen(W)
|
||||||
|
return
|
||||||
|
. = ..()
|
||||||
|
|
||||||
|
/obj/item/modular_computer/tablet/Destroy()
|
||||||
|
if(istype(inserted_item))
|
||||||
|
QDEL_NULL(inserted_item)
|
||||||
|
return ..()
|
||||||
|
|
||||||
|
/obj/item/modular_computer/tablet/ui_data(mob/user)
|
||||||
|
. = ..()
|
||||||
|
.["PC_showpeneject"] = inserted_item ? 1 : 0
|
||||||
|
|
||||||
/obj/item/modular_computer/tablet/update_icon_state()
|
/obj/item/modular_computer/tablet/update_icon_state()
|
||||||
if(has_variants)
|
if(has_variants)
|
||||||
if(!finish_color)
|
if(!finish_color)
|
||||||
@@ -64,6 +127,7 @@
|
|||||||
var/datum/computer_file/program/robotact/robotact
|
var/datum/computer_file/program/robotact/robotact
|
||||||
///IC log that borgs can view in their personal management app
|
///IC log that borgs can view in their personal management app
|
||||||
var/list/borglog = list()
|
var/list/borglog = list()
|
||||||
|
can_have_pen = FALSE
|
||||||
|
|
||||||
/obj/item/modular_computer/tablet/integrated/Initialize(mapload)
|
/obj/item/modular_computer/tablet/integrated/Initialize(mapload)
|
||||||
. = ..()
|
. = ..()
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ export const NtosWindow = (props, context) => {
|
|||||||
PC_stationtime,
|
PC_stationtime,
|
||||||
PC_programheaders = [],
|
PC_programheaders = [],
|
||||||
PC_showexitprogram,
|
PC_showexitprogram,
|
||||||
|
PC_showpeneject,
|
||||||
} = data;
|
} = data;
|
||||||
return (
|
return (
|
||||||
<Window
|
<Window
|
||||||
@@ -78,6 +79,17 @@ export const NtosWindow = (props, context) => {
|
|||||||
src={resolveAsset(PC_apclinkicon)} />
|
src={resolveAsset(PC_apclinkicon)} />
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
{!!PC_showpeneject && (
|
||||||
|
<Button
|
||||||
|
width="26px"
|
||||||
|
lineHeight="22px"
|
||||||
|
textAlign="center"
|
||||||
|
color="transparent"
|
||||||
|
icon="pen-alt"
|
||||||
|
tooltip="Eject pen"
|
||||||
|
tooltipPosition="bottom-left"
|
||||||
|
onClick={() => act('eject_pen')} />
|
||||||
|
)}
|
||||||
{!!PC_showexitprogram && (
|
{!!PC_showexitprogram && (
|
||||||
<Button
|
<Button
|
||||||
width="26px"
|
width="26px"
|
||||||
|
|||||||
Reference in New Issue
Block a user