Icons for new archetypes in ESB

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Icons for new archetypes in ESB

Post 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.
User avatar
ebeneezergude
Expert
Posts: 345
Joined: Mon Jan 21, 2013 10:58 pm
Location: I see walls stretching off into the darkness...

Re: Icons for new archetypes in ESB

Post by ebeneezergude »

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.
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Icons for new archetypes in ESB

Post 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.
User avatar
ebeneezergude
Expert
Posts: 345
Joined: Mon Jan 21, 2013 10:58 pm
Location: I see walls stretching off into the darkness...

Re: Icons for new archetypes in ESB

Post by ebeneezergude »

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:
Post Reply