Function: "able to hook things on"
#1
Hello. I'm wondering if there is some function to detect whether the given block has the ability to have things hooked to it (for example torches and buttons) or not.

If not, where is the best place for that kind of function? It would be just a big switch with block types.
Reply
Thanks given by:
#2
I don't think it is being handled (or at least handled correctly) at this moment. The best place to add this check would be, IMHO, to the block handler responsible for the torch / button / ... placement - cBlockTorch in $/source/Blocks/BlockTorch.h etc. You might need to add a new class for buttons, too. Just base it on the torch class, or give them a common ancestor (cAttachedBlock) that implements the generic stuff.
Also, be careful with the word "hook", as in the server it is used exclusively for API hooks that enable plugins to get called on specific events. "attached" is the term you're looking for here Wink
Reply
Thanks given by:
#3
Well, it's my first attempt to improve torches placement. Still not perfect (for example attaching torch to torch should place a new torch on ground), but at least we cannot place them everywhere like before.

https://dl.dropbox.com/u/29021761/torches.diff
(forum does not accept .diff attachments)
Reply
Thanks given by:
#4
Nice, I'll integrate the patch. Thanks.
Added as rev 721
Reply
Thanks given by:




Users browsing this thread: 4 Guest(s)