Files
Aurora.3/code/modules/clothing/chameleon.dm
2020-09-06 17:37:56 -03:00

533 lines
17 KiB
Plaintext

//*****************
//**Cham Jumpsuit**
//*****************
/obj/item/proc/disguise(newtype)
//this is necessary, unfortunately, as initial() does not play well with list vars
var/obj/item/copy = new newtype(null) //so that it is GCed once we exit
var/original_layer = layer
var/original_plane = plane
appearance = copy
layer = original_layer // So it doesn't get fucked up in the inv.
plane = original_plane
item_state = copy.item_state
body_parts_covered = copy.body_parts_covered
flags_inv = copy.flags_inv
body_parts_covered = copy.body_parts_covered
contained_sprite = copy.contained_sprite
icon_override = copy.icon_override
icon_species_tag = copy.icon_species_tag
if(copy.item_state_slots) // copy.item_state_slots.Copy() apears to be undefined
item_state_slots = copy.item_state_slots // however this appears to work perfectly fine
if(copy.item_icons)
item_icons = copy.item_icons.Copy()
if(copy.sprite_sheets)
sprite_sheets = copy.sprite_sheets.Copy()
//copying sprite_sheets_obj should be unnecessary as chameleon items are not refittable.
QDEL_IN(copy, 1) // The call chain should terminate by the time this triggers.
return copy //for inheritance
/proc/generate_chameleon_choices(var/basetype, var/blacklist=list())
. = list()
var/i = 1 //in case there is a collision with both name AND icon_state
for(var/typepath in typesof(basetype) - blacklist)
var/obj/O = typepath
if(initial(O.icon) && initial(O.icon_state))
var/name = initial(O.name)
if(name in .)
name += " ([initial(O.icon_state)])"
if(name in .)
name += " \[[i++]\]"
.[name] = typepath
/obj/item/clothing/under/chameleon
//starts off as black
name = "black jumpsuit"
icon_state = "black"
item_state = "bl_suit"
worn_state = "black"
desc = "It's a plain jumpsuit. It seems to have a small dial on the wrist."
origin_tech = list(TECH_ILLEGAL = 3)
var/global/list/clothing_choices
/obj/item/clothing/under/chameleon/Initialize()
. = ..()
if(!clothing_choices)
var/blocked = list(src.type, /obj/item/clothing/under/gimmick, /obj/item/clothing/under/rank/centcom_officer/bst)//Prevent infinite loops and bad jumpsuits.
clothing_choices = generate_chameleon_choices(/obj/item/clothing/under, blocked)
/obj/item/clothing/under/chameleon/emp_act(severity)
name = "psychedelic"
desc = "Groovy!"
icon_state = "psyche"
item_state_slots[slot_w_uniform_str] = "psyche"
update_icon()
update_clothing_icon()
/obj/item/clothing/under/chameleon/verb/change(picked in clothing_choices)
set name = "Change Jumpsuit Appearance"
set category = "Chameleon Items"
set src in usr
if(!ispath(clothing_choices[picked]))
return
disguise(clothing_choices[picked])
update_clothing_icon() //so our overlays update.
/obj/item/clothing/under/chameleon/wizard/Initialize()
. = ..()
disguise(/obj/item/clothing/under/lightpurple)
/obj/item/clothing/under/chameleon/wizard/change(picked in clothing_choices)
set name = "Change Jumpsuit Appearance"
set category = "Chameleon Items"
set src in usr
if(isliving(usr))
var/mob/living/user = usr
if(user.is_wizard())
..(picked)
return
to_chat(usr, SPAN_WARNING("You touch \the [src], but nothing happens."))
/obj/item/clothing/under/chameleon/wizard/emp_act()
return
//*****************
//**Chameleon Hat**
//*****************
/obj/item/clothing/head/chameleon
name = "grey cap"
icon_state = "greysoft"
desc = "It looks like a plain hat, but upon closer inspection, there's an advanced holographic array installed inside. It seems to have a small dial inside."
origin_tech = list(TECH_ILLEGAL = 3)
body_parts_covered = 0
var/global/list/clothing_choices
/obj/item/clothing/head/chameleon/Initialize()
. = ..()
if(!clothing_choices)
var/blocked = list(src.type, /obj/item/clothing/head/justice,)//Prevent infinite loops and bad hats.
clothing_choices = generate_chameleon_choices(/obj/item/clothing/head, blocked)
/obj/item/clothing/head/chameleon/emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown.
name = "grey cap"
desc = "It's a baseball hat in a tasteful grey colour."
icon_state = "greysoft"
update_icon()
update_clothing_icon()
/obj/item/clothing/head/chameleon/verb/change(picked in clothing_choices)
set name = "Change Hat/Helmet Appearance"
set category = "Chameleon Items"
set src in usr
if(!ispath(clothing_choices[picked]))
return
disguise(clothing_choices[picked])
update_clothing_icon() //so our overlays update.
/obj/item/clothing/head/chameleon/wizard
wizard_garb = TRUE
/obj/item/clothing/head/chameleon/wizard/Initialize()
. = ..()
disguise(/obj/item/clothing/head/wizard)
/obj/item/clothing/head/chameleon/wizard/change(picked in clothing_choices)
set name = "Change Hat/Helmet Appearance"
set category = "Chameleon Items"
set src in usr
if(isliving(usr))
var/mob/living/user = usr
if(user.is_wizard())
..(picked)
return
to_chat(usr, SPAN_WARNING("You touch \the [src], but nothing happens."))
/obj/item/clothing/head/chameleon/wizard/emp_act()
return
//******************
//**Chameleon Suit**
//******************
/obj/item/clothing/suit/chameleon
name = "armor"
icon_state = "armor"
item_state = "armor"
desc = "It appears to be a vest of standard armor, except this is embedded with a hidden holographic cloaker, allowing it to change it's appearance, but offering no protection.. It seems to have a small dial inside."
origin_tech = list(TECH_ILLEGAL = 3)
var/global/list/clothing_choices
/obj/item/clothing/suit/chameleon/Initialize()
. = ..()
if(!clothing_choices)
var/blocked = list(src.type, /obj/item/clothing/suit/cyborg_suit, /obj/item/clothing/suit/justice)
clothing_choices = generate_chameleon_choices(/obj/item/clothing/suit, blocked)
/obj/item/clothing/suit/chameleon/emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown.
name = "armor"
desc = "An armored vest that protects against some damage."
icon_state = "armor"
update_icon()
update_clothing_icon()
/obj/item/clothing/suit/chameleon/verb/change(picked in clothing_choices)
set name = "Change Oversuit Appearance"
set category = "Chameleon Items"
set src in usr
if(!ispath(clothing_choices[picked]))
return
disguise(clothing_choices[picked])
update_clothing_icon() //so our overlays update.
/obj/item/clothing/suit/chameleon/wizard
wizard_garb = TRUE
/obj/item/clothing/suit/chameleon/wizard/Initialize()
. = ..()
disguise(/obj/item/clothing/suit/wizrobe)
/obj/item/clothing/suit/chameleon/wizard/change(picked in clothing_choices)
set name = "Change Oversuit Appearance"
set category = "Chameleon Items"
set src in usr
if(isliving(usr))
var/mob/living/user = usr
if(user.is_wizard())
..(picked)
return
to_chat(usr, SPAN_WARNING("You touch \the [src], but nothing happens."))
/obj/item/clothing/suit/chameleon/wizard/emp_act()
return
//*******************
//**Chameleon Shoes**
//*******************
/obj/item/clothing/shoes/chameleon
name = "black shoes"
icon_state = "black"
item_state = "black"
desc = "They're comfy black shoes, with clever cloaking technology built in. It seems to have a small dial on the back of each shoe."
silent = 1
origin_tech = list(TECH_ILLEGAL = 3)
var/global/list/clothing_choices
/obj/item/clothing/shoes/chameleon/Initialize()
. = ..()
if(!clothing_choices)
var/blocked = list(src.type, /obj/item/clothing/shoes/syndigaloshes, /obj/item/clothing/shoes/cyborg, /obj/item/clothing/shoes/black/bst)//prevent infinite loops and bad shoes.
clothing_choices = generate_chameleon_choices(/obj/item/clothing/shoes, blocked)
/obj/item/clothing/shoes/chameleon/emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown.
name = "black shoes"
desc = "A pair of black shoes."
icon_state = "black"
item_state = "black"
update_icon()
update_clothing_icon()
/obj/item/clothing/shoes/chameleon/verb/change(picked in clothing_choices)
set name = "Change Footwear Appearance"
set category = "Chameleon Items"
set src in usr
if(!ispath(clothing_choices[picked]))
return
disguise(clothing_choices[picked])
update_clothing_icon() //so our overlays update.
/obj/item/clothing/shoes/chameleon/wizard/Initialize()
. = ..()
disguise(/obj/item/clothing/shoes/sandal)
/obj/item/clothing/shoes/chameleon/wizard/change(picked in clothing_choices)
set name = "Change Footwear Appearance"
set category = "Chameleon Items"
set src in usr
if(isliving(usr))
var/mob/living/user = usr
if(user.is_wizard())
..(picked)
return
to_chat(usr, SPAN_WARNING("You touch \the [src], but nothing happens."))
/obj/item/clothing/shoes/chameleon/wizard/emp_act()
return
//**********************
//**Chameleon Backpack**
//**********************
/obj/item/storage/backpack/chameleon
name = "backpack"
icon_state = "backpack"
item_state = "backpack"
desc = "A backpack outfitted with cloaking tech. It seems to have a small dial inside, kept away from the storage."
origin_tech = list(TECH_ILLEGAL = 3)
var/global/list/clothing_choices
/obj/item/storage/backpack/chameleon/fill()
..()
if(!clothing_choices)
var/blocked = list(src.type, /obj/item/storage/backpack/satchel/withwallet)
clothing_choices = generate_chameleon_choices(/obj/item/storage/backpack, blocked)
/obj/item/storage/backpack/chameleon/emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown.
name = "backpack"
desc = "You wear this on your back and put items into it."
icon_state = "backpack"
item_state = "backpack"
update_icon()
if (ismob(src.loc))
var/mob/M = src.loc
M.update_inv_back()
/obj/item/storage/backpack/chameleon/verb/change(picked in clothing_choices)
set name = "Change Backpack Appearance"
set category = "Chameleon Items"
set src in usr
if(!ispath(clothing_choices[picked]))
return
disguise(clothing_choices[picked])
//so our overlays update.
if (ismob(src.loc))
var/mob/M = src.loc
M.update_inv_back()
/obj/item/storage/backpack/chameleon/wizard/Initialize()
. = ..()
disguise(/obj/item/storage/backpack/wizard)
/obj/item/storage/backpack/chameleon/wizard/change(picked in clothing_choices)
set name = "Change Backpack Appearance"
set category = "Chameleon Items"
set src in usr
if(isliving(usr))
var/mob/living/user = usr
if(user.is_wizard())
..(picked)
return
to_chat(usr, SPAN_WARNING("You touch \the [src], but nothing happens."))
/obj/item/storage/backpack/chameleon/wizard/emp_act()
return
//********************
//**Chameleon Gloves**
//********************
/obj/item/clothing/gloves/chameleon
name = "black gloves"
icon_state = "black"
item_state = "black"
desc = "It looks like a pair of gloves, but it seems to have a small dial inside."
origin_tech = list(TECH_ILLEGAL = 3)
var/global/list/clothing_choices
/obj/item/clothing/gloves/chameleon/Initialize()
. = ..()
if(!clothing_choices)
var/blocked = list(src.type, /obj/item/clothing/gloves/swat/bst)
clothing_choices = generate_chameleon_choices(/obj/item/clothing/gloves, blocked)
/obj/item/clothing/gloves/chameleon/emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown.
name = "black gloves"
desc = "It looks like a pair of gloves, but it seems to have a small dial inside."
icon_state = "black"
update_icon()
update_clothing_icon()
/obj/item/clothing/gloves/chameleon/verb/change(picked in clothing_choices)
set name = "Change Gloves Appearance"
set category = "Chameleon Items"
set src in usr
if(!ispath(clothing_choices[picked]))
return
disguise(clothing_choices[picked])
update_clothing_icon() //so our overlays update.
//******************
//**Chameleon Mask**
//******************
/obj/item/clothing/mask/chameleon
name = "gas mask"
icon_state = "gas_alt"
item_state = "gas_alt"
desc = "It looks like a plain gask mask, but on closer inspection, it seems to have a small dial inside."
origin_tech = list(TECH_ILLEGAL = 3)
var/global/list/clothing_choices
/obj/item/clothing/mask/chameleon/Initialize()
. = ..()
if(!clothing_choices)
clothing_choices = generate_chameleon_choices(/obj/item/clothing/mask, list(src.type))
/obj/item/clothing/mask/chameleon/emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown.
name = "gas mask"
desc = "It's a gas mask."
icon_state = "gas_alt"
update_icon()
update_clothing_icon()
/obj/item/clothing/mask/chameleon/verb/change(picked in clothing_choices)
set name = "Change Mask Appearance"
set category = "Chameleon Items"
set src in usr
if(!ispath(clothing_choices[picked]))
return
disguise(clothing_choices[picked])
update_clothing_icon() //so our overlays update.
//*********************
//**Chameleon Glasses**
//*********************
/obj/item/clothing/glasses/chameleon
name = "optical meson scanner"
icon_state = "meson"
item_state = "glasses"
desc = "It looks like a plain set of mesons, but on closer inspection, it seems to have a small dial inside."
origin_tech = list(TECH_ILLEGAL = 3)
var/list/global/clothing_choices
/obj/item/clothing/glasses/chameleon/Initialize()
. = ..()
if(!clothing_choices)
var/blocked = list(src.type, /obj/item/clothing/glasses/sunglasses/bst)
clothing_choices = generate_chameleon_choices(/obj/item/clothing/glasses, blocked)
/obj/item/clothing/glasses/chameleon/emp_act(severity) //Because we don't have psych for all slots right now but still want a downside to EMP. In this case your cover's blown.
name = "optical meson scanner"
desc = "It's a set of mesons."
icon_state = "meson"
update_icon()
update_clothing_icon()
/obj/item/clothing/glasses/chameleon/verb/change(picked in clothing_choices)
set name = "Change Glasses Appearance"
set category = "Chameleon Items"
set src in usr
if(!ispath(clothing_choices[picked]))
return
disguise(clothing_choices[picked])
update_clothing_icon() //so our overlays update.
//*****************
//**Chameleon Gun**
//*****************
/obj/item/gun/energy/chameleon
name = "desert eagle"
desc = null
desc_info = null //The chameleon gun adopts the desc_info of the weapon it is impersonating as, to make meta-ing harder.
desc_antag = "This gun is actually a hologram projector that can alter its appearance to mimick other weapons. To change the appearance, use \
the appropriate verb in the chameleon items tab. Any beams or projectiles fired from this gun are actually holograms and useless for actual combat. \
Projecting these holograms over distance uses a little bit of charge."
icon = 'icons/obj/guns/deagle.dmi'
icon_state = "deagle"
w_class = ITEMSIZE_NORMAL
origin_tech = list(TECH_COMBAT = 2, TECH_MATERIAL = 2, TECH_ILLEGAL = 8)
matter = list()
fire_sound = 'sound/weapons/gunshot/gunshot1.ogg'
projectile_type = /obj/item/projectile/chameleon
charge_meter = 0
charge_cost = 20 //uses next to no power, since it's just holograms
max_shots = 50
var/obj/item/projectile/copy_projectile
var/global/list/gun_choices
/obj/item/gun/energy/chameleon/Initialize()
. = ..()
if(!gun_choices)
gun_choices = list()
for(var/gun_type in typesof(/obj/item/gun/) - src.type)
var/obj/item/gun/G = gun_type
src.gun_choices[initial(G.name)] = gun_type
/obj/item/gun/energy/chameleon/consume_next_projectile()
var/obj/item/projectile/P = ..()
if(P && ispath(copy_projectile))
P.name = initial(copy_projectile.name)
P.icon = initial(copy_projectile.icon)
P.icon_state = initial(copy_projectile.icon_state)
P.pass_flags = initial(copy_projectile.pass_flags)
P.hitscan = initial(copy_projectile.hitscan)
P.range = initial(copy_projectile.range)
P.muzzle_type = initial(copy_projectile.muzzle_type)
P.tracer_type = initial(copy_projectile.tracer_type)
P.impact_type = initial(copy_projectile.impact_type)
return P
/obj/item/gun/energy/chameleon/emp_act(severity)
name = "desert eagle"
desc = "It's a desert eagle."
icon_state = "deagle"
update_icon()
if (ismob(src.loc))
var/mob/M = src.loc
M.update_inv_r_hand()
M.update_inv_l_hand()
/obj/item/gun/energy/chameleon/disguise(var/newtype)
var/obj/item/gun/copy = ..()
flags_inv = copy.flags_inv
fire_sound = copy.fire_sound
fire_sound_text = copy.fire_sound_text
var/obj/item/gun/energy/E = copy
if(istype(E))
copy_projectile = E.projectile_type
desc = E.desc
desc_info = E.desc_info
else
copy_projectile = null
/obj/item/gun/energy/chameleon/verb/change(picked in gun_choices)
set name = "Change Gun Appearance"
set category = "Chameleon Items"
set src in usr
if(!ispath(gun_choices[picked]))
return
disguise(gun_choices[picked])
//so our overlays update.
if (ismob(src.loc))
var/mob/M = src.loc
M.update_inv_r_hand()
M.update_inv_l_hand()