Page 1 of 1

Icons for new archetypes in ESB

Posted: Mon Feb 22, 2010 5:55 am
by Sophia
I've been playing with some ways of expanding the icons available in ESB, and allowing custom designers to use whatever suits them best for working on their custom dungeons. One way I've been playing with is adding the following code near the top of editor/editor.lua, right after the "local arch = obj[arch_name]" line.

Code: Select all

if (arch.esb_drawinfo) then
	if (type(arch.esb_drawinfo) == "function") then
		return (arch:esb_drawinfo(dir, inactive, tile))
	elseif (type(arch.esb_drawinfo) == "table") then
		return arch.esb_drawinfo[1], arch.esb_drawinfo[2]
	end
end
This allows draw info to be contained within the object archetype itself, instead of having to expand the monolithic editor_drawnumber function. It can be stored either as just a table or as a function that returns information.

I haven't tested this very much, and I'm not sure if it's the best approach, so right now it's experimental, but I thought I'd put it out there in case anyone else wanted to play with it or possibly improve it. In particular, I'm not sure if per-archetype or per-dungeon is the best way to hook this sort of thing-- would a custom_editor_drawnumber that gets called before the main function work better? Perhaps both?

The other issue is that the standard icon sheet is still the only one loaded. I'll have to think more about how to handle custom images.

Re: Icons for new archetypes in ESB

Posted: Tue Mar 12, 2013 10:10 pm
by Ser Xav
Hi Sophia, could you provide a simple example of how this might work? I'm not a coder type, but can 'reverse engineer' stuff sometimes when I see an example of something similar... how would I add a custom icon for a custom object, how would the above code be amended? Could you explain how the the code works and how it references custom icons? Thanks.

Re: Icons for new archetypes in ESB

Posted: Tue Mar 12, 2013 11:35 pm
by Sophia
ebeneezergude wrote:how would I add a custom icon for a custom object
The short answer is "at the moment, you can't really." This topic is over three years old and unfortunately not that relevant to what you want to do.

Like I said,
Sophia wrote:The other issue is that the standard icon sheet is still the only one loaded. I'll have to think more about how to handle custom images.

Re: Icons for new archetypes in ESB

Posted: Thu Mar 14, 2013 12:08 am
by Ser Xav
OK thanks Sofia, no problem. Thought it might be a long shot. Am hoping you've had a think about 'how to handle custom images' for icons... :wink: