[MIRROR] Fixes display of appearance type in VV [MDB IGNORE] (#24092)

* Fixes display of appearance type in VV (#78725)

## About The Pull Request

Appearance vars are awful to detect. They have a type var you can
access, for an appearance the value of this var is `/image`. However
`istype(appearance, /image) == 0`. This is good enough for
identification, you might think this just means detecting appearance
would be something like `if(thing.type == /image && !istype(thing,
/image))`, but there's a problem with this: `istype(appearance, /datum)
== 0`. For that matter it seems like all istypes that check if an
appearance is some type fail, so you can't know that it's safe to access
the `.type` var to do that earlier combined check.

Now we get into magic territory, `istype(new /image, appearance) == 1`.
I have no clue internally why this is the case but it seems to be unique
to appearances, and so can be used to identify them from a previously
unknown var. You have to rule out that the thing you're checking is a
path, it would pass the check if the value were `/image` then, but this
is simple enough.

I hate having to know all this, so now you know this too.

🆑 ninjanomnom
admin: Appearance vars in VV now display instead of being left blank
/🆑

* Fixes display of appearance type in VV

---------

Co-authored-by: Emmett Gaines <ninjanomnom@gmail.com>
This commit is contained in:
SkyratBot
2023-10-03 15:13:32 -04:00
committed by GitHub
co-authored by Emmett Gaines
parent 79cf695ed5
commit e39a44e462
4 changed files with 23 additions and 6 deletions
@@ -41,6 +41,10 @@
item = "[name_part] = /icon (<span class='value'>[value]</span>)"
#endif
else if(isappearance(value))
var/image/actually_an_appearance = value
item = "[name_part] = /appearance (<span class='value'>[actually_an_appearance.icon]</span>)"
else if (isfile(value))
item = "[name_part] = <span class='value'>'[value]'</span>"
@@ -55,6 +59,7 @@
<tr><td>[M.c]</td><td>[M.f]</td><td>1</td></tr>
</tbody>
</table></td><td class='rbrak'>&nbsp;</td></tr></tbody></table></span>"} //TODO link to modify_transform wrapper for all matrices
else if (isdatum(value))
var/datum/DV = value
if ("[DV]" != "[DV.type]") //if the thing as a name var, lets use it.