Suggestion Ability to invert a query option

Discussion in 'Client & Site Suggestions' started by Cloud, May 13, 2016.

  1. Cloud

    Joined:
    Jul 28, 2013
    Messages:
    2,518
    Likes Received:
    890
    Example: Looking to find entities with animations that don't equal -1, so you would invoke a method that would make the next method call do the exact opposite or something. Typing super quickly as I'm in a rush and this implementation I proposed is shit but yeah, the point stands that it's something useful. Gotta run.
     
  2. Party

    Party The Favourite

    Joined:
    Oct 12, 2015
    Messages:
    3,107
    Likes Received:
    1,417
    Excellent idea, I'll tag in @Vap...

    Joking aside, isn't this the purpose of predicates?
     
  3. Savior

    Savior I'm your motherfucking conscience

    Joined:
    Nov 17, 2014
    Messages:
    3,373
    Likes Received:
    1,356
    Good suggestion, @SlashnHax can you add this please?
     
  4. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,549
    Likes Received:
    1,068
    *previous method call

    It's more standard. animations(-1).negate(). But @Party brings up a good point. Predicates handle this already. I'd rather keep the wheel re-invention to a minimum. Our wrapper methods should be used exclusively for simple things and Bot Authors should graduate to using Predicates once their needs are greater than the available convenience methods.
     
  5. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    2,964
    Likes Received:
    871
    I would if I could ;)

    Iirc, the QueryBuilders have an .accepts(T t) method, so a simple implementation would be to use that, in a similar way that Predicate's negate uses test.
    Idk how efficient it would be though.

    Edit: nvm I misread and thought you were talking about negating the entire query xD
     
  6. Cloud

    Joined:
    Jul 28, 2013
    Messages:
    2,518
    Likes Received:
    890
    Our convenience methods are not adequately convenient once they inconvenience me.
     
    Aidden likes this.
  7. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    2,964
    Likes Received:
    871
    What if you added MORE convenience methods? Like idsExcept() or namesExcept() : ^)
     
  8. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,549
    Likes Received:
    1,068
    pls no
    --- Double Post Merged, May 14, 2016, Original Post Date: May 14, 2016 ---
    Use a predicate. >.>
     
  9. Cloud

    Joined:
    Jul 28, 2013
    Messages:
    2,518
    Likes Received:
    890
    We can't optimize order and implement elegant caching when a predicate is used, thus defeating the purpose of us lazily evaluating queries.
     
  10. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,549
    Likes Received:
    1,068
    Sure we can by allowing the user to specify what data the predicate tests by as an Enum... argument. It would yield a more robust solution anyway. @Vaped


    Sent from my iPhone using Tapatalk
     
  11. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,549
    Likes Received:
    1,068
    GameObjects.newQuery().filter(() -> ..., GameObject.FilterType.ID, GameObject.FilterType.MODEL)


    Sent from my iPhone using Tapatalk
     
  12. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,549
    Likes Received:
    1,068
    We could then use these FilterTypes on a 1-X intensity scale to prioritize filtering. We could also allow devs to provide their own intensity level when our defined ones aren't sufficient.


    Sent from my iPhone using Tapatalk
     

Share This Page

Loading...