-
Notifications
You must be signed in to change notification settings - Fork 12
How to determine if (remote) sensor is visible? #68
Comments
That sounds interesting; I never thought of that use case (and it might be more code than you'd expected -- remember two cases: sensor may be set to always visible OR sensor may be set to 'when expanded' and the interface is expanded), but it would be fun to write, so sure! (Actually, brainstorming time -- how about if EvoGUI just raised a Probably will write it exactly as you described, to be honest. In fact, if you want to write it and pull request it, that's just as good -- I really don't know when I'll be able to bite off a chunk of time to get it done. Semi-off-topic, I peeked at your code, and I noticed the statement Also, I saw you're only tracking player 1, but since I haven't fixed #58, that's about as good as it gets at the moment; it might be worth making a note that your sensors are single-player-only (and subscribe to get notified when I close that other issue). |
I was actually just coming back to suggest something like this! Yes, Evo could send an event when it wants a sensor update. Thoughts:
Oh wow, I thought ticks were per second. I'll update that. I've just been adding in localisation, etc so will add that change in now. |
Exact same method as currently -- sensor makes remote call to update sensor data.
Not at all, we keep the same method as now and just write in whatever we have; if nobody updated it, it'll remain whatever it was before.
Agreed; in fact, if we do it right, the sensor can just populate the same data structure it received and post that in its update call.
That's more complicated, as you'd want the per-sensor update rate to be separate from the main GUI update rate, so you then want a table like sensor_updates = {
[10] => {"this_sensor", "that_sensor"},
[15} => {"that_other_sensor"},
} -- it's a whole new data structure to keep track of, for an uncertain benefit, since updates still won't be shown any more often than the GUI update rate.
I'm not convinced the data exists or is worth managing; sensors shouldn't be that complicated.
Technically, you can create and delete sensors on the fly, if memory serves, so the only remaining hurdle is having them automatically shown. That's requested at #61, and would totally be worthwhile.
Um. I thought I had that as a plan for future enhancement, but it turns out I don't. New issue ahoy! |
Yup - reuse same tables, just update the values. IMO localisation should be mandatory as it will promote this approach. |
Hi,
I've just written my first sensor mod (github) for EvoGUI and in the on-tick handler I was thinking how nice it would be to have some way to know whether the sensor is currently displayed or not (otherwise, no point in updating the sensor data). This may already be possible (let me know if it is) but I've only just scratched the surface of the Evo codebase and didn't see anything yet.
Maybe Evo could register custom event, 'sensor-toggle' - mods get the numeric event id via remote API and hook to the event. When sensor is shown/hidden, the event fires with a table payload such as:
That way I can set a local variable when the event fires, and in my on-tick handler rapidly exit out if the sensor is not currently visible.
The text was updated successfully, but these errors were encountered: