• Print

Author Topic: A hook for custom pieces. (Default Pieces: *, ^, $)  (Read 5164 times)

0 Members and 1 Guest are viewing this topic.

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
A hook for custom pieces. (Default Pieces: *, ^, $)
« on: August 05, 2014, 01:53:43 pm »
I would like to see the ability for people to add custom "pieces" into ULX, for their own targeting methods.


https://github.com/Nayruden/Ulysses/pull/332


Added a hook to allow custom pieces within ULib.getUsers. Lines: 219 - 223

Here is a quick example...

Code: Lua
  1. hook.Add("ulx_custompiece", "__j", function(ply, p)
  2.         if p:sub( 1, 1 ) == "&" then
  3.                 local uSel = ply._ulxSelection
  4.                 if uSel and type(uSel) == "table" and #uSel >= 1 then
  5.                         local tab = {}
  6.                         for _,v in next, ply._ulxSelection do
  7.                                 if IsValid(v) and v:IsPlayer() then
  8.                                         table.insert(tab, v)
  9.                                 end
  10.                         end
  11.                         return tab -- Notice how we are returning the built table here.
  12.                 else
  13.                         return nil
  14.                 end
  15.         end
  16. end)
I cry every time I see that I am not a respected member of this community.

Offline Cobalt

  • Full Member
  • ***
  • Posts: 216
  • Karma: 44
  • http://steamcommunity.com/id/__yvl/
Re: A hook for custom pieces. (Default Pieces: *, ^, $)
« Reply #1 on: August 05, 2014, 02:45:47 pm »
This is a good idea, I like it.

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: A hook for custom pieces. (Default Pieces: *, ^, $)
« Reply #2 on: August 07, 2014, 03:13:04 pm »
This is a very interesting feature- I'll have test it out myself and run the idea past Megiddo. :)
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

  • Print