-
-
Notifications
You must be signed in to change notification settings - Fork 683
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
Screentips #11938
base: master
Are you sure you want to change the base?
Screentips #11938
Conversation
Good pr, but there will be an option to turn this off right? I hate having a cluttered screen. |
It will be a preference, if you can mouse over somebody, you will be able to see their name (which you can do already with the status bar). |
he said so Co-authored-by: PowerfulBacon <[email protected]>
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.
the term add
to various proc names sounds very off. It sounds like you're adding an object to a list, and it sounds there's a function 'remove' to be paired with it.
I'd consider using different term. For example:
// instead of 'add', used 'build'
/datum/ai_controller/dog/proc/build_context(datum/source, datum/screentip_context/context, mob/user)
if (user.a_intent == INTENT_HARM)
context.assign_action_attack_hand("Punch")
else
context.assign_action_attack_hand("Pet")
// Changed from 'add_attack_hand_action("Thing")'
Technically, 'add' describes how exactly the code works, but the current proc name sounds that you can do that multiple times. I mean
/proc/foo(context)
context.add_attack_hand_action("take item")
context.add_attack_hand_action("do thing")
context.add_attack_hand_action("punch thing")
This isn't a thing, but the name makes it sounds possible.
ah, also, I don't like the term |
Context is programming standard.
Also this is possible, it will display all 3 actions |
I just worried about a case. I hope future coders won't be confused.
Yeah, I know it's possible, but such practice doesn't make sense to me. |
Each individual call also adds a new message, you aren't just setting a single context message but you can add multiple messages to the context for different controls (add a left click, then add a right click, then add a control click, etc.) |
You know, i have conflicted feelings about this. |
processing screentips
…g integrated with context itself)
That doesn't look what I mean. You don't set multiple contexts to a single action. (in codewise, I know it's possible, but again, for what and why?) If you think it suits there, would you please differentiate a proc 'add' that calls procs doing 'add' at least? |
You have a vehement dislike of combat mode that you wrote in cope Haiku or whatever on my pr. This PR will certainly help you and others when learning the new controls. I would not discount that its only for newfriends, I think it will be of assistance to a lot of people. I personally look at the wiki way too much for certain jobs, so I added tool act interactions to Bacon's branch so you can tell what is made in kitchen with what tools just by hovering over it. |
Anything good for new players is generally good for experienced ones too and makes their gameplay experience better |
About The Pull Request
Implements the foundation for contextual screentips.
Contains a partial port of: tgstation/tgstation#76889 since I struggled to find documentation on images in maptext.
Contains a partial port of tgstation/tgstation#63567 as I accessed the code to see how TG solved the MouseEntered overhead problem, though I have optimised the code slightly.
The TG code was mainly used to ensure that our system has some resemblance to the TG code, and only makes changes where necessary.
The rest of the code is original code.
It is important to note that simply defining MouseEntered on /atom will incur a pretty significant amount of overhead due to byond enabling networking of mouse entered actions when this is defined, but this is a cost that we are going to have to accept. I did try to implement this clientside, though I faced problems with the label component and it would be impossible to include contextual data. If we are going to have this cost, then we might as well make it as good as it gets.
There are some limitations that I encountered while creating this:
Limitations
The context objects will have a lot of proc-calls on objects that have a lot of actions. This may need a testmerge for testing, though since our pops aren't huge and there won't be many things with too many, I don't think the issue will be too great (it's also tied to a subsystem anyway, with low priority).
In the future we may be able to introduce some kind of compilation step that inlines procs for files that have been editted in production.
Adding screentips to objects
Adding screentips to objects is a matter of defining one of the context procs:
Context procs pass through a screentip context object, which includes procs that help you define the tips that appear on the object. The context handles styling itself so that we don't end up with inconsistent tips
Context procs:
Example
Caching (WIP)
Screentips that don't depend on external state can call
context.use_cache
which, for every input state, will cache the results and re-use it for the rest of the round when that type is encountered in the screentip system again. These must only depend on pre-selected conditions.Input states are as follows:
If caching is enabled, then the cache will be built as required, requiring no additional effort from the developer:
The above code will work the following way:
Any external state will break assumptions that the cache makes and will cause incorrect messages to show on the screentip.
While running in debug mode, an extra screentip line is added that tells the developer the cache is active for that object.
Autotips
To make adding tips easier, I have created a system for auto-tips. These define paths which get automatically added to the global screentip cache upon initialisation.
Since they use the cache, auto-tips cannot depend on external state.
They are defined as follows:
See caching to see the input states.
Why It's Good For The Game
Testing Photographs and Procedure
Changelog
🆑
add: Adds contextual screentips
/:cl: