scarpet icon indicating copy to clipboard operation
scarpet copied to clipboard

Add library for creating GUI menus

Open Ghoulboy78 opened this issue 1 year ago • 5 comments

Much like classes.scl, this will in theory allow players to create their own GUI libraries by declaring a list of functions in a map. Unlike classes.scl, this might actually be useful, since it abstracts a lot more of the grittier process behind nice-to use functions and syntax. Also, this has more flexibility.

Fixes #315

Todo items:

  • [x] Add basic (static) buttons which can do stuff when clicked
  • [x] Add dynamic buttons (clicking the button changes the icon, edits inventory itself, etc)
  • [x] Add storage (so items u put in can be saved)
  • [x] Add dynamic storage slots (Whenever this slot is modified, a function is called)
  • [x] Add ability for programmers to insert their own code into screen callback (with access to (screen, player, action, data) variables, as well as gui_screen variable)
  • [x] Add pages made of buttons
  • [x] Give different titles to new pages (Requires closing and opening new screens)
  • [x] Allow for different sized pages (Same here)
  • [x] Add button labels
  • [x] Allow to use any gui type, not just generic rectangle ones (Need to make sure they don't break existing stuff, and we're good)
  • [x] Add more triggers to change page (basically extract page-changing into a separate function that can be called from anywhere)
  • [x] Add special abilities for all the different types of inventories (Not all types need special treatment, but I'll add them all here, just so I can tick them through, and incase someone else thinks of what to do with this)
  • [x] Anvil (Maybe detecting when the player writes? If the player is renaming, each character change updates the item in the output slot, causing a slot_update action to be sent out)
  • [x] Beacon (~Effects ig, gotta read the docs~ Nothing, as it happens)
  • [x] Brewing stand (Nothing that I know of)
  • [x] Blast furnace (I'll redirect this to whatever the furnace does)
  • [x] Cartography table (Nothing that I know of)
  • [x] Crafting table (Selecting a crafting recipe)
  • [x] Enchanting table (All the enchantments, this is gonna be painful, I think)
  • [x] Furnace (Selecting a smelting recipe)
  • [x] Grindstone (Nothing that I know of)
  • [x] Hopper (Nothing that I know of)
  • [x] Lectern (Possibly the ability to detect when you change page? Though would have to tell the programmer that they must insert a book for this functionality to work)
  • [x] Loom (Editing the displayed banner pattern, but only available if player or programmer puts a banner and some dye in first, also returning the selected banner pattern)
  • [x] Merchant (I'd like to be able to edit trades, but it's probably not possible)
  • [x] Shulker box (Nothing that I know of)
  • [x] Smithing (~Maybe something with the new smithing templates?~ Nothing, it seems)
  • [x] Smoker (I'll redirect this to whatever the furnace does)
  • [x] Stonecutter (Selected recipe in the stonecutter, but only available if player or programmer puts some stone in first)
  • [x] Documentation (Dis gonna be chonky too)
  • [x] Add idiotproof checks to make sure programmer defines all the functions they need to etc.
  • [x] Add on_init function or smth like that for pages, so more complex initial setup can be done (useful for enchanting tables and beacons etc.)

Ghoulboy78 avatar Apr 06 '23 20:04 Ghoulboy78

I just read the code. This looks pretty cool. I've been wanting to rework the waystone app, when I do, Ill try this out. Unfortunately I may not have time to try it out for awhile. But I think it should tick the boxes. Thanks.

opsaaaaa avatar Apr 08 '23 17:04 opsaaaaa

https://github.com/gnembon/scarpet/pull/370/commits/55810ce4d50a7fb0570a91f4498d4d6fa17a7a71 Recording this commit as last commit before removal of placeholder names, JIC something goes wrong with that and I need to revert.

Ghoulboy78 avatar Jun 23 '23 09:06 Ghoulboy78

@altrisi I think this is ready

Ghoulboy78 avatar Jun 26 '23 20:06 Ghoulboy78

Seems handy and the test script demonstrates some cool functions. Thanks for adding the example else reviewing this would take an eternity. I'll being going through this for a while but I don't expect any major errors.

rv3r avatar Jul 28 '23 00:07 rv3r

Thanks for adding the example else reviewing this would take an eternity.

I actually created it so I could test the script as I added more and more to it. Imaging what a nightmare it would have been otherwise...

Ghoulboy78 avatar Aug 03 '23 11:08 Ghoulboy78