Icons for new archetypes in ESB
Posted: Mon Feb 22, 2010 5:55 am
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.
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.
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
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.