Merge pull request #8581 from Ghommie/Ghommie-cit42

[Ready]Reskinnable PDAs.
This commit is contained in:
kevinz000
2019-06-28 20:30:05 -07:00
committed by GitHub
16 changed files with 182 additions and 99 deletions
+9
View File
@@ -266,6 +266,15 @@ GLOBAL_LIST_INIT(ghost_others_options, list(GHOST_OTHERS_SIMPLE, GHOST_OTHERS_DE
GLOBAL_LIST_INIT(pda_styles, list(MONO, VT, ORBITRON, SHARE))
//pda icon reskins
#define PDA_SKIN_CLASSIC "Classic"
#define PDA_SKIN_ALT "Holographic"
#define PDA_SKIN_RUGGED "Rugged"
#define PDA_SKIN_MODERN "Modern"
GLOBAL_LIST_INIT(pda_reskins, list(PDA_SKIN_CLASSIC = 'icons/obj/pda.dmi', PDA_SKIN_ALT = 'icons/obj/pda_alt.dmi',
PDA_SKIN_RUGGED = 'icons/obj/pda_rugged.dmi', PDA_SKIN_MODERN = 'icons/obj/pda_modern.dmi'))
//Color Defines
#define OOC_COLOR "#002eb8"
#define AOOC_COLOR "#b8002e"
+20 -23
View File
@@ -35,15 +35,14 @@
/obj/item/pda/clear,
/obj/item/pda/syndicate,
/obj/item/pda/chameleon,
/obj/item/pda/chameleon/broken)
/obj/item/pda/chameleon/broken,
/obj/item/pda/lieutenant)
for(var/P in typesof(/obj/item/pda) - blocked)
var/obj/item/pda/D = new P
//D.name = "PDA Style [colorlist.len+1]" //Gotta set the name, otherwise it all comes up as "PDA"
D.name = D.icon_state //PDAs don't have unique names, but using the sprite names works.
src.colorlist += D
for(var/A in typesof(/obj/item/pda) - blocked)
var/obj/item/pda/P = A
var/PDA_name = initial(P.name)
colorlist += PDA_name
colorlist[PDA_name] = list(initial(P.icon_state), initial(P.desc), initial(P.overlays_offsets), initial(P.overlays_icons))
/obj/machinery/pdapainter/Destroy()
QDEL_NULL(storedpda)
@@ -108,22 +107,20 @@
if(.)
return
if(storedpda)
var/obj/item/pda/P
P = input(user, "Select your color!", "PDA Painting") as null|anything in colorlist
if(!P)
return
if(!in_range(src, user))
return
if(!storedpda)//is the pda still there?
return
storedpda.icon_state = P.icon_state
storedpda.desc = P.desc
ejectpda()
else
if(!storedpda)
to_chat(user, "<span class='notice'>[src] is empty.</span>")
return
var/choice = input(user, "Select the new skin!", "PDA Painting") as null|anything in colorlist
if(!choice || !storedpda || !in_range(src, user))
return
var/list/P = colorlist[choice]
storedpda.icon_state = P[1]
storedpda.desc = P[2]
storedpda.overlays_offsets = P[3]
storedpda.overlays_icons = P[4]
storedpda.set_new_overlays()
storedpda.update_icon()
ejectpda()
/obj/machinery/pdapainter/verb/ejectpda()
set name = "Eject PDA"
+98 -42
View File
@@ -10,6 +10,15 @@ GLOBAL_LIST_EMPTY(PDAs)
#define PDA_SCANNER_HALOGEN 4
#define PDA_SCANNER_GAS 5
#define PDA_SPAM_DELAY 2 MINUTES
#define PDA_STANDARD_OVERLAYS list("pda-r", "blank", "id_overlay", "insert_overlay", "light_overlay", "pai_overlay")
//pda icon overlays list defines
#define PDA_OVERLAY_ALERT 1
#define PDA_OVERLAY_SCREEN 2
#define PDA_OVERLAY_ID 3
#define PDA_OVERLAY_ITEM 4
#define PDA_OVERLAY_LIGHT 5
#define PDA_OVERLAY_PAI 6
/obj/item/pda
name = "\improper PDA"
@@ -31,7 +40,8 @@ GLOBAL_LIST_EMPTY(PDAs)
var/default_cartridge = 0 // Access level defined by cartridge
var/obj/item/cartridge/cartridge = null //current cartridge
var/mode = 0 //Controls what menu the PDA will display. 0 is hub; the rest are either built in or based on cartridge.
var/icon_alert = "pda-r" //Icon to be overlayed for message alerts. Taken from the pda icon file.
var/list/overlays_icons = list('icons/obj/pda_alt.dmi' = list("pda-r", "screen_default", "id_overlay", "insert_overlay", "light_overlay", "pai_overlay"))
var/current_overlays = PDA_STANDARD_OVERLAYS
var/font_index = 0 //This int tells DM which font is currently selected and lets DM know when the last font has been selected so that it can cycle back to the first font when "toggle font" is pressed again.
var/font_mode = "font-family:monospace;" //The currently selected font.
var/background_color = "#808000" //The currently selected background color.
@@ -78,7 +88,9 @@ GLOBAL_LIST_EMPTY(PDAs)
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/overlays_x_offset = 0 //x offset to use for certain overlays
var/list/overlays_offsets // offsets to use for certain overlays
var/overlays_x_offset = 0
var/overlays_y_offset = 0
var/underline_flag = TRUE //flag for underline
@@ -91,15 +103,13 @@ GLOBAL_LIST_EMPTY(PDAs)
return BRUTELOSS
/obj/item/pda/examine(mob/user)
..()
if(!id && !inserted_item)
return
if(id)
to_chat(user, "<span class='notice'>Alt-click to remove the id.</span>")
. = ..()
var/dat = id ? "<span class='notice'>Alt-click to remove the id.</span>" : ""
if(inserted_item && (!isturf(loc)))
to_chat(user, "<span class='notice'>Ctrl-click to remove [inserted_item].</span>")
dat += "\n<span class='notice'>Ctrl-click to remove [inserted_item].</span>"
if(LAZYLEN(GLOB.pda_reskins))
dat += "\n<span class='notice'>Ctrl-shift-click it to reskin it.</span>"
to_chat(user, dat)
/obj/item/pda/Initialize()
. = ..()
@@ -115,28 +125,71 @@ GLOBAL_LIST_EMPTY(PDAs)
inserted_item = new /obj/item/pen(src)
update_icon()
/obj/item/pda/CtrlShiftClick(mob/living/user)
. = ..()
if(GLOB.pda_reskins && user.canUseTopic(src, BE_CLOSE, NO_DEXTERY))
reskin_obj(user)
/obj/item/pda/reskin_obj(mob/M)
if(!LAZYLEN(GLOB.pda_reskins))
return
var/dat = "<b>Reskin options for [name]:</b>"
for(var/V in GLOB.pda_reskins)
var/output = icon2html(GLOB.pda_reskins[V], M, icon_state)
dat += "\n[V]: <span class='reallybig'>[output]</span>"
to_chat(M, dat)
var/choice = input(M, "Choose the a reskin for [src]","Reskin Object") as null|anything in GLOB.pda_reskins
var/new_icon = GLOB.pda_reskins[choice]
if(QDELETED(src) || isnull(new_icon) || new_icon == icon || M.incapacitated() || !in_range(M,src))
return
icon = new_icon
set_new_overlays()
update_icon()
to_chat(M, "[src] is now skinned as '[choice]'.")
/obj/item/pda/proc/set_new_overlays()
if(!overlays_offsets || !(icon in overlays_offsets))
overlays_x_offset = 0
overlays_y_offset = 0
else
var/list/new_offsets = overlays_offsets[icon]
if(new_offsets)
overlays_x_offset = new_offsets[1]
overlays_y_offset = new_offsets[2]
if(!(icon in overlays_icons))
current_overlays = PDA_STANDARD_OVERLAYS
return
current_overlays = overlays_icons[icon]
/obj/item/pda/equipped(mob/user, slot)
. = ..()
if(!equipped)
if(user.client)
background_color = user.client.prefs.pda_color
switch(user.client.prefs.pda_style)
if(MONO)
font_index = MODE_MONO
font_mode = FONT_MONO
if(SHARE)
font_index = MODE_SHARE
font_mode = FONT_SHARE
if(ORBITRON)
font_index = MODE_ORBITRON
font_mode = FONT_ORBITRON
if(VT)
font_index = MODE_VT
font_mode = FONT_VT
else
font_index = MODE_MONO
font_mode = FONT_MONO
equipped = TRUE
if(equipped)
return
if(user.client)
background_color = user.client.prefs.pda_color
switch(user.client.prefs.pda_style)
if(MONO)
font_index = MODE_MONO
font_mode = FONT_MONO
if(SHARE)
font_index = MODE_SHARE
font_mode = FONT_SHARE
if(ORBITRON)
font_index = MODE_ORBITRON
font_mode = FONT_ORBITRON
if(VT)
font_index = MODE_VT
font_mode = FONT_VT
else
font_index = MODE_MONO
font_mode = FONT_MONO
var/pref_skin = GLOB.pda_reskins[user.client.prefs.pda_skin]
if(icon != pref_skin)
icon = pref_skin
set_new_overlays()
update_icon()
equipped = TRUE
/obj/item/pda/proc/update_label()
name = "PDA-[owner] ([ownjob])" //Name generalisation
@@ -150,26 +203,23 @@ GLOBAL_LIST_EMPTY(PDAs)
/obj/item/pda/GetID()
return id
/obj/item/pda/update_icon()
/obj/item/pda/update_icon(alert = FALSE)
cut_overlays()
add_overlay(alert ? current_overlays[PDA_OVERLAY_ALERT] : current_overlays[PDA_OVERLAY_SCREEN])
var/mutable_appearance/overlay = new()
overlay.pixel_x = overlays_x_offset
if(id)
overlay.icon_state = "id_overlay"
overlay.icon_state = current_overlays[PDA_OVERLAY_ID]
add_overlay(new /mutable_appearance(overlay))
if(inserted_item)
overlay.icon_state = "insert_overlay"
overlay.icon_state = current_overlays[PDA_OVERLAY_ITEM]
add_overlay(new /mutable_appearance(overlay))
if(fon)
overlay.icon_state = "light_overlay"
overlay.icon_state = current_overlays[PDA_OVERLAY_LIGHT]
add_overlay(new /mutable_appearance(overlay))
if(pai)
if(pai.pai)
overlay.icon_state = "pai_overlay"
add_overlay(new /mutable_appearance(overlay))
else
overlay.icon_state = "pai_off_overlay"
add_overlay(new /mutable_appearance(overlay))
overlay.icon_state = "[current_overlays[PDA_OVERLAY_PAI]][pai.pai ? "" : "_off"]"
add_overlay(new /mutable_appearance(overlay))
/obj/item/pda/MouseDrop(mob/over, src_location, over_location)
var/mob/M = usr
@@ -740,8 +790,7 @@ GLOBAL_LIST_EMPTY(PDAs)
to_chat(L, "[icon2html(src)] <b>Message from [hrefstart][signal.data["name"]] ([signal.data["job"]])[hrefend], </b>[signal.format_message()] (<a href='byond://?src=[REF(src)];choice=Message;skiprefresh=1;target=[REF(signal.source)]'>Reply</a>)")
update_icon()
add_overlay(icon_alert)
update_icon(TRUE)
/obj/item/pda/proc/send_to_all(mob/living/U)
if (last_everyone && world.time < last_everyone + PDA_SPAM_DELAY)
@@ -1080,4 +1129,11 @@ GLOBAL_LIST_EMPTY(PDAs)
#undef PDA_SCANNER_HALOGEN
#undef PDA_SCANNER_GAS
#undef PDA_SPAM_DELAY
#undef PDA_STANDARD_OVERLAYS
#undef PDA_OVERLAY_ALERT
#undef PDA_OVERLAY_SCREEN
#undef PDA_OVERLAY_ID
#undef PDA_OVERLAY_ITEM
#undef PDA_OVERLAY_LIGHT
#undef PDA_OVERLAY_PAI
@@ -124,6 +124,16 @@
icon_state = "pda-captain"
detonatable = FALSE
/obj/item/pda/lieutenant
name = "lieutenant PDA"
default_cartridge = /obj/item/cartridge/captain
inserted_item = /obj/item/pen/fountain/captain
icon_state = "pda-lieutenant"
ttone = "bwoink"
detonatable = FALSE
hidden = TRUE
note = "Congratulations, you have chosen the Thinktronic 5230-2 Personal Data Assistant Prestige Edition! To help with navigation, we have provided the following definitions. North: Fore. South: Aft. West: Port. East: Starboard. Quarter is either side of aft."
/obj/item/pda/cargo
name = "cargo technician PDA"
default_cartridge = /obj/item/cartridge/quartermaster
@@ -171,25 +181,29 @@
/obj/item/pda/curator
name = "curator PDA"
icon_state = "pda-library"
icon_alert = "pda-r-library"
overlays_icons = list('icons/obj/pda.dmi' = list("pda-r-library","blank","id_overlay","insert_overlay", "light_overlay", "pai_overlay"),
'icons/obj/pda_alt.dmi' = list("pda-r","screen_default","id_overlay","insert_overlay", "light_overlay", "pai_overlay"))
current_overlays = list("pda-r-library","blank","id_overlay","insert_overlay", "light_overlay", "pai_overlay")
default_cartridge = /obj/item/cartridge/curator
inserted_item = /obj/item/pen/fountain
desc = "A portable microcomputer by Thinktronic Systems, LTD. This model is a WGW-11 series e-reader."
note = "Congratulations, your station has chosen the Thinktronic 5290 WGW-11 Series E-reader and Personal Data Assistant!"
note = "Congratulations, your station has chosen the Thinktronic 5290 WGW-11 Series E-reader and Personal Data Assistant! To help with navigation, we have provided the following definitions. North: Fore. South: Aft. West: Port. East: Starboard. Quarter is either side of aft."
silent = TRUE //Quiet in the library!
overlays_offsets = list('icons/obj/pda.dmi' = list(-3,0))
overlays_x_offset = -3
/obj/item/pda/clear
name = "clear PDA"
icon_state = "pda-clear"
desc = "A portable microcomputer by Thinktronic Systems, LTD. This model is a special edition with a transparent case."
note = "Congratulations, you have chosen the Thinktronic 5230 Personal Data Assistant Deluxe Special Max Turbo Limited Edition!"
note = "Congratulations, you have chosen the Thinktronic 5230 Personal Data Assistant Deluxe Special Max Turbo Limited Edition! To help with navigation, we have provided the following definitions. North: Fore. South: Aft. West: Port. East: Starboard. Quarter is either side of aft."
/obj/item/pda/neko
name = "neko PDA"
icon_state = "pda-neko"
desc = "A portable microcomputer by Thinktronic Systems, LTD. This model is a special edition a feline fine case."
note = "Congratulations, you have chosen the Thinktronic 5230 Personal Data Assistant Deluxe Special Mew Turbo Limited Edition NYA~!"
overlays_icons = list('icons/obj/pda_alt.dmi' = list("pda-r", "screen_neko", "id_overlay", "insert_overlay", "light_overlay", "pai_overlay"))
desc = "A portable microcomputer by Thinktronic Systems, LTD. This model is a special feline edition."
note = "Congratulations, you have chosen the Thinktronic 5230 Personal Data Assistant Deluxe Special Mew Turbo Limited Edition NYA~! To help with navigation, we have provided the following definitions. North: Fore. South: Aft. West: Port. East: Starboard. Quarter is either side of aft."
/obj/item/pda/cook
name = "cook PDA"
+13 -12
View File
@@ -18,8 +18,9 @@
var/acid_level = 0 //how much acid is on that obj
var/persistence_replacement //have something WAY too amazing to live to the next round? Set a new path here. Overuse of this var will make me upset.
var/current_skin //Has the item been reskinned?
var/current_skin //the item reskin
var/list/unique_reskin //List of options to reskin.
var/always_reskinnable = FALSE
// Access levels, used in modules\jobs\access.dm
var/list/req_access
@@ -228,26 +229,26 @@
..()
if(obj_flags & UNIQUE_RENAME)
to_chat(user, "<span class='notice'>Use a pen on it to rename it or change its description.</span>")
if(unique_reskin && !current_skin)
if(unique_reskin && (!current_skin || always_reskinnable))
to_chat(user, "<span class='notice'>Alt-click it to reskin it.</span>")
/obj/AltClick(mob/user)
. = ..()
if(unique_reskin && !current_skin && user.canUseTopic(src, BE_CLOSE, NO_DEXTERY))
if(unique_reskin && (!current_skin || always_reskinnable) && user.canUseTopic(src, BE_CLOSE, NO_DEXTERY))
reskin_obj(user)
/obj/proc/reskin_obj(mob/M)
if(!LAZYLEN(unique_reskin))
return
to_chat(M, "<b>Reskin options for [name]:</b>")
var/dat = "<b>Reskin options for [name]:</b>\n"
for(var/V in unique_reskin)
var/output = icon2html(src, M, unique_reskin[V])
to_chat(M, "[V]: <span class='reallybig'>[output]</span>")
dat += "[V]: <span class='reallybig'>[output]</span>\n"
to_chat(M, dat)
var/choice = input(M,"Warning, you can only reskin [src] once!","Reskin Object") as null|anything in unique_reskin
if(!QDELETED(src) && choice && !current_skin && !M.incapacitated() && in_range(M,src))
if(!unique_reskin[choice])
return
current_skin = choice
icon_state = unique_reskin[choice]
to_chat(M, "[src] is now skinned as '[choice].'")
var/choice = input(M, always_reskinnable ? "Choose the a reskin for [src]" : "Warning, you can only reskin [src] once!","Reskin Object") as null|anything in unique_reskin
if(QDELETED(src) || !choice || (current_skin && !always_reskinnable) || M.incapacitated() || !in_range(M,src) || !unique_reskin[choice] || unique_reskin[choice] == current_skin)
return
current_skin = choice
icon_state = unique_reskin[choice]
to_chat(M, "[src] is now skinned as '[choice]'.")
+6
View File
@@ -59,6 +59,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/preferred_map = null
var/pda_style = MONO
var/pda_color = "#808000"
var/pda_skin = PDA_SKIN_ALT
var/uses_glasses_colour = 0
@@ -746,6 +747,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += "<br>"
dat += "<b>PDA Color:</b> <span style='border:1px solid #161616; background-color: [pda_color];'>&nbsp;&nbsp;&nbsp;</span> <a href='?_src_=prefs;preference=pda_color;task=input'>Change</a><BR>"
dat += "<b>PDA Style:</b> <a href='?_src_=prefs;task=input;preference=pda_style'>[pda_style]</a><br>"
dat += "<b>PDA Reskin:</b> <a href='?_src_=prefs;task=input;preference=pda_skin'>[pda_skin]</a><br>"
dat += "<br>"
dat += "<b>Ghost Ears:</b> <a href='?_src_=prefs;preference=ghost_ears'>[(chat_toggles & CHAT_GHOSTEARS) ? "All Speech" : "Nearest Creatures"]</a><br>"
dat += "<b>Ghost Radio:</b> <a href='?_src_=prefs;preference=ghost_radio'>[(chat_toggles & CHAT_GHOSTRADIO) ? "All Messages":"No Messages"]</a><br>"
@@ -1986,6 +1988,10 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/pickedPDAColor = input(user, "Choose your PDA Interface color.", "Character Preference",pda_color) as color|null
if(pickedPDAColor)
pda_color = pickedPDAColor
if("pda_skin")
var/pickedPDASkin = input(user, "Choose your PDA reskin.", "Character Preference", pda_skin) as null|anything in GLOB.pda_reskins
if(pickedPDASkin)
pda_skin = pickedPDASkin
else
switch(href_list["preference"])
@@ -108,6 +108,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S["tip_delay"] >> tip_delay
S["pda_style"] >> pda_style
S["pda_color"] >> pda_color
S["pda_skin"] >> pda_skin
//citadel code
S["arousable"] >> arousable
@@ -144,6 +145,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
be_special = SANITIZE_LIST(be_special)
pda_style = sanitize_inlist(pda_style, GLOB.pda_styles, initial(pda_style))
pda_color = sanitize_hexcolor(pda_color, 6, 1, initial(pda_color))
pda_skin = sanitize_inlist(pda_skin, GLOB.pda_reskins, PDA_SKIN_ALT)
screenshake = sanitize_integer(screenshake, 0, 800, initial(screenshake))
damagescreenshake = sanitize_integer(damagescreenshake, 0, 2, initial(damagescreenshake))
+14 -1
View File
@@ -226,6 +226,19 @@
CL.flags_cover = initial(PCL.flags_cover)
target.icon = initial(picked_item.icon)
/datum/action/item_action/chameleon/change/pda/update_item(obj/item/pda/picked_item)
if(!istype(target, /obj/item/pda))
return ..()
var/obj/item/pda/P = target
P.name = initial(picked_item.name)
P.desc = initial(picked_item.desc)
P.icon_state = initial(picked_item.icon_state)
P.item_state = initial(picked_item.item_state)
P.item_color = initial(picked_item.item_color)
P.overlays_offsets = initial(picked_item.overlays_offsets)
P.set_new_overlays()
P.update_icon()
/datum/action/item_action/chameleon/change/Trigger()
if(!IsAvailable())
return
@@ -584,7 +597,7 @@
/obj/item/pda/chameleon
name = "PDA"
var/datum/action/item_action/chameleon/change/chameleon_action
var/datum/action/item_action/chameleon/change/pda/chameleon_action
/obj/item/pda/chameleon/Initialize()
. = ..()
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

