-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allows vv investigate /appearance + better checking image #82670
Conversation
hey thanks for all the images since they do help but in the future (or you can edit your PR body right now) can you use the dropdown "spoiler" function that Github Markdown supports? to use it you just gotta use this format: <details>
<summary>Text for spoiler </summary>
Spoilered content
</details> Then you can have a nice dropdownand put all your photos in here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my knowledge on how appearances and image byond fuckary is quite limited so i'll take your word on it (i've read a few MrStonedOne rants about it) but we can definitely make your approach a lot better by using a few more tools.
@EvilDragonfiend there's nothing dangerous because if anything undocumented breaks it or changes will break on a BYOND-version upgrade (when things are expected to break anyways) and it is vitally important to know if something is broken rather than cover it up, because you can't fix things that you don't know are broken. it's going to be slightly uglier to read, that is true, but i prefer utility over elegance in cases like these. your worries with NAMEOF() are also unwarranted, look at the documentation (unless this is the "wrong answer" you were talking about): /**
* NAMEOF: Compile time checked variable name to string conversion
* evaluates to a string equal to "X", but compile errors if X isn't a var on datum.
* datum may be null, but it does need to be a typed var.
**/
#define NAMEOF(datum, X) (#X || ##datum.##X) it compiles to the equivalent of a string! it's just important to assert that what we know exists works, and then fix it when it stops working. also, if you don't like the length of a statement in a switch chain using these macros, you can just do: #define APPEARANCE_NAMEOF(whatever, x) // code here
#define A_NAMEOF(whatever, x) APPEARANCE_NAMEOF(##whatever, ##x) you can do |
if it doesn't work it's fine but i'd like to at least try. we can also put these lists as a global or something and unit-test it too (even though |
aight I will try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i looked over at my screen and saw this so i figured i'd just mention it right now
So cursed lmao |
they're able to add anything that they know of that exists in valid DM but isn't supported yet in OpenDream at the very least (a list of unimplemented syntax) that will let it bypass the lints we run on it in this repository |
anyways having as much |
I think I sorted out all now |
@EvilDragonfiend If you really think we need the /proc/proc_a(variable_name)
try
value = locate_variable(variable_name)
catch
//whatever
/proc/locate_variable(variable_name)
switch(variable_name)
if(x)
return whatever we do incur a little bit more vertical footprint but it's worth it to lessen the amount of horizontal footprint (which is far uglier). also the |
/// manually locate a variable through string value. | ||
/// appearance type needs a manual var referencing because it doesn't have "vars" variable internally. | ||
/// There's no way doing this in a fancier way. | ||
/proc/locate_appearance_variable(var_name, atom/movable/appearance) // it isn't /movable. It had to be at it to use NAMEOF macro |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for keeping you in limbo for a bit, got busy and was puzzled after I saw some snippets from the Beestation review (specifically the one about aliasing for /atom/movable
here. i think i've figured out something that might work though, parent_type
.
basically what we do is we do something like client_interface
where we have a representative datum to "mock" out the potential extant vars on an appearance and access that instead of having the confusing movable
stuff be involved here. what we would do is just
/// An alias datum that allows us to access and view the variables of an appearance by keeping certain known, yet undocumented, variables that we can access and read in a datum for debugging purposes.
/// Kindly do not use this outside of a debugging context.
/datum/appearance_data
parent_type = /atom/movable // This is necessary to access the variables on compile-time.
Then, we can also potentially resolve some of the OD issues like NAMEOF()
and mouse_drop_zone
by declaring it as a var on this datum. It's a really hacky alias technique that came to me in a dream a few nights ago. Even if we can't resolve the NAMEOF()
stuff not working, it'll be slightly better than what we're presently doing instead of treating an appearance like a movable atom. Just test this out for me and it'll be good to ship.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's actually a good idea, but note that I'll do that differently in a few points:
- Replacing
for(var/each in dummy_image.vars)
into this is bad here because it will copy all atom/movable vars and we need to remove manually a lot. - I'd do
/image/appearance
instead of/datum/appearance_data
to mock more obvious. mouse_drop_zone
already exists, OD just doesn't like it. (unless we have a define like#ifdef OPENDREAM
?)
and it looks we have it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fine
It's fine in its current state and I hope we can continue to iterate and improve this framework |
if(NAMEOF(appearance, vis_contents)) // same reason above | ||
return appearance.vis_contents | ||
if(NAMEOF(appearance, vis_flags)) // DM document says /appearance has this, but it throws error | ||
return appearance.vis_flags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the record, the way this actually works is very dumb
appearances carry vis_flags, but you can't read them directly off
what you CAN do is copy the appearance onto a MOVABLE, and read the vis_flags off THAT. v stupid am sorry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var/static/atom/movable/pluto = new() // all alone at the end of the universe
pluto.appearance = appearance_father // We copy over our appearance onto an atom. This is done so we can read vars carried by but not accessible on appearances
var/vis_flags = pluto.vis_flags
like this ya feel? (I am assuming you're keeping something of this form downstream somewhere, this'll make that less hellish)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still hellish you say, but thank you for the advice.
my coder boss will decide what'd be best anyway.
About The Pull Request
VV editor can now see /appearance types
These ones are kinda blackboxed, and we have no idea what these are in general.
I made it investigatable, but because of the nature of /appearance, the code is super janky, but it's inevitable curse.
I left an important comment inside:
Comment
Why It's Good For The Game
Debugging tool is good for us
Testing evidence photos
click to see images
/image types no longer show first image incorrectly when its icon_state is null
This means it won't render first image (medical status) from
hud.dmi
when you investigate hud image in hud_list of a mobYou can see /appearance types are merged within.
APC example
Mob example
no vv option, because it's dangerous
/image and /alternative_appearance shows the same format
full variables list (excluding blacklisted ones)
Changelog
🆑
code: /appearance type references are now investigatable in vv editor.
code: /image references display a summarised name with its dmi file name and icon_state when it's investigated from a datum where it uses. Format is: "mob_hud_image = /image (hud.dmi:medical) [0x00000]"
code: /image types no longer show first image incorrectly when its icon_state is null
/:cl: