ID:270850
 
How do i make a shop that opens up a panel and allows users to see the items instead of going through the list of items


The most efficient procedure I could think to use deals with areas. Upon entering this area, locate the shopkeeper in their oview() and give them a statpanel for it.

mob/var/mob/byshopkeeper = 0
area
ShopKeeper
Entered(var/atom/moveable/M)
if(ismob(M))
var/mob/R = M
if(!R.client || R.byshopkeeper) ..()
else R.byshopkeeper = locate(/mob/NPCtype/) in oview(1)
else ..()

mob/Stat()
if(byshopkeeper) statpanel("Shop",byshopkeeper.contents)


That will, of course, be a little buggy if you place shopkeepers too close together. The area should cover their oview() one tile around them, and shopkeepers should be two tiles apart.