@@ -1,4 +0,0 @@
//Overrides TG's PDA sprites with Cit's PDA sprites. Remind me to turn this into a pref somewhere down the line.
/obj/item/pda
icon = 'modular_citadel/icons/obj/pda.dmi'
@@ -16,6 +16,7 @@
"purple hypovial" = "hypovial-p",
"black hypovial" = "hypovial-t"
)
always_reskinnable = TRUE
/obj/item/reagent_containers/glass/bottle/vial/Initialize()
. = ..()
@@ -29,17 +30,6 @@
/obj/item/reagent_containers/glass/bottle/vial/on_reagent_change()
update_icon()
/obj/item/reagent_containers/glass/bottle/vial/reskin_obj(mob/M) //Makes the vials completely reskinnable, and renames them - overrides /obj/proc/reskin_obj
if(!LAZYLEN(unique_reskin))
return
var/choice = input(M,"Do you wish to recolour your [src]?","Vial Recolour") as null|anything in unique_reskin
if(!QDELETED(src) && choice && !current_skin && !M.incapacitated() && in_range(M,src))
if(!unique_reskin[choice])
return
icon_state = unique_reskin[choice]
name = choice
to_chat(M, "[src] is now skinned as '[choice].'")
/obj/item/reagent_containers/glass/bottle/vial/update_icon()
cut_overlays()
if(reagents.total_volume)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

-1
View File
@@ -2886,7 +2886,6 @@
#include "modular_citadel\code\game\objects\items\vending_items.dm"
#include "modular_citadel\code\game\objects\items\circuitboards\machine_circuitboards.dm"
#include "modular_citadel\code\game\objects\items\devices\aicard.dm"
#include "modular_citadel\code\game\objects\items\devices\PDA\PDA.dm"
#include "modular_citadel\code\game\objects\items\devices\radio\encryptionkey.dm"
#include "modular_citadel\code\game\objects\items\devices\radio\headset.dm"
#include "modular_citadel\code\game\objects\items\devices\radio\shockcollar.dm"