Alternate Appearance system (from tgstation/-tg-station#16586)

This adds an "alternate appearance system" using image overrides and a new
handler system.

Usage:
 - Create a new `image()` casted as `var/image`
 - Set image.override = 1
 - Call mob.add_alt_appearance("appearance_ID", image, listOfMobsToDisplayTo).
 - To remove an image, you use mob.remove_alt_appearance("appearance_ID")

Comes with one usage, cardborg costumes. They will now disguise you as a
standard borg to any silicon mobs and yourself.
As this is a per-client system, that means that only silicon mobs and you will
see yourself as a standard borg. All other mobs will see you as a silly
human in a cardborg costume.
This commit is contained in:
Tigercat2000
2016-04-06 12:36:26 -07:00
parent 1a1701d27a
commit 801cbe7f8d
8 changed files with 212 additions and 12 deletions
-8
View File
@@ -89,14 +89,6 @@
item_state = "greenbandana"
flags_inv = 0
/obj/item/clothing/head/cardborg
name = "cardborg helmet"
desc = "A helmet made out of a box."
icon_state = "cardborg_h"
item_state = "cardborg_h"
flags = HEADCOVERSEYES | HEADCOVERSMOUTH
flags_inv = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE
/obj/item/clothing/head/justice
name = "justice hat"
desc = "Fight for what's righteous!"
+22 -2
View File
@@ -5,7 +5,7 @@
* Ushanka
* Pumpkin head
* Kitty ears
*
* Cardborg Disguise
*/
/*
@@ -207,4 +207,24 @@
var/icon/earbit = new/icon("icon" = 'icons/mob/head.dmi', "icon_state" = "mouseyinner")
mob.Blend(earbit, ICON_OVERLAY)
icon_override = mob
icon_override = mob
/obj/item/clothing/head/cardborg
name = "cardborg helmet"
desc = "A helmet made out of a box."
icon_state = "cardborg_h"
item_state = "cardborg_h"
flags = HEADCOVERSEYES | HEADCOVERSMOUTH
flags_inv = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE
/obj/item/clothing/head/cardborg/equipped(mob/living/user, slot)
..()
if(ishuman(user) && slot == slot_head)
var/mob/living/carbon/human/H = user
if(istype(H.wear_suit, /obj/item/clothing/suit/cardborg))
var/obj/item/clothing/suit/cardborg/CB = H.wear_suit
CB.disguise(user, src)
/obj/item/clothing/head/cardborg/dropped(mob/living/user)
..()
user.remove_alt_appearance("standard_borg_disguise")
@@ -199,6 +199,26 @@
body_parts_covered = UPPER_TORSO|LOWER_TORSO
flags_inv = HIDEJUMPSUIT
/obj/item/clothing/suit/cardborg/equipped(mob/living/user, slot)
..()
if(slot == slot_wear_suit)
disguise(user)
/obj/item/clothing/suit/cardborg/dropped(mob/living/user)
..()
user.remove_alt_appearance("standard_borg_disguise")
/obj/item/clothing/suit/cardborg/proc/disguise(mob/living/carbon/human/H, obj/item/clothing/head/cardborg/borghead)
if(istype(H))
if(!borghead)
borghead = H.head
if(istype(borghead, /obj/item/clothing/head/cardborg)) //why is this done this way? because equipped() is called BEFORE THE ITEM IS IN THE SLOT WHYYYY
var/image/I = image(icon = 'icons/mob/robots.dmi' , icon_state = "robot", loc = H)
I.override = 1
I.overlays += image(icon = 'icons/mob/robots.dmi' , icon_state = "eyes-robot") //gotta look realistic
H.add_alt_appearance("standard_borg_disguise", I, silicon_mob_list+H) //you look like a robot to robots! (including yourself because you're totally a robot)
/obj/item/clothing/suit/poncho
name = "poncho"
desc = "Your classic, non-racist poncho."
+6
View File
@@ -70,6 +70,12 @@
//readd this mob's HUDs (antag, med, etc)
reload_huds()
if(viewing_alternate_appearances && viewing_alternate_appearances.len)
for(var/aakey in viewing_alternate_appearances)
var/datum/alternate_appearance/AA = viewing_alternate_appearances[aakey]
if(AA)
AA.display_to(list(src))
CallHook("Login", list("client" = src.client, "mob" = src))
// Calling update_interface() in /mob/Login() causes the Cyborg to immediately be ghosted; because of winget().