dusting off

This commit is contained in:
SandPoot
2023-01-10 18:32:49 -03:00
parent 6bbd44afe7
commit cf51a4dce9
6 changed files with 37 additions and 9 deletions

View File

@@ -1,3 +1,20 @@
/*
* # Element: Object Reskinning
*
* Allows players to modify the appearance of their object (and other attributes if possible)
* PLEASE DO NOT HAVE INVALID VALUES IN unique_reskin I DON'T EVEN WANT TO KNOW WHAT HAPPENS.
* USAGE:
* unique_reskins = list(
* "skin 1" = list(
* "desc" = "very cool description",
* "icon" = 'very_cool_icon.dmi'
* ),
* "skin 2" = list(
* "desc" = "not as cool description",
* "icon" = 'the_boring_skin.dmi'
* )
* )
*/
/datum/element/object_reskinning
element_flags = ELEMENT_DETACH
@@ -22,7 +39,14 @@
if(obj.always_reskinnable)
examine_list += span_notice("It has no limit to reskinning.")
/// Reskins an object according to user's choice, modified to be overridable and supports different icons
/*
* Reskins an object according to user's choice.
* Will detach itself if there's no skins or if done successfully but not always reskinnable.
*
* Arguments:
* * to_reskin The object we will be reskinning
* * user The user who wants to choose a skin for the object
*/
/datum/element/object_reskinning/proc/reskin(obj/to_reskin, mob/user)
// Just stop early
if(!(LAZYLEN(to_reskin.unique_reskin) && user.canUseTopic(to_reskin, BE_CLOSE, NO_DEXTERY)))
@@ -30,6 +54,7 @@
Detach(to_reskin)
return FALSE
// Get our choices
var/list/items = list()
for(var/reskin_option in to_reskin.unique_reskin)
var/image/item_image = image(
@@ -38,14 +63,19 @@
items += list("[reskin_option]" = item_image)
sortList(items)
// Display to the user
var/pick = show_radial_menu(user, to_reskin, items, custom_check = CALLBACK(src, .proc/check_reskin_menu, user, to_reskin), radius = 38, require_near = TRUE)
if(!pick)
return FALSE
// Finish the work
to_reskin.current_skin = pick
for(var/reskin_var in to_reskin.unique_reskin[pick])
to_reskin.vars[reskin_var] = to_reskin.unique_reskin[pick][reskin_var]
to_chat(user, "[to_reskin] is now skinned as '[pick].'")
to_reskin.reskin_obj(user)
// Only once or always?
if(!to_reskin.always_reskinnable)
Detach(to_reskin)
return TRUE
@@ -55,6 +85,7 @@
*
* Arguments:
* * user The mob interacting with the menu
* * obj The obj to be checking against
*/
/datum/element/object_reskinning/proc/check_reskin_menu(mob/user, obj/obj)
if(QDELETED(obj))

View File

@@ -130,6 +130,11 @@ GLOBAL_LIST_EMPTY(PDAs)
new_overlays = TRUE
update_icon()
/// This is a mess i probably shouldn't touch.
/obj/item/pda/ComponentInitialize()
. = ..()
RemoveElement(/datum/element/object_reskinning)
/obj/item/pda/CtrlShiftClick(mob/living/user)
. = ..()
if(GLOB.pda_reskins && user.canUseTopic(src, BE_CLOSE, NO_DEXTERY))

View File

@@ -211,8 +211,6 @@
/obj/item/melee/transforming/energy/sword/saber/reskin_obj(mob/M)
. = ..()
if(!.)
return
switch(current_skin)
if("Sword")
icon_state = "sword[active ? sword_color : "0"]"

View File

@@ -86,8 +86,6 @@
/obj/item/clothing/gloves/fingerless/pugilist/crafted/reskin_obj(mob/M)
. = ..()
if(!.)
return
switch(current_skin)
if("Short")
item_state = "armwraps"

View File

@@ -576,6 +576,4 @@
/obj/item/clothing/accessory/pride/reskin_obj(mob/M)
. = ..()
if(!.)
return
name = "[current_skin] pin"

View File

@@ -120,8 +120,6 @@
/obj/item/pen/fountain/captain/reskin_obj(mob/M)
. = ..()
if(!.)
return
desc = "It's an expensive [current_skin] fountain pen. The nib is quite sharp."
/obj/item/pen/attack_self(mob/living/carbon/user)