Skip to content

Commit

Permalink
[MIRROR] True Chameleon Gear
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNightingale authored and SuhEugene committed Nov 23, 2023
1 parent 8bb3364 commit ee35ee4
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions code/datums/extensions/chameleon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@
atom_holder.verbs -= chameleon_verb
atom_holder = null

/datum/extension/chameleon/proc/disguise(newtype, mob/user)
/datum/extension/chameleon/proc/disguise(newtype, mob/user, newname, newdesc)
var/obj/item/copy = new newtype(null) //initial() does not handle lists well
var/obj/item/C = atom_holder

C.name = copy.name
C.desc = copy.desc
if (newname)
C.name = newname
else
C.name = copy.name
if (newdesc)
C.desc = newdesc
else
C.desc = copy.desc
C.icon = copy.icon
C.color = copy.color
C.icon_state = copy.icon_state
Expand Down Expand Up @@ -113,12 +118,14 @@
/datum/extension/chameleon/proc/change(mob/user)
var/choice = input(user, "Select a new appearance", "Select appearance") as null|anything in chameleon_choices
if (choice)
var/newname = input(user, "Choose a new name, or leave blank to use the default", "Choose item name") as null|text
var/newdesc = input(user, "Choose a new description, or leave blank to use the default", "Choose item description") as null|text
if (QDELETED(user) || QDELETED(holder))
return
if(user.incapacitated() || !(holder in user))
to_chat(user, SPAN_WARNING("You can't reach \the [holder]."))
return
disguise(chameleon_choices[choice], user)
disguise(chameleon_choices[choice], user, newname, newdesc)
OnChange(user,holder)

/datum/extension/chameleon/proc/OnChange(mob/user, obj/item/clothing/C) //contains icon updates
Expand Down

0 comments on commit ee35ee4

Please sign in to comment.